PSGraphics.mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
Doug Wyatt, August 10, 1987 3:19:12 pm PDT
Types
Graphics: TYPE ~ PS.Graphics;
VEC: TYPE ~ Vector2.VEC;
Box: TYPE ~ RECORD [ll, ur: VEC];
Matrix: TYPE ~ REF MatrixRep;
MatrixRep: TYPE ~ RECORD [a, b, c, d, tx, ty: REAL];
Graphics state operators
GSave:
PROC [g: Graphics];
save graphics state
GRestore:
PROC [g: Graphics];
restore graphics state
GRestoreAll:
PROC [g: Graphics];
restore to bottommost graphics state
InitGraphics:
PROC [g: Graphics];
reset graphics state parameters
SetLineWidth:
PROC [g: Graphics, lineWidth:
REAL];
set line width
CurrentLineWidth:
PROC [g: Graphics]
RETURNS [
REAL];
return current line width
LineCap:
TYPE ~ {butt, round, square};
SetLineCap:
PROC [g: Graphics, lineCap: LineCap];
set shape of ends for stroke
CurrentLineCap:
PROC [g: Graphics]
RETURNS [LineCap];
return current line cap
LineJoin:
TYPE ~ {miter, round, bevel};
SetLineJoin:
PROC [g: Graphics, lineJoin: LineJoin];
set shape of corners for stroke
CurrentLineJoin:
PROC [g: Graphics]
RETURNS [LineJoin];
return current line join
SetMiterLimit:
PROC [g: Graphics, miterLimit:
REAL];
set miter length limit
CurrentMiterLimit:
PROC [g: Graphics]
RETURNS [
REAL];
return current miter limit
Dash:
TYPE ~
RECORD [array:
PS.Array, offset:
REAL];
SetDash:
PROC [g: Graphics, dash: Dash];
set dash pattern for stroking
CurrentDash:
PROC [g: Graphics]
RETURNS [Dash];
return current dash pattern
SetFlat:
PROC [g: Graphics, flatness:
REAL];
set flatness tolerance
CurrentFlat:
PROC [g: Graphics]
RETURNS [
REAL];
return current flatness
SetGray:
PROC [g: Graphics, gray:
REAL];
set color to gray value from 0 (black) to 1 (white)
CurrentGray:
PROC [g: Graphics]
RETURNS [
REAL];
return current gray
HSBColor:
TYPE ~
RECORD [hue, sat, brt:
REAL];
SetHSBColor:
PROC [g: Graphics, hsbColor: HSBColor];
set color given hue, saturation, brightness
CurrentHSBColor:
PROC [g: Graphics]
RETURNS [HSBColor];
return current color hue, saturation, brightness
RGBColor:
TYPE ~
RECORD [red, green, blue:
REAL];
SetRGBColor:
PROC [g: Graphics, rgbColor: RGBColor];
set color given red, green, blue
CurrentRGBColor:
PROC [g: Graphics]
RETURNS [RGBColor];
return current color red, green, blue
Screen:
TYPE ~
RECORD [freq:
REAL, angle:
REAL, proc:
PS.Any];
SetScreen:
PROC [g: Graphics, screen: Screen];
set halftone screen
CurrentScreen:
PROC [g: Graphics]
RETURNS [Screen];
return current halftone screen
Transfer:
TYPE ~
RECORD [proc:
PS.Any];
SetTransfer:
PROC [g: Graphics, transfer: Transfer];
set transfer function
CurrentTransfer:
PROC [g: Graphics]
RETURNS [Transfer];
return current transfer function
Coordinate system and matrix operators
IdentMatrix:
PROC [result: Matrix]
RETURNS [Matrix];
return an identity matrix
Translate:
PROC [t:
VEC, result: Matrix]
RETURNS [Matrix];
define translation by t
Scale:
PROC [s:
VEC, result: Matrix]
RETURNS [Matrix];
define scaling by s
Rotate:
PROC [angle:
REAL, result: Matrix]
RETURNS [Matrix];
define rotation by angle degrees
ConcatMatrix:
PROC [matrix1, matrix2: Matrix, result: Matrix]
RETURNS [Matrix];
form product of two matrices
InvertMatrix:
PROC [matrix: Matrix, result: Matrix]
RETURNS [Matrix];
form inverse of a matrix
Transform:
PROC [p:
VEC, matrix: Matrix]
RETURNS [
VEC];
transform point p by matrix
DTransform:
PROC [d:
VEC, matrix: Matrix]
RETURNS [
VEC];
transform distance d by matrix
ITransform:
PROC [p:
VEC, matrix: Matrix]
RETURNS [
VEC];
inverse transform point p by matrix
IDTransform:
PROC [d:
VEC, matrix: Matrix]
RETURNS [
VEC];
inverse transform distance d by matrix
DefaultMatrix:
PROC [g: Graphics, result: Matrix]
RETURNS [Matrix];
return device default matrix
CurrentMatrix:
PROC [g: Graphics, result: Matrix]
RETURNS [Matrix];
return CTM
SetMatrix:
PROC [g: Graphics, matrix: Matrix];
replace CTM by matrix
Concat:
PROC [g: Graphics, matrix: Matrix];
replace CTM by matrix x CTM
Path construction operators
NewPath:
PROC [g: Graphics];
initialize current path to be empty
CurrentPoint:
PROC [g: Graphics]
RETURNS [
VEC];
return current point coordinates
MoveTo:
PROC [g: Graphics, p:
VEC];
set current point to p
RMoveTo:
PROC [g: Graphics, d:
VEC];
relative MoveTo
LineTo:
PROC [g: Graphics, p:
VEC];
append straight line to p
RLineTo:
PROC [g: Graphics, d:
VEC];
relative LineTo
ArcSense:
TYPE ~ {counterclockwise, clockwise};
Arc:
PROC [g: Graphics, p:
VEC, r:
REAL, ang1, ang2:
REAL, sense: ArcSense];
append counterclockwise or clockwise arc
ArcTo:
PROC [g: Graphics, p1, p2:
VEC, r:
REAL]
RETURNS [t1, t2:
VEC];
append tangent arc
CurveTo:
PROC [g: Graphics, p1, p2, p3:
VEC];
append Bezier cubic section
RCurveTo:
PROC [g: Graphics, d1, d2, d3:
VEC];
relative CurveTo
ClosePath:
PROC [g: Graphics];
connect subpath back to its starting point
FlattenPath:
PROC [g: Graphics];
convert curves to sequences of straight lines
ReversePath:
PROC [g: Graphics];
reverse direction of current path
StrokePath:
PROC [g: Graphics];
compute outline of stroked path
CharPath:
PROC [g: Graphics, string:
PS.String, bool:
BOOL];
append character outline to current path
ClipPath:
PROC [g: Graphics];
set current path to clipping path
PathBBox:
PROC [g: Graphics]
RETURNS [Box];
return bounding box of current path
MoveAction: TYPE ~ PROC [p: VEC];
LineAction: TYPE ~ PROC [p: VEC];
CurveAction: TYPE ~ PROC [p1, p2, p3: VEC];
CloseAction:
TYPE ~
PROC [];
PathForAll:
PROC [g: Graphics, move: MoveAction, line: LineAction, curve: CurveAction, close: CloseAction];
enumerate current path
InitClip:
PROC [g: Graphics];
set clip path to device default
Clip:
PROC [g: Graphics, eo:
BOOL ←
FALSE];
establish new clipping path
Painting operators
ErasePage:
PROC [g: Graphics];
paint current page white
Fill:
PROC [g: Graphics, eo:
BOOL ←
FALSE];
fill current path with current color
Stroke:
PROC [g: Graphics];
draw line along current path
Image:
PROC [g: Graphics, width, height:
INT, bitsPerSample:
INT, matrix: Matrix,
stringProc:
PROC
RETURNS [
PS.String]];
render sampled image onto current page
ImageMask:
PROC [g: Graphics, width, height:
INT, invert:
BOOL, matrix: Matrix,
stringProc:
PROC
RETURNS [
PS.String]];
render mask onto current page
Character and font operators
MakeFont:
PROC [font:
PS.Dict, matrix: Matrix]
RETURNS [
PS.Dict];
transform a font
StringWidth:
PROC [g: Graphics, string:
PS.String]
RETURNS [
VEC];
width of string in current font
DefineFont:
PROC [g: Graphics, key:
PS.Any, font:
PS.Dict]
RETURNS [
PS.Dict];
register a font dictionary
FindFont:
PROC [g: Graphics, key:
PS.Any]
RETURNS [
PS.Dict];
return font specified by key
SetFont:
PROC [g: Graphics, font:
PS.Dict];
set font dictionary
CurrentFont:
PROC [g: Graphics]
RETURNS [
PS.Dict];
return current font dictionary
Show:
PROC [g: Graphics, string:
PS.String];
print characters of string on page
AShow:
PROC [g: Graphics, a:
VEC, string:
PS.String];
add a to width of each char while showing string
WidthShow:
PROC [g: Graphics, c:
VEC, char:
CHAR, string:
PS.String];
add c to width of specified char while showing string
AWidthShow:
PROC [g: Graphics, c:
VEC, char:
CHAR, a:
VEC, string:
PS.String];
combined effects of ashow and widthshow
KShow:
PROC [g: Graphics, action:
PROC [
CHAR,
CHAR], string:
PS.String];
execute action between characters shown
Font cache operators
CacheInfo:
TYPE ~
RECORD [bsize, bmax, msize, mmax, csize, cmax, blimit:
INT];
CacheStatus:
PROC [g: Graphics]
RETURNS [CacheInfo];
return cache status and parameters
SetCacheDevice:
PROC [g: Graphics, w:
VEC, box: Box];
declare cached character metrics
SetCharWidth:
PROC [g: Graphics, w:
VEC];
declare uncached character metrics
SetCacheLimit:
PROC [g: Graphics, blimit:
INT];
set max bytes in cached character