]> git.ipfire.org Git - thirdparty/cups.git/blame - filter/raster.h
Load cups into easysw/current.
[thirdparty/cups.git] / filter / raster.h
CommitLineData
ef416fc2 1/*
f7deaa1a 2 * "$Id: raster.h 6274 2007-02-13 21:05:28Z mike $"
ef416fc2 3 *
4 * Raster file definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 1997-2006 by Easy Software Products.
7 *
8 * This file is part of the CUPS Imaging library.
9 *
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
15 * at:
16 *
17 * Attn: CUPS Licensing Information
18 * Easy Software Products
19 * 44141 Airport View Drive, Suite 204
20 * Hollywood, Maryland 20636 USA
21 *
22 * Voice: (301) 373-9600
23 * EMail: cups-info@cups.org
24 * WWW: http://www.cups.org
25 *
ef416fc2 26 * This file is subject to the Apple OS-Developed Software exception.
27 */
28
29#ifndef _CUPS_RASTER_H_
30# define _CUPS_RASTER_H_
31
32/*
33 * Include necessary headers...
34 */
35
923edb68 36# include <cups/cups.h>
ef416fc2 37
38# ifdef __cplusplus
39extern "C" {
40# endif /* __cplusplus */
41
42/*
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...
50 */
51
52/*
53 * Constants...
54 */
55
ed486911 56# define CUPS_RASTER_SYNC 0x52615333 /* RaS3 */
57# define CUPS_RASTER_REVSYNC 0x33536152 /* 3SaR */
ef416fc2 58
59# define CUPS_RASTER_SYNCv1 0x52615374 /* RaSt */
60# define CUPS_RASTER_REVSYNCv1 0x74536152 /* tSaR */
61
ed486911 62# define CUPS_RASTER_SYNCv2 0x52615332 /* RaS2 */
63# define CUPS_RASTER_REVSYNCv2 0x32536152 /* 2SaR */
64
ef416fc2 65
66/*
67 * The following definition can be used to determine if the
68 * colorimetric colorspaces (CIEXYZ, CIELAB, and ICCn) are
69 * defined...
70 */
71
72# define CUPS_RASTER_HAVE_COLORIMETRIC 1
73
74
75/*
76 * Types...
77 */
78
ef416fc2 79typedef enum cups_adv_e /**** AdvanceMedia attribute values ****/
80{
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 */
86} cups_adv_t;
87
b86bc4cf 88typedef enum cups_bool_e /**** Boolean type ****/
ef416fc2 89{
b86bc4cf 90 CUPS_FALSE = 0, /* Logical false */
91 CUPS_TRUE = 1 /* Logical true */
92} cups_bool_t;
ef416fc2 93
94typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
95{
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 */
112
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@ */
116
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@ */
132} cups_cspace_t;
133
b86bc4cf 134typedef enum cups_cut_e /**** CutMedia attribute values ****/
135{
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 */
141} cups_cut_t;
142
143typedef enum cups_edge_e /**** LeadingEdge attribute values ****/
144{
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 */
149} cups_edge_t;
150
151typedef enum cups_jog_e /**** Jog attribute values ****/
152{
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 */
157} cups_jog_t;
158
159typedef enum cups_mode_e /**** Raster modes ****/
160{
161 CUPS_RASTER_READ = 0, /* Open stream for reading */
f7deaa1a 162 CUPS_RASTER_WRITE = 1, /* Open stream for writing */
163 CUPS_RASTER_WRITE_COMPRESSED = 2 /* Open stream for compressed writing @since CUPS 1.3@ */
b86bc4cf 164} cups_mode_t;
165
166typedef enum cups_order_e /**** cupsColorOrder attribute values ****/
167{
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 ... */
171} cups_order_t;
172
173typedef enum cups_orient_e /**** Orientation attribute values ****/
174{
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 */
179} cups_orient_t;
180
ef416fc2 181
182/*
183 * The page header structure contains the standard PostScript page device
184 * dictionary, along with some CUPS-specific parameters that are provided
185 * by the RIPs...
186 *
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.
189 */
190
191typedef struct cups_page_header_s /**** Version 1 Page Header ****/
192{
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 */
198
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 */
223
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;
238
239/**** New in CUPS 1.2 ****/
240typedef struct cups_page_header2_s /**** Version 2 Page Header @since CUPS 1.2@ ****/
241{
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 */
247
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 */
272
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 */
286
287 /**** Version 2 Dictionary Values ****/
fa73b229 288 unsigned cupsNumColors; /* Number of colors @since CUPS 1.2@ */
923edb68 289 float cupsBorderlessScalingFactor;
b423cd4c 290 /* Scaling that was applied to page data @since CUPS 1.2@ */
923edb68 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@ */
fa73b229 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@ */
ef416fc2 301} cups_page_header2_t;
302
f301802f 303typedef struct _cups_raster_s cups_raster_t;
304 /**** Raster stream data ****/
ef416fc2 305
a74454a7 306typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits);
307
ef416fc2 308
309/*
310 * Prototypes...
311 */
312
313extern void cupsRasterClose(cups_raster_t *r);
314extern cups_raster_t *cupsRasterOpen(int fd, cups_mode_t mode);
315extern unsigned cupsRasterReadHeader(cups_raster_t *r,
316 cups_page_header_t *h);
317extern unsigned cupsRasterReadPixels(cups_raster_t *r,
318 unsigned char *p, unsigned len);
319extern unsigned cupsRasterWriteHeader(cups_raster_t *r,
320 cups_page_header_t *h);
321extern unsigned cupsRasterWritePixels(cups_raster_t *r,
322 unsigned char *p, unsigned len);
323
324/**** New in CUPS 1.2 ****/
325extern int cupsRasterInterpretPPD(cups_page_header2_t *h,
923edb68 326 ppd_file_t *ppd,
327 int num_options,
a74454a7 328 cups_option_t *options,
329 cups_interpret_cb_t func);
ef416fc2 330extern unsigned cupsRasterReadHeader2(cups_raster_t *r,
331 cups_page_header2_t *h);
332extern unsigned cupsRasterWriteHeader2(cups_raster_t *r,
333 cups_page_header2_t *h);
334
f7deaa1a 335/**** New in CUPS 1.3 ****/
336extern const char *cupsRasterErrorString(void);
337
ef416fc2 338# ifdef __cplusplus
339}
340# endif /* __cplusplus */
341
342#endif /* !_CUPS_RASTER_H_ */
343
344/*
f7deaa1a 345 * End of "$Id: raster.h 6274 2007-02-13 21:05:28Z mike $".
ef416fc2 346 */