<> <> <> <> <> <> <> DIRECTORY ImagerBasic, Rope USING [ROPE], UnifiedFonts USING [FONT]; Imager: CEDAR DEFINITIONS ~ BEGIN <> Rectangle: TYPE ~ ImagerBasic.Rectangle; -- RECORD [x, y, w, h: REAL] IntRectangle: TYPE ~ ImagerBasic.IntRectangle; -- RECORD [x, y, w, h: INTEGER] Pair: TYPE ~ ImagerBasic.Pair; -- RECORD [x, y: REAL] IntPair: TYPE ~ ImagerBasic.IntPair; -- RECORD [x, y: INTEGER] <> Context: TYPE ~ REF ContextRep; -- Holds the imager state ContextRep: TYPE ~ RECORD[class: REF ClassRep, data: REF]; Class: PRIVATE PROC [context: Context] RETURNS [REF ClassRep] ~ INLINE {RETURN [context.class]}; Create: PROC [deviceType: ATOM, name: Rope.ROPE _ NIL] RETURNS [Context]; <> <> UnImplementedDevice: ERROR; DeviceType: PROC [context: Context] RETURNS [ATOM] ~ INLINE {RETURN [Class[context].deviceType]}; Flush: PROC [context: Context] ~ INLINE {Class[context].Flush[context]}; <> Close: PROC [context: Context] ~ INLINE {Class[context].Close[context]}; <> <<>> <> <> DoSaveAll: PROC [context: Context, action: PROC] ~ INLINE {Class[context].DoSaveAll[context, action]}; <> DoSave: PROC [context: Context, action: PROC] ~ INLINE {Class[context].DoSave[context, action]}; <> <> Transformation: TYPE ~ ImagerBasic.Transformation; <> <> TranslateT: PROC [context: Context, dx, dy: REAL] ~ INLINE {Class[context].TranslateT[context, dx, dy]}; RotateT: PROC [context: Context, degrees: REAL] ~ INLINE {Class[context].RotateT[context, degrees]}; ScaleT: PROC [context: Context, sx, sy: REAL] ~ INLINE {Class[context].ScaleT[context, sx, sy]}; ConcatT: PROC [context: Context, transformation: Transformation] ~ INLINE {Class[context].ConcatT[context, transformation]}; <> GetT: PROC [context: Context] RETURNS [Transformation] ~ INLINE {RETURN [Class[context].GetT[context]]}; SetT: PROC [context: Context, transformation: Transformation] ~ INLINE {Class[context].SetT[context, transformation]}; <> IntTranslateT: PROC [context: Context, dx, dy: INTEGER] ~ INLINE {Class[context].IntTranslateT[context, dx, dy]}; IntScaleT: PROC [context: Context, sx, sy: INTEGER] ~ INLINE {Class[context].IntScaleT[context, sx, sy]}; <> <<>> <> Visibility: TYPE ~ ImagerBasic.Visibility; -- {visible, partlyVisible, invisible} Clipper: TYPE ~ REF; -- for use in GetClipper and SetClipper only. <> GetClipper: PROC [context: Context] RETURNS [Clipper] ~ INLINE {RETURN [Class[context].GetClipper[context]]}; SetClipper: PROC [context: Context, clipper: Clipper] ~ INLINE {Class[context].SetClipper[context, clipper]}; <> <> ClipPath: PROC [context: Context, outline: Path, exclude: BOOLEAN _ FALSE] ~ INLINE {Class[context].ClipPath[context, outline, exclude]}; <> ClipRectangle: PROC [context: Context, outline: Rectangle, exclude: BOOLEAN _ FALSE] ~ INLINE {Class[context].ClipRectangle[context, outline, exclude]}; <> TestRectangle: PROC [context: Context, area: Rectangle] RETURNS [Visibility] ~ INLINE {RETURN [Class[context].TestRectangle[context, area]]}; <> ClipIntRectangle: PROC [context: Context, outline: IntRectangle, exclude: BOOLEAN _ FALSE] ~ INLINE {Class[context].ClipIntRectangle[context, outline, exclude]}; <> TestIntRectangle: PROC [context: Context, area: IntRectangle] RETURNS [Visibility] ~ INLINE {RETURN [Class[context].TestIntRectangle[context, area]]}; DoWithoutClipping: PROC [context: Context, bounds: IntRectangle, callBack: PROC[Context]] ~ INLINE {Class[context].DoWithoutClipping[context, bounds, callBack]}; <> <> <> <<(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).>> <> Color: TYPE ~ ImagerBasic.Color; black: Color; white: Color; SetColor: PROC [context: Context, color: Color] ~ INLINE {Class[context].SetColor[context, color]}; GetColor: PROC [context: Context] RETURNS [Color] ~ INLINE {RETURN [Class[context].GetColor[context]]}; <> Path: TYPE ~ ImagerBasic.Path; <> <> StrokeEnds: TYPE ~ ImagerBasic.StrokeEnds; -- {butt, square, round} <<(1) "Butt" ends are squared off at the endpoint coordinate.>> <<(2) "Square" ends are extended by half the stroke width before squaring.>> <<(3) "Round" ends have semicircular caps at the ends.>> MaskStroke: PROC [context: Context, path: Path, width: REAL, strokeEnds: StrokeEnds, closed: BOOLEAN _ FALSE] ~ INLINE {Class[context].MaskStroke[context, path, width, strokeEnds, closed]}; <
> <> MaskFill: PROC [context: Context, path: Path] ~ INLINE {Class[context].MaskFill[context, path]}; <> MaskPixel: PROC [context: Context, pixelArray: ImagerBasic.PixelArray] ~ INLINE {Class[context].MaskPixel[context, pixelArray]}; <> MaskBits: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, tile: IntRectangle, area: IntRectangle] ~ INLINE {Class[context].MaskBits[context, base, raster, tile, area]}; <> <> <> <> <> <> <> <> <<>> <> MaskSegment: PROC [context: Context, p: Pair] ~ INLINE {Class[context].MaskSegment[context, p]}; <> MaskIntSegment: PROC [context: Context, p: IntPair] ~ INLINE {Class[context].MaskIntSegment[context, p]}; MaskThinStroke: PROC [context: Context, path: Path] ~ INLINE {Class[context].MaskThinStroke[context, path]}; <> MaskRectangle: PROC [context: Context, area: Rectangle] ~ INLINE {Class[context].MaskRectangle[context, area]}; <> MaskIntRectangle: PROC [context: Context, area: IntRectangle] ~ INLINE {Class[context].MaskIntRectangle[context, area]}; <> <> <> SetCP: PROC [context: Context, cp: Pair] ~ INLINE {Class[context].SetCP[context, cp]}; GetCP: PROC [context: Context] RETURNS [cp: Pair] ~ INLINE {RETURN [Class[context].GetCP[context]]}; <> SetIntCP: PROC [context: Context, cp: IntPair] ~ INLINE {Class[context].SetIntCP[context, cp]}; GetIntCP: PROC [context: Context] RETURNS [cp: IntPair] ~ INLINE {RETURN [Class[context].GetIntCP[context]]}; MaskChar: PROC [context: Context, font: UnifiedFonts.FONT, char: CHAR] ~ INLINE {Class[context].MaskChar[context, font, char]}; MaskCharacters: PROC [ context: Context, font: UnifiedFonts.FONT, characters: REF, -- may be a Rope.ROPE or a REF TEXT start: INT _ 0, length: INT _ LAST[INT] ] ~ INLINE {Class[context].MaskCharacters[context, font, characters, start, length]}; <> <> <> <> <> <> <> CreateBuffer: PROC [deviceType: ATOM, box: IntRectangle] RETURNS [Context]; <> TransferBuffer: PROC [context, source: Context] ~ INLINE {Class[context].TransferBuffer[context, source]}; <> IncompatibleContexts: ERROR; <> <> Reset: PROC [context: Context] ~ INLINE {Class[context].Reset[context]}; SetView: PROC [context: Context, box: IntRectangle, halftoneOrigin: IntPair _ [0, 0]] ~ INLINE {Class[context].SetView[context, box, halftoneOrigin]}; <> ClipView: PROC [context: Context, box: IntRectangle, exclude: BOOLEAN] ~ INLINE {Class[context].ClipView[context, box, exclude]}; <> GetSurfaceBounds: PROC [context: Context] RETURNS [IntRectangle] ~ INLINE {RETURN [Class[context].GetSurfaceBounds[context]]}; <> GetViewBounds: PROC [context: Context] RETURNS [IntRectangle] ~ INLINE {RETURN [Class[context].GetViewBounds[context]]}; <> MoveSurfaceRectangle: PROC [context: Context, source: IntRectangle, dest: IntPair] RETURNS [BOOLEAN] ~ INLINE {RETURN [Class[context].MoveSurfaceRectangle[context, source, dest]]}; <> <> SetColorInvert: PROC [context: Context] ~ INLINE {Class[context].SetColorInvert[context]}; DrawBitmap: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, area: IntRectangle] ~ INLINE {Class[context].DrawBitmap[context, base, raster, area]}; SpecialOp: PROC [context: Context, op: ATOM, data: REF] RETURNS [BOOLEAN] ~ INLINE {RETURN [Class[context].SpecialOp[context, op, data]]}; <> ClassRep: TYPE ~ RECORD [ deviceType: ATOM, Init: PROC [context: Context, name: Rope.ROPE, bounds: IntRectangle], DoSaveAll: PROC [context: Context, action: PROC], DoSave: PROC [context: Context, action: PROC], Flush: PROC [context: Context], Close: PROC [context: Context], TranslateT: PROC [context: Context, dx, dy: REAL], RotateT: PROC [context: Context, degrees: REAL], ScaleT: PROC [context: Context, sx, sy: REAL], ConcatT: PROC [context: Context, transformation: Transformation], GetT: PROC [context: Context] RETURNS [Transformation], SetT: PROC [context: Context, transformation: Transformation], IntTranslateT: PROC [context: Context, dx, dy: INTEGER], IntScaleT: PROC [context: Context, sx, sy: INTEGER], GetClipper: PROC [context: Context] RETURNS [Clipper], SetClipper: PROC [context: Context, clipper: Clipper], ClipPath: PROC [context: Context, outline: Path, exclude: BOOLEAN], ClipRectangle: PROC [context: Context, outline: Rectangle, exclude: BOOLEAN], TestRectangle: PROC [context: Context, area: Rectangle] RETURNS [Visibility], ClipIntRectangle: PROC [context: Context, outline: IntRectangle, exclude: BOOLEAN], TestIntRectangle: PROC [context: Context, area: IntRectangle] RETURNS [Visibility], DoWithoutClipping: PROC [context: Context, bounds: IntRectangle, callBack: PROC[Context]], SetColor: PROC [context: Context, color: Color], GetColor: PROC [context: Context] RETURNS [Color], MaskStroke: PROC [context: Context, path: Path, width: REAL, strokeEnds: StrokeEnds, closed: BOOLEAN _ FALSE], MaskFill: PROC [context: Context, path: Path], MaskPixel: PROC [context: Context, pixelArray: ImagerBasic.PixelArray], MaskBits: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, tile: IntRectangle, area: IntRectangle], MaskSegment: PROC [context: Context, p: Pair], MaskIntSegment: PROC [context: Context, p: IntPair], MaskThinStroke: PROC [context: Context, path: Path], MaskRectangle: PROC [context: Context, area: Rectangle], MaskIntRectangle: PROC [context: Context, area: IntRectangle], SetCP: PROC [context: Context, cp: Pair], GetCP: PROC [context: Context] RETURNS [Pair], SetIntCP: PROC [context: Context, cp: IntPair], GetIntCP: PROC [context: Context] RETURNS [IntPair], MaskChar: PROC [context: Context, font: UnifiedFonts.FONT, char: CHAR], MaskCharacters: PROC [context: Context, font: UnifiedFonts.FONT, characters: REF, start: INT _ 0, length: INT], TransferBuffer: PROC [context, source: Context] _ NIL, Reset: PROC [context: Context] _ NIL, SetView: PROC [context: Context, box: IntRectangle, halftoneOrigin: IntPair] _ NIL, ClipView: PROC [context: Context, box: IntRectangle, exclude: BOOLEAN] _ NIL, GetSurfaceBounds: PROC [context: Context] RETURNS [IntRectangle] _ NIL, GetViewBounds: PROC [context: Context] RETURNS [IntRectangle] _ NIL, MoveSurfaceRectangle: PROC [context: Context, source: IntRectangle, dest: IntPair] RETURNS [BOOLEAN] _ NIL, SetColorInvert: PROC [context: Context] _ NIL, DrawBitmap: PROC [context: Context, base: LONG POINTER, raster: CARDINAL, area: IntRectangle] _ NIL, SpecialOp: PROC [context: Context, op: ATOM, data: REF] RETURNS [BOOLEAN] _ NIL ]; nullBounds: IntRectangle ~ [FIRST[INTEGER], FIRST[INTEGER], FIRST[INTEGER], FIRST[INTEGER]]; END.