DIRECTORY Imager USING [ClipOutline, ClipRectangle, Color, ConcatT, Correct, CorrectMask, CorrectSpace, Font, MakeGray, MaskDashedStrokeTrajectory, MaskFill, MaskFillOutline, MaskPixel, MaskRectangle, MaskStrokeTrajectory, MaskUnderline, MaskVector, Move, Outline, PixelArray, SetColor, SetCorrectMeasure, SetCorrectTolerance, SetFont, SetGray, SetSampledBlack, SetSampledColor, SetXRel, SetXY, SetXYRel, SetYRel, Show, ShowAndFixedXRel, Space, StartUnderline, Trajectory, Trans, Transformation, TranslateT, VEC], ImagerBackdoor USING [Clipper, GetClipper, GetColor, GetCP, GetFont, GetInt, GetReal, GetT, SetClipper, SetInt, SetReal, SetT], ImagerColor USING [MakeSampledBlack, MakeSampledColor], ImagerFont USING [Modify, XStringProc], ImagerPath USING [ArcTo, ConicTo, CurveTo, LineTo, LineToX, LineToY, MoveTo, OutlineRep, PathProc], ImagerPixelArray USING [Extract], ImagerTransformation USING [Concat, Create, Rotate, Scale, Scale2, Translate], IO USING [GetIndex, SetIndex], IPImage USING [], IPImager USING [ColorOperatorFromOperator, FindColor, FindColorModelOperator, FindColorOperator, FindFont, MakePixelArray, MakeFont, MaskChar], IPInterpreter, IPMaster USING [ImagerVariable]; IPImageImpl: CEDAR PROGRAM IMPORTS Imager, ImagerBackdoor, ImagerColor, ImagerFont, ImagerPath, ImagerPixelArray, ImagerTransformation, IO, IPImager, IPInterpreter EXPORTS IPImage ~ BEGIN OPEN IPInterpreter; VEC: TYPE ~ Imager.VEC; Transformation: TYPE ~ Imager.Transformation; PixelArray: TYPE ~ Imager.PixelArray; Color: TYPE ~ Imager.Color; Trajectory: TYPE ~ Imager.Trajectory; Outline: TYPE ~ Imager.Outline; Font: TYPE ~ Imager.Font; Clipper: TYPE ~ ImagerBackdoor.Clipper; TransformationFromAny: PROC [x: Any] RETURNS [Transformation] ~ { WITH x SELECT FROM x: Transformation => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected Transformation)"]; RETURN[NIL]; }; PixelArrayFromAny: PROC [x: Any] RETURNS [PixelArray] ~ { WITH x SELECT FROM x: PixelArray => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected PixelArray)"]; RETURN[NIL]; }; ColorFromAny: PROC [x: Any] RETURNS [Color] ~ { WITH x SELECT FROM x: Color => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected Color)"]; RETURN[NIL]; }; TrajectoryFromAny: PROC [x: Any] RETURNS [Trajectory] ~ { WITH x SELECT FROM x: Trajectory => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected Trajectory)"]; RETURN[NIL]; }; OutlineFromAny: PROC [x: Any] RETURNS [Outline] ~ { WITH x SELECT FROM x: Outline => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected Outline)"]; RETURN[NIL]; }; FontFromAny: PROC [x: Any] RETURNS [Font] ~ { WITH x SELECT FROM x: Font => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected Font)"]; RETURN[NIL]; }; ClipperFromAny: PROC [x: Any] RETURNS [Clipper] ~ { WITH x SELECT FROM x: Clipper => RETURN[x]; ENDCASE; MasterError[$wrongType, "Wrong type (expected Clipper)"]; RETURN[NIL]; }; PushVec: PROC [self: Ref, v: VEC] ~ { PushReal[self, v.x]; PushReal[self, v.y]; }; PushTransformation: PROC [self: Ref, x: Transformation] ~ { IF x=NIL THEN MasterError[$nilFault, "Transformation value is NIL"]; PushAny[self, x]; }; PushPixelArray: PROC [self: Ref, x: PixelArray] ~ { IF x=NIL THEN MasterError[$nilFault, "PixelArray value is NIL"]; PushAny[self, x]; }; PushColor: PROC [self: Ref, x: Color] ~ { IF x=NIL THEN MasterError[$nilFault, "Color value is NIL"]; PushAny[self, x]; }; PushTrajectory: PROC [self: Ref, x: Trajectory] ~ { IF x=NIL THEN MasterError[$nilFault, "Trajectory value is NIL"]; PushAny[self, x]; }; PushOutline: PROC [self: Ref, x: Outline] ~ { IF x=NIL THEN MasterError[$nilFault, "Outline value is NIL"]; PushAny[self, x]; }; PushFont: PROC [self: Ref, x: Font] ~ { IF x=NIL THEN MasterError[$nilFault, "Font value is NIL"]; PushAny[self, x]; }; PushClipper: PROC [self: Ref, x: Clipper] ~ { IF x=NIL THEN MasterError[$nilFault, "Clipper value is NIL"]; PushAny[self, x]; }; PopVec: PROC [self: Ref] RETURNS [v: VEC] ~ { v.y _ PopReal[self]; v.x _ PopReal[self]; }; PopTransformation: PROC [self: Ref] RETURNS [Transformation] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: Transformation => RETURN[x]; ENDCASE; RETURN[TransformationFromAny[x]]; }; PopPixelArray: PROC [self: Ref] RETURNS [PixelArray] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: PixelArray => RETURN[x]; ENDCASE; RETURN[PixelArrayFromAny[x]]; }; PopColor: PROC [self: Ref] RETURNS [Color] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: Color => RETURN[x]; ENDCASE; RETURN[ColorFromAny[x]]; }; PopTrajectory: PROC [self: Ref] RETURNS [Trajectory] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: Trajectory => RETURN[x]; ENDCASE; RETURN[TrajectoryFromAny[x]]; }; PopOutline: PROC [self: Ref] RETURNS [Outline] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: Outline => RETURN[x]; ENDCASE; RETURN[OutlineFromAny[x]]; }; PopFont: PROC [self: Ref] RETURNS [Font] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: Font => RETURN[x]; ENDCASE; RETURN[FontFromAny[x]]; }; PopClipper: PROC [self: Ref] RETURNS [Clipper] ~ { x: Any ~ PopAny[self]; WITH x SELECT FROM x: Clipper => RETURN[x]; ENDCASE; RETURN[ClipperFromAny[x]]; }; SetMedium: PROC [self: Ref, m: Vector, pageNumber: Cardinal, duplex: BOOL, xImageShift: REAL] ~ { IF duplex AND Even[pageNumber] THEN Imager.TranslateT[self.imager, [-xImageShift, 0]] ELSE Imager.TranslateT[self.imager, [xImageShift, 0]]; }; ImagerVariable: TYPE ~ IPMaster.ImagerVariable; ImagerVariableVal: TYPE ~ [0..ORD[ImagerVariable.LAST]]; ImagerVariableFromCardinal: PROC [i: Cardinal] RETURNS [ImagerVariable] ~ { IF i NOT IN ImagerVariableVal THEN MasterError[$boundsFault, "Imager variable index out of bounds."]; RETURN[VAL[ImagerVariableVal[i]]]; }; ApplyIGET: PUBLIC PROC [self: Ref] ~ { i: Cardinal ~ PopCardinal[self]; SELECT ImagerVariableFromCardinal[i] FROM $DCScpx => PushReal[self, ImagerBackdoor.GetReal[self.imager, $DCScpx]]; $DCScpy => PushReal[self, ImagerBackdoor.GetReal[self.imager, $DCScpy]]; $correctMX => PushReal[self, ImagerBackdoor.GetReal[self.imager, $correctMX]]; $correctMY => PushReal[self, ImagerBackdoor.GetReal[self.imager, $correctMY]]; $T => PushTransformation[self, ImagerBackdoor.GetT[self.imager]]; $priorityImportant => PushCardinal[self, ImagerBackdoor.GetInt[self.imager, $priorityImportant]]; $mediumXSize => PushReal[self, ImagerBackdoor.GetReal[self.imager, $mediumXSize]]; $mediumYSize => PushReal[self, ImagerBackdoor.GetReal[self.imager, $mediumYSize]]; $fieldXMin => PushReal[self, ImagerBackdoor.GetReal[self.imager, $fieldXMin]]; $fieldYMin => PushReal[self, ImagerBackdoor.GetReal[self.imager, $fieldYMin]]; $fieldXMax => PushReal[self, ImagerBackdoor.GetReal[self.imager, $fieldXMax]]; $fieldYMax => PushReal[self, ImagerBackdoor.GetReal[self.imager, $fieldYMax]]; $font => PushFont[self, ImagerBackdoor.GetFont[self.imager]]; $color => PushColor[self, ImagerBackdoor.GetColor[self.imager]]; $noImage => PushCardinal[self, ImagerBackdoor.GetInt[self.imager, $noImage]]; $strokeWidth => PushReal[self, ImagerBackdoor.GetReal[self.imager, $strokeWidth]]; $strokeEnd => PushCardinal[self, ImagerBackdoor.GetInt[self.imager, $strokeEnd]]; $strokeJoint => PushCardinal[self, ImagerBackdoor.GetInt[self.imager, $strokeJoint]]; $underlineStart => PushReal[self, ImagerBackdoor.GetReal[self.imager, $underlineStart]]; $amplifySpace => PushReal[self, ImagerBackdoor.GetReal[self.imager, $amplifySpace]]; $correctPass => PushCardinal[self, ImagerBackdoor.GetInt[self.imager, $correctPass]]; $correctShrink => PushReal[self, ImagerBackdoor.GetReal[self.imager, $correctShrink]]; $correctTX => PushReal[self, ImagerBackdoor.GetReal[self.imager, $correctTX]]; $correctTY => PushReal[self, ImagerBackdoor.GetReal[self.imager, $correctTY]]; $clipper => PushClipper[self, ImagerBackdoor.GetClipper[self.imager]]; ENDCASE => ERROR; }; ApplyISET: PUBLIC PROC [self: Ref] ~ { i: Cardinal ~ PopCardinal[self]; SELECT ImagerVariableFromCardinal[i] FROM $DCScpx => ImagerBackdoor.SetReal[self.imager, $DCScpx, PopReal[self]]; $DCScpy => ImagerBackdoor.SetReal[self.imager, $DCScpy, PopReal[self]]; $correctMX => ImagerBackdoor.SetReal[self.imager, $correctMX, PopReal[self]]; $correctMY => ImagerBackdoor.SetReal[self.imager, $correctMY, PopReal[self]]; $T => ImagerBackdoor.SetT[self.imager, PopTransformation[self]]; $priorityImportant => ImagerBackdoor.SetInt[self.imager, $priorityImportant, PopCardinal[self]]; $mediumXSize => ImagerBackdoor.SetReal[self.imager, $mediumXSize, PopReal[self]]; $mediumYSize => ImagerBackdoor.SetReal[self.imager, $mediumYSize, PopReal[self]]; $fieldXMin => ImagerBackdoor.SetReal[self.imager, $fieldXMin, PopReal[self]]; $fieldYMin => ImagerBackdoor.SetReal[self.imager, $fieldYMin, PopReal[self]]; $fieldXMax => ImagerBackdoor.SetReal[self.imager, $fieldXMax, PopReal[self]]; $fieldYMax => ImagerBackdoor.SetReal[self.imager, $fieldYMax, PopReal[self]]; $font => Imager.SetFont[self.imager, PopFont[self]]; $color => Imager.SetColor[self.imager, PopColor[self]]; $noImage => ImagerBackdoor.SetInt[self.imager, $noImage, PopCardinal[self]]; $strokeWidth => ImagerBackdoor.SetReal[self.imager, $strokeWidth, PopReal[self]]; $strokeEnd => ImagerBackdoor.SetInt[self.imager, $strokeEnd, PopCardinal[self]]; $strokeJoint => ImagerBackdoor.SetInt[self.imager, $strokeJoint, PopCardinal[self]]; $underlineStart => ImagerBackdoor.SetReal[self.imager, $underlineStart, PopReal[self]]; $amplifySpace => ImagerBackdoor.SetReal[self.imager, $amplifySpace, PopReal[self]]; $correctPass => ImagerBackdoor.SetInt[self.imager, $correctPass, PopCardinal[self]]; $correctShrink => ImagerBackdoor.SetReal[self.imager, $correctShrink, PopReal[self]]; $correctTX => ImagerBackdoor.SetReal[self.imager, $correctTX, PopReal[self]]; $correctTY => ImagerBackdoor.SetReal[self.imager, $correctTY, PopReal[self]]; $clipper => ImagerBackdoor.SetClipper[self.imager, PopClipper[self]]; ENDCASE => ERROR; }; ApplyMAKET: PUBLIC PROC [self: Ref] ~ { f: REAL ~ PopReal[self]; e: REAL ~ PopReal[self]; d: REAL ~ PopReal[self]; c: REAL ~ PopReal[self]; b: REAL ~ PopReal[self]; a: REAL ~ PopReal[self]; PushTransformation[self, ImagerTransformation.Create[a, b, c, d, e, f]]; }; ApplyTRANSLATE: PUBLIC PROC [self: Ref] ~ { t: VEC ~ PopVec[self]; PushTransformation[self, ImagerTransformation.Translate[t]]; }; ApplyROTATE: PUBLIC PROC [self: Ref] ~ { a: REAL ~ PopReal[self]; PushTransformation[self, ImagerTransformation.Rotate[a]]; }; ApplySCALE: PUBLIC PROC [self: Ref] ~ { s: REAL ~ PopReal[self]; PushTransformation[self, ImagerTransformation.Scale[s]]; }; ApplySCALE2: PUBLIC PROC [self: Ref] ~ { s: VEC ~ PopVec[self]; PushTransformation[self, ImagerTransformation.Scale2[s]]; }; ApplyCONCAT: PUBLIC PROC [self: Ref] ~ { n: Transformation ~ PopTransformation[self]; m: Transformation ~ PopTransformation[self]; PushTransformation[self, ImagerTransformation.Concat[m, n]]; }; ApplyCONCATT: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; Imager.ConcatT[self.imager, m]; }; ApplyMOVE: PUBLIC PROC [self: Ref] ~ { Imager.Move[self.imager]; }; ApplyTRANS: PUBLIC PROC [self: Ref] ~ { Imager.Trans[self.imager]; }; ApplySETXY: PUBLIC PROC [self: Ref] ~ { Imager.SetXY[self.imager, PopVec[self]]; }; ApplySETXYREL: PUBLIC PROC [self: Ref] ~ { Imager.SetXYRel[self.imager, PopVec[self]]; }; ApplySETXREL: PUBLIC PROC [self: Ref] ~ { Imager.SetXRel[self.imager, PopReal[self]]; }; ApplySETYREL: PUBLIC PROC [self: Ref] ~ { Imager.SetYRel[self.imager, PopReal[self]]; }; ApplyGETCP: PUBLIC PROC [self: Ref] ~ { PushVec[self, ImagerBackdoor.GetCP[context: self.imager]]; }; ApplyMAKEPIXELARRAY: PUBLIC PROC [self: Ref] ~ { samples: Vector ~ PopVector[self]; m: Transformation ~ PopTransformation[self]; samplesInterleaved: BOOL ~ PopBool[self]; maxSampleValue: Vector _ IF TopType[self]=vector THEN PopVector[self] ELSE NIL; maxSampleValueI: Cardinal ~ IF maxSampleValue=NIL THEN PopCardinal[self] ELSE 0; samplesPerPixel: Cardinal ~ PopCardinal[self]; yPixels: Cardinal ~ PopCardinal[self]; xPixels: Cardinal ~ PopCardinal[self]; PushPixelArray[self, IPImager.MakePixelArray[ xPixels: xPixels, yPixels: yPixels, samplesPerPixel: samplesPerPixel, maxSampleValue: maxSampleValue, maxSampleValueI: maxSampleValueI, samplesInterleaved: samplesInterleaved, m: m, samples: samples]]; }; ApplyEXTRACTPIXELARRAY: PUBLIC PROC [self: Ref] ~ { select: Vector ~ PopVector[self]; selectShape: VectorShape ~ Shape[select]; pa: PixelArray ~ PopPixelArray[self]; Select: PROC [i: NAT] RETURNS [NAT] ~ {RETURN [GetCardinal[select, i]]}; IF selectShape.lowerBound#0 THEN MasterError[$misshapedVector, "EXTRACTPIXELARRAY select Vector should be origin zero."]; PushPixelArray[self, ImagerPixelArray.Extract[old: pa, samplesPerPixel: selectShape.size, select: Select]]; }; ApplyFINDDECOMPRESSOR: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; MasterError[$unimplemented, "FINDDECOMPRESSOR is not implemented."]; }; ApplyFINDCOLOR: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; PushColor[self, IPImager.FindColor[self, v]]; }; ApplyFINDCOLOROPERATOR: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; PushOperator[self, IPImager.FindColorOperator[self, v]]; }; ApplyFINDCOLORMODELOPERATOR: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; PushOperator[self, IPImager.FindColorModelOperator[self, v]]; }; ApplyMAKEGRAY: PUBLIC PROC [self: Ref] ~ { f: REAL ~ PopReal[self]; PushColor[self, Imager.MakeGray[f]]; }; ApplyMAKESAMPLEDCOLOR: PUBLIC PROC [self: Ref] ~ { colorOperator: Operator ~ PopOperator[self]; um: Transformation ~ PopTransformation[self]; pa: PixelArray ~ PopPixelArray[self]; PushColor[self, ImagerColor.MakeSampledColor[pa, um, IPImager.ColorOperatorFromOperator[colorOperator]]]; }; ApplyMAKESAMPLEDBLACK: PUBLIC PROC [self: Ref] ~ { clear: BOOL ~ PopBool[self]; um: Transformation ~ PopTransformation[self]; pa: PixelArray ~ PopPixelArray[self]; PushColor[self, ImagerColor.MakeSampledBlack[pa, um, clear]]; }; ApplySETGRAY: PUBLIC PROC [self: Ref] ~ { f: REAL ~ PopReal[self]; Imager.SetGray[self.imager, f]; }; ApplySETSAMPLEDCOLOR: PUBLIC PROC [self: Ref] ~ { colorOperator: Operator ~ PopOperator[self]; m: Transformation ~ PopTransformation[self]; pa: PixelArray ~ PopPixelArray[self]; Imager.SetSampledColor[self.imager, pa, m, IPImager.ColorOperatorFromOperator[colorOperator]]; }; ApplySETSAMPLEDBLACK: PUBLIC PROC [self: Ref] ~ { clear: BOOL ~ PopBool[self]; m: Transformation ~ PopTransformation[self]; pa: PixelArray ~ PopPixelArray[self]; Imager.SetSampledBlack[self.imager, pa, m, clear]; }; ApplyMOVETO: PUBLIC PROC [self: Ref] ~ { p: VEC ~ PopVec[self]; PushTrajectory[self, ImagerPath.MoveTo[p]]; }; ApplyLINETO: PUBLIC PROC [self: Ref] ~ { p: VEC ~ PopVec[self]; t: Trajectory ~ PopTrajectory[self]; PushTrajectory[self, ImagerPath.LineTo[t, p]]; }; ApplyLINETOX: PUBLIC PROC [self: Ref] ~ { x: REAL ~ PopReal[self]; t: Trajectory ~ PopTrajectory[self]; PushTrajectory[self, ImagerPath.LineToX[t, x]]; }; ApplyLINETOY: PUBLIC PROC [self: Ref] ~ { y: REAL ~ PopReal[self]; t: Trajectory ~ PopTrajectory[self]; PushTrajectory[self, ImagerPath.LineToY[t, y]]; }; ApplyCURVETO: PUBLIC PROC [self: Ref] ~ { p3: VEC ~ PopVec[self]; p2: VEC ~ PopVec[self]; p1: VEC ~ PopVec[self]; t: Trajectory ~ PopTrajectory[self]; PushTrajectory[self, ImagerPath.CurveTo[t, p1, p2, p3]]; }; ApplyCONICTO: PUBLIC PROC [self: Ref] ~ { r: REAL ~ PopReal[self]; p2: VEC ~ PopVec[self]; p1: VEC ~ PopVec[self]; t: Trajectory ~ PopTrajectory[self]; PushTrajectory[self, ImagerPath.ConicTo[t, p1, p2, r]]; }; ApplyARCTO: PUBLIC PROC [self: Ref] ~ { p2: VEC ~ PopVec[self]; p1: VEC ~ PopVec[self]; t: Trajectory ~ PopTrajectory[self]; PushTrajectory[self, ImagerPath.ArcTo[t, p1, p2]]; }; MakeOutline: PROC [self: Ref, oddWrap: BOOL _ FALSE] ~ { n: Cardinal ~ PopCardinal[self]; outline: Outline ~ NEW[ImagerPath.OutlineRep[n] _ [oddWrap: oddWrap, seq: ]]; FOR i: NAT DECREASING IN[0..outline.size) DO outline[i] _ PopTrajectory[self] ENDLOOP; PushOutline[self, outline]; }; ApplyMAKEOUTLINE: PUBLIC PROC [self: Ref] ~ { MakeOutline[self] }; ApplyMAKEOUTLINEODD: PUBLIC PROC [self: Ref] ~ { MakeOutline[self, TRUE] }; ApplyMASKFILL: PUBLIC PROC [self: Ref] ~ { outline: Outline ~ PopOutline[self]; Imager.MaskFillOutline[context: self.imager, outline: outline]; }; ApplyMASKRECTANGLE: PUBLIC PROC [self: Ref] ~ { h: REAL ~ PopReal[self]; w: REAL ~ PopReal[self]; y: REAL ~ PopReal[self]; x: REAL ~ PopReal[self]; Imager.MaskRectangle[self.imager, [x: x, y: y, w: w, h: h]]; }; ApplySTARTUNDERLINE: PUBLIC PROC [self: Ref] ~ { Imager.StartUnderline[self.imager]; }; ApplyMASKUNDERLINE: PUBLIC PROC [self: Ref] ~ { h: REAL ~ PopReal[self]; dy: REAL ~ PopReal[self]; Imager.MaskUnderline[self.imager, dy, h]; }; ApplyMASKTRAPEZOIDX: PUBLIC PROC [self: Ref] ~ { x4: REAL ~ PopReal[self]; y3: REAL ~ PopReal[self]; x3: REAL ~ PopReal[self]; x2: REAL ~ PopReal[self]; y1: REAL ~ PopReal[self]; x1: REAL ~ PopReal[self]; path: ImagerPath.PathProc ~ { moveTo[[x1, y1]]; lineTo[[x2, y1]]; lineTo[[x3, y3]]; lineTo[[x4, y3]]; }; Imager.MaskFill[self.imager, path]; }; ApplyMASKTRAPEZOIDY: PUBLIC PROC [self: Ref] ~ { y4: REAL ~ PopReal[self]; y3: REAL ~ PopReal[self]; x3: REAL ~ PopReal[self]; y2: REAL ~ PopReal[self]; y1: REAL ~ PopReal[self]; x1: REAL ~ PopReal[self]; path: ImagerPath.PathProc ~ { moveTo[[x1, y1]]; lineTo[[x3, y3]]; lineTo[[x3, y4]]; lineTo[[x1, y2]]; }; Imager.MaskFill[self.imager, path]; }; ApplyMASKSTROKE: PUBLIC PROC [self: Ref] ~ { t: Trajectory ~ PopTrajectory[self]; Imager.MaskStrokeTrajectory[context: self.imager, trajectory: t]; }; ApplyMASKSTROKECLOSED: PUBLIC PROC [self: Ref] ~ { t: Trajectory ~ PopTrajectory[self]; Imager.MaskStrokeTrajectory[context: self.imager, trajectory: t, closed: TRUE]; }; ApplyMASKVECTOR: PUBLIC PROC [self: Ref] ~ { p2: VEC ~ PopVec[self]; p1: VEC ~ PopVec[self]; Imager.MaskVector[self.imager, p1, p2]; }; ApplyMASKDASHEDSTROKE: PUBLIC PROC [self: Ref] ~ { length: REAL ~ PopReal[self]; offset: REAL ~ PopReal[self]; pattern: Vector ~ PopVector[self]; pShape: VectorShape ~ Shape[pattern]; pGet: PROC [i: NAT] RETURNS [REAL] ~ { RETURN[GetReal[pattern, pShape.lowerBound+i]] }; t: Trajectory ~ PopTrajectory[self]; Imager.MaskDashedStrokeTrajectory[self.imager, t, pShape.size, pGet, offset, length]; }; ApplyMASKPIXEL: PUBLIC PROC [self: Ref] ~ { pa: PixelArray ~ PopPixelArray[self]; Imager.MaskPixel[self.imager, pa]; }; ApplyCLIPOUTLINE: PUBLIC PROC [self: Ref] ~ { outline: Outline ~ PopOutline[self]; Imager.ClipOutline[context: self.imager, outline: outline]; }; ApplyCLIPRECTANGLE: PUBLIC PROC [self: Ref] ~ { h: REAL ~ PopReal[self]; w: REAL ~ PopReal[self]; y: REAL ~ PopReal[self]; x: REAL ~ PopReal[self]; Imager.ClipRectangle[context: self.imager, r: [x: x, y: y, w: w, h: h]]; }; ApplyMASKCHAR: PUBLIC PROC [self: Ref] ~ { i: Cardinal ~ PopCardinal[self]; fd: Vector ~ PopVector[self]; IPImager.MaskChar[self, fd, i]; PushVector[self, fd]; }; ApplyMAKEFONT: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; PushFont[self, IPImager.MakeFont[self, v]]; }; ApplyFINDFONT: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; PushFont[self, IPImager.FindFont[self, v]]; }; ApplyMODIFYFONT: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; font: Font ~ PopFont[self]; PushFont[self, ImagerFont.Modify[font, m]]; }; ApplySETFONT: PUBLIC PROC [self: Ref] ~ { n: Cardinal ~ PopCardinal[self]; font: Font ~ FontFromAny[FGet[self, n]]; Imager.SetFont[self.imager, font]; }; ApplySHOW: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; string: ImagerFont.XStringProc ~ { StringFromVector[v, charAction] }; Imager.Show[context: self.imager, string: string]; }; ApplySHOWANDXREL: PUBLIC PROC [self: Ref] ~ { v: Vector ~ PopVector[self]; string: ImagerFont.XStringProc ~ { StringFromVector[v, charAction] }; Imager.Show[context: self.imager, string: string, xrel: TRUE]; }; ApplySHOWANDFIXEDXREL: PUBLIC PROC [self: Ref] ~ { x: REAL ~ PopReal[self]; v: Vector ~ PopVector[self]; string: ImagerFont.XStringProc ~ { StringFromVector[v, charAction] }; Imager.ShowAndFixedXRel[context: self.imager, string: string, x: x]; }; ApplyCORRECTMASK: PUBLIC PROC [self: Ref] ~ { Imager.CorrectMask[self.imager]; }; ApplyCORRECTSPACE: PUBLIC PROC [self: Ref] ~ { Imager.CorrectSpace[self.imager, PopVec[self]]; }; ApplyCORRECT: PUBLIC PROC [self: Ref] ~ { frame: Vector ~ Frame[self]; env: Vector ~ Env[self]; index: INT ~ IO.GetIndex[self.stream]; action: PROC ~ { inner: PROC ~ { CallInlineBody[self: self, frame: frame, env: env] }; IO.SetIndex[self.stream, index]; DoWithMarkProtection[self, inner]; }; Imager.Correct[self.imager, action]; }; ApplySETCORRECTMEASURE: PUBLIC PROC [self: Ref] ~ { Imager.SetCorrectMeasure[self.imager, PopVec[self]]; }; ApplySETCORRECTTOLERANCE: PUBLIC PROC [self: Ref] ~ { Imager.SetCorrectTolerance[self.imager, PopVec[self]]; }; ApplySPACE: PUBLIC PROC [self: Ref] ~ { Imager.Space[self.imager, PopReal[self]]; }; END. PIPImageImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Michael Plass, June 7, 1985 6:51:26 pm PDT Doug Wyatt, November 21, 1985 3:09:43 pm PST self.mediumSize _ xxx; self.fieldMin _ xxx; self.fieldMax _ xxx; PushOperator[self, FindDecompressor[self, v]]; ApplyDROUND: PUBLIC PROC [self: Ref] ~ { p: VEC ~ PopVec[self]; PushVec[self, ImagerTransformation.DRound[p]]; }; ApplyOPENT: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; PushReal[self, m.a]; PushReal[self, m.b]; PushReal[self, m.c]; PushReal[self, m.d]; PushReal[self, m.e]; PushReal[self, m.f]; }; ApplyINVERT: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; PushTransformation[self, ImagerTransformation.Invert[m]]; }; ApplyTRANSFORM: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; p: VEC ~ PopVec[self]; PushVec[self, m.Transform[p]]; }; ApplyTRANSFORMVEC: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; v: VEC ~ PopVec[self]; PushVec[self, m.TransformVec[v]]; }; ApplyROUNDXY: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; p: VEC ~ PopVec[self]; PushVec[self, m.RoundXY[p]]; }; ApplyROUNDXYVEC: PUBLIC PROC [self: Ref] ~ { m: Transformation ~ PopTransformation[self]; v: VEC ~ PopVec[self]; PushVec[self, m.RoundXYVec[v]]; }; ApplyGETCPROUNDED: PUBLIC PROC [self: Ref] ~ { PushVec[self, ImagerBackdoor.GetCP[context: self.imager, rounded: TRUE]]; }; ApplyJOINPIXELARRAYS: PUBLIC PROC [self: Ref] ~ { MasterError[$unimplemented, "JOINPIXELARRAYS is not implemented."]; }; ApplyEXCLUDEOUTLINE: PUBLIC PROC [self: Ref] ~ { ClipOutline[self, TRUE] }; ApplyEXCLUDERECTANGLE: PUBLIC PROC [self: Ref] ~ { ClipRectangle[self, TRUE] }; ApplyDISABLECORRECTION: PUBLIC PROC [self: Ref] ~ { MasterError[$unimplemented, "Not implemented: DISABLECORRECTION"]; }; Κπ˜codešœ™Kšœ Οmœ1™K˜—š œžœžœ˜2Kšœžœ˜Kšœ˜KšœE˜EKšœD˜DK˜—K˜š œžœžœ˜-K˜ K˜—š œžœžœ˜.Kšœ/˜/K˜—š  œžœžœ˜)K˜K˜Kšœžœžœ˜&šœžœ˜Kšœžœ:˜EKšžœ˜ Kšœ"˜"Kšœ˜—Kšœ$˜$K˜—š œžœžœ˜3Kšœ4˜4K˜—š œžœžœ˜5Kšœ6˜6K˜—š  œžœžœ˜'Kšœ)˜)K˜—K˜š  œžœžœ™(Kšœžœ™Kšœ.™.K™—š  œžœžœ™'Kšœ,™,Kšœ>™>Kšœ>™>K™—š  œžœžœ™(Kšœ,™,Kšœ9™9K™—š œžœžœ™+Kšœ,™,Kšœžœ™Kšœ™K™—š œžœžœ™.Kšœ,™,Kšœžœ™Kšœ!™!K™—š  œžœžœ™)Kšœ,™,Kšœžœ™Kšœ™K™—š œžœžœ™,Kšœ,™,Kšœžœ™Kšœ™K™—š œžœžœ™.KšœBžœ™IK™—š œžœžœ™1KšœC™CK™—Kš œžœžœ#žœ™KKš œžœžœ%žœ™Oš œžœžœ™3KšœB™BK™—K™Kšžœ˜—…—RRo’