<> <> <> <> 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 BOOL _ NIL, propRef: CD.PropRef, --for client only data: REF _ NIL --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: REF_NIL, data: REF _ NIL, stopFlag: REF BOOL _ NIL] 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: ATOM_NIL, dispose: BOOL_TRUE, remFirst: BOOL_TRUE, except: REF_NIL] RETURNS [num: INT_0]; <<--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: REF_NIL, dispose: BOOL_FALSE] 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: REF_NIL, dispose: BOOL_FALSE] 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_0, into: Tesselation_NIL, except: REF_NIL, use: REF_$covered, dispose: BOOL_FALSE] 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: BOOL_FALSE] 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: BOOL_FALSE] RETURNS [Tesselation]; AndIn: PROC [x: Tesselation, into: Tesselation, dispose: BOOL_FALSE] RETURNS [Tesselation]; OrIn: PROC [x: Tesselation, into: Tesselation, dispose: BOOL_FALSE] RETURNS [Tesselation]; AndNotIn: PROC [x, into: Tesselation, dispose: BOOL_FALSE] 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_0, dispose: BOOL_FALSE] RETURNS [Tesselation]; <<--grows if amount>0>> <<--shrinks if amount<0; (Not per tile! grows background)>> END.