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. °IPColorImpl.mesa Last edited by: Doug Wyatt, July 7, 1983 11:53 am RETURN[NEW[ColorRep[sampled][0] _ [sampled[ transparent: transparent, pa: pa, m: um, colorMap: ]]]]; Κϊ˜headšœ™šœ™Jšœ!™!—J˜šΟk ˜ Jšœœ˜*Jšœ œ1˜?Jšœ œ˜Jšœœ>˜QJšœ œ˜Jšœœ˜ Jšœœ ˜—J˜—šœ œ˜Jšœ˜Jšœ˜Jšœœœ˜$J˜Jšœœ˜Jšœ œœΟc˜>J˜J˜šΟnœœœ˜6Jšœ)˜)Jšœœ˜Jšœ#˜#Jšœ˜šœœ5˜IJšœA˜AJšœA˜A—Jšœ˜ J˜—J™šŸœœœœ˜KJšœ%˜*J˜—J˜š Ÿœœœœœ ˜1Jšœœœ.˜BJšœœœ.˜Bšœœœœ˜2Jšœœ4˜>Jšœ˜—J˜—J˜šŸ œœœœ ˜AJšœ'˜-Jšœ˜J˜—J˜šŸœœœœ˜LJšœ%˜*J˜—J˜šŸœœœœ˜QJšœ%˜*J˜—J˜šŸœœœ$˜AJšœ œœœ ˜-šœ+™+Jšœ8™8—Jšœ+˜1Jšœ˜J˜—J˜šŸœœœ$˜AJšœœ ˜+Jšœ'˜-Jšœ˜J˜—J˜šŸœœœœ˜.J˜&J˜"J˜J˜—J˜Jšœ˜——…—ά †