CII.mesa
Copyright Ó 1993 by Xerox Corporation. All rights reserved.
Michael Plass, October 28, 1993 12:12 pm PDT
DIRECTORY
CStrings USING [CString],
ImagerClipper USING [Clipper],
ImagerDevice USING [EasyMetrics],
ImagerFont USING [XChar],
ImagerError USING [ErrorCode],
ImagerBox USING [Rectangle],
Scaled USING [Value],
Vector2 USING [VEC];
CII: DEFINITIONS
= BEGIN
CProc: TYPE = RECORD [CARD];
CString: TYPE = CStrings.CString;
ScaledValue: TYPE = RECORD [Scaled.Value];
RES: TYPE = MACHINE DEPENDENT {ok(0), base(1000), last(1255)};
RESFromErrorCode: SAFE PROC [code: ImagerError.ErrorCode] RETURNS [RES] = CHECKED INLINE {
RETURN [IF code = $ok THEN $ok ELSE VAL[ORD[RES.base] + ORD[code]]]
};
Handle: TYPE = REF ObjectRep;
Rectangle: TYPE = ImagerBox.Rectangle;
VEC: TYPE = Vector2.VEC;
Color: TYPE = REF ColorRep;
ColorRep: TYPE;
ColorOperator: TYPE = REF ColorOperatorRep;
ColorOperatorRep: TYPE;
Matrix: TYPE = ARRAY [0..6) OF REAL;
SetMatrix: SetMatrixProc;
SetMatrixProc: TYPE = PROC [h: Handle, matrix: POINTER TO Matrix] RETURNS [RES];
GetMatrix: GetMatrixProc;
GetMatrixProc: TYPE = PROC [h: Handle, matrixResult: POINTER TO Matrix] RETURNS [RES];
SetInitialMatrix: SetInitialMatrixProc;
SetInitialMatrixProc: TYPE = PROC [h: Handle, matrix: POINTER TO Matrix] RETURNS [RES];
GetInitialMatrix: GetInitialMatrixProc;
GetInitialMatrixProc: TYPE = PROC [h: Handle, matrixResult: POINTER TO Matrix] RETURNS [RES];
SampleRange: TYPE = RECORD [sWhite: REAL, sBlack: REAL];
GrayColorOperatorParameters: TYPE = RECORD [
sWhite: REAL,
sBlack: REAL,
sampleTableSize: CARD,
sampleTable: POINTER TO ARRAY [0..0) OF REAL
];
MakeGrayColorOperator: MakeGrayColorOperatorProc;
MakeGrayColorOperatorProc: TYPE = PROC [h: Handle, sampleRange: POINTER TO SampleRange, sampleTableSize: CARD, sampleTable: POINTER TO ARRAY [0..0) OF REAL, colorOperatorResult: POINTER TO ColorOperator] RETURNS [RES];
RGBColorOperatorParameters: TYPE = RECORD [
sWhite: REAL,
sBlack: REAL,
sampleTableSize: CARD,
sampleTableR: POINTER TO ARRAY [0..0) OF REAL,
sampleTableG: POINTER TO ARRAY [0..0) OF REAL,
sampleTableB: POINTER TO ARRAY [0..0) OF REAL
];
MakeRGBColorOperator: MakeRGBColorOperatorProc;
MakeRGBColorOperatorProc: TYPE = PROC [h: Handle, sampleRange: POINTER TO SampleRange, sampleTableSize: CARD, sampleTableR: POINTER TO ARRAY [0..0) OF REAL, sampleTableG: POINTER TO ARRAY [0..0) OF REAL, sampleTableB: POINTER TO ARRAY [0..0) OF REAL, colorOperatorResult: POINTER TO ColorOperator] RETURNS [RES];
CMYKColorOperatorParameters: TYPE = RECORD [
sWhite: REAL,
sBlack: REAL,
sampleTableSize: CARD,
sampleTableC: POINTER TO ARRAY [0..0) OF REAL,
sampleTableM: POINTER TO ARRAY [0..0) OF REAL,
sampleTableY: POINTER TO ARRAY [0..0) OF REAL,
sampleTableK: POINTER TO ARRAY [0..0) OF REAL
];
MakeCMYKColorOperator: MakeCMYKColorOperatorProc;
MakeCMYKColorOperatorProc: TYPE = PROC [h: Handle, sampleRange: POINTER TO SampleRange, sampleTableSize: CARD, sampleTableC: POINTER TO ARRAY [0..0) OF REAL, sampleTableM: POINTER TO ARRAY [0..0) OF REAL, sampleTableY: POINTER TO ARRAY [0..0) OF REAL, sampleTableK: POINTER TO ARRAY [0..0) OF REAL, colorOperatorResult: POINTER TO ColorOperator] RETURNS [RES];
HighlightColorOperatorParameters: TYPE = RECORD [
sWhite: REAL,
sBlack: REAL,
baseColor: Color,
highlightColor: Color,
sampleTableSize: CARD,
sampleTableBaseColor: POINTER TO ARRAY [0..0) OF REAL,
sampleTableHighlightColor: POINTER TO ARRAY [0..0) OF REAL
];
MakeHighlightColorOperator: MakeHighlightColorOperatorProc;
MakeHighlightColorOperatorProc: TYPE = PROC [h: Handle, sampleRange: POINTER TO SampleRange, baseColor: Color, highlightColor: Color, sampleTableSize: CARD, sampleTableBaseColor: POINTER TO ARRAY [0..0) OF REAL, sampleTableHighlightColor: POINTER TO ARRAY [0..0) OF REAL, colorOperatorResult: POINTER TO ColorOperator] RETURNS [RES];
MakeColor: MakeColorProc;
MakeColorProc: TYPE = PROC [h: Handle, colorOperator: ColorOperator, samplesPerPixel: CARD, pixel: POINTER TO ARRAY [0..0) OF REAL, colorResult: POINTER TO Color] RETURNS [RES];
MakeSampledBlack: MakeSampledBlackProc;
MakeSampledBlackProc: TYPE = PROC [h: Handle, bitmap: POINTER TO RasterRep, pixelToDevice: POINTER TO Matrix, clear: BOOL, colorResult: POINTER TO Color] RETURNS [RES];
SetColor: SetColorProc;
SetColorProc: TYPE = PROC [h: Handle, color: Color] RETURNS [RES];
SetGray: SetGrayProc;
SetGrayProc: TYPE = PROC [h: Handle, gray: POINTER TO REAL] RETURNS [RES];
SetRGB: SetRGBProc;
SetRGBProc: TYPE = PROC [h: Handle, rgb: POINTER TO ARRAY [0..3) OF REAL] RETURNS [RES];
SetHSV: SetHSVProc;
SetHSVProc: TYPE = PROC [h: Handle, hsv: POINTER TO ARRAY [0..3) OF REAL] RETURNS [RES];
SetCMYK: SetCMYKProc;
SetCMYKProc: TYPE = PROC [h: Handle, cmyk: POINTER TO ARRAY [0..4) OF REAL] RETURNS [RES];
GetColor: GetColorProc;
GetColorProc: TYPE = PROC [h: Handle, colorResult: POINTER TO Color] RETURNS [RES];
LookupTable: TYPE = REF LookupTableRep;
LookupTableRep: TYPE;
MakeLookupTable: MakeLookupTableProc;
MakeLookupTableProc: TYPE = PROC [h: Handle, tableSize: CARD, table: POINTER TO ARRAY [0..0) OF REAL, lookupTableResult: POINTER TO LookupTable] RETURNS [RES];
DestroyLookupTable: DestroyLookupTableProc;
DestroyLookupTableProc: TYPE = PROC [h: Handle, lookupTable: LookupTable] RETURNS [RES];
ColorLookupTableType: TYPE = MACHINE DEPENDENT { redTransfer, greenTransfer, blueTransfer, grayTransfer, blackGeneration, undercolorRemoval };
SetColorLookupTable: SetColorLookupTableProc;
SetColorLookupTableProc: TYPE = PROC [h: Handle, which: ColorLookupTableType, lookupTable: LookupTable] RETURNS [RES];
GetColorLookupTable: GetColorLookupTableProc;
GetColorLookupTableProc: TYPE = PROC [h: Handle, which: ColorLookupTableType, lookupTableResult: POINTER TO LookupTable] RETURNS [RES];
FillType: TYPE = MACHINE DEPENDENT { nonZero, eo };
PathGenerator: TYPE = POINTER TO PathGeneratorObjectRep;
PathGeneratorObjectRep: TYPE = RECORD [
data: POINTER,
proc: CProc
];
GeneratePathProc: TYPE = PROC [self: PathGenerator, sink: PathSink] RETURNS [RES];
PathSink: TYPE = POINTER TO PathSinkObjectRep;
PathSinkObjectRep: TYPE = RECORD [
data: POINTER,
moveTo: CProc,
lineTo: CProc,
curveTo: CProc,
conicTo: CProc
];
PathGeneratorProc: TYPE = PROC [self: PathGenerator, p: PathSink] RETURNS [RES];
MoveToProc: TYPE = PROC [sink: PathSink, p: POINTER TO <<READONLY>> VEC] RETURNS [RES];
LineToProc: TYPE = PROC [sink: PathSink, p: POINTER TO <<READONLY>> VEC] RETURNS [RES];
CurveToProc: TYPE = PROC [sink: PathSink, p: POINTER TO <<READONLY>> ARRAY[0..3) OF VEC] RETURNS [RES];
ConicControlRep: TYPE = RECORD [
p1, p2: VEC,
s: REAL
];
ConicToProc: TYPE = PROC [sink: PathSink, c: POINTER TO <<READONLY>> ConicControlRep] RETURNS [RES];
Clip: ClipProc;
ClipProc: TYPE = PROC [h: Handle, pathGenerator: PathGenerator, fillType: FillType] RETURNS [RES];
Clipper: TYPE = ImagerClipper.Clipper;
GetClipper: GetClipperProc;
GetClipperProc: TYPE = PROC [h: Handle, clipperResult: POINTER TO Clipper] RETURNS [RES];
SetClipper: SetClipperProc;
SetClipperProc: TYPE = PROC [h: Handle, clipper: Clipper] RETURNS [RES];
MaskFill: MaskFillProc;
MaskFillProc: TYPE = PROC [h: Handle, pathGenerator: PathGenerator, fillType: FillType] RETURNS [RES];
MaskRectangle: MaskRectangleProc;
MaskRectangleProc: TYPE = PROC [h: Handle, rect: POINTER TO <<READONLY>> Rectangle] RETURNS [RES];
CIIEndType: TYPE = MACHINE DEPENDENT {squareEnd, buttEnd, roundEnd, triangularEnd};
CIIJointType: TYPE = MACHINE DEPENDENT {miterJoint, bevelJoint, roundJoint, triangularJoint, noJoint, miterclipJoint, miterbevelJoint};
StrokeControlRep: TYPE = RECORD [
closed: BOOL,
end: CIIEndType,
joint: CIIJointType,
miterLimit: REAL,
strokeWidth: REAL,
dashCount: INT,
dashArray: POINTER TO ARRAY [0..0) OF REAL,
dashOffset: REAL,
dashCorrectLength: REAL,
strokeAdjust: BOOL,
thickening: VEC,
minThickness: VEC,
stamp: INT
];
MaskStroke: MaskStrokeProc;
MaskStrokeProc: TYPE = PROC [h: Handle, pathGenerator: PathGenerator, s: POINTER TO <<READONLY>> StrokeControlRep] RETURNS [RES];
VectorEndpoints: TYPE = RECORD [
p1, p2: VEC
];
MaskVector: MaskVectorProc;
MaskVectorProc: TYPE = PROC [h: Handle, endpoints: POINTER TO VectorEndpoints, s: POINTER TO <<READONLY>> StrokeControlRep] RETURNS [RES];
RasterRep: TYPE = MACHINE DEPENDENT RECORD [
sMinBox: INT,
fMinBox: INT,
sMaxBox: INT,
fMaxBox: INT,
bitsPerSample: CARDINAL,
bitsPerLine: CARDINAL,
basePointer: POINTER,
bitIndex: CARDINAL,
ref: REF
];
MaskBitmap: MaskBitmapProc;
MaskBitmapProc: TYPE = PROC [h: Handle, raster: POINTER TO <<READONLY>> RasterRep, background: Color] RETURNS [RES];
MaskDeviceTrapezoid: MaskDeviceTrapezoidProc;
MaskDeviceTrapezoidProc: TYPE = PROC [h: Handle, sMin, fMin, sMax, fMax: INT, f0, df0, f1, df1: ScaledValue] RETURNS [RES];
RunRep: TYPE = RECORD [fMin: INT, fSize: CARD];
LineRunsRep: TYPE = RECORD [numOfRuns: CARD, run: POINTER TO ARRAY [0..0) OF RunRep];
MaskRuns: MaskRunsProc;
MaskRunsProc: TYPE = PROC [h: Handle, sMin: INT, numOfLines: CARD, lineRuns: POINTER TO ARRAY [0..0) OF LineRunsRep] RETURNS [RES];
MaskProgram: TYPE = REF MaskProgramRep;
MaskProgramRep: TYPE;
MakeMaskProgram: MakeMaskProgramProc;
MakeMaskProgramProc: TYPE = PROC [h: Handle, codeVersion: INT, bigEndian: BOOL, codeString: CString, maskProgramResult: POINTER TO MaskProgram] RETURNS [RES];
MaskDeviceBoxes: MaskDeviceBoxesProc;
MaskDeviceBoxesProc: TYPE = PROC [h: Handle, sMin, fMin, sMax, fMax: INT, boxOrder: INT, maskProgram: MaskProgram, maskDataByteCount: INT, maskData: POINTER] RETURNS [RES];
BuildClipperBegin: BuildClipperBeginProc;
BuildClipperBeginProc: TYPE = PROC [h: Handle] RETURNS [RES];
BuildClipperEnd: BuildClipperEndProc;
BuildClipperEndProc: TYPE = PROC [h: Handle] RETURNS [RES];
Font: TYPE = REF FontRep;
FontRep: TYPE;
FindFont: FindFontProc;
FindFontProc: TYPE = PROC [h: Handle, fontName: CString, fontResult: POINTER TO Font] RETURNS [RES];
ModifyFont: ModifyFontProc;
ModifyFontProc: TYPE = PROC [h: Handle, font: Font, mp: POINTER TO <<READONLY>> Matrix, fontResult: POINTER TO Font] RETURNS [RES];
MakeFontAtom: ModifyFontProc;
XChar: TYPE = ImagerFont.XChar;
XChars: TYPE = RECORD [
SEQUENCE COMPUTED CARDINAL OF XChar
];
ShowArgs: TYPE = RECORD [
fontAtom: Font,
easyMetrics: ImagerDevice.EasyMetrics,
noImage: BOOL,
hardChar: CProc, -- a DoHardCharProc
hardMetrics: CProc, -- a DoHardMetricsProc
cp: VEC,
start: INT,
end: INT,
characters: POINTER TO XChars,
clientData: POINTER
];
Show: ShowProc;
ShowProc: TYPE = PROC [h: Handle, s: POINTER TO ShowArgs] RETURNS [RES];
DoHardChar: DoHardCharProc;
DoHardCharProc: TYPE = PROC [h: Handle, s: POINTER TO ShowArgs] RETURNS [RES];
MaskInfo: TYPE = RECORD [
fontAtom: Font,
charCode: XChar,
deltaX: ScaledValue,
deltaY: ScaledValue,
minX, minY, maxX, maxY: INT
];
DoHardMetrics: DoHardMetricsProc;
DoHardMetricsProc: TYPE = PROC [h: Handle, s: POINTER TO ShowArgs, maskInfo: POINTER TO MaskInfo] RETURNS [RES];
BufferedSeparationImage: BufferedSeparationImageProc;
BufferedSeparationImageProc: TYPE = PROC [h: Handle, buffers: POINTER TO ARRAY[0..0) OF POINTER TO RasterRep, samplesPerPixel: CARD, sMin, sMax: INT, colorOperator: ColorOperator, interpolate: BOOL] RETURNS [RES];
BufferedInterleavedImage: BufferedInterleavedImageProc;
BufferedInterleavedImageProc: TYPE = PROC [h: Handle, buffer: POINTER TO RasterRep, samplesPerPixel: CARD, sMin, sMax: INT, colorOperator: ColorOperator, interpolate: BOOL] RETURNS [RES];
ImageSourceReadProc: TYPE = PROC [self: ImageSource, buf: POINTER, nbytes: CARD, nbytesResult: POINTER TO CARD] RETURNS [RES];
ImageSourceDestroyProc: TYPE = PROC [self: ImageSource] RETURNS [RES];
ImageSource: TYPE = POINTER TO ImageSourceObjectRep;
ImageSourceObjectRep: TYPE = RECORD [
data: POINTER,
read: CProc,
destroy: CProc
];
StreamImage: StreamImageProc;
StreamImageProc: TYPE = PROC [h: Handle, sSize: CARD, fSize: CARD, bitsPerSample: CARD, samplesPerPixel: CARD, padMod: CARD, co: ColorOperator, interpolate: BOOL, source: ImageSource] RETURNS [RES];
MaskStreamBits: MaskStreamBitsProc;
MaskStreamBitsProc: TYPE = PROC [h: Handle, sSize: CARD, fSize: CARD, padMod: CARD, source: ImageSource, background: Color] RETURNS [RES];
ApplyCCITTFacsimileDecompressionFilter: ApplyCCITTFacsimileDecompressionFilterProc;
ApplyCCITTFacsimileDecompressionFilterProc: TYPE = PROC [h: Handle, input: ImageSource, k: INT, requireEOL: BOOL, padMod: CARD, sSize: CARD, fSize: CARD, endOfBlock: BOOL, blackIs1: BOOL, msbFirst: BOOL, damagedRowsBeforeError: INT, filteredResult: POINTER TO ImageSource] RETURNS [RES];
Destroy: DestroyProc;
DestroyProc: TYPE = PROC [h: Handle] RETURNS [RES];
RegisterCleanupObject: RegisterCleanupObjectProc;
UnRegisterCleanupObject: RegisterCleanupObjectProc;
RegisterCleanupObjectProc: TYPE = PROC [h: Handle, cleanupObject: CleanupObject] RETURNS [RES];
CleanupProc: TYPE = PROC [self: CleanupObject, h: Handle] RETURNS [RES];
CleanupObject: TYPE = POINTER TO CleanupObjectRep;
CleanupObjectRep: TYPE = RECORD [
data: POINTER,
Cleanup: CProc
];
DestroyColor: DestroyColorProc;
DestroyColorProc: TYPE = PROC [h: Handle, color: Color] RETURNS [RES];
DestroyColorOperator: DestroyColorOperatorProc;
DestroyColorOperatorProc: TYPE = PROC [h: Handle, colorOperator: ColorOperator] RETURNS [RES];
DestroyClipper: DestroyClipperProc;
DestroyClipperProc: TYPE = PROC [h: Handle, clipper: Clipper] RETURNS [RES];
DestroyMaskProgram: DestroyMaskProgramProc;
DestroyMaskProgramProc: TYPE = PROC [h: Handle, maskProgram: MaskProgram] RETURNS [RES];
DestroyFont: DestroyFontProc;
DestroyFontProc: TYPE = PROC [h: Handle, font: Font] RETURNS [RES];
Toner: TYPE = MACHINE DEPENDENT {black, cyan, magenta, yellow, white, red, green, blue, (255)};
HalftonePropertiesForSeparation: TYPE = RECORD [
type: CString,
toner: Toner,
maxSample: CARDINAL,
thresholds: RasterRep,
phase: NAT,
reserved: POINTER
];
HalftoneProperties: TYPE = REF HalftonePropertiesRep;
HalftonePropertiesRep: TYPE;
MakeHalftoneProperties: MakeHalftonePropertiesProc;
MakeHalftonePropertiesProc: TYPE = PROC [h: Handle, separationCount: INT, halftonePropertiesForSeparation: POINTER TO ARRAY [0..0) OF HalftonePropertiesForSeparation, halftonePropertiesResult: POINTER TO HalftoneProperties] RETURNS [RES];
SetHalftoneProperties: SetHalftonePropertiesProc;
SetHalftonePropertiesProc: TYPE = PROC [h: Handle, halftoneProperties: HalftoneProperties] RETURNS [RES];
GetHalftoneProperties: GetHalftonePropertiesProc;
GetHalftonePropertiesProc: TYPE = PROC [h: Handle, halftonePropertiesResult: POINTER TO HalftoneProperties] RETURNS [RES];
DestroyHalftoneProperties: DestroyHalftonePropertiesProc;
DestroyHalftonePropertiesProc: TYPE = PROC [h: Handle, halftoneProperties: HalftoneProperties] RETURNS [RES];
DefaultSetOutputBuffers: SetOutputBuffersProc;
SetOutputBuffersProc: TYPE = PROC [h: Handle, nBuffers: INT, outputBuffers: POINTER TO ARRAY [0..0) OF RasterRep] RETURNS [RES];
DefaultSetSeparation: SetSeparationProc;
SetSeparationProc: TYPE = PROC [h: Handle, toner: Toner] RETURNS [RES];
DefaultSetColorTable: SetColorTableProc;
SetColorTableProc: TYPE = PROC [h: Handle, name: CString, identification: CString, format: CString, tableBase: POINTER, tableByteLength: CARD, replacementHint: CARD, stampValueResult: POINTER TO CARD] RETURNS [RES];
DefaultSync: SyncProc;
SyncProc: TYPE = PROC [h: Handle, operationName: CString, format: CString, dataPointer: POINTER, dataByteLength: CARD] RETURNS [RES];
ObjectRep: TYPE = RECORD [
data: REF,
procs: SEQUENCE COMPUTED CARDINAL OF CProc
];
MakeHandle: PROC [
data: REF,
SetOutputBuffers: SetOutputBuffersProc ¬ DefaultSetOutputBuffers,
SetSeparation: SetSeparationProc ¬ DefaultSetSeparation,
SetColorTable: SetColorTableProc ¬ DefaultSetColorTable,
Sync: SyncProc ¬ DefaultSync
] RETURNS [Handle];
For this, data must be a CIIPrivate.State
END.