DIRECTORY IPBasic USING [Any, Integer, Operator, State, Vector], IPErrors USING [MasterError], IPGeometry USING [CurveTo, LineTo, LineToX, LineToY, MakeOutline, MoveTo], IPImagerBasic USING [Color, Outline, Pair, PixelArray, Trajectory, Transformation], IPImagerOps -- USING everything --, IPImagePrimitives USING [], IPStack USING [PopAny, PopBool, PopInteger, PopOperator, PopReal, PopVector, PushAny, PushOperator, PushReal, PushVector], IPTransform USING [Concat, DRound, Invert, MakeT, Rotate, RoundXY, RoundXYVec, Scale, Scale2, Transform, TransformVec, Translate]; IPImagePrimitivesImpl: CEDAR PROGRAM IMPORTS IPErrors, IPGeometry, IPImagerOps, IPStack, IPTransform EXPORTS IPImagePrimitives = BEGIN OPEN IPImagerOps, IPStack, IPImagerBasic, IPBasic; ApplyIGET: PUBLIC PROC[self: State] = { n: Integer = PopInteger[self]; x: Any = IGet[self, n]; PushAny[self, x]; }; ApplyISET: PUBLIC PROC[self: State] = { n: Integer = PopInteger[self]; x: Any = PopAny[self]; ISet[self, x, n]; }; ApplyDROUND: PUBLIC PROC[self: State] = { p: Pair = PopPair[self]; r: Pair = IPTransform.DRound[p]; PushPair[self, r]; }; ApplyMAKET: PUBLIC PROC[self: State] = { f: REAL = PopReal[self]; e: REAL = PopReal[self]; d: REAL = PopReal[self]; c: REAL = PopReal[self]; b: REAL = PopReal[self]; a: REAL = PopReal[self]; m: Transformation = IPTransform.MakeT[a, b, c, d, e, f]; PushTransformation[self, m]; }; ApplyOPENT: PUBLIC PROC[self: State] = { 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]; }; ApplyTRANSLATE: PUBLIC PROC[self: State] = { y: REAL = PopReal[self]; x: REAL = PopReal[self]; m: Transformation = IPTransform.Translate[x, y]; PushTransformation[self, m]; }; ApplyROTATE: PUBLIC PROC[self: State] = { a: REAL = PopReal[self]; m: Transformation = IPTransform.Rotate[a]; PushTransformation[self, m]; }; ApplySCALE: PUBLIC PROC[self: State] = { s: REAL = PopReal[self]; m: Transformation = IPTransform.Scale[s]; PushTransformation[self, m]; }; ApplySCALE2: PUBLIC PROC[self: State] = { sy: REAL = PopReal[self]; sx: REAL = PopReal[self]; m: Transformation = IPTransform.Scale2[sx, sy]; PushTransformation[self, m]; }; ApplyCONCAT: PUBLIC PROC[self: State] = { n: Transformation = PopTransformation[self]; m: Transformation = PopTransformation[self]; p: Transformation = IPTransform.Concat[m, n]; PushTransformation[self, p]; }; ApplyINVERT: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; n: Transformation = IPTransform.Invert[m]; PushTransformation[self, n]; }; ApplyTRANSFORM: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; p: Pair = PopPair[self]; q: Pair = IPTransform.Transform[m, p]; PushPair[self, q]; }; ApplyTRANSFORMVEC: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; v: Pair = PopPair[self]; w: Pair = IPTransform.TransformVec[m, v]; PushPair[self, w]; }; ApplyROUNDXY: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; p: Pair = PopPair[self]; q: Pair = IPTransform.RoundXY[m, p]; PushPair[self, q]; }; ApplyROUNDXYVEC: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; v: Pair = PopPair[self]; w: Pair = IPTransform.RoundXYVec[m, v]; PushPair[self, w]; }; ApplyCONCATT: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; ConcatT[self, m]; }; ApplyMOVE: PUBLIC PROC[self: State] = { Move[self]; }; ApplyTRANS: PUBLIC PROC[self: State] = { Trans[self]; }; ApplySHOW: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; Show[self, v]; }; ApplySHOWANDXREL: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; ShowAndXRel[self, v]; }; ApplySETXY: PUBLIC PROC[self: State] = { p: Pair = PopPair[self]; SetXY[self, p]; }; ApplySETXYREL: PUBLIC PROC[self: State] = { v: Pair = PopPair[self]; SetXYRel[self, v]; }; ApplySETXREL: PUBLIC PROC[self: State] = { x: REAL = PopReal[self]; SetXYRel[self, [x, 0]]; }; ApplySETYREL: PUBLIC PROC[self: State] = { y: REAL = PopReal[self]; SetXYRel[self, [0, y]]; }; ApplyGETCP: PUBLIC PROC[self: State] = { p: Pair = GetCP[self]; PushPair[self, p]; }; ApplyGETCPROUNDED: PUBLIC PROC[self: State] = { p: Pair = GetCP[self, TRUE]; PushPair[self, p]; }; ApplyMAKEPIXELARRAY: PUBLIC PROC[self: State] = { samples: Vector = PopVector[self]; m: Transformation = PopTransformation[self]; samplesInterleaved: BOOL = PopBool[self]; maxSampleValue: Integer = PopInteger[self]; samplesPerPixel: Integer = PopInteger[self]; yPixels: Integer = PopInteger[self]; xPixels: Integer = PopInteger[self]; pa: PixelArray = MakePixelArray[xPixels: xPixels, yPixels: yPixels, samplesPerPixel: samplesPerPixel, maxSampleValue: maxSampleValue, samplesInterleaved: samplesInterleaved, m: m, samples: samples]; PushPixelArray[self, pa]; }; ApplyFINDDECOMPRESSOR: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; op: Operator = FindDecompressor[self, v]; PushOperator[self, op]; }; ApplyFINDCOLOR: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; col: Color = FindColor[self, v]; PushColor[self, col]; }; ApplyFINDCOLOROPERATOR: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; op: Operator = FindColorOperator[self, v]; PushOperator[self, op]; }; ApplyFINDCOLORMODELOPERATOR: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; op: Operator = FindColorModelOperator[self, v]; PushOperator[self, op]; }; ApplyMAKEGRAY: PUBLIC PROC[self: State] = { f: REAL = PopReal[self]; col: Color = MakeGray[f]; PushColor[self, col]; }; ApplySETGRAY: PUBLIC PROC[self: State] = { f: REAL = PopReal[self]; SetGray[self, f]; }; ApplyMAKESAMPLEDBLACK: PUBLIC PROC[self: State] = { transparent: BOOL = PopBool[self]; um: Transformation = PopTransformation[self]; pa: PixelArray = PopPixelArray[self]; col: Color = MakeSampledBlack[pa, um, transparent]; PushColor[self, col]; }; ApplyMAKESAMPLEDCOLOR: PUBLIC PROC[self: State] = { colorOperator: Operator = PopOperator[self]; um: Transformation = PopTransformation[self]; pa: PixelArray = PopPixelArray[self]; col: Color = MakeSampledColor[pa, um, colorOperator]; PushColor[self, col]; }; ApplyMOVETO: PUBLIC PROC[self: State] = { p: Pair = PopPair[self]; t: Trajectory = IPGeometry.MoveTo[p]; PushTrajectory[self, t]; }; ApplyLINETO: PUBLIC PROC[self: State] = { p: Pair = PopPair[self]; t1: Trajectory = PopTrajectory[self]; t2: Trajectory = IPGeometry.LineTo[t1, p]; PushTrajectory[self, t2]; }; ApplyLINETOX: PUBLIC PROC[self: State] = { x: REAL = PopReal[self]; t1: Trajectory = PopTrajectory[self]; t2: Trajectory = IPGeometry.LineToX[t1, x]; PushTrajectory[self, t2]; }; ApplyLINETOY: PUBLIC PROC[self: State] = { y: REAL = PopReal[self]; t1: Trajectory = PopTrajectory[self]; t2: Trajectory = IPGeometry.LineToY[t1, y]; PushTrajectory[self, t2]; }; ApplyCURVETO: PUBLIC PROC[self: State] = { p3: Pair = PopPair[self]; p2: Pair = PopPair[self]; p1: Pair = PopPair[self]; t1: Trajectory = PopTrajectory[self]; t2: Trajectory = IPGeometry.CurveTo[t1, p1, p2, p3]; PushTrajectory[self, t2]; }; ApplyARCTO: PUBLIC PROC[self: State] = { ERROR IPErrors.MasterError[Unimplemented]; }; ApplyCONICTO: PUBLIC PROC[self: State] = { ERROR IPErrors.MasterError[Unimplemented]; }; ApplyMAKEOUTLINE: PUBLIC PROC[self: State] = { n: Integer = PopInteger[self]; p: PROC RETURNS[Trajectory] = { RETURN[PopTrajectory[self]] }; o: Outline = IPGeometry.MakeOutline[n, p]; PushOutline[self, o]; }; ApplyMASKFILL: PUBLIC PROC[self: State] = { o: Outline = PopOutline[self]; MaskFill[self, o]; }; ApplyMASKSTROKE: PUBLIC PROC[self: State] = { t: Trajectory = PopTrajectory[self]; MaskStroke[self, t, FALSE]; }; ApplyMASKSTROKECLOSED: PUBLIC PROC[self: State] = { t: Trajectory = PopTrajectory[self]; MaskStroke[self, t, TRUE]; }; ApplyMASKRECTANGLE: PUBLIC PROC[self: State] = { h: REAL = PopReal[self]; w: REAL = PopReal[self]; y: REAL = PopReal[self]; x: REAL = PopReal[self]; MaskRectangle[self, x, y, w, h]; }; ApplyMASKVECTOR: PUBLIC PROC[self: State] = { p2: Pair = PopPair[self]; p1: Pair = PopPair[self]; MaskVector[self, p1, p2]; }; ApplySTARTUNDERLINE: PUBLIC PROC[self: State] = { StartUnderline[self]; }; ApplyMASKUNDERLINE: PUBLIC PROC[self: State] = { h: REAL = PopReal[self]; dy: REAL = PopReal[self]; MaskUnderline[self, dy, h]; }; ApplyMASKTRAPEZOIDX: PUBLIC PROC[self: State] = { x4: REAL = PopReal[self]; y3: REAL = PopReal[self]; x3: REAL = PopReal[self]; x2: REAL = PopReal[self]; y1: REAL = PopReal[self]; x1: REAL = PopReal[self]; MaskTrapezoidX[self, x1, y1, x2, x3, y3, x4]; }; ApplyMASKTRAPEZOIDY: PUBLIC PROC[self: State] = { y4: REAL = PopReal[self]; y3: REAL = PopReal[self]; x3: REAL = PopReal[self]; y2: REAL = PopReal[self]; y1: REAL = PopReal[self]; x1: REAL = PopReal[self]; MaskTrapezoidY[self, x1, y1, y2, x3, y3, y4]; }; ApplyMASKPIXEL: PUBLIC PROC[self: State] = { pa: PixelArray = PopPixelArray[self]; MaskPixel[self, pa]; }; ApplyCLIPOUTLINE: PUBLIC PROC[self: State] = { ERROR IPErrors.MasterError[Unimplemented]; }; ApplyCLIPRECTANGLE: PUBLIC PROC[self: State] = { ERROR IPErrors.MasterError[Unimplemented]; }; ApplyFINDFONT: PUBLIC PROC[self: State] = { v: Vector = PopVector[self]; w: Vector = FindFont[self, v]; PushVector[self, w]; }; ApplyFINDFONTVEC: PUBLIC PROC[self: State] = { ERROR IPErrors.MasterError[Unimplemented]; }; ApplyMODIFYFONT: PUBLIC PROC[self: State] = { m: Transformation = PopTransformation[self]; v: Vector = PopVector[self]; w: Vector = ModifyFont[v, m]; PushVector[self, w]; }; ApplySETFONT: PUBLIC PROC[self: State] = { n: Integer = PopInteger[self]; SetFont[self, n]; }; ApplyCORRECTMASK: PUBLIC PROC[self: State] = { CorrectMask[self]; }; ApplyCORRECTSPACE: PUBLIC PROC[self: State] = { v: Pair = PopPair[self]; CorrectSpace[self, v]; }; ApplyCORRECT: PUBLIC PROC[self: State] = { Correct[self]; }; ApplySETCORRECTMEASURE: PUBLIC PROC[self: State] = { v: Pair = PopPair[self]; SetCorrectMeasure[self, v]; }; ApplySETCORRECTTOLERANCE: PUBLIC PROC[self: State] = { v: Pair = PopPair[self]; SetCorrectTolerance[self, v]; }; ApplySPACE: PUBLIC PROC[self: State] = { x: REAL = PopReal[self]; Space[self, x]; }; END. IPImagePrimitivesImpl.mesa Last edited by: Doug Wyatt, April 29, 1983 1:58 pm 4.2 Imager state 4.3 Coordinate systems 4.4 Transformations 4.5 Current position operators 4.6 Pixel arrays 4.7 Color 4.8 Mask operators 4.9 Character operators 4.10 Spacing correction Κ ˜headšœ™šœ™Jšœ"™"—J˜šΟk ˜ Jšœœ)˜6Jšœ œ˜Jšœ œ:˜JJšœœ@˜SJšœ Οcœ˜#Jšœœ˜Jšœœm˜zJšœ œq˜‚—J˜—šœœ˜$Jšœ8˜?Jšœ˜Jšœœœ.˜:J˜šœ™šΟn œœœ˜'Jšœ˜J˜J˜J˜—šŸ œœœ˜'Jšœ˜Jšœ˜J˜J˜—J˜—šœ™šŸ œœœ˜)J˜Jšœ ˜ J˜J˜—J˜—šœ™šŸ œœœ˜(Jšœœœ˜1Jšœœœ˜1Jšœœœ˜1J˜8Jšœ˜J˜—šŸ œœœ˜(Jšœ,˜,J˜>J˜>J˜—šŸœœœ˜,Jšœœœ˜1J˜0Jšœ˜J˜—šŸ œœœ˜)Jšœœ˜J˜*Jšœ˜J˜—šŸ œœœ˜(Jšœœ˜J˜)Jšœ˜J˜—šŸ œœœ˜)Jšœœœ˜3J˜/Jšœ˜J˜—šŸ œœœ˜)Jšœ,˜,Jšœ,˜,J˜-Jšœ˜J˜—šŸ œœœ˜)Jšœ,˜,J˜*Jšœ˜J˜—J˜šŸœœœ˜,Jšœ,˜,J˜J˜&J˜J˜—šŸœœœ˜/Jšœ,˜,J˜J˜)J˜J˜—šŸ œœœ˜*Jšœ,˜,J˜J˜$J˜J˜—šŸœœœ˜-Jšœ,˜,J˜J˜'J˜J˜—J˜šŸ œœœ˜*Jšœ,˜,J˜J˜—šŸ œœœ˜'J˜ J˜—šŸ œœœ˜(J˜ J˜—J˜šŸ œœœ˜'J˜J˜J˜—šŸœœœ˜.J˜J˜J˜—J˜—šœ™šŸ œœœ˜(J˜J˜J˜—šŸ œœœ˜+J˜J˜J˜—šŸ œœœ˜*Jšœœ˜J˜J˜—šŸ œœœ˜*Jšœœ˜J˜J˜—šŸ œœœ˜(Jšœ˜Jšœ˜J˜—šŸœœœ˜/Jšœœ˜Jšœ˜J˜—J˜—šœ™šŸœœœ˜1J˜"Jšœ,˜,Jšœœ˜)Jšœ+˜+Jšœ,˜,Jšœ$˜$Jšœ$˜$šœC˜CJšœA˜AJšœ@˜@—J˜J˜—šŸœœœ˜3J˜Jšœ)˜)J˜J˜—J˜—šœ ™ šŸœœœ˜,J˜J˜ J˜J˜—šŸœœœ˜4J˜J˜*J˜J˜—šŸœœœ˜9J˜J˜/J˜J˜—šŸ œœœ˜+Jšœœ˜J˜Jšœ˜J˜—šŸ œœœ˜*Jšœœ˜J˜J˜—šŸœœœ˜3Jšœ œ˜"Jšœ-˜-Jšœ%˜%J˜3J˜J˜—šŸœœœ˜3Jšœ,˜,Jšœ-˜-Jšœ%˜%Jšœ5˜5J˜J˜—J˜—šœ™šŸ œœœ˜)J˜J˜%J˜J˜—šŸ œœœ˜)J˜J˜%J˜*J˜J˜—šŸ œœœ˜*Jšœœ˜J˜%J˜+J˜J˜—šŸ œœœ˜*Jšœœ˜J˜%J˜+J˜J˜—šŸ œœœ˜*J˜J˜J˜J˜%J˜4J˜J˜—šŸ œœœ˜(Jšœ%˜*J˜—šŸ œœœ˜*Jšœ%˜*J˜—šŸœœœ˜.Jšœ˜Jšœœœœ˜>Jšœ*˜*Jšœ˜J˜—J˜J˜šŸ œœœ˜+J˜J˜J˜—šŸœœœ˜-J˜$Jšœœ˜J˜—šŸœœœ˜3J˜$Jšœœ˜J˜—šŸœœœ˜0Jšœœœ˜1Jšœœœ˜1J˜ J˜—šŸœœœ˜-J˜J˜J˜J˜—šŸœœœ˜1Jšœ˜J˜—šŸœœœ˜0Jšœœœ˜2Jšœ˜J˜—šŸœœœ˜1Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜J˜-J˜—šŸœœœ˜1Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜Jšœœ˜J˜-J˜—J˜šŸœœœ˜,J˜%J˜J˜—J˜šŸœœœ˜.Jšœ%˜*J˜—šŸœœœ˜0Jšœ%˜*J˜——šœ™šŸ œœœ˜+Jšœ˜Jšœ˜J˜J˜—šŸœœœ˜.Jšœ%˜*J˜—šŸœœœ˜-Jšœ,˜,J˜J˜J˜J˜—šŸ œœœ˜*Jšœ˜J˜J˜—J˜—šœ™šŸœœœ˜.J˜J˜—šŸœœœ˜/J˜J˜J˜—šŸ œœœ˜*J˜J˜—šŸœœœ˜4J˜J˜J˜—šŸœœœ˜6J˜J˜J˜—šŸ œœœ˜(Jšœœ˜J˜J˜——J˜Jšœ˜—J˜J˜—…—'ͺ3Γ