<> <> <> DIRECTORY IPBasic USING [Integer, Operator, Vector], IPErrors USING [AppearanceWarning, MasterError, MasterWarning], IPImager USING [Imager, Vars], IPImagerBasic USING [Color, ColorRep, PixelArray, PixelArrayRep, Transformation], IPImagerOps USING [], IPState USING [State, StateRep], Real USING [RoundC]; IPColorImpl: CEDAR PROGRAM IMPORTS IPErrors, Real EXPORTS IPImagerOps, IPBasic = BEGIN OPEN IPImagerBasic, IPBasic; State: TYPE = IPState.State; StateRep: PUBLIC TYPE = IPState.StateRep; -- export to IPBasic MakePixelArray: PUBLIC PROC[xPixels, yPixels: Integer, samplesPerPixel, maxSampleValue: Integer, samplesInterleaved: BOOL, m: Transformation, samples: Vector] RETURNS[PixelArray] = { pa: PixelArray = NEW[PixelArrayRep _ [xPixels: xPixels, yPixels: yPixels, maxSampleValue: maxSampleValue, samplesPerPixel: samplesPerPixel, samplesInterleaved: samplesInterleaved, m: m, samples: samples]]; RETURN[pa]; }; <<>> FindDecompressor: PUBLIC PROC[self: State, v: Vector] RETURNS[Operator] = { ERROR IPErrors.MasterError[Unimplemented]; }; MakeGray: PUBLIC PROC[f: REAL] RETURNS[Color] = { IF f<0 THEN { SIGNAL IPErrors.MasterWarning[InvalidArgs]; f _ 0 }; IF f>1 THEN { SIGNAL IPErrors.MasterWarning[InvalidArgs]; f _ 1 }; { x: CARDINAL = Real.RoundC[(1-f)*LAST[CARDINAL]]; RETURN[NEW[ColorRep[constant] _ [constant[r: x, g: x, b: x]]]] }; }; FindColor: PUBLIC PROC[self: State, v: Vector] RETURNS[Color] = { SIGNAL IPErrors.MasterWarning[Unimplemented]; RETURN[MakeGray[0]]; }; FindColorOperator: PUBLIC PROC[self: State, v: Vector] RETURNS[Operator] = { ERROR IPErrors.MasterError[Unimplemented]; }; FindColorModelOperator: PUBLIC PROC[self: State, v: Vector] RETURNS[Operator] = { ERROR IPErrors.MasterError[Unimplemented]; }; MakeSampledBlack: PUBLIC PROC[pa: PixelArray, um: Transformation, transparent: BOOL _ FALSE] RETURNS[Color] = { <> <> SIGNAL IPErrors.AppearanceWarning[Unimplemented]; RETURN[MakeGray[0.5]]; }; MakeSampledColor: PUBLIC PROC[pa: PixelArray, um: Transformation, colorOperator: Operator] RETURNS[Color] = { SIGNAL IPErrors.MasterWarning[Unimplemented]; RETURN[MakeGray[0]]; }; SetGray: PUBLIC PROC[self: State, f: REAL] = { imager: IPImager.Imager = self.imager; vars: IPImager.Vars = imager.vars; vars.color _ MakeGray[f]; }; END.