IPImagerBasic.mesa
Last changed by:
Doug Wyatt, April 9, 1983 2:33 pm
IPImagerBasic: DEFINITIONS
= BEGIN
Pair: TYPE = RECORD[x, y: REAL]; -- a pair of coordinates
Bezier: TYPE = RECORD[b0, b1, b2, b3: Pair]; -- Bezier control points for a cubic curve
StrokeEnds: TYPE = {butt, square, round}; -- endpoint types for strokes
Transformation: TYPE = REF TransformationRep;
TransformationRep: TYPE = RECORD[ -- a transformation matrix
a, b, c, d, e, f: REAL, -- matrix elements
code: CARDINAL ← 0 -- identifies special matrix forms
];
The form of the complete transformation matrix is:
a d 0
b e 0
c f 1
PixelArray: TYPE = REF PixelArrayRep;
PixelArrayRep: TYPE = RECORD[
xPixels, yPixels: INT, -- dimensions of the array, in pixels
maxSampleValue: INT, -- the range of sample values is [0..maxSampleValue]
samplesPerPixel: INT, -- number of samples for each pixel
samplesInterleaved: BOOL, -- are samples interleaved?
m: Transformation, -- transforms pixel coordinates to master coordinate system
samples: REF -- the samples (probably a large vector)
];
Color: TYPE = REF ColorRep;
ConstantColor: TYPE = REF ColorRep[constant];
SampledColor: TYPE = REF ColorRep[sampled];
ColorRep: TYPE = RECORD[ -- a color value
SELECT tag: * FROM
constant => [r, g, b: CARDINAL], -- red, green, blue
sampled => [
transparent: BOOL, -- are 0 samples white (false) or transparent (true)?
pa: PixelArray, -- the array of samples
m: Transformation, -- transforms from pa to device coordinates
colorMap: SEQUENCE length: NAT OF ConstantColor -- maps samples into colors
],
ENDCASE
];
Trajectory: TYPE = Segment;
Segment: TYPE = REF SegmentRep;
SegmentRep: TYPE = RECORD[ -- a segment of a trajectory
prev: Segment, -- the preceding trajectory
lp: Pair, -- the last point
simple: BOOL, -- TRUE if trajectory is all horizontal and vertical lines
variant: SELECT tag: * FROM
moveto => [], -- lp is the first point, prev=NIL
lineto => [], -- straight line from prev.lp to lp
curveto => [p1, p2: Pair], -- bezier curve: [prev.lp, p1, p2, lp]
ENDCASE
];
Outline: TYPE = REF OutlineRep;
OutlineRep: TYPE = RECORD[SEQUENCE length: NAT OF Trajectory];
END.