This interface provides the public data structures shared by clients and the Imager.
Last Edited by:
Crow, Plass, Wyatt, July 6, 1983 2:38 pm
Wyatt, September 30, 1983 2:11 pm
Plass, October 26, 1983 2:41 pm
DIRECTORY
Real USING [TrappingNaN],
Scaled USING [Value];
ImagerBasic: CEDAR DEFINITIONS
= BEGIN
Basic Definitions (Numbers and Shapes)
Pair: TYPE = RECORD [x, y: REAL];
IntPair: TYPE = RECORD [x, y: INTEGER];
Rectangle: TYPE = RECORD [x, y, w, h: REAL];
IntRectangle: TYPE = RECORD [x, y, w, h: INTEGER];
nullBox: IntRectangle = [FIRST[INTEGER], FIRST[INTEGER], FIRST[INTEGER], FIRST[INTEGER]];
Bezier: TYPE = RECORD [b0, b1, b2, b3: Pair]; -- Bezier control points for a cubic curve
nullREAL: REAL = Real.TrappingNaN;
DeviceCoordinate: TYPE ~ RECORD [s, f: INTEGER];
DeviceRectangle: TYPE ~ RECORD [sMin, fMin: INTEGER, sSize, fSize: NAT];
Transformations
TransformType: TYPE = {none, identity, rot90, rot180, rot270, mirrorX, mirrorY, mirror45Deg, mirror135Deg, hard};
Transformation:
TYPE =
RECORD [
-- a transformation matrix
a, b, c, d, e, f: REAL, -- matrix elements
type: TransformType -- identifies special matrix forms
];
The form of the complete transformation matrix is:
a d 0
b e 0
c f 1
Clipping
Visibility: TYPE = {visible, partlyVisible, invisible};
Paths
PathMapType:
TYPE =
PROC[
data: REF,
move: PROC[p: Pair],
line: PROC[p: Pair],
curve: PROC[p1, p2, p3: Pair],
conic: PROC[p1, p2: Pair, r: REAL]
];
Masks
StrokeEnd: TYPE = {nil, square, butt, round};
Colors
Color: TYPE = REF ColorRep;
ColorRep:
TYPE =
RECORD[
SELECT tag: *
FROM
constant => [x, y, Y: CARDINAL], -- CIE Chromaticity coordinates
sampled => [
transparent: BOOLEAN, -- are 0 samples white (false) or transparent (true)?
pa: PixelArray, -- the array of samples
m: Transformation, -- transforms from pa to device coordinates
colorOperator: ATOM -- maps samples into colors
],
special => [ref: REF],
ENDCASE
];
ConstantColor: TYPE = REF ColorRep[constant];
SampledColor: TYPE = REF ColorRep[sampled];
PixelArrays
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
m: Transformation, -- transformation to client space (see Interpress, section 4.6)
get:
PROC [
self: PixelArray,
buffer: PixelBuffer,
object implementation fills this with the requested number of samples.
nSamples:
NAT,
number of samples to put in buffer.
layer:
INT,
in the range [0..samplesPerPixel)
xStart, yStart: Scaled.Value,
position of first sample.
xDelta, yDelta: Scaled.Value
increment to get to successive samples.
],
data:
REF
ANY
for use by the get proc; some devices may discriminate on this REF to get at the representation directly, if they are able to recognize it.
];
PixelBuffer: TYPE = REF PixelBufferRep;
PixelBufferRep:
TYPE =
RECORD [
SEQUENCE maxLength: NAT OF CARDINAL
];
END.