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