<> <> <> <> <> <> <> <<>> DIRECTORY Convert, FileNames, GGBasicTypes, GGCoreOps, GGCoreTypes, GGFont, GGFromImager, GGModelTypes, GGOutline, GGParseIn, GGScene, GGSegment, GGSegmentTypes, GGSlice, GGSliceOps, GGTraj, GGUtility, Imager, ImagerBackdoor, ImagerColor, ImagerDeviceVector, ImagerFont, ImagerInterpress, ImagerPath, ImagerPrivate, ImagerState, ImagerTransformation, ImagerTypeface, Interpress, IO, RefText, Rope, SF, Vectors2d; GGFromImagerImpl: CEDAR PROGRAM IMPORTS Convert, FileNames, GGCoreOps, GGFont, GGOutline, GGParseIn, GGScene, GGSegment, GGSlice, GGSliceOps, GGTraj, GGUtility, Imager, ImagerBackdoor, ImagerFont, ImagerInterpress, ImagerPath, ImagerState, ImagerTransformation, Interpress, IO, RefText, Rope, Vectors2d EXPORTS GGFromImager, Imager, ImagerFont = BEGIN Camera: TYPE ~ GGModelTypes.Camera; Class: TYPE ~ REF ClassRep; ClassRep: PUBLIC TYPE ~ ImagerPrivate.ClassRep; -- export to Imager.ClassRep Clipper: TYPE ~ ImagerBackdoor.Clipper; Color: TYPE ~ Imager.Color; ColorOperator: TYPE ~ Imager.ColorOperator; Context: TYPE ~ Imager.Context; CoordSys: TYPE ~ ImagerBackdoor.CoordSys; Font: TYPE ~ ImagerFont.Font; Object: TYPE ~ Imager.Object; PathProc: TYPE ~ ImagerPath.PathProc; PixelArray: TYPE ~ Imager.PixelArray; PixelMap: TYPE ~ Imager.PixelMap; Point: TYPE ~ GGBasicTypes.Point; Rectangle: TYPE ~ Imager.Rectangle; ROPE: TYPE ~ Rope.ROPE; SampleMap: TYPE ~ Imager.SampleMap; ScanMode: TYPE ~ ImagerTransformation.ScanMode; Scene: TYPE ~ GGModelTypes.Scene; SequenceOfReal: TYPE ~ REF SequenceOfRealObj; SequenceOfRealObj: TYPE ~ GGCoreTypes.SequenceOfRealObj; Slice: TYPE ~ GGModelTypes.Slice; SliceParts: TYPE ~ GGModelTypes.SliceParts; State: TYPE ~ REF StateRep; StateRep: PUBLIC TYPE ~ ImagerState.StateRep; StrokeEnd: TYPE ~ Imager.StrokeEnd; StrokeJoint: TYPE ~ Imager.StrokeJoint; Transformation: TYPE ~ ImagerTransformation.Transformation; VEC: TYPE ~ Imager.VEC; <> Visibility: TYPE ~ ImagerBackdoor.Visibility; XChar: TYPE ~ ImagerFont.XChar; XStringProc: TYPE ~ ImagerFont.XStringProc; Data: TYPE ~ REF DataRep; DataRep: TYPE ~ RECORD [ scene: Scene, camera: Camera, <> curOutline: Slice ]; Typeface: TYPE ~ REF TypefaceRep; TypefaceRep: PUBLIC TYPE = ImagerTypeface.TypefaceRep; -- export to ImagerFont WarningMessage: PUBLIC SIGNAL [context: Context, code: ATOM, message: ROPE] ~ CODE; Create: PROC [camera: Camera] RETURNS [Context] ~ { data: Data ~ NEW[DataRep _ [scene: GGScene.CreateScene[], camera: camera]]; state: State ~ ImagerState.CreateState[]; state.color _ Imager.black; RETURN[NEW[Imager.ContextRep _ [class: gargoyleClass, state: state, data: data]]]; }; Capture: PUBLIC PROC [action: PROC [Context], camera: Camera] RETURNS [Scene] ~ { context: Context ~ Create[camera]; action[context ! Imager.Warning => { r: ROPE _ IO.PutFR["code: %g, message: %g", [atom[error.code]], [rope[error.explanation]] ]; SIGNAL WarningMessage[context, $Capture, r]; RESUME; }; ]; WITH context.data SELECT FROM data: Data => RETURN [data.scene]; ENDCASE => ERROR; }; ProcessStateChanges: PUBLIC PROC [context: Context] ~ { state: State ~ context.state; changed: ImagerState.ChangeFlags ~ state.changed; state.changed _ ImagerState.notChanged; IF changed.clipper AND state.clipper # NIL THEN SIGNAL WarningMessage[context, $Clipping, "NotImplemented: Clipping"]; }; RopeFromXStringProc: PROC [string: XStringProc] RETURNS [rope: ROPE _ NIL] ~ { text: REF TEXT _ RefText.ObtainScratch[256]; set: BYTE _ 0; action: PROC [char: XChar] ~ { IF char.set#set THEN { text _ RefText.AppendChar[to: text, from: VAL[255]]; text _ RefText.AppendChar[to: text, from: VAL[set _ char.set]]; }; text _ RefText.AppendChar[to: text, from: VAL[char.code]]; }; text.length _ 0; string[action]; rope _ Rope.FromRefText[text]; RefText.ReleaseScratch[text]; RETURN [rope]; }; UnpackComplexFontName: PROC [fontName: Rope.ROPE] RETURNS [prefix, family, face: Rope.ROPE, fontSize: REAL] = { <> <> DigitProc: IO.BreakProc = { SELECT char FROM IO.LF, IO.CR, IO.TAB, IO.SP => RETURN [break]; '0, '1, '2, '3, '4, '5, '6, '7, '8, '9 => RETURN [break]; ENDCASE => RETURN [other]; }; AlphaProc: IO.BreakProc = { SELECT char FROM IO.LF, IO.CR, IO.TAB, IO.SP => RETURN [break]; IN ['a .. 'z], IN ['A .. 'Z] => RETURN [break]; ENDCASE => RETURN [other]; }; new, sizeRope: Rope.ROPE; prefix _ FileNames.Directory[path: fontName]; -- "xerox/*fonts/" new _ FileNames.GetShortName[fontName]; -- get family "name" face _ FileNames.Tail[new, '-]; -- get face component (MIR, BRR, ...) IF Rope.Equal[face, new] THEN { -- have a name like Helvetica10I OR TERMINAL endOfName: BOOL; nameStream: IO.STREAM _ IO.RIS[new]; family _ IO.GetTokenRope[nameStream, DigitProc].token; -- get the leading alpha characters sizeRope _ IO.GetTokenRope[nameStream, AlphaProc ! IO.EndOfStream, IO.Error => {endOfName _ TRUE; CONTINUE;};].token; -- get any digit characters fontSize _ Convert.RealFromRope[sizeRope]; IF endOfName THEN face _ "" -- because face = new ELSE face _ Rope.Concat["-", GGParseIn.ReadWWord[nameStream]]; } ELSE { -- have a name like Helvetica-MIR family _ Rope.Substr[base: new, start: 0, len: Rope.SkipTo[s: new, pos: 0, skip: "-"]]; -- throw away "-XXX" face _ SELECT TRUE FROM Rope.Equal[face, "MRR", FALSE] => "", Rope.Equal[face, "BRR", FALSE] => "-B", Rope.Equal[face, "Bold", FALSE] => "-B", Rope.Equal[face, "MIR", FALSE] => "-I", Rope.Equal[face, "Italic", FALSE] => "-I", Rope.Equal[face, "BIR", FALSE] => "-BI", ENDCASE => ERROR; fontSize _ 1.0; }; }; SetSegProperties: PROC [context: Context, m: Transformation, outlined: BOOL, seg: GGSegmentTypes.Segment] = { <> strokeEnd: StrokeEnd; strokeEnd _ VAL[NAT[context.state.np.strokeEnd]]; IF outlined THEN { seg.strokeWidth _ Vectors2d.Magnitude[ImagerTransformation.TransformVec[m, [context.state.np.strokeWidth, 0.0] ] ]; seg.color _ IF ISTYPE[context.state.color, ImagerColor.ConstantColor] THEN context.state.color ELSE Imager.black; seg.strokeEnd _ strokeEnd; } ELSE { seg.strokeWidth _ 0.0; seg.color _ NIL; seg.strokeEnd _ round; }; }; OutlineFromPath: PROC[context: Context, path: PathProc, m: Transformation, closed: BOOL, outlined: BOOL _ TRUE] RETURNS [GGModelTypes.Slice] ~ { curOutline: GGModelTypes.Slice; curTraj: GGModelTypes.Traj; curSeg: GGSegmentTypes.Segment; lp: VEC _ [0,0]; firstPoint: VEC _ [0,0]; Finish: PROC ~ { IF curTraj # NIL THEN { IF curSeg # NIL THEN { IF closed THEN { IF curSeg.hi = firstPoint THEN { [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; GGTraj.CloseByDistorting[curTraj, hi]; } ELSE { [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; curSeg _ GGSegment.MakeLine[curSeg.hi, firstPoint, NIL]; SetSegProperties[context, m, outlined, curSeg]; GGTraj.CloseWithSegment[curTraj, curSeg, lo]; }; } ELSE [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; } ELSE { -- unlikely but legal case: Traj with a single point, no segment [] _ GGTraj.AddSegment[curTraj, lo, GGSegment.MakeLine[[lp.x, lp.y], [lp.x, lp.y], NIL], lo]; }; curSeg _ NIL; IF curOutline = NIL THEN curOutline _ GGOutline.CreateOutline[curTraj, NIL] <> <> ELSE AppendChild[curOutline, curTraj]; curTraj _ NIL; }; }; AppendChild: PROC [outline: Slice, child: Slice] = { holyData: GGOutline.OutlineData _ NARROW[outline.data]; holyData.children _ GGUtility.AppendSliceList[holyData.children, LIST[child]]; child.parent _ outline; GGTraj.SetTrajRole[child, hole]; }; Move: PROC [p: VEC] ~ { Finish[]; curTraj _ GGTraj.CreateTraj[[p.x, p.y]]; firstPoint _ lp _ p; }; Line: PROC [p1: VEC] ~ { IF curSeg # NIL THEN [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; curSeg _ GGSegment.MakeLine[[lp.x, lp.y], [p1.x, p1.y], NIL]; SetSegProperties[context, m, outlined, curSeg]; lp _ p1; }; Curve: PROC [p1, p2, p3: VEC] ~ { IF curSeg # NIL THEN [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; curSeg _ GGSegment.MakeBezier[[lp.x, lp.y], [p1.x, p1.y], [p2.x, p2.y], [p3.x, p3.y], NIL]; SetSegProperties[context, m, outlined, curSeg]; lp _ p3; }; Conic: PROC [p1, p2: VEC, r: REAL] ~ { IF curSeg # NIL THEN [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; curSeg _ GGSegment.MakeConic[[lp.x, lp.y], [p1.x, p1.y], [p2.x, p2.y], r, NIL]; SetSegProperties[context, m, outlined, curSeg]; lp _ p2; }; Arc: PROC [p1, p2: VEC] ~ { IF curSeg # NIL THEN [] _ GGTraj.AddSegment[curTraj, hi, curSeg, lo]; curSeg _ GGSegment.MakeArc[[lp.x, lp.y], [p1.x, p1.y], [p2.x, p2.y], NIL]; SetSegProperties[context, m, outlined, curSeg]; lp _ p2; }; ImagerPath.Transform[path, m, Move, Line, Curve, Conic, Arc]; Finish[]; GGSlice.KillBoundBox[curOutline]; RETURN [curOutline]; }; MyShow: PROC[context: Context, string: XStringProc, xrel: BOOL] = { MyShowAux[context, RopeFromXStringProc[string], xrel]; }; MyShowText: PROC [context: Context, text: REF READONLY TEXT, start, len: NAT, xrel: BOOL] = { rope: ROPE ~ IF len=NAT.LAST THEN Rope.FromRefText[s: text, start: start] -- let len default ELSE Rope.FromRefText[s: text, start: start, len: len]; <> MyShowAux[context, rope, xrel]; }; MyShowAux: PROC[context: Context, rope: Rope.ROPE, xrel: BOOL] = { OPEN ImagerTransformation; font: ImagerFont.Font _ context.class.GetFont[context]; escapement: VEC _ ImagerFont.RopeEscapement[font, rope]; camera: Camera _ NARROW[context.data, Data].camera; IF context.state.np.noImage=0 THEN { textSlice: GGModelTypes.Slice; data: Data _ NARROW[context.data]; amplifySpace: REAL _ ImagerBackdoor.GetReal[context, $amplifySpace]; color: Imager.Color _ context.class.GetColor[context]; currentT: Transformation _ context.class.GetT[context]; currentPoint: Point _ context.class.GetCP[context, FALSE]; fontName: Rope.ROPE _ ImagerFont.Name[font]; fontData: GGFont.FontData; fontData _ IF fontName # NIL THEN GGFont.ParseFontData[data: NIL, inStream: IO.RIS[fontName], literalP: TRUE ! GGFont.ParseError => { fontData _ GGFont.CreateFontData[]; CONTINUE; }; ] ELSE GGFont.FontDataFromNamelessFont[font]; fontData.transform _ Cat[Scale[fontData.storedSize], font.charToClient, Translate[currentPoint], currentT]; fontData.substituteOK _ TRUE; -- allow font substitution on file reads textSlice _ GGSlice.MakeTextSlice[rope, color, camera.displayStyle, amplifySpace]; [] _ GGSlice.SetTextFontAndTransform[textSlice, fontData, NIL, NIL]; GGScene.AddSlice[data.scene, textSlice, -1]; }; ImagerState.StateSetXYRel[context, escapement]; }; MySetSampledColor: PUBLIC PROC [context: Context, pa: PixelArray, m: Transformation, colorOperator: ColorOperator] = { ImagerState.StateSetSampledColor[context, pa, m, colorOperator]; }; MySetSampledBlack: PUBLIC PROC [context: Context, pa: PixelArray, m: Transformation, clear: BOOL] = { ImagerState.StateSetSampledBlack[context, pa, m, clear]; }; MyShowBackward: PROC[context: Context, string: XStringProc] = { SIGNAL WarningMessage[context, $MyShowBackward, "NotImplemented: ShowBackward"]; }; MyMaskFill: PROC[context: Context, path: PathProc, oddWrap: BOOL] = { data: Data ~ NARROW[context.data]; state: State ~ context.state; IF state.changed#ImagerState.notChanged THEN ProcessStateChanges[context]; IF context.state.np.noImage=0 THEN { outline: GGModelTypes.Slice; IF ImagerTransformation.CloseEnough[state.clientToDevice, identity] THEN outline _ OutlineFromPath[context, path, NIL, TRUE, FALSE] ELSE outline _ OutlineFromPath[context, path, state.clientToDevice, TRUE, FALSE]; IF outline = NIL THEN RETURN; -- MASKFILL with a null outline can occur in Interpress GGOutline.SetWrapRule[outline, oddWrap]; GGSliceOps.SetFillColor[outline, NIL, GGCoreOps.CopyColor[state.color], $Set, NIL]; GGScene.AddSlice[data.scene, outline, -1]; data.curOutline _ outline; }; }; ReplaceChild: PROC [outline: Slice, oldChild, newChild: Slice] = { outlineData: GGOutline.OutlineData _ NARROW[outline.data]; beforeEnt, ent, afterEnt: LIST OF Slice; found: BOOL _ FALSE; [beforeEnt, ent, afterEnt, found] _ GGUtility.FindSliceAndNeighbors[oldChild, outlineData.children]; IF NOT found THEN ERROR; IF beforeEnt = NIL THEN { outlineData.children _ CONS[newChild, afterEnt]; } ELSE { beforeEnt.rest _ CONS[newChild, afterEnt]; }; newChild.parent _ outline; GGTraj.SetTrajRole[newChild, GGTraj.GetTrajRole[oldChild]]; }; identity: ImagerTransformation.Transformation _ ImagerTransformation.Scale[1.0]; MyMaskStroke: PROC[context: Context, path: PathProc, closed: BOOL] ~ { outline: GGModelTypes.Slice; strokeJoint: StrokeJoint; data: Data ~ NARROW[context.data]; state: State ~ context.state; IF state.changed#ImagerState.notChanged THEN ProcessStateChanges[context]; IF context.state.np.noImage=0 THEN { trajs: LIST OF Slice; oldTraj: Slice; IF ImagerTransformation.CloseEnough[state.clientToDevice, identity] THEN outline _ OutlineFromPath[context, path, NIL, closed] ELSE outline _ OutlineFromPath[context, path, state.clientToDevice, closed]; trajs _ GGOutline.TrajectoriesOfOutline[outline]; IF trajs.rest = NIL AND data.curOutline # NIL THEN { oldTrajs: LIST OF Slice _ GGOutline.FindTrajShapeInOutline[trajs.first, data.curOutline]; oldTraj _ IF oldTrajs = NIL THEN NIL ELSE oldTrajs.first; }; strokeJoint _ VAL[NAT[context.state.np.strokeJoint]]; IF oldTraj = NIL THEN { GGSliceOps.SetFillColor[outline, NIL, NIL, $Set, NIL]; -- no fill color GGSliceOps.SetStrokeJoint[outline, GGSliceOps.NewParts[outline, NIL, slice].parts, strokeJoint, NIL]; GGScene.AddSlice[data.scene, outline, -1]; } ELSE { ReplaceChild[data.curOutline, oldTraj, trajs.first]; GGSliceOps.SetStrokeJoint[trajs.first, GGSliceOps.NewParts[trajs.first, NIL, slice].parts, strokeJoint, NIL]; }; }; }; MyMaskDashedStroke: PROC[context: Context, path: PathProc, patternLen: NAT, pattern: PROC [NAT] RETURNS [REAL], offset, length: REAL] ~ { outline: GGModelTypes.Slice; strokeJoint: StrokeJoint; data: Data ~ NARROW[context.data]; state: State ~ context.state; patternSeq: SequenceOfReal _ NEW[SequenceOfRealObj[patternLen]]; IF state.changed#ImagerState.notChanged THEN ProcessStateChanges[context]; IF context.state.np.noImage=0 THEN { completeParts: SliceParts; IF ImagerTransformation.CloseEnough[state.clientToDevice, identity] THEN outline _ OutlineFromPath[context, path, NIL, FALSE] -- to preserve arcs ELSE outline _ OutlineFromPath[context, path, state.clientToDevice, FALSE]; completeParts _ GGSliceOps.NewParts[outline, NIL, slice].parts; GGSliceOps.SetFillColor[outline, NIL, NIL, $Set, NIL]; -- no fill color strokeJoint _ VAL[NAT[context.state.np.strokeJoint]]; GGSliceOps.SetStrokeJoint[outline, completeParts, strokeJoint, NIL]; FOR i: NAT IN [0..patternLen) DO patternSeq[i] _ pattern[i]; ENDLOOP; GGSliceOps.SetDashed[outline, completeParts, TRUE, patternSeq, offset, length, NIL]; GGScene.AddSlice[data.scene, outline, -1]; }; }; MyShowAndFixedXRel: PROC [context: Context, string: XStringProc, x: REAL] ~ { SIGNAL WarningMessage[context, $ShowAndFixedXRel, "Not implemented: ShowAndFixedXRel"]; }; MyMaskRectangle: PROC[context: Context, r: Rectangle] ~ { path: PathProc ~ { moveTo[[r.x, r.y]]; lineTo[[r.x+r.w, r.y]]; lineTo[[r.x+r.w, r.y+r.h]]; lineTo[[r.x, r.y+r.h]] }; MyMaskFill[context, path, FALSE]; }; MyMaskRectangleI: PROC[context: Context, x, y, w, h: INTEGER] ~ { MyMaskRectangle[context, [x, y, w, h]]; }; MyMaskVector: PROC[context: Context, p1, p2: VEC] ~ { path: PathProc ~ {moveTo[p1]; lineTo[p2]}; MyMaskStroke[context, path, FALSE]; }; MyMaskPixel: PROC[context: Context, pa: PixelArray] ~ { DoMyMaskPixel: PROC [dc: Imager.Context] = { Imager.MaskPixel[dc, pa]; }; data: Data _ NARROW[context.data]; boxSlice: Slice; currentColor: Color; currentT: ImagerTransformation.Transformation; currentColor _ context.state.color; currentT _ ImagerTransformation.Copy[context.state.clientToDevice]; boxSlice _ GGSlice.MakeBoxFromMaskPixel[pa, currentColor, NIL, currentT]; GGScene.AddSlice[data.scene, boxSlice, -1]; }; MyMaskBitmap: PROC[context: Context, bitmap: SampleMap, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC] ~ { DoMyMaskBits: PROC [dc: Imager.Context] = { Imager.MaskBitmap[dc, bitmap, referencePoint, scanMode, position]; }; masterStream, outStream: IO.STREAM; masterRope: Rope.ROPE; data: Data _ NARROW[context.data]; ipRef: ImagerInterpress.Ref; ipMaster: Interpress.Master; ipSlice: Slice; <> outStream _ IO.ROS[]; ipRef _ ImagerInterpress.CreateFromStream[outStream, "Interpress/Xerox/3.0 "]; ImagerInterpress.DoPage[ipRef, DoMyMaskBits]; ImagerInterpress.Finish[ipRef]; masterRope _ IO.RopeFromROS[outStream]; masterStream _ IO.RIS[masterRope]; ipMaster _ Interpress.FromStream[masterStream, NIL]; <> ipSlice _ GGSlice.MakeIPSliceFromMaster[ipMaster: ipMaster, router: NIL, includeByValue: TRUE]; -- KAP GGScene.AddSlice[data.scene, ipSlice, -1]; }; MyDrawBitmap: PROC [context: Context, bitmap: SampleMap, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC] ~ { DoMyDrawBits: PROC [dc: Imager.Context] = { Imager.MaskBitmap[dc, bitmap, referencePoint, scanMode, position]; }; masterStream, outStream: IO.STREAM; masterRope: Rope.ROPE; data: Data _ NARROW[context.data]; ipRef: ImagerInterpress.Ref; ipMaster: Interpress.Master; ipSlice: Slice; <> outStream _ IO.ROS[]; ipRef _ ImagerInterpress.CreateFromStream[outStream, "Interpress/Xerox/3.0 "]; ImagerInterpress.DoPage[ipRef, DoMyDrawBits]; ImagerInterpress.Finish[ipRef]; masterRope _ IO.RopeFromROS[outStream]; masterStream _ IO.RIS[masterRope]; ipMaster _ Interpress.FromStream[masterStream, NIL]; <> ipSlice _ GGSlice.MakeIPSliceFromMaster[ipMaster: ipMaster, router: NIL, includeByValue: TRUE]; -- KAP GGScene.AddSlice[data.scene, ipSlice, -1]; }; MyDrawPixels: PROC[context: Context, pixelMap: PixelMap, colorOperator: ColorOperator, referencePoint: SF.Vec, scanMode: ScanMode, position: VEC] ~ { SIGNAL WarningMessage[context, $MyDrawPixels, "NotImplemented: DrawPixels"]; }; MyDoIfVisible: PROC[context: Context, r: Rectangle, action: PROC] ~ { SIGNAL WarningMessage[context, $MyDoIfVisible, "NotImplemented: DoIfVisible"]; }; MyDoWithBuffer: PROC[context: Context, action: PROC, x, y, w, h: INTEGER, backgroundColor: Color] ~ { SIGNAL WarningMessage[context, $MyDoWithBuffer, "NotImplemented: DoWithBuffer"]; }; MyDrawObject: PROC[context: Context, object: Object, position: VEC, interactive: BOOL] ~ { SIGNAL WarningMessage[context, $MyDrawObject, "NotImplemented: DrawObject:"]; }; MyGetBounds: PROC [context: Context] RETURNS [Rectangle] ~ { ERROR Imager.Error[[$NotImplemented, "NotImplemented: GetBounds"]] }; MyViewReset: PROC[context: Context] ~ { SIGNAL WarningMessage[context, $MyViewReset, "NotImplemented: ViewReset"]; }; MyViewTranslateI: PROC[context: Context, x, y: INTEGER] ~ { SIGNAL WarningMessage[context, $MyViewTranslateI, "NotImplemented: ViewTranslateI"]; }; MyViewClip: PROC[context: Context, path: PathProc, oddWrap: BOOL, exclude: BOOL] ~ { SIGNAL WarningMessage[context, $MyViewClip, "NotImplemented: ViewClip"]; }; MyViewClipRectangleI: PROC[context: Context, x, y, w, h: INTEGER, exclude: BOOL] ~ { SIGNAL WarningMessage[context, $MyViewClipRectangleI, "NotImplemented: ViewClipRectangleI"]; }; MyGetTransformation: PROC[context: Context, from, to: CoordSys] RETURNS [Transformation] ~ { state: State _ context.state; m: Transformation _ NIL; SELECT to FROM client => m _ ImagerTransformation.Copy[state.clientToDevice]; view => m _ ImagerTransformation.Scale[1.0]; surface => m _ ImagerTransformation.Scale[1.0]; device => m _ ImagerTransformation.Scale[1.0]; ENDCASE => ERROR; ImagerTransformation.ApplyInvert[m]; SELECT from FROM client => ImagerTransformation.ApplyPreConcat[m: m, p: state.clientToDevice]; view => NULL; surface => NULL; device => NULL; ENDCASE => ERROR; RETURN [m] }; MyTransform: PROC[context: Context, v: VEC, from, to: CoordSys, vec: BOOL] RETURNS [VEC] ~ { SIGNAL WarningMessage[context, $MyTransform, "NotImplemented: Transform"]; RETURN[[0,0]]; }; MyMoveViewRectangle: PROC[context: Context, width, height, fromX, fromY, toX, toY: INTEGER] ~ { SIGNAL WarningMessage[context, $MyMoveViewRectangle, "NotImplemented: MoveViewRectangle"]; }; MyTestViewRectangle: PROC[context: Context, x, y, w, h: INTEGER] RETURNS [Visibility] ~ { SIGNAL WarningMessage[context, $MyTestViewRectangle, "NotImplemented: TestViewRectangle"]; RETURN[all] }; gargoyleClass: Class ~ NEW[ClassRep _ [ type: $Gargoyle, Save: ImagerState.StateSave, Restore: ImagerState.StateRestore, SetInt: ImagerState.StateSetInt, SetReal: ImagerState.StateSetReal, SetT: ImagerState.StateSetT, SetFont: ImagerState.StateSetFont, SetColor: ImagerState.StateSetColor, SetClipper: ImagerState.StateSetClipper, GetInt: ImagerState.StateGetInt, GetReal: ImagerState.StateGetReal, GetT: ImagerState.StateGetT, GetFont: ImagerState.StateGetFont, GetColor: ImagerState.StateGetColor, GetClipper: ImagerState.StateGetClipper, ConcatT: ImagerState.StateConcatT, Scale2T: ImagerState.StateScale2T, RotateT: ImagerState.StateRotateT, TranslateT: ImagerState.StateTranslateT, Move: ImagerState.StateMove, SetXY: ImagerState.StateSetXY, SetXYRel: ImagerState.StateSetXYRel, Show: MyShow, ShowText: MyShowText, StartUnderline: ImagerState.StateStartUnderline, MaskUnderline: ImagerState.StateMaskUnderline, CorrectMask: ImagerState.StateCorrectMask, CorrectSpace: ImagerState.StateCorrectSpace, Space: ImagerState.StateSpace, SetCorrectMeasure: ImagerState.StateSetCorrectMeasure, SetCorrectTolerance: ImagerState.StateSetCorrectTolerance, Correct: ImagerState.StateCorrect, DontCorrect: ImagerState.StateDontCorrect, SetGray: ImagerState.StateSetGray, SetSampledColor: ImagerState.StateSetSampledColor, SetSampledBlack: ImagerState.StateSetSampledBlack, ShowBackward: MyShowBackward, MaskFill: MyMaskFill, MaskStroke: MyMaskStroke, ShowAndFixedXRel: MyShowAndFixedXRel, MaskDashedStroke: MyMaskDashedStroke, MaskRectangle: MyMaskRectangle, MaskRectangleI: MyMaskRectangleI, MaskVector: MyMaskVector, MaskPixel: MyMaskPixel, MaskBitmap: MyMaskBitmap, DrawBitmap: MyDrawBitmap, DrawPixels: MyDrawPixels, DoIfVisible: MyDoIfVisible, DoWithBuffer: MyDoWithBuffer, DrawObject: MyDrawObject, Clip: ImagerState.StateClip, ClipRectangle: ImagerState.StateClipRectangle, ClipRectangleI: ImagerState.StateClipRectangleI, GetCP: ImagerState.StateGetCP, GetBounds: MyGetBounds, ViewReset: MyViewReset, ViewTranslateI: MyViewTranslateI, ViewClip: MyViewClip, ViewClipRectangleI: MyViewClipRectangleI, GetTransformation: MyGetTransformation, Transform: MyTransform, MoveViewRectangle: MyMoveViewRectangle, TestViewRectangle: MyTestViewRectangle, propList: NIL ]]; END.