/* cii.h
** Copyright (C) 1990, 1993 by Xerox Corporation. All rights reserved.
** MFP, October 28, 1993 12:48:42 pm PDT
**
** Version CII-93-10-28
**
** Caveats:
** Device creation procedures are not part of cii.h; see ciisetup.h.
**
** Changes since CII-93-07-01
** New methods:
** CII←MakeSampledBlack
** CII←ApplyCCITTFacsimileDecompressionFilter
** CII←SetSeparation
** CII←SetOutputBuffers
** CII←SetColorTable
** Revised:
** CII←StrokeControlRep now has provisions for dashed strokes.
**
** Changes since CII-93-08-11
** New methods:
** CII←MakeLookupTable
** CII←DestroyLookupTable
** CII←SetColorLookupTable
** CII←GetColorLookupTable
** CII←Sync
**
** Changes since CII-93-09-21
** The comments to GetMatrix and GetInitialMatrix were made more
** specific about the the result of GetMatrix on a newly-created
** handle.
**
** Changes since CII-93-09-28
** New methods:
** CII←RegisterCleanupObject
** CII←UnRegisterCleanupObject
** CII←SetInitialMatrix
**
*/
#ifndef cii←h
#define cii←h
/**********************************************************************
** CII←RES: TYPE **
** **
** Error Codes **
**********************************************************************/
typedef enum {
CII←RES←ok = 0,
CII←RES←bounds = 1001,
CII←RES←overflow = 1002,
CII←RES←zeroDivide = 1003,
CII←RES←nilFault = 1004,
CII←RES←insufficientMemory = 1005,
CII←RES←ioError = 1006,
CII←RES←timeout = 1007,
CII←RES←eof = 1008,
CII←RES←numericalInstability = 1009,
CII←RES←bug = 1010,
CII←RES←fileNotFound = 1020,
CII←RES←colorModelOperatorNotFound = 1021,
CII←RES←colorOperatorNotFound = 1022,
CII←RES←colorNotFound = 1023,
CII←RES←decompressorNotFound = 1024,
CII←RES←fontNotFound = 1025,
CII←RES←operatorNotFound = 1026,
CII←RES←resourceNotFound = 1027,
CII←RES←accessError = 1028,
CII←RES←syntax = 1040,
CII←RES←undefinedOperation = 1041,
CII←RES←invalidCompressedSequence = 1042,
CII←RES←malformedFont = 1043,
CII←RES←invalidEncoding = 1044,
CII←RES←invalidHeader = 1045,
CII←RES←invalidIdentifier = 1046,
CII←RES←invalidInstructionProperty = 1047,
CII←RES←invalidName = 1048,
CII←RES←invalidString = 1049,
CII←RES←invalidToner = 1050,
CII←RES←invalidVersion = 1051,
CII←RES←nullValue = 1060,
CII←RES←illegalAlternateMetrics = 1061,
CII←RES←illegalColor = 1062,
CII←RES←unknownSpecialColor = 1063,
CII←RES←unknownSignalType = 1064,
CII←RES←wrongShape = 1065,
CII←RES←wrongSize = 1066,
CII←RES←notCardinal = 1067,
CII←RES←notInteger = 1068,
CII←RES←notNumber = 1069,
CII←RES←wrongType = 1070,
CII←RES←noFont = 1071,
CII←RES←illegalArguments = 1072,
CII←RES←illegalTransformation = 1073,
CII←RES←illegalPixelMask = 1074,
CII←RES←illegalPropertyVector = 1075,
CII←RES←illegalRunVector = 1076,
CII←RES←undefinedProperty = 1077,
CII←RES←stackOverflow = 1080,
CII←RES←stackUnderflow = 1081,
CII←RES←saveRestoreMismatch = 1082,
CII←RES←markMismatch = 1083,
CII←RES←unmarkFailed = 1084,
CII←RES←invalidOperationSequence = 1085,
CII←RES←obsoleteConstruct = 1100,
CII←RES←unsupportedColorOperator = 1101,
CII←RES←notImplemented = 1102,
CII←RES←unimplemented = 1103,
CII←RES←squareEndOnStrokeOfZeroLength = 1120,
CII←RES←unableToProperlyAdjustMaskPositions = 1121,
CII←RES←noSubstituteColor = 1122,
CII←RES←fontSubstitution = 1123,
CII←RES←appearance = 1124,
CII←RES←error = 1140,
CII←RES←copySensitive = 1160
} CII←RES;
/**********************************************************************
** CII←Handle: TYPE **
** **
** This is the primary object for the imaging operations; most of **
** this interface is concerned with the methods belonging to this **
** kind of object. **
**********************************************************************/
typedef struct CII←ObjectRep * CII←Handle;
/**********************************************************************
** CII←Destroy: METHOD **
** **
** Should be called exactly once on each CII←Handle created. **
** Prior to handle destruction, each of the registered **
** CleanupObjects is notified - see the RegisterCleanupObject **
** method for details. **
**********************************************************************/
#define CII←Destroy(h) \
(((h)->Destroy)(h))
typedef CII←RES
PROC←CII←Destroy(CII←Handle h);
/**********************************************************************
** CII←Boolean: TYPE **
** **
** A Boolean: 0 => FALSE, 1 => TRUE **
**********************************************************************/
typedef int CII←Boolean;
/**********************************************************************
** CII←Scaled: TYPE **
** **
** A fixed point number, scaled by 2**16 **
**********************************************************************/
typedef long int CII←Scaled;
/**********************************************************************
** CII←RectangleRep: TYPE **
** **
** Explicit representation of a rectangle **
** In client coordinates. **
** (x,y) is one corner. **
** w is the width, in the x direction. **
** h is the height, in the y direction. **
** w and/or h may be negative. **
**********************************************************************/
typedef struct CII←RectangleRep {float x, y, w, h;} CII←RectangleRep;
/**********************************************************************
** CII←VectorRep: TYPE **
** **
** Explicit representation of a point or vector **
** In client coordinates. **
**********************************************************************/
typedef struct CII←VectorRep {float x, y;} CII←VectorRep;
/**********************************************************************
** CII←Color: TYPE **
** **
** Represents a color. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←Color;
/**********************************************************************
** CII←DestroyColor: METHOD **
** **
** Should be called exactly once for each CII←Color returned to **
** the client, after after which the client should not use the **
** object again. The handle must be the same handle used to **
** create the CII←Color. **
**********************************************************************/
#define CII←DestroyColor(h, color) \
(((h)->DestroyColor)(h, color))
typedef CII←RES
PROC←CII←DestroyColor(
CII←Handle h,
CII←Color color
);
/**********************************************************************
** CII←ColorOperator: TYPE **
** **
** Represents a color operator, which maps pixel values (tuples of **
** numbers) into colors. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←ColorOperator;
/**********************************************************************
** CII←DestroyColorOperator: METHOD **
** **
** Should be called exactly once for each CII←ColorOperator **
** returned to the client, after after which the client should not **
** use the object again. The handle must be the same handle used **
** to create the CII←ColorOperator. **
**********************************************************************/
#define CII←DestroyColorOperator(h, colorOperator) \
(((h)->DestroyColorOperator)(h, colorOperator))
typedef CII←RES
PROC←CII←DestroyColorOperator(
CII←Handle h,
CII←ColorOperator colorOperator
);
/**********************************************************************
** CII←SampleRange: TYPE **
** **
** Used as a parameter to the color operator creation procs, **
** declares the interval over which the signal values may range, **
** and what the sense is. The signal values are the result of the **
** samples after being processed through the lookup tables, if any. **
**********************************************************************/
typedef struct CII←SampleRange {
float sWhite; /* input value corresponding to white */
float sBlack; /* input value for max density */
} CII←SampleRange;
/**********************************************************************
** CII←Clipper: TYPE **
** **
** Represents a clipping region. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←Clipper;
/**********************************************************************
** CII←DestroyClipper: METHOD **
** **
** Should be called exactly once for each CII←Clipper returned to **
** the client, after after which the client should not use the **
** object again. The handle must be the same handle used to **
** create the CII←Clipper. **
**********************************************************************/
#define CII←DestroyClipper(h, clipper) \
(((h)->DestroyClipper)(h, clipper))
typedef CII←RES
PROC←CII←DestroyClipper(
CII←Handle h,
CII←Clipper clipper
);
/**********************************************************************
** CII←Font: TYPE **
** **
** Represents a font. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←Font;
/**********************************************************************
** CII←DestroyFont: METHOD **
** **
** Should be called exactly once for each CII←Font returned to the **
** client, after after which the client should not use the object **
** again. The handle must be the same handle used to create the **
** CII←Font. **
**********************************************************************/
#define CII←DestroyFont(h, font) \
(((h)->DestroyFont)(h, font))
typedef CII←RES
PROC←CII←DestroyFont(
CII←Handle h,
CII←Font font
);
/**********************************************************************
** CII←FillType: TYPE **
** **
** Specifies the fill rule. **
**********************************************************************/
typedef enum {
CII←NONZERO←FILL, /* Use non-zero winding-number fill rule */
CII←EO←FILL /* Use even/odd winding-number fill rule */
} CII←FillType;
/**********************************************************************
** CII←RasterRep: TYPE **
** **
** Describes the layout of a raster in memory **
**********************************************************************/
typedef struct CII←RasterRep {
int sMinBox; /* box.min.s */
int fMinBox; /* box.min.f */
int sMaxBox; /* box.max.s */
int fMaxBox; /* box.max.f */
unsigned bitsPerSample; /* number of bits per sample */
unsigned bitsPerLine; /* number of bits per scan line */
long* basePointer; /* word pointer to data area */
unsigned bitIndex; /* index of first bit of data */
void* ref; /* for retaining collectible storage */
} CII←RasterRep;
/**********************************************************************
** CII←SetMatrix: METHOD **
** **
** Sets the client-to-device transformation. **
**********************************************************************/
#define CII←SetMatrix(h, matrix) \
(((h)->SetMatrix)(h, matrix))
typedef CII←RES
PROC←CII←SetMatrix(
CII←Handle h,
float matrix[]
);
/**********************************************************************
** CII←GetMatrix: METHOD **
** **
** Gets the client-to-device transformation. For a newly-created **
** handle, this will be the identity matrix. **
**********************************************************************/
#define CII←GetMatrix(h, matrixResult) \
(((h)->GetMatrix)(h, matrixResult))
typedef CII←RES
PROC←CII←GetMatrix(
CII←Handle h,
float matrixResult[]
);
/**********************************************************************
** CII←GetInitialMatrix: METHOD **
** **
** Gets the client-to-device transformation that maps the standard **
** initial page coordinate system to device space, taking into **
** account the resolution and scan direction of the device. Units **
** are inch/72, as for PostScript(TM). Note that this is not the **
** matrix that is current for a newly-created handle. **
**********************************************************************/
#define CII←GetInitialMatrix(h, matrixResult) \
(((h)->GetInitialMatrix)(h, matrixResult))
typedef CII←RES
PROC←CII←GetInitialMatrix(
CII←Handle h,
float matrixResult[]
);
/**********************************************************************
** CII←SetInitialMatrix: METHOD **
** **
** Sets the value to be returned by CII←GetInitialMatrix. This **
** may be used reflect changes to the effective resolution, **
** origin, and orientation. Note that the value of the initial **
** matrix does not have any effect on the CII imaging methods, but **
** rather is for the benefit of the client. **
**********************************************************************/
#define CII←SetInitialMatrix(h, matrix) \
(((h)->SetInitialMatrix)(h, matrix))
typedef CII←RES
PROC←CII←SetInitialMatrix(
CII←Handle h,
float matrix[]
);
/**********************************************************************
** CII←MakeGrayColorOperator: METHOD **
** **
** Makes a gray color operator **
**********************************************************************/
#define CII←MakeGrayColorOperator(a, b, c, d, e) \
(((a)->MakeGrayColorOperator)(a, b, c, d, e))
typedef CII←RES
PROC←CII←MakeGrayColorOperator(
CII←Handle h,
CII←SampleRange* sampleRange,
unsigned int sampleTableSize,
float sampleTable[],
CII←ColorOperator* colorOperatorResult
);
/**********************************************************************
** CII←MakeRGBColorOperator: METHOD **
** **
** Makes a RGB color operator **
**********************************************************************/
#define CII←MakeRGBColorOperator(a, b, c, d, e, f, g) \
(((a)->MakeRGBColorOperator)(a, b, c, d, e, f, g))
typedef CII←RES
PROC←CII←MakeRGBColorOperator(
CII←Handle h,
CII←SampleRange* sampleRange,
unsigned int sampleTableSize,
float sampleTableR[],
float sampleTableG[],
float sampleTableB[],
CII←ColorOperator* colorOperatorResult
);
/**********************************************************************
** CII←MakeCMYKColorOperator: METHOD **
** **
** Makes a CMYK color operator **
**********************************************************************/
#define CII←MakeCMYKColorOperator(a, b, c, d, e, f, g, h) \
(((a)->MakeCMYKColorOperator)(a, b, c, d, e, f, g, h))
typedef CII←RES
PROC←CII←MakeCMYKColorOperator(
CII←Handle h,
CII←SampleRange* sampleRange,
unsigned int sampleTableSize,
float sampleTableC[],
float sampleTableM[],
float sampleTableY[],
float sampleTableK[],
CII←ColorOperator* colorOperatorResult
);
/**********************************************************************
** CII←MakeHighlightColorOperator: METHOD **
** **
** Makes a Highlight color operator **
**********************************************************************/
#define CII←MakeHighlightColorOperator(a, b, c, d, e, f, g, h) \
(((a)->MakeHighlightColorOperator)(a, b, c, d, e, f, g, h))
typedef CII←RES
PROC←CII←MakeHighlightColorOperator(
CII←Handle h,
CII←SampleRange* sampleRange,
CII←Color baseColor,
CII←Color highlightColor,
unsigned int sampleTableSize,
float sampleTableBaseColor[],
float sampleTableHighlightColor[],
CII←ColorOperator* colorOperatorResult
);
/**********************************************************************
** CII←MakeColor: METHOD **
** **
** Creates a color by applying a color operator to a tuple of **
** sample values. The samplesPerPixel parameter is present as an **
** error check against the samplesPerPixel of the color operator **
**********************************************************************/
#define CII←MakeColor(h, colorOperator, samplesPerPixel, pixel, colorResult) \
(((h)->MakeColor)(h, colorOperator, samplesPerPixel, pixel, colorResult))
typedef CII←RES
PROC←CII←MakeColor(
CII←Handle h,
CII←ColorOperator colorOperator,
unsigned int samplesPerPixel,
float pixel[],
CII←Color* colorResult
);
/**********************************************************************
** CII←MakeSampledBlack: METHOD **
** **
** Creates a color that consists of a black-and-white or **
** black-and-clear pattern that is replicated as necessary to fill **
** the entire mask area. The provided raster must have one bit **
** per sample. The '1' bits specify black, and the '0' bits **
** specify white or clear, depending on the 'clear' parameter. **
** The transformation matrix maps the [s, f] coordinates of the **
** source bitmap to the [s, f] device coordinates; the current **
** matrix has no effect on the way the color is created. **
** Note: If the tiling effect is not needed, it is normally **
** preferable to use MaskBitmap (with a clipping region, if **
** required). **
**********************************************************************/
#define CII←MakeSampledBlack(h, bitmap, pixelToDevice, clear, colorResult) \
(((h)->MakeSampledBlack)(h, bitmap, pixelToDevice, clear, colorResult))
typedef CII←RES
PROC←CII←MakeSampledBlack(
CII←Handle h,
CII←RasterRep* bitmap,
float pixelToDevice[],
CII←Boolean clear,
CII←Color* colorResult
);
/**********************************************************************
** CII←SetColor: METHOD **
** **
** Sets the current color **
**********************************************************************/
#define CII←SetColor(h, color) \
(((h)->SetColor)(h, color))
typedef CII←RES
PROC←CII←SetColor(
CII←Handle h,
CII←Color color
);
/**********************************************************************
** CII←SetGray: METHOD **
** **
** Convenience proc to set gray; 0=>black, 1=>white **
**********************************************************************/
#define CII←SetGray(h, gray) \
(((h)->SetGray)(h, gray))
typedef CII←RES
PROC←CII←SetGray(
CII←Handle h,
float* gray
);
/**********************************************************************
** CII←SetRGB: METHOD **
** **
** convenience proc to set rgb color; 0=>black, 1=>full primary **
**********************************************************************/
#define CII←SetRGB(h, rgb) \
(((h)->SetRGB)(h, rgb))
typedef CII←RES
PROC←CII←SetRGB(
CII←Handle h,
float rgb[]
);
/**********************************************************************
** CII←SetHSV: METHOD **
** **
** convenience proc to set hsv color **
**********************************************************************/
#define CII←SetHSV(h, hsv) \
(((h)->SetHSV)(h, hsv))
typedef CII←RES
PROC←CII←SetHSV(
CII←Handle h,
float hsv[]
);
/**********************************************************************
** CII←SetCMYK: METHOD **
** **
** convenience proc to set cmyk color **
**********************************************************************/
#define CII←SetCMYK(h, cmyk) \
(((h)->SetCMYK)(h, cmyk))
typedef CII←RES
PROC←CII←SetCMYK(
CII←Handle h,
float cmyk[]
);
/**********************************************************************
** CII←GetColor: METHOD **
** **
** Gets the current color **
**********************************************************************/
#define CII←GetColor(h, colorResult) \
(((h)->GetColor)(h, colorResult))
typedef CII←RES
PROC←CII←GetColor(
CII←Handle h,
CII←Color* colorResult
);
/**********************************************************************
** CII←MaskRectangle: METHOD **
** **
** Masks a rectangle. **
** Uses the current matrix, color, and clipping region **
**********************************************************************/
#define CII←MaskRectangle(h, rect) \
(((h)->MaskRectangle)(h, rect))
typedef CII←RES
PROC←CII←MaskRectangle(
CII←Handle h,
CII←RectangleRep* rect
);
/**********************************************************************
** CII←PathSink: TYPE **
** **
** Pointer to private information to be supplied to MoveTo, **
** LineTo, CurveTo, and ConicTo. Normally the referent is **
** stack-allocated; so don't retain this pointer when the path **
** generator is done. **
**********************************************************************/
typedef struct CII←PathSinkObjectRep *CII←PathSink;
/**********************************************************************
** CII←PathGenerator: TYPE **
** **
** An abstract, procedural representation of a path **
**********************************************************************/
typedef struct CII←PathGeneratorObjectRep *CII←PathGenerator;
/**********************************************************************
** CII←GeneratePath: METHOD **
** **
** Invokes the PathGenerator into a PathSink **
**********************************************************************/
#define CII←GeneratePath(self, sink) \
(((self)->GeneratePath)(self, sink))
typedef CII←RES
PROC←CII←GeneratePath(
CII←PathGenerator self,
CII←PathSink sink
);
/**********************************************************************
** CII←MoveTo: METHOD **
** **
** begins a new trajectory at the point p; p0 := p **
**********************************************************************/
#define CII←MoveTo(sink, p) \
(((sink)->MoveTo)(sink, p))
typedef CII←RES
PROC←CII←MoveTo(
CII←PathSink sink,
CII←VectorRep* p
);
/**********************************************************************
** CII←LineTo: METHOD **
** **
** extends a straight line from p0 to p; p0 := p **
**********************************************************************/
#define CII←LineTo(sink, p) \
(((sink)->LineTo)(sink, p))
typedef CII←RES
PROC←CII←LineTo(
CII←PathSink sink,
CII←VectorRep* p
);
/**********************************************************************
** CII←CurveTo: METHOD **
** **
** extends a cubic curve from p0 (controlled by p[0], p[1]) to **
** p[2]; p0 := p[2] **
**********************************************************************/
#define CII←CurveTo(sink, p) \
(((sink)->CurveTo)(sink, p))
typedef CII←RES
PROC←CII←CurveTo(
CII←PathSink sink,
CII←VectorRep p[]
);
/**********************************************************************
** CII←ConicControlRep: TYPE **
** **
** Control parameters for a conic piece **
**********************************************************************/
typedef struct CII←ConicControlRep {
CII←VectorRep p1, p2;
float s;
} CII←ConicControlRep;
/**********************************************************************
** CII←ConicTo: METHOD **
** **
** extends a conic curve from p0 (controlled by p1, s) to p2; p0 **
** := p2 **
**********************************************************************/
#define CII←ConicTo(sink, c) \
(((sink)->ConicTo)(sink, c))
typedef CII←RES
PROC←CII←ConicTo(
CII←PathSink sink,
CII←ConicControlRep* c
);
/**********************************************************************
** CII←MaskFill: METHOD **
** **
** For filling an area specified by a path. **
**********************************************************************/
#define CII←MaskFill(h, pathGenerator, fillType) \
(((h)->MaskFill)(h, pathGenerator, fillType))
typedef CII←RES
PROC←CII←MaskFill(
CII←Handle h,
CII←PathGenerator pathGenerator,
CII←FillType fillType
);
/**********************************************************************
** CII←Clip: METHOD **
** **
** Replaces the current clipping region with its intersection with **
** the specified area **
**********************************************************************/
#define CII←Clip(h, pathGenerator, fillType) \
(((h)->Clip)(h, pathGenerator, fillType))
typedef CII←RES
PROC←CII←Clip(
CII←Handle h,
CII←PathGenerator pathGenerator,
CII←FillType fillType
);
/**********************************************************************
** CII←GetClipper: METHOD **
** **
** Gets the current clipping region. **
**********************************************************************/
#define CII←GetClipper(h, clipperResult) \
(((h)->GetClipper)(h, clipperResult))
typedef CII←RES
PROC←CII←GetClipper(
CII←Handle h,
CII←Clipper* clipperResult
);
/**********************************************************************
** CII←SetClipper: METHOD **
** **
** Sets the current clipping region. **
**********************************************************************/
#define CII←SetClipper(h, clipper) \
(((h)->SetClipper)(h, clipper))
typedef CII←RES
PROC←CII←SetClipper(
CII←Handle h,
CII←Clipper clipper
);
/**********************************************************************
** CII←BuildClipperBegin: METHOD **
** **
** The sequence of calls **
** CII←BuildClipperBegin(h); **
** CII←MaskXXX(h, ...); **
** ... **
** CII←BuildClipperEnd(h); **
** may be used to modify the clipping region by means of any of **
** the masking operations. The area marked by these mask **
** operations will be intersected with the active clipping region; **
** if it is desired to totally replace the clipper, do **
** CII←SetClipper(h, NIL); **
** prior to the above sequence. **
** The BuildClipperBegin / BuildClipperEnd sequence may not be **
** nested. **
**********************************************************************/
#define CII←BuildClipperBegin(h) \
(((h)->BuildClipperBegin)(h))
typedef CII←RES
PROC←CII←BuildClipperBegin(CII←Handle h);
/**********************************************************************
** CII←BuildClipperEnd: METHOD **
** **
** See CII←BuildClipperBegin, above. **
**********************************************************************/
#define CII←BuildClipperEnd(h) \
(((h)->BuildClipperEnd)(h))
typedef CII←RES
PROC←CII←BuildClipperEnd(CII←Handle h);
/**********************************************************************
** CII←StrokeType: TYPE **
** **
** For controlling closed strokes **
**********************************************************************/
typedef enum {CII←OPEN←STROKE, CII←CLOSED←STROKE} CII←StrokeType;
/**********************************************************************
** CII←EndType: TYPE **
** **
** End treatment for strokes **
**********************************************************************/
typedef enum {
CII←SQUARE←END, CII←BUTT←END, CII←ROUND←END,
CII←TRIANGULAR←END
} CII←EndType;
/**********************************************************************
** CII←JointType: TYPE **
** **
** Joint treatment for strokes **
**********************************************************************/
typedef enum {
CII←MITER←JOINT, CII←BEVEL←JOINT, CII←ROUND←JOINT,
CII←TRIANGULAR←JOINT, CII←NO←JOINT, CII←MITERCLIP←JOINT,
CII←MITERBEVEL←JOINT
} CII←JointType;
/**********************************************************************
** CII←StrokeControlRep: TYPE **
** **
** Collected stroke control. **
** For a normal (non-dashed) stroke, dashCount is 0. For a dashed **
** stroke, dashCount is the number of elements in the dash pattern **
** arry, dashArray. The dashArray elements are given in **
** user-space units, and are used cyclicly to indicate the lengths **
** of the on ond off sections of the stroke. These elements must **
** be non-negative, and not all zero. **
** The value of dashOffset indicates (in user-space units) where **
** to start the pattern. **
** If dashCorrectLength is positive, the dashArray values (and the **
** offset value) are effectively multiplied by the ratio **
** dashComputedLength/dashCorrectLength, **
** where dashComputedLength is the length of the path, in user **
** coordinates, as computed by the imager. This allows the client **
** to have control over the number and ending state of the dashes **
** without needing to use exactly the same length approximations **
** as the imager does. **
** The setting of strokeAdjust controls the way strokes are **
** rendered; use 0 (FALSE) to get inferior quality. **
** thickening is in device space and can be negative **
** (i.e. thinning is OK) **
** minThickness is in device space and should be non-negative. **
** A CII←StrokeControlRep should be initialized with the value **
** CII←INITIALSTROKECONTROL, the stamp value is used to help **
** ensure that the fields have all been properly set up. **
**********************************************************************/
typedef struct CII←StrokeControlRep {
CII←StrokeType strokeType;
CII←EndType end;
CII←JointType joint;
float miterLimit;
float strokeWidth;
int dashCount;
float* dashArray;
float dashOffset;
float dashCorrectLength;
CII←Boolean strokeAdjust;
CII←VectorRep thickening;
CII←VectorRep minThickness;
int stamp;
} CII←StrokeControlRep;
#define CII←INITIALSTROKECONTROL \
{0, CII←SQUARE←END, CII←MITER←JOINT, 0.0, 0.0, 0, (float*)0, \
0.0, 0.0, 1, {0.0, 0.0}, {0.0, 0.0}, 6218}
/**********************************************************************
** CII←MaskStroke: METHOD **
** **
** Masks a stroke **
**********************************************************************/
#define CII←MaskStroke(h, pathGenerator, s) \
(((h)->MaskStroke)(h, pathGenerator, s))
typedef CII←RES
PROC←CII←MaskStroke(
CII←Handle h,
CII←PathGenerator pathGenerator,
CII←StrokeControlRep* s
);
/**********************************************************************
** CII←MaskBitmap: METHOD **
** **
** Uses a bitmap as a mask. The raster provided should be 1 bit **
** per pixel. The current transformation matrix is used to **
** specify the mapping of the [s, f] source coordinate system to **
** the device coordinate system. The current color fills the **
** portions of the output image that correspond with the '1' bits. **
** In most cases, the background color will be NIL, which means **
** the '0' bits are clear, and this acts like a true masking **
** operation. However, if the background color is not NIL, it **
** will be used to fill the portions of the output image that **
** correspond with the '0' bits of the source. **
**********************************************************************/
#define CII←MaskBitmap(h, raster, background) \
(((h)->MaskBitmap)(h, raster, background))
typedef CII←RES
PROC←CII←MaskBitmap(
CII←Handle h,
CII←RasterRep* raster,
CII←Color background
);
/**********************************************************************
** CII←MaskDeviceTrapezoid: METHOD **
** **
** Masks a trapezoid, expressed in device coordinates. This **
** operation ignores the clipping region, as well as the clipper, **
** so it is up to the client to make sure that the trapezoid has **
** been properly transformed and clipped. The interpretation of **
** the parameters is as follows: **
** sMin, fMin, sMax, fMax: these express the bounding box of the **
** trapezoid; they are integers in device space and therefore **
** demarcate the boundaries of pixels. Only pixels inside **
** this box will be affected by the mask. **
** f0, df0: these express the starting location and slope of one **
** of the trapezoid's sides. These are both fixed-point **
** representations of rational numbers, with a scale factor of **
** 65536 (2**16). The value of f0 is the point at which the **
** side intersects the line of constant s value (sMin+0.5). **
** The corresponding values for successive lines are obtained **
** by adding df0 to the previous line's value. **
** f1, df1: these are like f0 and df0, but for the opposite side. **
** It is permitted for the two sides of the trapezoid to **
** cross, and for the sides to extend beyond the sides of the **
** bounding box; in the latter case the mask will be clipped **
** by the bounding box. The mask includes precisely those **
** pixel areas [s..s+1) X [f..f+1) such that **
** (sMin <= s < sMax) and (fMin <= f < fMax) and ( **
** (f0+(s-sMin)*df0) <= C*(f+0.5) < (f1+(s-sMin)*df1) or **
** (f1+(s-sMin)*df1) <= C*(f+0.5) < (f0+(s-sMin)*df0)), **
** where C is the scale factor (2**16). **
** As described thus far, the trapezoid is filled using a **
** point-sampled, pixel-center rule. To get the effect of **
** including any pixel touched by the trapezoid, consistent with **
** section 6.5.1 of the PLRM(2nd ed) the client may do the **
** following: **
** 1. If necessary, subdivide the original trapezoid to **
** eliminate crossing sides. This step may not be needed **
** if the source of the trapezoids is guaranteed never to **
** create such beasts. **
** 2. Use the floor function to calculate sMin and fMin, and **
** the ceiling function to calculate sMax and fMax, rather **
** than rounding. **
** 3. Sort the sides so that the f value for side 0 does not **
** exceed the f value for side 1; this makes sense by **
** virtue of step 1, which eliminated crossings. **
** 4. The calculation of df0 and df1 stay the same, since the **
** slope of the sides does not change when you offset them. **
** However, before the calculation of f0 as the **
** intersection of side 0 with the (sMin+0.5) line, offset **
** the side 0 line by (ds, df) = (-0.5, -0.5) if df0 < 0, **
** or by (0.5, -0.5) if df0 > 0 (if df0 = 0, both offsets **
** give the same answer). Similarly, offset side 1 by **
** (0.5, 0.5) if df1 < 0, or by (-0.5, 0.5) otherwise; **
** additionally, f1 should be decreased by 1 after **
** conversion to scaled form. **
**********************************************************************/
#define CII←MaskDeviceTrapezoid(h, sMin, fMin, sMax, fMax, f0, df0, f1, df1) \
(((h)->MaskDeviceTrapezoid)(h, sMin, fMin, sMax, fMax, f0, df0, f1, df1))
typedef CII←RES
PROC←CII←MaskDeviceTrapezoid(
CII←Handle h,
int sMin,
int fMin,
int sMax,
int fMax,
CII←Scaled f0,
CII←Scaled df0,
CII←Scaled f1,
CII←Scaled df1
);
/**********************************************************************
** CII←MaskProgram: TYPE **
** **
** Represents a 'compiled' version of a little program for **
** generating device masks. See MakeMaskProgram and **
** MaskDeviceBoxes, below. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←MaskProgram;
/**********************************************************************
** CII←DestroyMaskProgram: METHOD **
** **
** Should be called exactly once for each CII←MaskProgram returned **
** to the client, after after which the client should not use the **
** object again. The handle must be the same handle used to **
** create the CII←MaskProgram. **
**********************************************************************/
#define CII←DestroyMaskProgram(h, maskProgram) \
(((h)->DestroyMaskProgram)(h, maskProgram))
typedef CII←RES
PROC←CII←DestroyMaskProgram(
CII←Handle h,
CII←MaskProgram maskProgram
);
/**********************************************************************
** CII←MakeMaskProgram: METHOD **
** **
** Various CII clients may choose to represent mask data in **
** various forms, differing in detail, but all representing mask **
** data in device coordinates. To deal effectively with this **
** diversity, CII allows device-resolution mask data to be stored **
** in a form driven by the client, and accepts a little program **
** that knows how to decode the data into device-boxes. This **
** program is provided in the form of an ascii string, using the **
** little language we define here. The CII implementation may **
** work by (a) interpreting the string, by (b) recognizing special **
** cases, or even by (c) compiling it into a small **
** machine-language program. So that any such processing need be **
** done only once, the CII←MakeMaskProgram is a separate call from **
** CII←MaskDeviceBoxes. **
** The machine model for this little programming language is as **
** follows: **
** There is one accumulator and ten registers, each 32 bits wide. **
** Registers 0, 1, 2, and 3 have a special meaning, as follows: **
** 0 - sMin **
** 1 - fMin **
** 2 - sMax **
** 3 - fMax **
** These assigned registers are used to communicate the resulting **
** device boxes out of the program, via the E instruction; they **
** are also initialized to be the clipping box that is passed to **
** CII←MaskDeviceBoxes. The accumulator and the other registers **
** are initialized to zero. **
** For input to the program, there is (conceptually) a stream of **
** input bytes; for CII←MaskDeviceBoxes, this data comes from **
** consecutive memory locations. The value of bigEndian **
** determines the order with which the bytes are fetched. The **
** program should respect alignment - the data for F2 and F4 must **
** occur on 2-byte and 4-byte boundaries, respectively, and the **
** maskData pointer should be aligned on a word boundary. A **
** program that needs to deal with unaligned data must assemble **
** the bytes itself. **
** The instructions in the program string are each one or two **
** characters long. In the following description, k is a single **
** decimal digit, and denotes a register number, and A denotes the **
** accumulator. **
** { start loop **
** } end loop **
** Lk load var k into A **
** Sk store accum into var k **
** +k Add var k to A **
** -k Subtract var k from A **
** ↑k Shift (unsigned) A by (signed) count in register k **
** X exit loop if A is zero **
** ~ **
** F1 F2 F4 - fetch 1, 2, or 4 bytes into A, bump src pointer **
** W1 W2 - fetch 1 or 2 bytes, unsigned, into A, bump src **
** pointer **
** = clear A **
** 0 .. 7 - multiply A by 8 and add digit value. **
** E emit a box (in registers 0 to 3) **
** The program string is terminated by a null. No white space is **
** allowed. The storage for the program string may be re-used **
** after the MakeMaskProgram call is complete. **
** The shift command multiplies by 2**k, dropping any bits that **
** fall off either end of the word. **
** This is codeVersion 1; this value should be explicitly coded **
** with the program string, rather than symbolically, so that may **
** be updated when the program string is updated. **
** The program execution terminates when the end is reached, or **
** when a fetch is attempted and there is no further data. **
** As a simple example, the following program decodes a simple **
** run-length encoding of a monotone region, consisting of a **
** sequence of halfwords that give the start and length of the box **
** on each scanline, with the start relative to the initial fMin: **
** L1S4L2S5{L0-5XW2+4S1W2+1S3=1+0S2ES0} **
** Breaking this down, we get: **
** L1S4 save the initial fMin in register 4 **
** L2S5 save the initial sMax in register 5 **
** {L0-5X while sMin ~= sMaxInitial do **
** W2+4S1 fMin := fetch2()+fMinInitial **
** W2+1S3 fMax := fetch2()+fMin **
** =1+0S2 sMax := sMin+1 **
** E emit(sMin, fMin, sMax, fMax) **
** S0 sMin := sMin+1 **
** } end **
** **
** Notes: **
** Loops may be nested. **
** A simple conditional may be obtained by the idiom: **
** { <condition> X <action> =X} **
** The equal sign together with the digits 0 to 7 constitute an **
** idiom for loading octal constants. Nontrivial constants may **
** be loaded into registers outside of any loop. **
**********************************************************************/
#define CII←MakeMaskProgram(h, codeVersion, bigEndian, codeString, maskProgramResult) \
(((h)->MakeMaskProgram)(h, codeVersion, bigEndian, codeString, maskProgramResult))
typedef CII←RES
PROC←CII←MakeMaskProgram(
CII←Handle h,
int codeVersion,
CII←Boolean bigEndian,
char* codeString,
CII←MaskProgram* maskProgramResult
);
/**********************************************************************
** CII←MaskDeviceBoxes: METHOD **
** **
** See CII←MakeMaskProgram for details of maskProgram. This **
** operation bypasses the transformation and the clipper, leaving **
** these responsibilities to the client. **
** sMin, fMin, sMax, fMax specify the bounds of the mask. It is **
** an error to exceed these bounds. **
** boxOrder gives some information about the generated boxes: **
** 0 - nothing is known about the order or overlap of the boxes **
** 1 - boxes will be disjoint **
** 2 - boxes will be disjoint, nonempty, and for any two **
** consecutive boxes a and b, b.sMin >= a.sMax-1 **
**********************************************************************/
#define CII←MaskDeviceBoxes(a, b, c, d, e, f, g, h, i) \
(((a)->MaskDeviceBoxes)(a, b, c, d, e, f, g, h, i))
typedef CII←RES
PROC←CII←MaskDeviceBoxes(
CII←Handle h,
int sMin,
int fMin,
int sMax,
int fMax,
int boxOrder,
CII←MaskProgram maskProgram,
int maskDataByteCount,
void* maskData
);
/**********************************************************************
** CII←FindFont: METHOD **
** **
** Finds a font, given a name. **
** fontName is the Hierarchical name, slash delimited **
**********************************************************************/
#define CII←FindFont(h, fontName, fontResult) \
(((h)->FindFont)(h, fontName, fontResult))
typedef CII←RES
PROC←CII←FindFont(
CII←Handle h,
char* fontName,
CII←Font* fontResult
);
/**********************************************************************
** CII←ModifyFont: METHOD **
** **
** Makes a new font with a modified transformation, according to **
** the supplied matrix. **
**********************************************************************/
#define CII←ModifyFont(h, font, mp, fontResult) \
(((h)->ModifyFont)(h, font, mp, fontResult))
typedef CII←RES
PROC←CII←ModifyFont(
CII←Handle h,
CII←Font font,
float mp[],
CII←Font* fontResult
);
/**********************************************************************
** CII←MakeFontAtom: METHOD **
** **
** Differs from ModifyFont in that it ignores the translation **
** component of the supplied matrix **
**********************************************************************/
#define CII←MakeFontAtom(h, font, mp, fontResult) \
(((h)->MakeFontAtom)(h, font, mp, fontResult))
typedef CII←RES
PROC←CII←MakeFontAtom(
CII←Handle h,
CII←Font font,
float mp[],
CII←Font* fontResult
);
/**********************************************************************
** CII←EasyMetrics: TYPE **
** **
** all easy => never call hardMetrics proc **
** ordinary easy => call hardMetrics for spacing characters **
** none easy => call hardMetrics for each character **
**********************************************************************/
typedef enum {
CII←ALL←EASY←METRICS,
CII←ORDINARY←EASY←METRICS,
CII←NONE←EASY←METRICS
} CII←EasyMetrics;
/**********************************************************************
** CII←CharCode: TYPE **
** **
** A 32-bit character code **
**********************************************************************/
typedef unsigned long CII←CharCode;
/**********************************************************************
** CII←MaskInfo: TYPE **
** **
** Information about the character just masked, for benefit of **
** hardMetrics procedure **
**********************************************************************/
typedef struct CII←MaskInfo {
CII←Font fontAtom;
CII←CharCode charCode;
CII←Scaled deltaX; /* device coords, slow scan direction */
CII←Scaled deltaY; /* device coords, fast scan direction */
int minX, minY, maxX, maxY; /* bounding box, device coords */
} CII←MaskInfo;
/**********************************************************************
** CII←ShowArgs: TYPE **
** **
** The control block for Show. This is a read-write area; the cp **
** field and the start field get updated to reflect how much work **
** has been done. **
**********************************************************************/
typedef struct CII←ShowArgs {
CII←Font fontAtom; /* with transformation to device coordinates */
CII←EasyMetrics easyMetrics; /* controls metrics callback */
CII←Boolean noImage; /* TRUE turns off imaging */
CII←RES (*hardChar)(CII←Handle, struct CII←ShowArgs*);
CII←RES (*hardMetrics)(CII←Handle, struct CII←ShowArgs*, struct CII←MaskInfo*);
CII←VectorRep cp; /* gets updated; device coords */
int start; /* gets updated for callbacks */
int end; /* characters[end-1] is the last one */
CII←CharCode* characters; /* the character codes, one per word */
void* clientData; /* for benefit of callbacks */
} CII←ShowArgs;
/**********************************************************************
** CII←DoHardChar: METHOD **
** **
** May be used as the hardChar proc, or simply to show a single **
** character without using the mask cache. **
** N.B. ignores current transformation **
**********************************************************************/
#define CII←DoHardChar(h, s) \
(((h)->DoHardChar)(h, s))
typedef CII←RES
PROC←CII←DoHardChar(
CII←Handle h,
CII←ShowArgs* s
);
/**********************************************************************
** CII←DoHardMetrics: METHOD **
** **
** May be used as the hardMetrics proc to provide the default **
** behavior of adding the escapement to the current position. **
** N.B. ignores current transformation **
**********************************************************************/
#define CII←DoHardMetrics(h, s, maskInfo) \
(((h)->DoHardMetrics)(h, s, maskInfo))
typedef CII←RES
PROC←CII←DoHardMetrics(
CII←Handle h,
CII←ShowArgs* s,
CII←MaskInfo* maskInfo
);
/**********************************************************************
** CII←Show: METHOD **
** **
** General-purpose Show procedure. **
**********************************************************************/
#define CII←Show(h, s) \
(((h)->Show)(h, s))
typedef CII←RES
PROC←CII←Show(
CII←Handle h,
CII←ShowArgs* s
);
/**********************************************************************
** CII←BufferedSeparationImage: METHOD **
** **
** Draws a portion of the buffered image, using any data outside **
** of the sMin .. sMax range any interpolation or other **
** anti-aliasing that might be done. This range will typically **
** specify most of the image, with only a few scanlines of context **
** from adjacent bands. **
**********************************************************************/
#define CII←BufferedSeparationImage(a, b, c, d, e, f, g) \
(((a)->BufferedSeparationImage)(a, b, c, d, e, f, g))
typedef CII←RES
PROC←CII←BufferedSeparationImage(
CII←Handle h,
CII←RasterRep* buffers[],
unsigned int samplesPerPixel,
int sMin,
int sMax,
CII←ColorOperator colorOperator,
CII←Boolean interpolate
);
/**********************************************************************
** CII←BufferedInterleavedImage: METHOD **
** **
** Like BufferedSeparationImage, but the samples are interleaved **
** in the buffer. The fSize of the buffer is samplesPerPixel **
** times greater than the fSize of the image data. **
**********************************************************************/
#define CII←BufferedInterleavedImage(a, b, c, d, e, f, g) \
(((a)->BufferedInterleavedImage)(a, b, c, d, e, f, g))
typedef CII←RES
PROC←CII←BufferedInterleavedImage(
CII←Handle h,
CII←RasterRep* buffer,
unsigned int samplesPerPixel,
int sMin,
int sMax,
CII←ColorOperator colorOperator,
CII←Boolean interpolate
);
/**********************************************************************
** CII←ImageSource: TYPE **
** **
** This is a simple, abstract byte-stream object. **
**********************************************************************/
typedef struct CII←ImageSourceObjectRep * CII←ImageSource;
/**********************************************************************
** CII←ImageSourceRead: METHOD **
** **
** The read proc places the number of bytes read into **
** *nbytesResult. Zero bytes read indicates the end-of-stream. **
**********************************************************************/
#define CII←ImageSourceRead(self, buf, nbytes, nbytesResult) \
(((self)->ImageSourceRead)(self, buf, nbytes, nbytesResult))
typedef CII←RES
PROC←CII←ImageSourceRead(
CII←ImageSource self,
void* buf,
unsigned int nbytes,
unsigned int* nbytesResult
);
/**********************************************************************
** CII←ImageSourceDestroy: METHOD **
** **
** Asserts this image source is finished. **
**********************************************************************/
#define CII←ImageSourceDestroy(self) \
(((self)->ImageSourceDestroy)(self))
typedef CII←RES
PROC←CII←ImageSourceDestroy(CII←ImageSource self);
/**********************************************************************
** CII←StreamImage: METHOD **
** **
** Draws the image; takes care of breaking the image into **
** managable pieces. The image data is pulled from the source, **
** and is always interleaved, with each scanline starting at a bit **
** index that is zero modulo padMod. Use padMod = 1 for no **
** padding, padMod = 8 for byte-aligned scanlines, etc. **
**********************************************************************/
#define CII←StreamImage(a, b, c, d, e, f, g, h, i) \
(((a)->StreamImage)(a, b, c, d, e, f, g, h, i))
typedef CII←RES
PROC←CII←StreamImage(
CII←Handle h,
unsigned int sSize,
unsigned int fSize,
unsigned int bitsPerSample,
unsigned int samplesPerPixel,
unsigned int padMod,
CII←ColorOperator co,
CII←Boolean interpolate,
CII←ImageSource source
);
/**********************************************************************
** CII←MaskStreamBits: METHOD **
** **
** Stream-oriented analogue to MaskBitmap. Always 1 bit per **
** pixel. The padMod argument is as for StreamImage. **
**********************************************************************/
#define CII←MaskStreamBits(h, sSize, fSize, padMod, source, background) \
(((h)->MaskStreamBits)(h, sSize, fSize, padMod, source, background))
typedef CII←RES
PROC←CII←MaskStreamBits(
CII←Handle h,
unsigned int sSize,
unsigned int fSize,
unsigned int padMod,
CII←ImageSource source,
CII←Color background
);
/**********************************************************************
** CII←ApplyCCITTFacsimileDecompressionFilter: METHOD **
** **
** Makes a new ImageSource that works by decompressing the data **
** supplied by the input ImageSource according to the CCITT Group **
** 3 or Group 4 Facsimile compression standards. **
** **
** input: This supplies the (compressed) source data. **
** **
** k: If negative, source is pure 2-D (Group 4) encoding. **
** If zero, source is pure 1-D (Group 3) encoding. **
** If positive, a mixed 1-D / 2-D encoding is accepted. The **
** G3-specified limits on consecutive 2-D encoded scanlines is **
** not enforced. **
** **
** requireEOL: If true, the end-of-line bit pattern is **
** required at the end of each scan line. **
** **
** padMod: Additional zero bits are inserted at the end of each **
** output scanline for alignment purposes; normal values for **
** this would be 1 (no padding), 8 (pad to byte boundary), or **
** 32 (pad to a word boundary). If the filtered output is **
** destined for StreamImage or MaskStreamBits, this should **
** match up with the padMod of that call. **
** **
** sSize: The number of scan lines (rows) present in the image. **
** A value of 0 may be used if the scan count is not known. **
** **
** fSize: The number of source pixels in each scan line. (The **
** facsimile standards assume a value of 1728, so the ability **
** to specify this is a slight generalization of the **
** standards.) **
** **
** endOfBlock: If true, the data is expected to be terminated **
** with an end-of-block pattern, overriding the sSize **
** parameter. If false, the data stops at end-of-block or **
** after sSize scan lines, whichever comes first. **
** **
** blackIs1: If true, the black pixels in the source come out **
** as 1 bits in the filtered output; otherwise the black pixels **
** come out as 0 bits. (The facsimile standards are written in **
** terms of black and white pixels, and leave unspecified the **
** sense of the unencoded bits.) **
** **
** msbFirst: If true, the bits within each input byte of **
** compressed data are interpreted with the **
** most-significant-bit first; otherwise, interpret the bytes **
** lsb-first. **
** **
** damagedRowsBeforeError: If > 0, with requireEOL and k >= 0, **
** then tolerate this many damaged rows before generating an **
** error. **
** **
** filteredResult: This is for returning the ImageSource that **
** may be read to obtain the decompressed data. Note that the **
** decompression won't, in general, take place until this **
** source is read. (Issue: it should be specified what the **
** destroy proc of the filtered stream does - should it call **
** the destroy proc of the input stream or not?) **
** **
** There may be a performance advantage in using this **
** decompression filter with the MaskStreamBits or StreamImage **
** methods of this handle, because in such a case there is an **
** opportunity for the implementation to avoid the extra buffering **
** stage; this is the primary motivation for introducing this **
** decompression filter into the CII interface. **
**********************************************************************/
#define CII←ApplyCCITTFacsimileDecompressionFilter(a, b, c, d, e, f, g, h, i, j, k, l) \
(((a)->ApplyCCITTFacsimileDecompressionFilter)(a, b, c, d, e, f, g, h, i, j, k, l))
typedef CII←RES
PROC←CII←ApplyCCITTFacsimileDecompressionFilter(
CII←Handle h,
CII←ImageSource input,
int k,
CII←Boolean requireEOL,
unsigned int padMod,
unsigned int sSize,
unsigned int fSize,
CII←Boolean endOfBlock,
CII←Boolean blackIs1,
CII←Boolean msbFirst,
int damagedRowsBeforeError,
CII←ImageSource* filteredResult
);
/**********************************************************************
** CII←Toner: TYPE **
** **
** Specifies a toner color for several of the more **
** device-dependent methods **
**********************************************************************/
typedef enum {
CII←TONER←BLACK,
CII←TONER←CYAN,
CII←TONER←MAGENTA,
CII←TONER←YELLOW,
CII←TONER←WHITE,
CII←TONER←RED,
CII←TONER←GREEN,
CII←TONER←BLUE,
CII←TONER←CUSTOM,
CII←TONER←HIGHLIGHT
} CII←Toner;
/**********************************************************************
** CII←HalftonePropertiesForSeparation: TYPE **
** **
** Specifies the halftone dot growth for a given toner. For **
** samples samples normalized to the range [0..maxSample], a **
** printer pixel will be inked if sample > threshold; thus to **
** allow full range on the output, the threshold values should be **
** confined to the range [0..maxSample-1]. A value of 255 for **
** maxSample is strongly recommended. **
** Not all toner values will, in general, be meaningful for this **
** call; the ones you probably want to use are CII←TONER←BLACK, **
** CII←TONER←CYAN, CII←TONER←MAGENTA, and CII←TONER←YELLOW. **
**********************************************************************/
typedef struct CII←HalftonePropertiesForSeparation {
char* halftoneType; /* make this NIL for now */
CII←Toner toner; /* says which toner this is for */
unsigned maxSample; /* expected range of input samples */
CII←RasterRep thresholds; /* the threshold array */
unsigned phase; /* successive rows offset by this much */
void* reserved; /* reserved - must be NIL */
} CII←HalftonePropertiesForSeparation;
/**********************************************************************
** CII←HalftoneProperties: TYPE **
** **
** Represents the halftone properties for all toners. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←HalftoneProperties;
/**********************************************************************
** CII←MakeHalftoneProperties: METHOD **
** **
** Makes the imager-private representation of the halftone **
** properties. **
**********************************************************************/
#define CII←MakeHalftoneProperties(a, b, c, d) \
(((a)->MakeHalftoneProperties)(a, b, c, d))
typedef CII←RES
PROC←CII←MakeHalftoneProperties(
CII←Handle h,
int separationCount,
CII←HalftonePropertiesForSeparation halftonePropertiesForSeparation[],
CII←HalftoneProperties* halftonePropertiesResult
);
/**********************************************************************
** CII←SetHalftoneProperties: METHOD **
** **
** Sets the halftone properties for all toners. **
**********************************************************************/
#define CII←SetHalftoneProperties(h, halftoneProperties) \
(((h)->SetHalftoneProperties)(h, halftoneProperties))
typedef CII←RES
PROC←CII←SetHalftoneProperties(
CII←Handle h,
CII←HalftoneProperties halftoneProperties
);
/**********************************************************************
** CII←GetHalftoneProperties: METHOD **
** **
** Gets the imager-private representation of the halftone **
** properties. **
**********************************************************************/
#define CII←GetHalftoneProperties(h, halftonePropertiesResult) \
(((h)->GetHalftoneProperties)(h, halftonePropertiesResult))
typedef CII←RES
PROC←CII←GetHalftoneProperties(
CII←Handle h,
CII←HalftoneProperties* halftonePropertiesResult
);
/**********************************************************************
** CII←DestroyHalftoneProperties: METHOD **
** **
** Should be called exactly once for each CII←HalftoneProperties **
** returned to the client, after after which the client should not **
** use the object again. The handle must be the same handle used **
** to create the CII←HalftoneProperties. **
**********************************************************************/
#define CII←DestroyHalftoneProperties(h, halftoneProperties) \
(((h)->DestroyHalftoneProperties)(h, halftoneProperties))
typedef CII←RES
PROC←CII←DestroyHalftoneProperties(
CII←Handle h,
CII←HalftoneProperties halftoneProperties
);
/**********************************************************************
** CII←SetSeparation: METHOD **
** **
** For some devices, indicates which of the separations are to be **
** constructed. Do not confuse this with the PostScript **
** Separation color space. **
** CII←RES←notImplemented => the device cannot support **
** separations. **
** CII←RES←invalidToner => the device cannot handle the selected **
** toner. **
** The color should be re-set after this method is invoked. **
**********************************************************************/
#define CII←SetSeparation(h, toner) \
(((h)->SetSeparation)(h, toner))
typedef CII←RES
PROC←CII←SetSeparation(
CII←Handle h,
CII←Toner toner
);
/**********************************************************************
** CII←SetOutputBuffers: METHOD **
** **
** For some devices, redirects the output to a different **
** page/frame buffer. **
** CII←RES←notImplemented => the device does not support **
** changing the output buffer. **
** CII←RES←wrongShape => the device does not support changing **
** the dimensions of the output buffer. **
**********************************************************************/
#define CII←SetOutputBuffers(h, nBuffers, outputBuffers) \
(((h)->SetOutputBuffers)(h, nBuffers, outputBuffers))
typedef CII←RES
PROC←CII←SetOutputBuffers(
CII←Handle h,
int nBuffers,
CII←RasterRep outputBuffers[]
);
/**********************************************************************
** CII←SetColorTable: METHOD **
** **
** Indicates the (device-dependent) color conversion tables to **
** use. **
** **
** name: a null-terminated alphanumeric string naming the table; **
** this is for informational purposes, and will generally not **
** affect the behavior of the device. **
** **
** identification: a null-terminated ascii string with a longer **
** description of the table; this will generally not affect the **
** behavior of the device, but may be useful for diagnostic **
** purposes. For example, it may include a description of how **
** and when the table was created, and/or the name of the file **
** that the table was loaded from. **
** **
** format: a null-terminated string identifying the format of the **
** table. This is used by the device to determine whether the **
** color table data is appropriate for the device. Each device **
** will support only a limited number of formats (often 0 or **
** 1); you will have to look elsewhere to find out what the **
** supported formats are. As a special case, a null or **
** zero-length format causes the device to revert to its **
** initial color table. **
** **
** tableBase: A pointer to the color table data. This pointer **
** must remain valid until a new color table is set or the **
** handle is destroyed; furthermore, the client should not alter **
** the table without doing another SetColorTable. **
** **
** tableByteLength: The length, in bytes, of the color table data. **
** **
** replacementHint: May give the stamp from a previous call (see **
** stampValueResult, below). If the device can cache **
** information about color tables, this may be used as a hint **
** about which previous cache entry to replace. A value of 0 is **
** recommended here unless the client really has some good **
** information about the usage pattern of the color tables. **
** **
** stampValueResult: When SetColorTable is called for the first **
** time with a given table, this should point to a **
** zero-initialized word; the device stores a stamp in this word **
** that it may use on subsequent calls to speed the loading of **
** the color table data. The stamp should be presented to the **
** device only in the case that the color table data is the same **
** that was presented when the stamp was created. This may be **
** used, for example, to take advantage of hardware that allows **
** several tables to be in use at one time, without asking the **
** client to keep track of how many such tables are available. **
** **
** Return codes: **
** CII←RES←notImplemented => the device has ignored the table **
** because the format was not recognized. **
** CII←RES←malformedDataFile => the device has detected an **
** error in the color table data. The check for a valid **
** format is always done before this, so that if it is desired **
** to test whether a particular format is known by the device **
** before the actual table is read in, the client may pass a **
** tableByteLength of 0 and check the return code. In the **
** case of CII←RES←malformedDataFile, the color table should **
** be set again (with a null format, if necessary), to ensure **
** that a valid translation is in effect. **
** **
** The color should be re-set after the SetColorTable method is **
** invoked. **
**********************************************************************/
#define CII←SetColorTable(a, b, c, d, e, f, g, h) \
(((a)->SetColorTable)(a, b, c, d, e, f, g, h))
typedef CII←RES
PROC←CII←SetColorTable(
CII←Handle h,
char* name,
char* identification,
char* format,
void* tableBase,
unsigned int tableByteLength,
unsigned int replacementHint,
unsigned int* stampValueResult
);
/**********************************************************************
** CII←LookupTable: TYPE **
** **
** Represents, by means of equally-spaced samples, a function that **
** maps the real interval [0.0,1.0] into real values. **
** Details are opaque to the client. These objects are **
** heap-allocated, and so may be stored in persistent data **
** structures. **
**********************************************************************/
typedef struct {int opaque;} *CII←LookupTable;
/**********************************************************************
** CII←MakeLookupTable: METHOD **
** **
** The value of table[0] represents the value of the function at **
** 0.0, table[tableSize-1] represents the value of the function at **
** 1.0, and the remaining samples are equally-spaced in between **
** these two extremes. Intermediate values are filled in, if **
** necessary, by linear interpolation. These functions are used **
** to provide some rudimentary control of the generation of **
** device-dependent color. **
**********************************************************************/
#define CII←MakeLookupTable(h, tableSize, table, lookupTableResult) \
(((h)->MakeLookupTable)(h, tableSize, table, lookupTableResult))
typedef CII←RES
PROC←CII←MakeLookupTable(
CII←Handle h,
unsigned int tableSize,
float table[],
CII←LookupTable* lookupTableResult
);
/**********************************************************************
** CII←DestroyLookupTable: METHOD **
** **
** Should be called exactly once for each CII←LookupTable returned **
** to the client, after after which the client should not use the **
** object again. The handle must be the same handle used to **
** create the CII←LookupTable. **
**********************************************************************/
#define CII←DestroyLookupTable(h, lookupTable) \
(((h)->DestroyLookupTable)(h, lookupTable))
typedef CII←RES
PROC←CII←DestroyLookupTable(
CII←Handle h,
CII←LookupTable lookupTable
);
/**********************************************************************
** CII←ColorLookupTableType: TYPE **
** **
** This enumeration is used to distinguish which of the various **
** 1-d lookup tables are being referenced. **
** **
** CII←*←TRANSFER **
** The RED, GREEN, BLUE, and GRAY transfer functions are **
** applied as the final client-controlled stage of color **
** generation (prior to any halftoning). Each of these **
** functions transform a device-dependent component of the **
** color independently of the other components. For a **
** monochrome device, only the GRAY transfer function is used. **
** For an RGB device, only the RED, GREEN, BLUE transfer **
** functions are used, with one exception. The exception **
** occurs whan a Gray color operator is in effect, in which **
** case the GRAY transfer function is used prior to the **
** conversion to RGB, and the RED, GREEN, BLUE transfer **
** functions are not used. For a CMYK device, all four **
** transfer functions are used; in this case, values of 0 **
** correspond to maximum colorant, and values of 1 correspond **
** minimum colorant; note this is the inverse of the usual **
** sense of CMYK. **
** There is the possibility of a device for which this **
** expression of a final transfer function makes very little **
** sense, for instance if the target is a CIE L*a*b* rendition. **
** The device may ignore the transfer functions in such a **
** case, except that the GRAY transfer shall always apply to **
** the results of the Gray color operator. **
** For the transfer functions, a NIL lookupTable corresponds to **
** the identity function. **
** All four transfer functions should be provided; if only a **
** gray transfer function is available, it should be used for **
** all four. **
** **
** CII←BLACK←GENERATION **
** This function (BG) is used when the device needs to produce **
** a CMYK output, and it only has three-component (CMY) color. **
** The input to the BG is the minimum of the cyan, magenta, and **
** yellow components, and the output is the amount of black; **
** the range for both input and output is 0 (minimum colorant) **
** to 1 (maximum colorant). Notice the sense of these numbers **
** is opposite to that of the inputs and outputs of the **
** transfer functions. **
** A NIL BG lookupTable corresponds to the constant zero **
** function. **
** **
** CII←UNDERCOLOR←REMOVAL **
** This function (UCR) is used under the same circumstances as **
** the black generation function, and takes the same input. **
** The output is in the range -1 to +1, and says how much **
** colorant to remove from each of the cyan, magenta, and **
** yellow components. **
** A NIL UCR lookupTable corresponds to the constant zero **
** function. **
** **
** Note that this form of specification of BG and UCR functions is **
** quite limited; some devices may benefit from functions that use **
** more information than just MIN(C,M,Y). Such functions might be **
** expressed as part of (device-dependent) data passed to **
** SetColorTable. A device that recognizes this situation may end **
** up effectively ignoring the BG and UCR lookup tables, because **
** the color correction intrinsically generates CMYK. **
** **
**********************************************************************/
typedef enum {CII←RED←TRANSFER, CII←GREEN←TRANSFER, CII←BLUE←TRANSFER, CII←GRAY←TRANSFER, CII←BLACK←GENERATION, CII←UNDERCOLOR←REMOVAL} CII←ColorLookupTableType;
/**********************************************************************
** CII←SetColorLookupTable: METHOD **
** **
** Sets one of the color lookup tables. Refer to comments above **
** for details. **
**********************************************************************/
#define CII←SetColorLookupTable(h, which, lookupTable) \
(((h)->SetColorLookupTable)(h, which, lookupTable))
typedef CII←RES
PROC←CII←SetColorLookupTable(
CII←Handle h,
CII←ColorLookupTableType which,
CII←LookupTable lookupTable
);
/**********************************************************************
** CII←GetColorLookupTable: METHOD **
** **
** Gets one of the color lookup tables. **
**********************************************************************/
#define CII←GetColorLookupTable(h, which, lookupTableResult) \
(((h)->GetColorLookupTable)(h, which, lookupTableResult))
typedef CII←RES
PROC←CII←GetColorLookupTable(
CII←Handle h,
CII←ColorLookupTableType which,
CII←LookupTable* lookupTableResult
);
/**********************************************************************
** CII←Sync: METHOD **
** **
** There may be a situation where the further processing of the **
** output of a device requires the cooperation of the cii layer; **
** for instance it may be necessary to complete processing of **
** requests that have been internally buffered or that are being **
** processed in parallel. The Sync method allows for this; the **
** parameters allow for additional (device-dependent) data to be **
** passed as appropriate. The interpretation of the data, if any, **
** is not specified by this interface. The operation named **
** "sync", with a null dataFormat and no data, will mean to **
** complete all outstanding imaging requests. **
** **
** operationName: a null-terminated alphanumeric string naming **
** the synchonization operation to be performed. An **
** unrecognized operation will yield a return code of **
** CII←RES←notImplemented. **
** **
** format: a null-terminated alphanumeric string identifying **
** the format of the data. **
** **
** dataPointer: a pointer to any data the operation may require; **
** devices might have operations that place results here, but **
** they must respect the dataByteLength. **
** **
** dataByteLength: the length, in bytes, of the data area. **
**********************************************************************/
#define CII←Sync(h, operationName, format, dataPointer, dataByteLength) \
(((h)->Sync)(h, operationName, format, dataPointer, dataByteLength))
typedef CII←RES
PROC←CII←Sync(
CII←Handle h,
char* operationName,
char* format,
void* dataPointer,
unsigned int dataByteLength
);
/**********************************************************************
** CII←CleanupObject: TYPE **
** **
** A CleanupObject, when registered with a given handle, will be **
** invoked prior to the destruction of the handle. **
**********************************************************************/
typedef struct CII←CleanupObjectRep * CII←CleanupObject;
/**********************************************************************
** CII←RegisterCleanupObject: METHOD **
** **
** Registers the client-supplied cleanupObject with the handle. **
** Upon handle destruction, the cleanupObject will be **
** unregistered, then sent the cleanup message. There may be more **
** than one cleanupObject object registered with a given handle. **
** RegisterCleanupObject does not check for duplicates; if there **
** is a chance that the client has registered the cleanupObject **
** already, it may call CII←UnRegisterCleanupObject first to **
** eliminate any duplicates. The cleanup objects are called in **
** reverse order of registration. **
**********************************************************************/
#define CII←RegisterCleanupObject(h, cleanupObject) \
(((h)->RegisterCleanupObject)(h, cleanupObject))
typedef CII←RES
PROC←CII←RegisterCleanupObject(
CII←Handle h,
CII←CleanupObject cleanupObject
);
/**********************************************************************
** CII←UnRegisterCleanupObject: METHOD **
** **
** Unregisters the cleanupObject, if it had previously been **
** registered. In the case that cleanupObject got registered **
** multiple times, this will only remove one registration, the **
** most recently registered one. The match is done by pointer **
** comparison of the cleanupObject. **
** CII←RES←accessError => cleanupObject was not registered. **
**********************************************************************/
#define CII←UnRegisterCleanupObject(h, cleanupObject) \
(((h)->UnRegisterCleanupObject)(h, cleanupObject))
typedef CII←RES
PROC←CII←UnRegisterCleanupObject(
CII←Handle h,
CII←CleanupObject cleanupObject
);
/**********************************************************************
** CII←Cleanup: METHOD **
** **
** Invokes a CleanupObject **
**********************************************************************/
#define CII←Cleanup(self, h) \
(((self)->Cleanup)(self, h))
typedef CII←RES
PROC←CII←Cleanup(
CII←CleanupObject self,
CII←Handle h
);
/**********************************************************************
** CII←PathGeneratorObjectRep: OBJECT **
** **
**********************************************************************/
typedef struct CII←PathGeneratorObjectRep {
void* data;
PROC←CII←GeneratePath* GeneratePath;
} CII←PathGeneratorObjectRep;
/**********************************************************************
** CII←CleanupObjectRep: OBJECT **
** **
**********************************************************************/
typedef struct CII←CleanupObjectRep {
void* data;
PROC←CII←Cleanup* Cleanup;
} CII←CleanupObjectRep;
/**********************************************************************
** CII←PathSinkObjectRep: OBJECT **
** **
**********************************************************************/
typedef struct CII←PathSinkObjectRep {
void* data;
PROC←CII←MoveTo* MoveTo;
PROC←CII←LineTo* LineTo;
PROC←CII←CurveTo* CurveTo;
PROC←CII←ConicTo* ConicTo;
} CII←PathSinkObjectRep;
/**********************************************************************
** CII←ObjectRep: OBJECT **
** **
**********************************************************************/
typedef struct CII←ObjectRep {
void* data;
PROC←CII←Destroy* Destroy;
PROC←CII←DestroyColor* DestroyColor;
PROC←CII←DestroyColorOperator* DestroyColorOperator;
PROC←CII←DestroyClipper* DestroyClipper;
PROC←CII←DestroyFont* DestroyFont;
PROC←CII←SetMatrix* SetMatrix;
PROC←CII←GetMatrix* GetMatrix;
PROC←CII←GetInitialMatrix* GetInitialMatrix;
PROC←CII←SetInitialMatrix* SetInitialMatrix;
PROC←CII←MakeGrayColorOperator* MakeGrayColorOperator;
PROC←CII←MakeRGBColorOperator* MakeRGBColorOperator;
PROC←CII←MakeCMYKColorOperator* MakeCMYKColorOperator;
PROC←CII←MakeHighlightColorOperator* MakeHighlightColorOperator;
PROC←CII←MakeColor* MakeColor;
PROC←CII←MakeSampledBlack* MakeSampledBlack;
PROC←CII←SetColor* SetColor;
PROC←CII←SetGray* SetGray;
PROC←CII←SetRGB* SetRGB;
PROC←CII←SetHSV* SetHSV;
PROC←CII←SetCMYK* SetCMYK;
PROC←CII←GetColor* GetColor;
PROC←CII←MaskRectangle* MaskRectangle;
PROC←CII←MaskFill* MaskFill;
PROC←CII←Clip* Clip;
PROC←CII←GetClipper* GetClipper;
PROC←CII←SetClipper* SetClipper;
PROC←CII←BuildClipperBegin* BuildClipperBegin;
PROC←CII←BuildClipperEnd* BuildClipperEnd;
PROC←CII←MaskStroke* MaskStroke;
PROC←CII←MaskBitmap* MaskBitmap;
PROC←CII←MaskDeviceTrapezoid* MaskDeviceTrapezoid;
PROC←CII←DestroyMaskProgram* DestroyMaskProgram;
PROC←CII←MakeMaskProgram* MakeMaskProgram;
PROC←CII←MaskDeviceBoxes* MaskDeviceBoxes;
PROC←CII←FindFont* FindFont;
PROC←CII←ModifyFont* ModifyFont;
PROC←CII←MakeFontAtom* MakeFontAtom;
PROC←CII←DoHardChar* DoHardChar;
PROC←CII←DoHardMetrics* DoHardMetrics;
PROC←CII←Show* Show;
PROC←CII←BufferedSeparationImage* BufferedSeparationImage;
PROC←CII←BufferedInterleavedImage* BufferedInterleavedImage;
PROC←CII←StreamImage* StreamImage;
PROC←CII←MaskStreamBits* MaskStreamBits;
PROC←CII←ApplyCCITTFacsimileDecompressionFilter* ApplyCCITTFacsimileDecompressionFilter;
PROC←CII←MakeHalftoneProperties* MakeHalftoneProperties;
PROC←CII←SetHalftoneProperties* SetHalftoneProperties;
PROC←CII←GetHalftoneProperties* GetHalftoneProperties;
PROC←CII←DestroyHalftoneProperties* DestroyHalftoneProperties;
PROC←CII←SetSeparation* SetSeparation;
PROC←CII←SetOutputBuffers* SetOutputBuffers;
PROC←CII←SetColorTable* SetColorTable;
PROC←CII←MakeLookupTable* MakeLookupTable;
PROC←CII←DestroyLookupTable* DestroyLookupTable;
PROC←CII←SetColorLookupTable* SetColorLookupTable;
PROC←CII←GetColorLookupTable* GetColorLookupTable;
PROC←CII←Sync* Sync;
PROC←CII←RegisterCleanupObject* RegisterCleanupObject;
PROC←CII←UnRegisterCleanupObject* UnRegisterCleanupObject;
} CII←ObjectRep;
/**********************************************************************
** CII←ImageSourceObjectRep: OBJECT **
** **
**********************************************************************/
typedef struct CII←ImageSourceObjectRep {
void* data;
PROC←CII←ImageSourceRead* ImageSourceRead;
PROC←CII←ImageSourceDestroy* ImageSourceDestroy;
} CII←ImageSourceObjectRep;
#endif /* cii←h */