<> <<>> <> <<>> <> <> <> <> <> DIRECTORY ImagerBasic USING [Color, IntPair, IntRectangle, Pair, PathClosure, PixelArray, Rectangle, StrokeEnds, Transformation, Visibility], Rope USING [ROPE], UnifiedFonts USING [FONT]; Imager: CEDAR DEFINITIONS = BEGIN <<>> <> ROPE: TYPE = Rope.ROPE; FONT: TYPE = UnifiedFonts.FONT; Pair: TYPE = ImagerBasic.Pair; IntPair: TYPE = ImagerBasic.IntPair; Rectangle: TYPE = ImagerBasic.Rectangle; IntRectangle: TYPE = ImagerBasic.IntRectangle; Color: TYPE = ImagerBasic.Color; PixelArray: TYPE = ImagerBasic.PixelArray; Transformation: TYPE = ImagerBasic.Transformation; Path: TYPE = REF PathRep; PathRep: TYPE = PRIVATE RECORD[ prev: Path, -- the preceding path, NIL if path begins at lp lp: Pair, -- the last point variant: SELECT tag: * FROM move => [], -- begin new trajectory at lp line => [], -- straight line segment, endpoints [prev.lp, lp] curve => [p1, p2: Pair], -- cubic curve segment, Bezier control points [prev.lp, p1, p2, lp] conic => [p1: Pair, e: REAL], -- conic section segment; see Full Interpress ENDCASE ]; Polygon: TYPE = REF PolygonRep; PolygonRep: TYPE = RECORD[length: NAT, vertices: SEQUENCE max: NAT OF Pair]; <<>> <> Context: TYPE = REF ContextRep; -- Holds the imager state ContextRep: TYPE = RECORD[class: REF, data: REF]; Create: PROC [deviceType: ATOM, data: REF] RETURNS [Context]; <> <> <> UnimplementedDevice: ERROR; <<>> DeviceType: PROC [context: Context] RETURNS [ATOM]; Clear: PROC [context: Context]; <> <<>> NewPage: PROC [context: Context]; <> <<>> Close: PROC [context: Context]; <> <<>> <<>> <> <<>> <> <<>> DoSaveAll: PROC [context: Context, action: PROC]; <> <<>> DoSave: PROC [context: Context, action: PROC]; <> <<>> <<>> <> <> <<>> ConcatT: PROC [context: Context, m: Transformation]; <> TranslateT: PROC [context: Context, dx, dy: REAL]; RotateT: PROC [context: Context, degrees: REAL]; ScaleT: PROC [context: Context, sx, sy: REAL]; <> <<>> Move: PROC[context: Context]; <> Trans: PROC[context: Context]; <> <<>> <> <<>> <> <<>> SetXY: PROC [context: Context, p: Pair]; SetXYRel: PROC [context: Context, v: Pair]; SetXRel: PROC [context: Context, x: REAL]; SetYRel: PROC [context: Context, y: REAL]; <<>> <> <<>> <> <<(1) a constant color (ImagerBasic.CIEColor),>> <<(2) color from an array of samples, which tile the plane (ImagerBasic.SampledColor), and>> <<(3) special colors (see ImagerDoc.tioga for details).>> <> black: Color; white: Color; SetColor: PROC [context: Context, color: Color]; <<>> <> MoveTo: PROC[path: Path, p: Pair] RETURNS[Path]; <> StartAt: PROC[p: Pair] RETURNS[Path] = INLINE { RETURN[MoveTo[NIL, p]] }; <> LineTo: PROC[path: Path, p: Pair] RETURNS[Path]; <> CurveTo: PROC[path: Path, p1, p2, p3: Pair] RETURNS[Path]; <> <> ConicTo: PROC[path: Path, p1, p2: Pair, e: REAL] RETURNS[Path]; <> <> LastPoint: PROC[path: Path] RETURNS[Pair] = INLINE { RETURN[path.lp] }; <> <> <> <> <<>> <> <<>> <> MaskFill: PROC [context: Context, path: Path]; <> StrokeEnd: TYPE = {default, butt, square, round}; MaskStroke: PROC [context: Context, path: Path, width: REAL _ defaultWidth, strokeEnd: StrokeEnd _ default, closed: BOOL _ FALSE]; <
> <<"butt" ends are squared off at the endpoint coordinate.>> <<"square" ends are extended by half the stroke width before squaring.>> <<"round" ends have semicircular caps at the ends.>> MaskPixel: PROC [context: Context, pixelArray: PixelArray]; <> <<>> <<>> MaskRectangle: PROC [context: Context, area: Rectangle]; <> <<>> MaskIntRectangle: PROC [context: Context, area: IntRectangle]; StartUnderline: PROC[context: Context]; MaskUnderline: PROC[context: Context, dy, h: REAL]; <> <<>> MaskThinStroke: PROC [context: Context, path: Path, closed: BOOL _ FALSE]; <> <<>> MaskVector: PROC [context: Context, p1, p2: Pair]; <> <<>> MaskBits: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, tile: IntRectangle, area: IntRectangle]; <> <> <> <> <> <> <> <> <> <<>> <<>> <> <<>> <> <<>> Clipper: TYPE = REF; -- for use in GetClipper and SetClipper only. <> <<>> GetClipper: PROC [context: Context] RETURNS [Clipper]; SetClipper: PROC [context: Context, clipper: Clipper]; <> <<>> ClipOutline: PROC [context: Context, outline: Path, exclude: BOOL _ FALSE]; <> <<>> ClipRectangle: PROC [context: Context, outline: Rectangle, exclude: BOOL _ FALSE]; <> <<>> TestRectangle: PROC [context: Context, area: Rectangle] RETURNS [Visibility]; <<>> ClipIntRectangle: PROC [context: Context, outline: IntRectangle, exclude: BOOL _ FALSE]; <> <<>> TestIntRectangle: PROC [context: Context, area: IntRectangle] RETURNS [Visibility]; DoWithoutClipping: PROC [context: Context, bounds: IntRectangle, action: PROC[Context]]; <> <<>> <<>> <> <<>> <> MaskChar: PROC [context: Context, font: FONT, char: CHAR]; MaskCharacters: PROC [context: Context, font: FONT, characters: REF, -- ROPE or REF TEXT start: INT _ 0, length: INT _ LAST[INT]]; <> <> <<>> <> <<>> <> <> <> <> Reset: PROC [context: Context]; <> <<>> <> <<>> SetView: PROC [context: Context, box: IntRectangle, halftoneOrigin: IntPair _ [0, 0]]; <> <<>> ClipView: PROC [context: Context, box: IntRectangle, exclude: BOOL]; <> <<>> GetSurfaceBounds: PROC [context: Context] RETURNS [IntRectangle]; <> <<>> GetViewBounds: PROC [context: Context] RETURNS [IntRectangle]; <> <<>> MoveSurfaceRectangle: PROC [context: Context, source: IntRectangle, dest: IntPair] RETURNS [BOOL]; <> <<>> <<>> <> <<>> SetColorInvert: PROC [context: Context]; DrawBitmap: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, area: IntRectangle]; SpecialOp: PROC [context: Context, op: ATOM, data: REF] RETURNS [BOOL]; END.