CDCSUtil.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created by: Christian Jacobi, December 12, 1985 2:19:57 pm PST
Last edited by: Christian Jacobi, December 1, 1986 7:02:20 pm PST
DIRECTORY
CD,
CDBasics,
CStitching,
D2Basic,
Rope;
CDCSUtil: CEDAR DEFINITIONS =
BEGIN
Tesselation: TYPE = CStitching.Tesselation;
Scale: TYPE = RECORD [
off: CD.Position ← [0, 0],
num: INT ← 1,
denom: INT ← 1
];
-- scaling: scaledNumber ← (cdNumber+off)*num/denom
CDWorld: TYPE = REF CDWorldRec;
CDWorldRec: TYPE = RECORD [
design: CD.Design←NIL,
ob: CD.Object ← NIL,
restrict: CD.Rect ← CDBasics.universe,
minGrowClip: CD.Number ← 0,
scale: Scale,
drawChild: CD.DrawProc ← NIL,
drawContext: CD.DrawContextProc ← NIL,
stopFlag: REF BOOLNIL,
propRef: CD.PropRef, --for client only
data: REFNIL --for client only
];
Layers: TYPE = LIST OF LayerDesc;
LayerDesc: TYPE = REF LayerDescRec ← NIL;
LayerDescRec: TYPE = RECORD [
source: CD.Layer,
deltaDiameter: INT ← 0, -- + means cs feature is bigger than cd feature, in scaled numbers
growClip: CD.Number ← 0,
plane: Tesselation←NIL --NIL: use output tesselation; #NIL use this tesselation
];
New: PROC [filledWith: REFNIL, data: REFNIL, stopFlag: REF BOOLNIL] RETURNS [plane: Tesselation];
--creates new tesselation
Dispose: PROC [basis: Tesselation];
--free memory of tesselation
Make: PROC [what: CDWorld, layers: Layers, into: Tesselation←NIL] RETURNS [Tesselation];
--converts from cd world to tesselation world
ExtractErrors: PROC [what: CDWorld, x: Tesselation, msg: Rope.ROPE, owner: ATOMNIL, dispose: BOOLTRUE, remFirst: BOOLTRUE, except: REFNIL] RETURNS [num: INT𡤀];
--writes the contexnts of tesselation as error messages back into cd world
BackRect: PROC [what: CDWorld, csRect: CStitching.Rect] RETURNS [CD.Rect];
--un-scales a rectangle from tesselation world into cd world,
--in doubt larger, usefull for error messages
--basic operations
Fill: PROC [x: Tesselation, into: Tesselation←NIL, except: REFNIL, dispose: BOOLFALSE] RETURNS [Tesselation];
--fills "into" with $covered except where "x" has "except"
--NIL "into" creates new tesselation filled with NIL
Rem: PROC [x: Tesselation, into: Tesselation←NIL, except: REFNIL, dispose: BOOLFALSE] RETURNS [Tesselation];
--fills "into" with NIL except where "x" has "except"
--NIL "into" creates new tesselation filled with $covered
FillGrow: PROC [x: Tesselation, grow: INT𡤀, into: Tesselation←NIL, except: REFNIL, use: REF←$covered, dispose: BOOLFALSE] RETURNS [Tesselation];
--fills "into" with "use" except where "x" has "except"
--NIL "into" creates new tesselation filled with NIL
Copy: PROC [x: Tesselation, into: Tesselation←NIL, dispose: BOOLFALSE] RETURNS [Tesselation];
--simple copy operation
--fills "into" with "x" except where "x" is NIL
--NIL "into" creates new tesselation filled with NIL
--simple operators; use only $covered and NIL
Not: PROC [x: Tesselation, dispose: BOOLFALSE] RETURNS [Tesselation];
AndIn: PROC [x: Tesselation, into: Tesselation, dispose: BOOLFALSE] RETURNS [Tesselation];
OrIn: PROC [x: Tesselation, into: Tesselation, dispose: BOOLFALSE] RETURNS [Tesselation];
AndNotIn: PROC [x, into: Tesselation, dispose: BOOLFALSE] RETURNS [Tesselation];
--into ← into AND (~x)
And: PROC [t1, t2, t3, t4: Tesselation←NIL] RETURNS [Tesselation];
Or: PROC [t1, t2, t3, t4: Tesselation←NIL] RETURNS [Tesselation];
AndNot: PROC [a, n: Tesselation] RETURNS [Tesselation];
--a AND (~n)
Grow: PROC [x: Tesselation, amount: INT𡤀, dispose: BOOLFALSE] RETURNS [Tesselation];
--grows if amount>0
--shrinks if amount<0; (Not per tile! grows background)
END.