]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
ac884b6a | 2 | * "$Id$" |
ef416fc2 | 3 | * |
4 | * Raster file definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
db0bd74a | 6 | * Copyright 2007-2008 by Apple Inc. |
ef416fc2 | 7 | * Copyright 1997-2006 by Easy Software Products. |
8 | * | |
9 | * This file is part of the CUPS Imaging library. | |
10 | * | |
11 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 12 | * property of Apple Inc. and are protected by Federal copyright |
13 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
14 | * which should have been included with this file. If this file is | |
15 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 16 | * |
ef416fc2 | 17 | * This file is subject to the Apple OS-Developed Software exception. |
18 | */ | |
19 | ||
20 | #ifndef _CUPS_RASTER_H_ | |
21 | # define _CUPS_RASTER_H_ | |
22 | ||
23 | /* | |
24 | * Include necessary headers... | |
25 | */ | |
26 | ||
923edb68 | 27 | # include <cups/cups.h> |
ef416fc2 | 28 | |
29 | # ifdef __cplusplus | |
30 | extern "C" { | |
31 | # endif /* __cplusplus */ | |
32 | ||
33 | /* | |
34 | * Every non-PostScript printer driver that supports raster images | |
35 | * should use the application/vnd.cups-raster image file format. | |
36 | * Since both the PostScript RIP (pstoraster, based on GNU/GPL | |
37 | * Ghostscript) and Image RIP (imagetoraster, located in the filter | |
38 | * directory) use it, using this format saves you a lot of work. | |
39 | * Also, the PostScript RIP passes any printer options that are in | |
40 | * a PS file to your driver this way as well... | |
41 | */ | |
42 | ||
43 | /* | |
44 | * Constants... | |
45 | */ | |
46 | ||
ed486911 | 47 | # define CUPS_RASTER_SYNC 0x52615333 /* RaS3 */ |
48 | # define CUPS_RASTER_REVSYNC 0x33536152 /* 3SaR */ | |
ef416fc2 | 49 | |
50 | # define CUPS_RASTER_SYNCv1 0x52615374 /* RaSt */ | |
51 | # define CUPS_RASTER_REVSYNCv1 0x74536152 /* tSaR */ | |
52 | ||
ed486911 | 53 | # define CUPS_RASTER_SYNCv2 0x52615332 /* RaS2 */ |
54 | # define CUPS_RASTER_REVSYNCv2 0x32536152 /* 2SaR */ | |
55 | ||
ef416fc2 | 56 | |
57 | /* | |
58 | * The following definition can be used to determine if the | |
59 | * colorimetric colorspaces (CIEXYZ, CIELAB, and ICCn) are | |
60 | * defined... | |
61 | */ | |
62 | ||
63 | # define CUPS_RASTER_HAVE_COLORIMETRIC 1 | |
64 | ||
65 | ||
66 | /* | |
67 | * Types... | |
68 | */ | |
69 | ||
ef416fc2 | 70 | typedef enum cups_adv_e /**** AdvanceMedia attribute values ****/ |
71 | { | |
72 | CUPS_ADVANCE_NONE = 0, /* Never advance the roll */ | |
73 | CUPS_ADVANCE_FILE = 1, /* Advance the roll after this file */ | |
74 | CUPS_ADVANCE_JOB = 2, /* Advance the roll after this job */ | |
75 | CUPS_ADVANCE_SET = 3, /* Advance the roll after this set */ | |
76 | CUPS_ADVANCE_PAGE = 4 /* Advance the roll after this page */ | |
77 | } cups_adv_t; | |
78 | ||
b86bc4cf | 79 | typedef enum cups_bool_e /**** Boolean type ****/ |
ef416fc2 | 80 | { |
b86bc4cf | 81 | CUPS_FALSE = 0, /* Logical false */ |
82 | CUPS_TRUE = 1 /* Logical true */ | |
83 | } cups_bool_t; | |
ef416fc2 | 84 | |
85 | typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/ | |
86 | { | |
87 | CUPS_CSPACE_W = 0, /* Luminance */ | |
88 | CUPS_CSPACE_RGB = 1, /* Red, green, blue */ | |
89 | CUPS_CSPACE_RGBA = 2, /* Red, green, blue, alpha */ | |
90 | CUPS_CSPACE_K = 3, /* Black */ | |
91 | CUPS_CSPACE_CMY = 4, /* Cyan, magenta, yellow */ | |
92 | CUPS_CSPACE_YMC = 5, /* Yellow, magenta, cyan */ | |
93 | CUPS_CSPACE_CMYK = 6, /* Cyan, magenta, yellow, black */ | |
94 | CUPS_CSPACE_YMCK = 7, /* Yellow, magenta, cyan, black */ | |
95 | CUPS_CSPACE_KCMY = 8, /* Black, cyan, magenta, yellow */ | |
96 | CUPS_CSPACE_KCMYcm = 9, /* Black, cyan, magenta, yellow, * | |
97 | * light-cyan, light-magenta */ | |
98 | CUPS_CSPACE_GMCK = 10, /* Gold, magenta, yellow, black */ | |
99 | CUPS_CSPACE_GMCS = 11, /* Gold, magenta, yellow, silver */ | |
100 | CUPS_CSPACE_WHITE = 12, /* White ink (as black) */ | |
101 | CUPS_CSPACE_GOLD = 13, /* Gold foil */ | |
102 | CUPS_CSPACE_SILVER = 14, /* Silver foil */ | |
103 | ||
104 | CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19@ */ | |
105 | CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19@ */ | |
db0bd74a | 106 | CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.5@ */ |
ef416fc2 | 107 | |
108 | CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19@ */ | |
109 | CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19@ */ | |
110 | CUPS_CSPACE_ICC3 = 34, /* ICC-based, 3 colors @since CUPS 1.1.19@ */ | |
111 | CUPS_CSPACE_ICC4 = 35, /* ICC-based, 4 colors @since CUPS 1.1.19@ */ | |
112 | CUPS_CSPACE_ICC5 = 36, /* ICC-based, 5 colors @since CUPS 1.1.19@ */ | |
113 | CUPS_CSPACE_ICC6 = 37, /* ICC-based, 6 colors @since CUPS 1.1.19@ */ | |
114 | CUPS_CSPACE_ICC7 = 38, /* ICC-based, 7 colors @since CUPS 1.1.19@ */ | |
115 | CUPS_CSPACE_ICC8 = 39, /* ICC-based, 8 colors @since CUPS 1.1.19@ */ | |
116 | CUPS_CSPACE_ICC9 = 40, /* ICC-based, 9 colors @since CUPS 1.1.19@ */ | |
117 | CUPS_CSPACE_ICCA = 41, /* ICC-based, 10 colors @since CUPS 1.1.19@ */ | |
118 | CUPS_CSPACE_ICCB = 42, /* ICC-based, 11 colors @since CUPS 1.1.19@ */ | |
119 | CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19@ */ | |
120 | CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19@ */ | |
121 | CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19@ */ | |
122 | CUPS_CSPACE_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19@ */ | |
123 | } cups_cspace_t; | |
124 | ||
b86bc4cf | 125 | typedef enum cups_cut_e /**** CutMedia attribute values ****/ |
126 | { | |
127 | CUPS_CUT_NONE = 0, /* Never cut the roll */ | |
128 | CUPS_CUT_FILE = 1, /* Cut the roll after this file */ | |
129 | CUPS_CUT_JOB = 2, /* Cut the roll after this job */ | |
130 | CUPS_CUT_SET = 3, /* Cut the roll after this set */ | |
131 | CUPS_CUT_PAGE = 4 /* Cut the roll after this page */ | |
132 | } cups_cut_t; | |
133 | ||
134 | typedef enum cups_edge_e /**** LeadingEdge attribute values ****/ | |
135 | { | |
136 | CUPS_EDGE_TOP = 0, /* Leading edge is the top of the page */ | |
137 | CUPS_EDGE_RIGHT = 1, /* Leading edge is the right of the page */ | |
138 | CUPS_EDGE_BOTTOM = 2, /* Leading edge is the bottom of the page */ | |
139 | CUPS_EDGE_LEFT = 3 /* Leading edge is the left of the page */ | |
140 | } cups_edge_t; | |
141 | ||
142 | typedef enum cups_jog_e /**** Jog attribute values ****/ | |
143 | { | |
144 | CUPS_JOG_NONE = 0, /* Never move pages */ | |
145 | CUPS_JOG_FILE = 1, /* Move pages after this file */ | |
146 | CUPS_JOG_JOB = 2, /* Move pages after this job */ | |
147 | CUPS_JOG_SET = 3 /* Move pages after this set */ | |
148 | } cups_jog_t; | |
149 | ||
5a738aea | 150 | enum cups_mode_e /**** cupsRasterOpen modes ****/ |
b86bc4cf | 151 | { |
152 | CUPS_RASTER_READ = 0, /* Open stream for reading */ | |
f7deaa1a | 153 | CUPS_RASTER_WRITE = 1, /* Open stream for writing */ |
154 | CUPS_RASTER_WRITE_COMPRESSED = 2 /* Open stream for compressed writing @since CUPS 1.3@ */ | |
5a738aea MS |
155 | }; |
156 | ||
157 | typedef enum cups_mode_e cups_mode_t; /**** cupsRasterOpen modes ****/ | |
b86bc4cf | 158 | |
159 | typedef enum cups_order_e /**** cupsColorOrder attribute values ****/ | |
160 | { | |
161 | CUPS_ORDER_CHUNKED = 0, /* CMYK CMYK CMYK ... */ | |
162 | CUPS_ORDER_BANDED = 1, /* CCC MMM YYY KKK ... */ | |
163 | CUPS_ORDER_PLANAR = 2 /* CCC ... MMM ... YYY ... KKK ... */ | |
164 | } cups_order_t; | |
165 | ||
166 | typedef enum cups_orient_e /**** Orientation attribute values ****/ | |
167 | { | |
168 | CUPS_ORIENT_0 = 0, /* Don't rotate the page */ | |
169 | CUPS_ORIENT_90 = 1, /* Rotate the page counter-clockwise */ | |
170 | CUPS_ORIENT_180 = 2, /* Turn the page upside down */ | |
171 | CUPS_ORIENT_270 = 3 /* Rotate the page clockwise */ | |
172 | } cups_orient_t; | |
173 | ||
ef416fc2 | 174 | |
175 | /* | |
176 | * The page header structure contains the standard PostScript page device | |
177 | * dictionary, along with some CUPS-specific parameters that are provided | |
178 | * by the RIPs... | |
179 | * | |
180 | * The API supports a "version 1" (from CUPS 1.0 and 1.1) and a "version 2" | |
181 | * (from CUPS 1.2 and higher) page header, for binary compatibility. | |
182 | */ | |
183 | ||
db0bd74a | 184 | typedef struct cups_page_header_s /**** Version 1 page header @deprecated@ ****/ |
ef416fc2 | 185 | { |
186 | /**** Standard Page Device Dictionary String Values ****/ | |
187 | char MediaClass[64]; /* MediaClass string */ | |
188 | char MediaColor[64]; /* MediaColor string */ | |
189 | char MediaType[64]; /* MediaType string */ | |
190 | char OutputType[64]; /* OutputType string */ | |
191 | ||
192 | /**** Standard Page Device Dictionary Integer Values ****/ | |
193 | unsigned AdvanceDistance; /* AdvanceDistance value in points */ | |
db0bd74a | 194 | cups_adv_t AdvanceMedia; /* AdvanceMedia value (@link cups_adv_t@) */ |
ef416fc2 | 195 | cups_bool_t Collate; /* Collated copies value */ |
db0bd74a | 196 | cups_cut_t CutMedia; /* CutMedia value (@link cups_cut_t@) */ |
ef416fc2 | 197 | cups_bool_t Duplex; /* Duplexed (double-sided) value */ |
198 | unsigned HWResolution[2]; /* Resolution in dots-per-inch */ | |
db0bd74a | 199 | unsigned ImagingBoundingBox[4]; /* Pixel region that is painted (points, left, bottom, right, top) */ |
ef416fc2 | 200 | cups_bool_t InsertSheet; /* InsertSheet value */ |
db0bd74a MS |
201 | cups_jog_t Jog; /* Jog value (@link cups_jog_t@) */ |
202 | cups_edge_t LeadingEdge; /* LeadingEdge value (@link cups_edge_t@) */ | |
ef416fc2 | 203 | unsigned Margins[2]; /* Lower-lefthand margins in points */ |
204 | cups_bool_t ManualFeed; /* ManualFeed value */ | |
205 | unsigned MediaPosition; /* MediaPosition value */ | |
206 | unsigned MediaWeight; /* MediaWeight value in grams/m^2 */ | |
207 | cups_bool_t MirrorPrint; /* MirrorPrint value */ | |
208 | cups_bool_t NegativePrint; /* NegativePrint value */ | |
209 | unsigned NumCopies; /* Number of copies to produce */ | |
db0bd74a | 210 | cups_orient_t Orientation; /* Orientation value (@link cups_orient_t@) */ |
ef416fc2 | 211 | cups_bool_t OutputFaceUp; /* OutputFaceUp value */ |
212 | unsigned PageSize[2]; /* Width and length of page in points */ | |
213 | cups_bool_t Separations; /* Separations value */ | |
214 | cups_bool_t TraySwitch; /* TraySwitch value */ | |
215 | cups_bool_t Tumble; /* Tumble value */ | |
216 | ||
217 | /**** CUPS Page Device Dictionary Values ****/ | |
218 | unsigned cupsWidth; /* Width of page image in pixels */ | |
219 | unsigned cupsHeight; /* Height of page image in pixels */ | |
220 | unsigned cupsMediaType; /* Media type code */ | |
221 | unsigned cupsBitsPerColor; /* Number of bits for each color */ | |
222 | unsigned cupsBitsPerPixel; /* Number of bits for each pixel */ | |
223 | unsigned cupsBytesPerLine; /* Number of bytes per line */ | |
224 | cups_order_t cupsColorOrder; /* Order of colors */ | |
225 | cups_cspace_t cupsColorSpace; /* True colorspace */ | |
226 | unsigned cupsCompression; /* Device compression to use */ | |
227 | unsigned cupsRowCount; /* Rows per band */ | |
228 | unsigned cupsRowFeed; /* Feed between bands */ | |
229 | unsigned cupsRowStep; /* Spacing between lines */ | |
230 | } cups_page_header_t; | |
231 | ||
232 | /**** New in CUPS 1.2 ****/ | |
db0bd74a | 233 | typedef struct cups_page_header2_s /**** Version 2 page header @since CUPS 1.2/Mac OS X 10.5@ ****/ |
ef416fc2 | 234 | { |
235 | /**** Standard Page Device Dictionary String Values ****/ | |
236 | char MediaClass[64]; /* MediaClass string */ | |
237 | char MediaColor[64]; /* MediaColor string */ | |
238 | char MediaType[64]; /* MediaType string */ | |
239 | char OutputType[64]; /* OutputType string */ | |
240 | ||
241 | /**** Standard Page Device Dictionary Integer Values ****/ | |
242 | unsigned AdvanceDistance; /* AdvanceDistance value in points */ | |
db0bd74a | 243 | cups_adv_t AdvanceMedia; /* AdvanceMedia value (@link cups_adv_t@) */ |
ef416fc2 | 244 | cups_bool_t Collate; /* Collated copies value */ |
db0bd74a | 245 | cups_cut_t CutMedia; /* CutMedia value (@link cups_cut_t@) */ |
ef416fc2 | 246 | cups_bool_t Duplex; /* Duplexed (double-sided) value */ |
247 | unsigned HWResolution[2]; /* Resolution in dots-per-inch */ | |
db0bd74a | 248 | unsigned ImagingBoundingBox[4]; /* Pixel region that is painted (points, left, bottom, right, top) */ |
ef416fc2 | 249 | cups_bool_t InsertSheet; /* InsertSheet value */ |
db0bd74a MS |
250 | cups_jog_t Jog; /* Jog value (@link cups_jog_t@) */ |
251 | cups_edge_t LeadingEdge; /* LeadingEdge value (@link cups_edge_t@) */ | |
ef416fc2 | 252 | unsigned Margins[2]; /* Lower-lefthand margins in points */ |
253 | cups_bool_t ManualFeed; /* ManualFeed value */ | |
254 | unsigned MediaPosition; /* MediaPosition value */ | |
255 | unsigned MediaWeight; /* MediaWeight value in grams/m^2 */ | |
256 | cups_bool_t MirrorPrint; /* MirrorPrint value */ | |
257 | cups_bool_t NegativePrint; /* NegativePrint value */ | |
258 | unsigned NumCopies; /* Number of copies to produce */ | |
db0bd74a | 259 | cups_orient_t Orientation; /* Orientation value (@link cups_orient_t@) */ |
ef416fc2 | 260 | cups_bool_t OutputFaceUp; /* OutputFaceUp value */ |
261 | unsigned PageSize[2]; /* Width and length of page in points */ | |
262 | cups_bool_t Separations; /* Separations value */ | |
263 | cups_bool_t TraySwitch; /* TraySwitch value */ | |
264 | cups_bool_t Tumble; /* Tumble value */ | |
265 | ||
266 | /**** CUPS Page Device Dictionary Values ****/ | |
267 | unsigned cupsWidth; /* Width of page image in pixels */ | |
268 | unsigned cupsHeight; /* Height of page image in pixels */ | |
269 | unsigned cupsMediaType; /* Media type code */ | |
270 | unsigned cupsBitsPerColor; /* Number of bits for each color */ | |
271 | unsigned cupsBitsPerPixel; /* Number of bits for each pixel */ | |
272 | unsigned cupsBytesPerLine; /* Number of bytes per line */ | |
273 | cups_order_t cupsColorOrder; /* Order of colors */ | |
274 | cups_cspace_t cupsColorSpace; /* True colorspace */ | |
275 | unsigned cupsCompression; /* Device compression to use */ | |
276 | unsigned cupsRowCount; /* Rows per band */ | |
277 | unsigned cupsRowFeed; /* Feed between bands */ | |
278 | unsigned cupsRowStep; /* Spacing between lines */ | |
279 | ||
280 | /**** Version 2 Dictionary Values ****/ | |
db0bd74a | 281 | unsigned cupsNumColors; /* Number of color compoents @since CUPS 1.2/Mac OS X 10.5@ */ |
923edb68 | 282 | float cupsBorderlessScalingFactor; |
db0bd74a | 283 | /* Scaling that was applied to page data @since CUPS 1.2/Mac OS X 10.5@ */ |
923edb68 | 284 | float cupsPageSize[2]; /* Floating point PageSize (scaling * |
db0bd74a MS |
285 | * factor not applied) @since CUPS 1.2/Mac OS X 10.5@ */ |
286 | float cupsImagingBBox[4]; /* Floating point ImagingBoundingBox | |
287 | * (scaling factor not applied, left, | |
288 | * bottom, right, top) @since CUPS 1.2/Mac OS X 10.5@ */ | |
289 | unsigned cupsInteger[16]; /* User-defined integer values @since CUPS 1.2/Mac OS X 10.5@ */ | |
290 | float cupsReal[16]; /* User-defined floating-point values @since CUPS 1.2/Mac OS X 10.5@ */ | |
291 | char cupsString[16][64]; /* User-defined string values @since CUPS 1.2/Mac OS X 10.5@ */ | |
292 | char cupsMarkerType[64]; /* Ink/toner type @since CUPS 1.2/Mac OS X 10.5@ */ | |
293 | char cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2/Mac OS X 10.5@ */ | |
294 | char cupsPageSizeName[64]; /* PageSize name @since CUPS 1.2/Mac OS X 10.5@ */ | |
ef416fc2 | 295 | } cups_page_header2_t; |
296 | ||
f301802f | 297 | typedef struct _cups_raster_s cups_raster_t; |
298 | /**** Raster stream data ****/ | |
ef416fc2 | 299 | |
a74454a7 | 300 | typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits); |
5a738aea MS |
301 | /**** cupsRasterInterpretPPD callback function |
302 | * | |
303 | * This function is called by | |
304 | * @link cupsRasterInterpretPPD@ to | |
305 | * validate (and update, as needed) | |
db0bd74a MS |
306 | * the page header attributes. The |
307 | * "preferred_bits" argument provides | |
308 | * the value of the | |
309 | * @code cupsPreferredBitsPerColor@ | |
310 | * key from the PostScript page device | |
311 | * dictionary and is 0 if undefined. | |
5a738aea | 312 | ****/ |
a74454a7 | 313 | |
ef416fc2 | 314 | |
315 | /* | |
316 | * Prototypes... | |
317 | */ | |
318 | ||
319 | extern void cupsRasterClose(cups_raster_t *r); | |
320 | extern cups_raster_t *cupsRasterOpen(int fd, cups_mode_t mode); | |
321 | extern unsigned cupsRasterReadHeader(cups_raster_t *r, | |
db0bd74a | 322 | cups_page_header_t *h) _CUPS_DEPRECATED; |
ef416fc2 | 323 | extern unsigned cupsRasterReadPixels(cups_raster_t *r, |
324 | unsigned char *p, unsigned len); | |
325 | extern unsigned cupsRasterWriteHeader(cups_raster_t *r, | |
db0bd74a | 326 | cups_page_header_t *h) _CUPS_DEPRECATED; |
ef416fc2 | 327 | extern unsigned cupsRasterWritePixels(cups_raster_t *r, |
328 | unsigned char *p, unsigned len); | |
329 | ||
330 | /**** New in CUPS 1.2 ****/ | |
331 | extern int cupsRasterInterpretPPD(cups_page_header2_t *h, | |
923edb68 | 332 | ppd_file_t *ppd, |
333 | int num_options, | |
a74454a7 | 334 | cups_option_t *options, |
2fb76298 | 335 | cups_interpret_cb_t func) _CUPS_API_1_2; |
ef416fc2 | 336 | extern unsigned cupsRasterReadHeader2(cups_raster_t *r, |
2fb76298 | 337 | cups_page_header2_t *h) _CUPS_API_1_2; |
ef416fc2 | 338 | extern unsigned cupsRasterWriteHeader2(cups_raster_t *r, |
2fb76298 | 339 | cups_page_header2_t *h) _CUPS_API_1_2; |
ef416fc2 | 340 | |
f7deaa1a | 341 | /**** New in CUPS 1.3 ****/ |
2fb76298 | 342 | extern const char *cupsRasterErrorString(void) _CUPS_API_1_3; |
f7deaa1a | 343 | |
ef416fc2 | 344 | # ifdef __cplusplus |
345 | } | |
346 | # endif /* __cplusplus */ | |
347 | ||
348 | #endif /* !_CUPS_RASTER_H_ */ | |
349 | ||
350 | /* | |
ac884b6a | 351 | * End of "$Id$". |
ef416fc2 | 352 | */ |