<> <> <> <<>> <> DIRECTORY Atom USING [PropList], Font USING [FONT], ImagerBasic USING [ColorRep, Pair, PathMapType, PixelArray], ImagerTransform USING [Transformation, TransformationRec], Rope USING [ROPE]; Imager: CEDAR DEFINITIONS ~ BEGIN <> <> <> <> Context: TYPE ~ REF ContextRep; ContextRep: TYPE ~ RECORD[ class: Class, -- procedures for the context class state: REF, -- state of the imager variables, if available data: REF, -- instance data, type depends on the class propList: Atom.PropList -- a property list ]; Create: PROC[deviceType: ATOM, data: REF _ NIL] RETURNS [Context]; <> <> <> Error: ERROR[errorCode: ErrorCode]; ErrorCode: TYPE ~ ATOM; <<$Bug -- detected an internal inconsistency>> <<$Unimplemented -- operation not provided for this context>> <<$NotYetImplemented -- part of the Imager implementation is incomplete>> <<$InvalidState -- context.state is NIL or has wrong type>> <<$ZeroDivideInCorrectSpace -- CorrectSpace calculation tried to divide by zero>> <<$UnableToProperlyAdjustMaskPositions -- Correct failed to achieve target measure>> <<$UnknownSpecialColor -- unrecognized atom for a special Color>> <<$UnknownColorModel -- unrecognized colorOperator for a sampled color>> <<$MustBeRopeOrRefText -- characters argument is not ROPE or REF TEXT>> <<$UnimplementedSpecialOp -- unrecognized op for SpecialOp>> <<>> <> <> <<>> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <<>> <<>> <> <<>> DoSave: PROC[context: Context, body: PROC]; DoSaveAll: PROC[context: Context, body: PROC]; <> SetPriorityImportant: PROC[context: Context, priorityImportant: BOOL]; <> <> <<>> <> <> <<>> PutProp: PROC[context: Context, key: REF, value: REF]; <> GetProp: PROC[context: Context, key: REF] RETURNS[value: REF]; <> RemProp: PROC[context: Context, key: REF]; <> <> <> Transformation: TYPE ~ ImagerTransform.Transformation; Matrix: TYPE ~ ImagerTransform.TransformationRec; MakeT: PROC[Matrix] RETURNS[Transformation]; OpenT: PROC[Transformation] RETURNS[Matrix]; Scale: PROC[s: REAL] RETURNS[Transformation]; Scale2: PROC[sx, sy: REAL] RETURNS[Transformation]; Rotate: PROC[a: REAL] RETURNS[Transformation]; Translate: PROC[x, y: REAL] RETURNS[Transformation]; Concat: PROC[m, n: Transformation] RETURNS[Transformation]; Invert: PROC[m: Transformation] RETURNS[Transformation]; <> Transform: PROC[m: Transformation, p: Pair] RETURNS[Pair]; TransformVec: PROC[m: Transformation, p: Pair] RETURNS[Pair]; InverseTransform: PROC[m: Transformation, p: Pair] RETURNS[Pair]; InverseTransformVec: PROC[m: Transformation, p: Pair] RETURNS[Pair]; <<>> <> ConcatT: PROC[context: Context, m: Transformation]; <<>> ScaleT: PROC[context: Context, s: REAL]; <> micasToMeters: REAL ~ 0.00001; inchesToMeters: REAL ~ micasToMeters*2540; pointsToMeters: REAL ~ inchesToMeters/72.27; <> <<>> Scale2T: PROC[context: Context, sx, sy: REAL]; <> <<>> RotateT: PROC[context: Context, a: REAL]; <> <> <<>> TranslateT: PROC[context: Context, x, y: REAL]; <> <<>> <<>> Move: PROC[context: Context]; <> <<>> Trans: PROC[context: Context]; <> <> <> <> <<>> <> << The current transformation, T, transforms the specified mask shape to determine the coordinates of the mask on the image.>> << The current color governs the color of the object that will be placed on the image.>> << If priorityImportant is TRUE, the priority order of objects laid down is preserved.>> << If noImage is TRUE, mask operators will have no effect on the image, although they will have the proper effect on the imager variables.>> <<>> <> <<>> <> <> <<>> Pair: TYPE ~ ImagerBasic.Pair; -- RECORD[x, y: REAL] Trajectory: TYPE ~ REF TrajectoryRep; TrajectoryRep: TYPE ~ RECORD[ prev: Trajectory, -- the preceding trajectory lp: Pair, -- the last point variant: SELECT tag: * FROM move => [], -- begin new trajectory at lp line => [], -- straight line, endpoints [prev.lp, lp] curve => [p1, p2: Pair], -- cubic curve, Bezier control points [prev.lp, p1, p2, lp] conic => [p1: Pair, r: REAL], -- conic curve, control points [prev.lp, p1, lp] ENDCASE ]; TrajectoryList: TYPE ~ LIST OF Trajectory; LastPoint: PROC[t: Trajectory] RETURNS[x, y: REAL]; LastPointP: PROC[t: Trajectory] RETURNS[Pair]; <> <<>> MoveTo: PROC[x, y: REAL] RETURNS[Trajectory]; MoveToP: PROC[p: Pair] RETURNS[Trajectory]; <> <<>> LineTo: PROC[t: Trajectory, x, y: REAL] RETURNS[Trajectory]; LineToP: PROC[t: Trajectory, p: Pair] RETURNS[Trajectory]; <> <<>> LineToX: PROC[t: Trajectory, x: REAL] RETURNS[Trajectory]; LineToY: PROC[t: Trajectory, y: REAL] RETURNS[Trajectory]; <> <> <<>> CurveTo: PROC[t: Trajectory, x1, y1, x2, y2, x3, y3: REAL] RETURNS[Trajectory]; CurveToP: PROC[t: Trajectory, p1, p2, p3: Pair] RETURNS[Trajectory]; <> <> ConicTo: PROC[t: Trajectory, x1, y1, x2, y2: REAL, r: REAL] RETURNS[Trajectory]; ConicToP: PROC[t: Trajectory, p1, p2: Pair, r: REAL] RETURNS[Trajectory]; <> <> ArcTo: PROC[t: Trajectory, x1, y1, x2, y2: REAL] RETURNS[Trajectory]; ArcToP: PROC[t: Trajectory, p1, p2: Pair] RETURNS[Trajectory]; <> <> PathProc: TYPE ~ ImagerBasic.PathMapType; MapTrajectory: PathProc; -- for a Trajectory MapTrajectoryList: PathProc; -- for a TrajectoryList <> MaskFill: PROC[context: Context, outline: REF]; <> <> <> <<>> MaskFillPath: PROC[context: Context, pathProc: PathProc, pathData: REF _ NIL]; <<>> <> SetStrokeWidth: PROC[context: Context, strokeWidth: REAL]; <> StrokeEnd: TYPE ~ { square, -- Square off the end after extending the stroke by half its width butt, -- Square off the end flush with the endpoint round -- Round the end with a semicircular cap }; SetStrokeEnd: PROC[context: Context, strokeEnd: StrokeEnd]; <> MaskStroke: PROC[context: Context, stroke: REF]; <> <> <> <<>> MaskStrokeClosed: PROC[context: Context, stroke: REF]; <> <<>> MaskStrokePath: PROC[context: Context, pathProc: PathProc, pathData: REF _ NIL]; MaskStrokeClosedPath: PROC[context: Context, pathProc: PathProc, pathData: REF _ NIL]; <<>> <> MaskRectangle: PROC[context: Context, x, y, w, h: REAL]; MaskRectangleI: PROC[context: Context, x, y, w, h: INTEGER] ~ INLINE { context.class.MaskRectangleI[context, x, y, w, h] }; <> <> <<>> Box: TYPE ~ RECORD[xmin, ymin, xmax, ymax: REAL]; MaskBox: PROC[context: Context, box: Box]; <> <> <> <<>> MaskVector: PROC[context: Context, x1, y1, x2, y2: REAL]; MaskVectorI: PROC[context: Context, x1, y1, x2, y2: INTEGER] ~ INLINE { context.class.MaskVectorI[context, x1, y1, x2, y2] }; MaskVectorP: PROC[context: Context, p1, p2: Pair]; <> <> <<>> <> SetNoImage: PROC[context: Context, noImage: BOOL]; <> <<>> <> <> <> <<>> SetXY: PROC[context: Context, x, y: REAL]; SetXYI: PROC[context: Context, x, y: INTEGER] ~ INLINE { context.class.SetXYI[context, x, y] }; SetXYP: PROC[context: Context, p: Pair]; <> <<>> SetXYRel: PROC[context: Context, x, y: REAL]; SetXYRelI: PROC[context: Context, x, y: INTEGER] ~ INLINE { context.class.SetXYRelI[context, x, y] }; SetXYRelP: PROC[context: Context, p: Pair]; <> SetXRel: PROC[context: Context, x: REAL]; SetXRelI: PROC[context: Context, x: INTEGER] ~ INLINE { context.class.SetXYRelI[context, x, 0] }; <> <<>> SetYRel: PROC[context: Context, y: REAL]; SetYRelI: PROC[context: Context, y: INTEGER] ~ INLINE { context.class.SetXYRelI[context, 0, y] }; <> <> <<>> <> <<>> FONT: TYPE ~ Font.FONT; ROPE: TYPE ~ Rope.ROPE; FindFont: PROC[name: ROPE] RETURNS[FONT]; ModifyFont: PROC[font: FONT, m: Transformation] RETURNS[FONT]; MakeFont: PROC[name: ROPE, size: REAL] RETURNS[FONT]; SetFont: PROC[context: Context, font: FONT]; ShowRope: PROC[context: Context, rope: ROPE, start: INT _ 0, len: INT _ INT.LAST]; ShowText: PROC[context: Context, text: REF READONLY TEXT, start: NAT _ 0, len: NAT _ NAT.LAST]; ShowChar: PROC[context: Context, char: CHAR]; SetAmplifySpace: PROC[context: Context, amplifySpace: REAL]; <> <> <<>> StartUnderline: PROC[context: Context]; <> <<>> MaskUnderline: PROC[context: Context, dy, h: REAL]; MaskUnderlineI: PROC[context: Context, dy, h: INTEGER] ~ INLINE { context.class.MaskUnderlineI[context, dy, h] }; <> <> <<>> <> CorrectMask: PROC[context: Context]; CorrectSpace: PROC[context: Context, x, y: REAL]; CorrectSpaceP: PROC[context: Context, p: Pair]; Correct: PROC[context: Context, body: PROC]; SetCorrectMeasure: PROC[context: Context, x, y: REAL]; SetCorrectMeasureP: PROC[context: Context, p: Pair]; SetCorrectTolerance: PROC[context: Context, x, y: REAL]; SetCorrectToleranceP: PROC[context: Context, p: Pair]; SetCorrectShrink: PROC[context: Context, correctShrink: REAL]; Space: PROC[context: Context, x: REAL]; SpaceI: PROC[context: Context, x: INTEGER] ~ INLINE { context.class.SpaceI[context, x] }; <> PixelArray: TYPE ~ ImagerBasic.PixelArray; MakePixelArrayFromBits: PROC[ bitPointer: LONG POINTER TO PACKED ARRAY [0..0) OF [0..1], bitsPerLine, samplesPerLine, numberOfLines: NAT ] RETURNS [PixelArray]; <> <> <> <> MaskPixel: PROC[context: Context, pa: PixelArray]; <> <> <<>> <> ConstantColor: TYPE ~ REF ImagerBasic.ColorRep[constant]; MakeGray: PROC[f: REAL] RETURNS[ConstantColor]; <> <<>> black: ConstantColor; -- MakeGray[1] white: ConstantColor; -- MakeGray[0] <> Color: TYPE ~ REF ImagerBasic.ColorRep; SetSampledColor: PROC[context: Context, pa: PixelArray, pixelT: Transformation, colorOperator: ATOM _ $Intensity]; SetSampledBlack: PROC[context: Context, pa: PixelArray, pixelT: Transformation, transparent: BOOLEAN _ FALSE]; <> <> <> <> <> <> <> <<>> <> SetColor: PROC[context: Context, color: Color]; <> SetGray: PROC[context: Context, f: REAL]; <> <<>> <> <<>> ClipOutline: PROC[context: Context, outline: REF]; ClipOutlinePath: PROC[context: Context, pathProc: PathProc, pathData: REF _ NIL]; ExcludeOutline: PROC[context: Context, outline: REF]; ExcludeOutlinePath: PROC[context: Context, pathProc: PathProc, pathData: REF _ NIL]; ClipRectangle: PROC[context: Context, x, y, w, h: REAL]; ClipRectangleI: PROC[context: Context, x, y, w, h: INTEGER]; ExcludeRectangle: PROC[context: Context, x, y, w, h: REAL]; ExcludeRectangleI: PROC[context: Context, x, y, w, h: INTEGER]; <<>> <> Class: TYPE ~ REF ClassRep; ClassRep: TYPE ~ RECORD[ type: ATOM, DoSave: PROC[context: Context, body: PROC] _, DoSaveAll: PROC[context: Context, body: PROC] _, SetPriorityImportant: PROC[context: Context, priorityImportant: BOOL] _, SetFont: PROC[context: Context, font: FONT] _, SetColor: PROC[context: Context, color: Color] _, SetNoImage: PROC[context: Context, noImage: BOOL] _, SetStrokeWidth: PROC[context: Context, strokeWidth: REAL] _, SetStrokeEnd: PROC[context: Context, strokeEnd: StrokeEnd] _, SetAmplifySpace: PROC[context: Context, amplifySpace: REAL] _, SetCorrectShrink: PROC[context: Context, correctShrink: REAL] _, ConcatT: PROC[context: Context, m: Transformation] _, ScaleT: PROC[context: Context, s: REAL] _, Scale2T: PROC[context: Context, sx, sy: REAL] _, RotateT: PROC[context: Context, a: REAL] _, TranslateT: PROC[context: Context, x, y: REAL] _, Move: PROC[context: Context] _, Trans: PROC[context: Context] _, ShowRope: PROC[context: Context, rope: ROPE, start, len: INT] _, ShowText: PROC[context: Context, text: REF READONLY TEXT, start, len: NAT] _, ShowChar: PROC[context: Context, char: CHAR] _, SetXY: PROC[context: Context, x, y: REAL] _, SetXYI: PROC[context: Context, x, y: INTEGER] _, SetXYRel: PROC[context: Context, x, y: REAL] _, SetXYRelI: PROC[context: Context, x, y: INTEGER] _, SetSampledColor: PROC[context: Context, pa: PixelArray, pixelT: Transformation, colorOperator: ATOM] _, SetSampledBlack: PROC[context: Context, pa: PixelArray, pixelT: Transformation, transparent: BOOL] _, SetGray: PROC[context: Context, f: REAL] _, MaskFill: PROC[context: Context, pathProc: PathProc, pathData: REF] _, MaskStroke: PROC[context: Context, pathProc: PathProc, pathData: REF] _, MaskStrokeClosed: PROC[context: Context, pathProc: PathProc, pathData: REF] _, MaskVector: PROC[context: Context, x1, y1, x2, y2: REAL] _, MaskVectorI: PROC[context: Context, x1, y1, x2, y2: INTEGER] _, MaskRectangle: PROC[context: Context, x, y, w, h: REAL] _, MaskRectangleI: PROC[context: Context, x, y, w, h: INTEGER] _, StartUnderline: PROC[context: Context] _, MaskUnderline: PROC[context: Context, dy, h: REAL] _, MaskUnderlineI: PROC[context: Context, dy, h: INTEGER] _, MaskPixel: PROC[context: Context, pa: PixelArray] _, ClipOutline: PROC[context: Context, pathProc: PathProc, pathData: REF] _, ExcludeOutline: PROC[context: Context, pathProc: PathProc, pathData: REF] _, ClipRectangle: PROC[context: Context, x, y, w, h: REAL] _, ClipRectangleI: PROC[context: Context, x, y, w, h: INTEGER] _, ExcludeRectangle: PROC[context: Context, x, y, w, h: REAL] _, ExcludeRectangleI: PROC[context: Context, x, y, w, h: INTEGER] _, CorrectMask: PROC[context: Context] _, CorrectSpace: PROC[context: Context, x, y: REAL] _, Correct: PROC[context: Context, body: PROC] _, SetCorrectMeasure: PROC[context: Context, x, y: REAL] _, SetCorrectTolerance: PROC[context: Context, x, y: REAL] _, Space: PROC[context: Context, x: REAL] _, SpaceI: PROC[context: Context, x: INTEGER] _ ]; <<>> END.