PSPaintImpl.mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
Doug Wyatt, March 26, 1987 11:16:50 am PST
PostScript implementation: painting operators.
DIRECTORY
PS,
Vector2;
PSPaintImpl: CEDAR PROGRAM
IMPORTS PS, Vector2
~ BEGIN OPEN PS;
Painting operators
Fill: PROC [g: GState, oddWrap: BOOL] ~ {
};
Stroke: PROC [g: GState] ~ {
};
Image: PROC [g: GState, width: INT, height: INT, bitsPerSample: INT, matrix: Matrix,
stringProc: PROC RETURNS [String]] ~ {
};
ImageMask: PROC [g: GState, width: INT, height: INT, invert: BOOL, matrix: Matrix,
stringProc: PROC RETURNS [String]] ~ {
};
Primitives
Perasepage: PROC [self: Root] ~ {
g: GState ~ self.graphics;
};
Pfill: PROC [self: Root] ~ {
g: GState ~ self.graphics;
Fill[g, FALSE];
};
Peofill: PROC [self: Root] ~ {
g: GState ~ self.graphics;
Fill[g, TRUE];
};
Pstroke: PROC [self: Root] ~ {
g: GState ~ self.graphics;
Stroke[g];
};
Pimage: PROC [self: Root] ~ {
g: GState ~ self.graphics;
proc: Any ~ PopAny[self];
matrixArray: Array ~ PopArray[self];
bitsPerSample: INT ~ PopInt[self];
height: INT ~ PopInt[self];
width: INT ~ PopInt[self];
stringProc: PROC RETURNS [String] ~ {
Execute[self, proc];
RETURN [PopString[self.ostack]];
};
Image[g, width, height, bitsPerSample, GetMatrix[matrix], stringProc];
};
Pimagemask: PROC [self: Root] ~ {
g: GState ~ self.graphics;
proc: Any ~ PopAny[self];
matrixArray: Array ~ PopArray[self];
invert: BOOL ~ PopBool[self];
height: INT ~ PopInt[self];
width: INT ~ PopInt[self];
stringProc: PROC RETURNS [String] ~ {
Execute[self, proc];
RETURN [PopString[self.ostack]];
};
ImageMask[g, width, height, invert, GetMatrix[matrix], stringProc];
};
Registration
PaintPrimitives: PROC [self: Root] ~ {
Register[self, "erasepage", Perasepage];
Register[self, "fill", Pfill];
Register[self, "eofill", Peofill];
Register[self, "stroke", Pstroke];
Register[self, "image", Pimage];
Register[self, "imagemask", Pimagemask];
};
RegisterPrimitives[PaintPrimitives];
END.