PipalMaskImpl.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Louis Monier January 15, 1988 8:46:10 pm PST
Bertrand Serlet March 7, 1988 3:57:08 pm PST
DIRECTORY Imager, ImagerBackdoor, IO, Pipal, PipalInt, PipalMask, PipalPaint, PipalReal;
PipalMaskImpl: CEDAR PROGRAM
IMPORTS Imager, ImagerBackdoor, IO, Pipal, PipalInt, PipalPaint, PipalReal
EXPORTS PipalMask =
BEGIN OPEN PipalMask;
Brick
brickClass: PUBLIC Pipal.Class ← Pipal.RegisterClass[name: "Brick", type: CODE [BrickRec]];
SizeBrick: PipalInt.SizeProc ~ {size ← NARROW [object, Brick].size};
PaintBrick: PipalPaint.PaintProc ~ {
brick: Brick ← NARROW [object];
IF brick.layer#ImagerBackdoor.GetColor[context] THEN Imager.SetColor[context, brick.layer];
Imager.MaskRectangle[context, [0.0, 0.0, brick.size.x, brick.size.y]];
};
DescribeBrick: Pipal.DescribeProc = {
brick: Brick ← NARROW [object];
Pipal.PutIndent[out, indent, cr];
IO.PutF[out, "Brick %g", IO.rope[PipalInt.VectorToRope[brick.size]]];
};
CreateBrick: PUBLIC PROC [size: PipalInt.Size, layer: Layer] RETURNS [brick: Brick] ~ {
brick ← NEW [BrickRec ← [size: size, layer: layer]];
};
Initialization
Pipal.PutClassMethod[brickClass, PipalInt.sizeMethod, NEW [PipalInt.SizeProc ← SizeBrick]];
Pipal.PutClassMethod[brickClass, PipalReal.sizeMethod, NEW [PipalReal.SizeProc ← PipalReal.UseIntSize]];
Pipal.PutClassMethod[brickClass, PipalInt.abutBoxMethod, NEW [PipalInt.AbutBoxProc ← PipalInt.AbutBoxFromSize]];
Pipal.PutClassMethod[brickClass, PipalPaint.paintMethod, NEW [PipalPaint.PaintProc ← PaintBrick]];
Pipal.PutClassMethod[brickClass, Pipal.describeMethod, NEW [Pipal.DescribeProc ← DescribeBrick]];
END.