<> <> <> DIRECTORY Imager USING [ClassRep, Context, ContextRep, Error, PixelArray], ImagerBackdoor USING [Clipper, IntKey, RealKey], ImagerColorDefs USING [Color, ColorOperator, ConstantColor, ConstantColorImplRep, SampledColor], ImagerColorOperatorPrivate USING [ColorOperatorImpl, ColorOperatorImplRep], ImagerColorPrivate USING [ConstantColorImpl, ConstantColorImplRep], ImagerFont USING [Font, XChar, XStringProc], ImagerPath USING [ArcToProc, ConicToProc, CurveToProc, LineToProc, MoveToProc, PathProc], ImagerPixelArray USING [PixelArray], ImagerPrivate USING [Class, ClassRep], ImagerTransformation USING [Rectangle, Scale, Transformation], Rope USING [ROPE], Vector2 USING [VEC]; ImagerNullImpl: CEDAR PROGRAM IMPORTS Imager, ImagerTransformation EXPORTS Imager, ImagerColorDefs ~ BEGIN ROPE: TYPE ~ Rope.ROPE; VEC: TYPE ~ Vector2.VEC; Rectangle: TYPE ~ ImagerTransformation.Rectangle; Transformation: TYPE ~ ImagerTransformation.Transformation; PathProc: TYPE ~ ImagerPath.PathProc; Color: TYPE ~ ImagerColorDefs.Color; ConstantColor: TYPE ~ ImagerColorDefs.ConstantColor; SampledColor: TYPE ~ ImagerColorDefs.SampledColor; ConstantColorImpl: TYPE ~ ImagerColorPrivate.ConstantColorImpl; ConstantColorImplRep: PUBLIC TYPE ~ ImagerColorPrivate.ConstantColorImplRep; PixelArray: TYPE ~ ImagerPixelArray.PixelArray; ColorOperator: TYPE ~ ImagerColorDefs.ColorOperator; ColorOperatorImpl: TYPE ~ ImagerColorOperatorPrivate.ColorOperatorImpl; ColorOperatorImplRep: PUBLIC TYPE ~ ImagerColorOperatorPrivate.ColorOperatorImplRep; -- export to ImagerColorDefs Font: TYPE ~ ImagerFont.Font; XChar: TYPE ~ ImagerFont.XChar; XStringProc: TYPE ~ ImagerFont.XStringProc; IntKey: TYPE ~ ImagerBackdoor.IntKey; RealKey: TYPE ~ ImagerBackdoor.RealKey; Clipper: TYPE ~ ImagerBackdoor.Clipper; Context: TYPE ~ Imager.Context; Class: TYPE ~ ImagerPrivate.Class; ClassRep: PUBLIC TYPE ~ ImagerPrivate.ClassRep; -- export to Imager Data: TYPE ~ REF DataRep; DataRep: TYPE ~ RECORD [ doSave: INT _ 0, nest: INT _ 0, setInt: ARRAY IntKey OF INT _ ALL[0], setReal: ARRAY RealKey OF INT _ ALL[0], setFont: INT _ 0, setColorGray: INT _ 0, setColorRGB: INT _ 0, setColorOther: INT _ 0, setColorSampled: INT _ 0, concatT: INT _ 0, scale2T: INT _ 0, rotateT: INT _ 0, translateT: INT _ 0, getT: INT _ 0, move: INT _ 0, setXY: INT _ 0, setXYRel: INT _ 0, show: INT _ 0, showChars: INT _ 0, showText: INT _ 0, showBytes: INT _ 0, startUnderline: INT _ 0, maskUnderline: INT _ 0, correctMask: INT _ 0, correctSpace: INT _ 0, space: INT _ 0, setCorrectMeasure: INT _ 0, setCorrectTolerance: INT _ 0, correct: INT _ 0, dontCorrect: INT _ 0, setGray: INT _ 0, setSampledColor: INT _ 0, setSampledBlack: INT _ 0, maskFill: INT _ 0, maskFillPath: PathStats _ NIL, maskRectangle: INT _ 0, maskRectangleI: INT _ 0, maskStroke: INT _ 0, maskStrokePath: PathStats _ NIL, maskStrokeClosed: INT _ 0, maskStrokeClosedPath: PathStats _ NIL, maskDashedStroke: INT _ 0, maskDashedStrokePath: PathStats _ NIL, maskVector: INT _ 0, maskPixel: INT _ 0, maskBits: INT _ 0, clip: INT _ 0, clipRectangle: INT _ 0, clipRectangleI: INT _ 0 ]; PathStats: TYPE ~ REF PathStatsRep; PathStatsRep: TYPE ~ RECORD [ move: INT _ 0, line: INT _ 0, curve: INT _ 0, conic: INT _ 0, arc: INT _ 0 ]; CountPath: PROC [path: PathProc, pathStats: PathStats] ~ { MoveTo: ImagerPath.MoveToProc ~ {pathStats.move _ pathStats.move + 1}; LineTo: ImagerPath.LineToProc ~ {pathStats.line _ pathStats.line + 1}; CurveTo: ImagerPath.CurveToProc ~ {pathStats.curve _ pathStats.curve + 1}; ConicTo: ImagerPath.ConicToProc ~ {pathStats.conic _ pathStats.conic + 1}; ArcTo: ImagerPath.ArcToProc ~ {pathStats.arc _ pathStats.arc + 1}; path[MoveTo, LineTo, CurveTo, ConicTo, ArcTo]; }; Create: PUBLIC PROC RETURNS [Context] ~ { data: Data _ NEW[DataRep _ [maskFillPath: NEW[PathStatsRep], maskStrokePath: NEW[PathStatsRep], maskStrokeClosedPath: NEW[PathStatsRep], maskDashedStrokePath: NEW[PathStatsRep]]]; context: Context _ NEW[Imager.ContextRep _ [class: nullClass, data: data]]; RETURN [context] }; break: BOOL _ FALSE; NullDoSave: PROC [context: Context, action: PROC, all: BOOL] ~ { data: Data ~ NARROW[context.data]; data.doSave _ data.doSave + 1; IF data.nest = 0 THEN break _ TRUE; data.nest _ data.nest + 1; action[]; data.nest _ data.nest - 1; IF data.nest = 0 THEN break _ FALSE; }; NullSetInt: PROC [context: Context, key: IntKey, val: INT] ~ { data: Data ~ NARROW[context.data]; data.setInt[key] _ data.setInt[key] + 1; }; NullSetReal: PROC [context: Context, key: RealKey, val: REAL] ~ { data: Data ~ NARROW[context.data]; data.setReal[key] _ data.setReal[key] + 1; }; NullSetFont: PROC [context: Context, font: Font] ~ { data: Data ~ NARROW[context.data]; data.setFont _ data.setFont + 1; }; NullSetColor: PROC [context: Context, color: Color] ~ { data: Data ~ NARROW[context.data]; WITH color SELECT FROM color: ConstantColor => { impl: ConstantColorImpl ~ color.impl; WITH impl: impl SELECT FROM gray => {data.setColorGray _ data.setColorGray + 1}; rgb => {data.setColorRGB _ data.setColorRGB + 1}; ENDCASE => {data.setColorOther _ data.setColorOther + 1}; }; color: SampledColor => { data.setColorSampled _ data.setColorSampled + 1; }; ENDCASE => ERROR; }; NullSetT: PROC [context: Context, m: Transformation] ~ { Imager.Error[[$unimplemented, "SetT not implemented"]]; }; NullSetClipper: PROC [context: Context, clipper: Clipper] ~ { Imager.Error[[$unimplemented, "SetClipper not implemented"]]; }; NullGetInt: PROC [context: Context, key: IntKey] RETURNS[INT] ~ { Imager.Error[[$unimplemented, "Not implemented"]]; }; NullGetReal: PROC [context: Context, key: RealKey] RETURNS[REAL] ~ { Imager.Error[[$unimplemented, "Not implemented"]]; }; NullGetT: PROC [context: Context] RETURNS[Transformation] ~ { data: Data ~ NARROW[context.data]; m: Transformation _ ImagerTransformation.Scale[1.0]; data.getT _ data.getT + 1; RETURN [m]; }; NullGetClipper: PROC [context: Context] RETURNS[Clipper] ~ { Imager.Error[[$unimplemented, "Not implemented"]]; }; NullGetFont: PROC [context: Context] RETURNS[Font] ~ { Imager.Error[[$unimplemented, "Not implemented"]]; }; NullGetColor: PROC [context: Context] RETURNS[Color] ~ { Imager.Error[[$unimplemented, "Not implemented"]]; }; NullConcatT: PROC [context: Context, m: Transformation] ~ { data: Data ~ NARROW[context.data]; data.concatT _ data.concatT + 1; }; NullScale2T: PROC [context: Context, s: VEC] ~ { data: Data ~ NARROW[context.data]; data.scale2T _ data.scale2T + 1; }; NullRotateT: PROC [context: Context, a: REAL] ~ { data: Data ~ NARROW[context.data]; data.rotateT _ data.rotateT + 1; }; NullTranslateT: PROC [context: Context, t: VEC] ~ { data: Data ~ NARROW[context.data]; data.translateT _ data.translateT + 1; }; NullMove: PROC [context: Context, rounded: BOOL] ~ { data: Data ~ NARROW[context.data]; data.move _ data.move + 1; }; NullSetXY: PROC [context: Context, p: VEC] ~ { data: Data ~ NARROW[context.data]; data.setXY _ data.setXY + 1; }; NullSetXYRel: PROC [context: Context, v: VEC] ~ { data: Data ~ NARROW[context.data]; data.setXYRel _ data.setXYRel + 1; }; NullShow: PROC [context: Context, string: XStringProc, xrel: BOOL] ~ { data: Data ~ NARROW[context.data]; action: PROC [char: XChar] ~ {data.showChars _ data.showChars + 1}; data.show _ data.show + 1; string[action]; }; NullShowText: PROC [context: Context, text: REF READONLY TEXT, start, len: NAT, xrel: BOOL] ~ { data: Data ~ NARROW[context.data]; data.showBytes _ data.showBytes + text.length; data.showText _ data.showText + 1; }; NullStartUnderline: PROC [context: Context] ~ { data: Data ~ NARROW[context.data]; data.startUnderline _ data.startUnderline + 1; }; NullMaskUnderline: PROC [context: Context, dy, h: REAL] ~ { data: Data ~ NARROW[context.data]; data.maskUnderline _ data.maskUnderline + 1; }; NullCorrectMask: PROC [context: Context] ~ { data: Data ~ NARROW[context.data]; data.correctMask _ data.correctMask + 1; }; NullCorrectSpace: PROC [context: Context, v: VEC] ~ { data: Data ~ NARROW[context.data]; data.correctSpace _ data.correctSpace + 1; }; NullSpace: PROC [context: Context, x: REAL] ~ { data: Data ~ NARROW[context.data]; data.space _ data.space + 1; }; NullSetCorrectMeasure: PROC [context: Context, v: VEC] ~ { data: Data ~ NARROW[context.data]; data.setCorrectMeasure _ data.setCorrectMeasure + 1; }; NullSetCorrectTolerance: PROC [context: Context, v: VEC] ~ { data: Data ~ NARROW[context.data]; data.setCorrectTolerance _ data.setCorrectTolerance + 1; }; NullCorrect: PROC [context: Context, action: PROC] ~ { data: Data ~ NARROW[context.data]; data.correct _ data.correct + 1; action[]; }; NullDontCorrect: PROC [context: Context, action: PROC, saveCP: BOOL] ~ { data: Data ~ NARROW[context.data]; data.dontCorrect _ data.dontCorrect + 1; action[]; }; NullSetGray: PROC [context: Context, f: REAL] ~ { data: Data ~ NARROW[context.data]; data.setGray _ data.setGray + 1; }; NullSetSampledColor: PROC [context: Context, pa: PixelArray, m: Transformation, colorOperator: ColorOperator] ~ { data: Data ~ NARROW[context.data]; data.setSampledColor _ data.setSampledColor + 1; }; NullSetSampledBlack: PROC [context: Context, pa: PixelArray, m: Transformation, clear: BOOL] ~ { data: Data ~ NARROW[context.data]; data.setSampledBlack _ data.setSampledBlack + 1; }; NullMaskFill: PROC [context: Context, path: PathProc, oddWrap: BOOL] ~ { data: Data ~ NARROW[context.data]; data.maskFill _ data.maskFill + 1; CountPath[path, data.maskFillPath]; }; NullMaskRectangle: PROC [context: Context, r: Rectangle] ~ { data: Data ~ NARROW[context.data]; data.maskRectangle _ data.maskRectangle + 1; }; NullMaskRectangleI: PROC [context: Context, x, y, w, h: INTEGER] ~ { data: Data ~ NARROW[context.data]; data.maskRectangleI _ data.maskRectangleI + 1; }; NullMaskStroke: PROC [context: Context, path: PathProc, closed: BOOL] ~ { data: Data ~ NARROW[context.data]; IF closed THEN { CountPath[path, data.maskStrokeClosedPath]; data.maskStrokeClosed _ data.maskStrokeClosed + 1; } ELSE { CountPath[path, data.maskStrokePath]; data.maskStroke _ data.maskStroke + 1; }; }; NullMaskDashedStroke: PROC [context: Context, path: PathProc, patternLen: NAT, pattern: PROC [NAT] RETURNS [REAL], offset, length: REAL] ~ { data: Data ~ NARROW[context.data]; data.maskDashedStroke _ data.maskDashedStroke + 1; CountPath[path, data.maskDashedStrokePath]; }; NullMaskVector: PROC [context: Context, p1, p2: VEC] ~ { data: Data ~ NARROW[context.data]; data.maskVector _ data.maskVector + 1; }; NullMaskPixel: PROC [context: Context, pa: PixelArray] ~ { data: Data ~ NARROW[context.data]; data.maskPixel _ data.maskPixel + 1; }; NullMaskBits: PROC [context: Context, base: LONG POINTER, wordsPerLine: NAT, sMin, fMin, sSize, fSize: NAT, tx, ty: INTEGER] ~ TRUSTED { data: Data ~ NARROW[context.data]; data.maskBits _ data.maskBits + 1; }; NullClip: PROC [context: Context, path: PathProc, oddWrap: BOOL, exclude: BOOL] ~ { data: Data ~ NARROW[context.data]; data.clip _ data.clip + 1; }; NullClipRectangle: PROC [context: Context, r: Rectangle, exclude: BOOL] ~ { data: Data ~ NARROW[context.data]; data.clipRectangle _ data.clipRectangle + 1; }; NullClipRectangleI: PROC [context: Context, x, y, w, h: INTEGER, exclude: BOOL] ~ { data: Data ~ NARROW[context.data]; data.clipRectangleI _ data.clipRectangleI + 1; }; NullGetCP: PROC [context: Context, rounded: BOOL] RETURNS [VEC] ~ { Imager.Error[[$unimplemented, "GetCP not implemented"]]; }; NullGetBoundingRectangle: PROC [context: Context] RETURNS [Rectangle] ~ { Imager.Error[[$unimplemented, "GetBoundingRectangle not implemented"]]; }; nullClass: Class ~ NEW[ClassRep _ [ type: $Interpress, DoSave: NullDoSave, SetInt: NullSetInt, SetReal: NullSetReal, SetT: NullSetT, SetFont: NullSetFont, SetColor: NullSetColor, SetClipper: NullSetClipper, GetInt: NullGetInt, GetReal: NullGetReal, GetT: NullGetT, GetFont: NullGetFont, GetColor: NullGetColor, GetClipper: NullGetClipper, ConcatT: NullConcatT, Scale2T: NullScale2T, RotateT: NullRotateT, TranslateT: NullTranslateT, Move: NullMove, SetXY: NullSetXY, SetXYRel: NullSetXYRel, Show: NullShow, ShowText: NullShowText, StartUnderline: NullStartUnderline, MaskUnderline: NullMaskUnderline, CorrectMask: NullCorrectMask, CorrectSpace: NullCorrectSpace, Space: NullSpace, SetCorrectMeasure: NullSetCorrectMeasure, SetCorrectTolerance: NullSetCorrectTolerance, Correct: NullCorrect, DontCorrect: NullDontCorrect, SetGray: NullSetGray, SetSampledColor: NullSetSampledColor, SetSampledBlack: NullSetSampledBlack, MaskFill: NullMaskFill, MaskRectangle: NullMaskRectangle, MaskRectangleI: NullMaskRectangleI, MaskStroke: NullMaskStroke, MaskDashedStroke: NullMaskDashedStroke, MaskVector: NullMaskVector, MaskPixel: NullMaskPixel, MaskBits: NullMaskBits, Clip: NullClip, ClipRectangle: NullClipRectangle, ClipRectangleI: NullClipRectangleI, GetCP: NullGetCP, GetBoundingRectangle: NIL ]]; END.