GGFromImagerImpl.mesa
Contents: Routines for building Gargoyle objects from Interpres.
Copyright Ó 1985, 1989, 1990 by Xerox Corporation. All rights reserved.
Michael Plass, September 18, 1989 11:14:22 am PDT
Pier, April 21, 1992 4:30 pm PDT
Bier, December 11, 1989 8:37:02 pm PST
Doug Wyatt, January 3, 1990 5:10:40 pm PST
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;
Viewer: TYPE ~ ViewerClasses.Viewer;
Visibility: TYPE ~ ImagerBackdoor.Visibility;
XChar: TYPE ~ ImagerFont.XChar;
XStringProc: TYPE ~ ImagerFont.XStringProc;
Data: TYPE ~ REF DataRep;
DataRep: TYPE ~ RECORD [
scene: Scene,
camera: Camera,
feedback: Viewer,
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: ROPEIO.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: ROPENIL] ~ {
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] = {
Takes a complex name like "xerox/pressfonts/Helvetica-MIR" and a font size and returns components.
May already have a simple name like xerox/tiogafonts/Helvetica10I. KAP August 8, 1986
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.STREAMIO.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] = {
A kludge for the moment to avoid segments with sampled colors
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: BOOLTRUE] 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 curOutline ← GGOutline.AddChild[curOutline, curTraj];
ASSERT: this code can modify curOutline because it owns it. This is a big win.
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];
What a crock... in PCedar the len argument is a NAT15, which is smaller than NAT!
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: BOOLFALSE;
[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;
SIGNAL WarningMessage[context, $MaskBitmap, "NotImplemented: MaskBitmap"];
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, NIL, NIL, NIL, TRUE];
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;
SIGNAL WarningMessage[context, $DrawBits, "NotImplemented: DrawBits"];
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, NIL, NIL, NIL, TRUE];
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.