]>
Commit | Line | Data |
---|---|---|
cfb0ab24 | 1 | /* |
efb2f309 | 2 | * "$Id: raster.h,v 1.3 2002/01/02 17:59:01 mike Exp $" |
cfb0ab24 | 3 | * |
4 | * Raster file definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
efb2f309 | 6 | * Copyright 1997-2002 by Easy Software Products. |
cfb0ab24 | 7 | * |
8 | * These coded instructions, statements, and computer programs are the | |
9 | * property of Easy Software Products and are protected by Federal | |
10 | * copyright law. Distribution and use rights for the CUPS Raster source | |
11 | * files are outlined in the GNU Library General Public License, located | |
12 | * in the "pstoraster" directory. If this file is missing or damaged | |
13 | * please contact Easy Software Products at: | |
14 | * | |
15 | * Attn: CUPS Licensing Information | |
16 | * Easy Software Products | |
8cb60b06 | 17 | * 44141 Airport View Drive, Suite 204 |
cfb0ab24 | 18 | * Hollywood, Maryland 20636-3111 USA |
19 | * | |
20 | * Voice: (301) 373-9603 | |
21 | * EMail: cups-info@cups.org | |
22 | * WWW: http://www.cups.org | |
b87e43e9 | 23 | * |
24 | * This code and any derivative of it may be used and distributed | |
25 | * freely under the terms of the GNU General Public License when | |
26 | * used with GNU Ghostscript or its derivatives. Use of the code | |
27 | * (or any derivative of it) with software other than GNU | |
28 | * GhostScript (or its derivatives) is governed by the CUPS license | |
29 | * agreement. | |
cfb0ab24 | 30 | */ |
31 | ||
32 | #ifndef _CUPS_RASTER_H_ | |
33 | # define _CUPS_RASTER_H_ | |
34 | ||
cb985dd0 | 35 | # ifdef __cplusplus |
36 | extern "C" { | |
37 | # endif /* __cplusplus */ | |
38 | ||
cfb0ab24 | 39 | /* |
40 | * Every non-PostScript printer driver that supports raster images should | |
8cb60b06 | 41 | * use the application/vnd.cups-raster image file format. Since both the |
b87e43e9 | 42 | * PostScript RIP (pstoraster, based on GNU Ghostscript 4.03) and Image RIP |
8cb60b06 | 43 | * (imagetoraster, located in the filter directory) use it, using this format |
44 | * saves you a lot of work. Also, the PostScript RIP passes any printer | |
45 | * options that are in a PS file to your driver this way as well... | |
cfb0ab24 | 46 | */ |
47 | ||
48 | /* | |
49 | * Constants... | |
50 | */ | |
51 | ||
52 | # define CUPS_RASTER_SYNC 0x52615374 /* RaSt */ | |
58ec2a95 | 53 | # define CUPS_RASTER_REVSYNC 0x74536152 /* tSaR */ |
cfb0ab24 | 54 | |
55 | ||
56 | /* | |
57 | * Types... | |
58 | */ | |
59 | ||
60 | typedef enum | |
61 | { | |
58ec2a95 | 62 | CUPS_RASTER_READ, /* Open stream for reading */ |
63 | CUPS_RASTER_WRITE /* Open stream for writing */ | |
64 | } cups_mode_t; | |
65 | ||
66 | typedef enum | |
67 | { | |
68 | CUPS_FALSE, /* Logical false */ | |
69 | CUPS_TRUE /* Logical true */ | |
cfb0ab24 | 70 | } cups_bool_t; |
71 | ||
72 | typedef enum | |
73 | { | |
58ec2a95 | 74 | CUPS_JOG_NONE, /* Never move pages */ |
75 | CUPS_JOG_FILE, /* Move pages after this file */ | |
76 | CUPS_JOG_JOB, /* Move pages after this job */ | |
77 | CUPS_JOG_SET /* Move pages after this set */ | |
cfb0ab24 | 78 | } cups_jog_t; |
79 | ||
80 | typedef enum | |
81 | { | |
58ec2a95 | 82 | CUPS_ORIENT_0, /* Don't rotate the page */ |
83 | CUPS_ORIENT_90, /* Rotate the page counter-clockwise */ | |
84 | CUPS_ORIENT_180, /* Turn the page upside down */ | |
85 | CUPS_ORIENT_270 /* Rotate the page clockwise */ | |
cfb0ab24 | 86 | } cups_orient_t; |
87 | ||
88 | typedef enum | |
89 | { | |
58ec2a95 | 90 | CUPS_CUT_NONE, /* Never cut the roll */ |
91 | CUPS_CUT_FILE, /* Cut the roll after this file */ | |
92 | CUPS_CUT_JOB, /* Cut the roll after this job */ | |
93 | CUPS_CUT_SET, /* Cut the roll after this set */ | |
94 | CUPS_CUT_PAGE /* Cut the roll after this page */ | |
cfb0ab24 | 95 | } cups_cut_t; |
96 | ||
97 | typedef enum | |
98 | { | |
58ec2a95 | 99 | CUPS_ADVANCE_NONE, /* Never advance the roll */ |
100 | CUPS_ADVANCE_FILE, /* Advance the roll after this file */ | |
101 | CUPS_ADVANCE_JOB, /* Advance the roll after this job */ | |
102 | CUPS_ADVANCE_SET, /* Advance the roll after this set */ | |
103 | CUPS_ADVANCE_PAGE /* Advance the roll after this page */ | |
cfb0ab24 | 104 | } cups_adv_t; |
105 | ||
106 | typedef enum | |
107 | { | |
58ec2a95 | 108 | CUPS_EDGE_TOP, /* Leading edge is the top of the page */ |
109 | CUPS_EDGE_RIGHT, /* Leading edge is the right of the page */ | |
110 | CUPS_EDGE_BOTTOM, /* Leading edge is the bottom of the page */ | |
111 | CUPS_EDGE_LEFT /* Leading edge is the left of the page */ | |
112 | } cups_edge_t; | |
113 | ||
114 | typedef enum | |
115 | { | |
b87e43e9 | 116 | CUPS_ORDER_CHUNKED, /* CMYK CMYK CMYK ... */ |
58ec2a95 | 117 | CUPS_ORDER_BANDED, /* CCC MMM YYY KKK ... */ |
118 | CUPS_ORDER_PLANAR /* CCC ... MMM ... YYY ... KKK ... */ | |
119 | } cups_order_t; | |
120 | ||
121 | typedef enum | |
122 | { | |
123 | CUPS_CSPACE_W, /* Luminance */ | |
124 | CUPS_CSPACE_RGB, /* Red, green, blue */ | |
125 | CUPS_CSPACE_RGBA, /* Red, green, blue, alpha */ | |
126 | CUPS_CSPACE_K, /* Black */ | |
127 | CUPS_CSPACE_CMY, /* Cyan, magenta, yellow */ | |
128 | CUPS_CSPACE_YMC, /* Yellow, magenta, cyan */ | |
129 | CUPS_CSPACE_CMYK, /* Cyan, magenta, yellow, black */ | |
130 | CUPS_CSPACE_YMCK, /* Yellow, magenta, cyan, black */ | |
131 | CUPS_CSPACE_KCMY, /* Black, cyan, magenta, yellow */ | |
8b0cdc5b | 132 | CUPS_CSPACE_KCMYcm, /* Black, cyan, magenta, yellow, * |
58ec2a95 | 133 | * light-cyan, light-magenta */ |
8b0cdc5b | 134 | CUPS_CSPACE_GMCK, /* Gold, magenta, yellow, black */ |
135 | CUPS_CSPACE_GMCS, /* Gold, magenta, yellow, silver */ | |
136 | CUPS_CSPACE_WHITE, /* White ink (as black) */ | |
137 | CUPS_CSPACE_GOLD, /* Gold foil */ | |
138 | CUPS_CSPACE_SILVER /* Silver foil */ | |
58ec2a95 | 139 | } cups_cspace_t; |
cfb0ab24 | 140 | |
141 | ||
142 | /* | |
143 | * The page header structure contains the standard PostScript page device | |
144 | * dictionary, along with some CUPS-specific parameters that are provided | |
145 | * by the RIPs... | |
146 | */ | |
147 | ||
148 | typedef struct | |
149 | { | |
58ec2a95 | 150 | /**** Standard Page Device Dictionary String Values ****/ |
151 | char MediaClass[64]; /* MediaClass string */ | |
152 | char MediaColor[64]; /* MediaColor string */ | |
153 | char MediaType[64]; /* MediaType string */ | |
154 | char OutputType[64]; /* OutputType string */ | |
155 | ||
156 | /**** Standard Page Device Dictionary Integer Values ****/ | |
8debe872 | 157 | unsigned AdvanceDistance; /* AdvanceDistance value in points */ |
cfb0ab24 | 158 | cups_adv_t AdvanceMedia; /* AdvanceMedia value (see above) */ |
159 | cups_bool_t Collate; /* Collated copies value */ | |
160 | cups_cut_t CutMedia; /* CutMedia value (see above) */ | |
161 | cups_bool_t Duplex; /* Duplexed (double-sided) value */ | |
58ec2a95 | 162 | unsigned HWResolution[2]; /* Resolution in dots-per-inch */ |
8debe872 | 163 | unsigned ImagingBoundingBox[4]; /* Pixel region that is painted (points) */ |
58ec2a95 | 164 | cups_bool_t InsertSheet; /* InsertSheet value */ |
cfb0ab24 | 165 | cups_jog_t Jog; /* Jog value (see above) */ |
58ec2a95 | 166 | cups_edge_t LeadingEdge; /* LeadingEdge value (see above) */ |
8debe872 | 167 | unsigned Margins[2]; /* Lower-lefthand margins in points */ |
cfb0ab24 | 168 | cups_bool_t ManualFeed; /* ManualFeed value */ |
cfb0ab24 | 169 | unsigned MediaPosition; /* MediaPosition value */ |
cfb0ab24 | 170 | unsigned MediaWeight; /* MediaWeight value in grams/m^2 */ |
171 | cups_bool_t MirrorPrint; /* MirrorPrint value */ | |
172 | cups_bool_t NegativePrint; /* NegativePrint value */ | |
173 | unsigned NumCopies; /* Number of copies to produce */ | |
174 | cups_orient_t Orientation; /* Orientation value (see above) */ | |
175 | cups_bool_t OutputFaceUp; /* OutputFaceUp value */ | |
8debe872 | 176 | unsigned PageSize[2]; /* Width and length of page in points */ |
cfb0ab24 | 177 | cups_bool_t Separations; /* Separations value */ |
178 | cups_bool_t TraySwitch; /* TraySwitch value */ | |
179 | cups_bool_t Tumble; /* Tumble value */ | |
cfb0ab24 | 180 | |
181 | /**** CUPS Page Device Dictionary Values ****/ | |
cb985dd0 | 182 | unsigned cupsWidth; /* Width of page image in pixels */ |
183 | unsigned cupsHeight; /* Height of page image in pixels */ | |
991a5d0d | 184 | unsigned cupsMediaType; /* Media type code */ |
58ec2a95 | 185 | unsigned cupsBitsPerColor; /* Number of bits for each color */ |
186 | unsigned cupsBitsPerPixel; /* Number of bits for each pixel */ | |
187 | unsigned cupsBytesPerLine; /* Number of bytes per line */ | |
188 | cups_order_t cupsColorOrder; /* Order of colors */ | |
189 | cups_cspace_t cupsColorSpace; /* True colorspace */ | |
991a5d0d | 190 | unsigned cupsCompression; /* Device compression to use */ |
554fab97 | 191 | unsigned cupsRowCount; /* Rows per band */ |
192 | unsigned cupsRowFeed; /* Feed between bands */ | |
193 | unsigned cupsRowStep; /* Spacing between lines */ | |
cfb0ab24 | 194 | } cups_page_header_t; |
195 | ||
196 | ||
58ec2a95 | 197 | /* |
198 | * The raster structure maintains information about a raster data | |
199 | * stream... | |
200 | */ | |
201 | ||
202 | typedef struct | |
203 | { | |
204 | unsigned sync; /* Sync word from start of stream */ | |
205 | int fd; /* File descriptor */ | |
206 | cups_mode_t mode; /* Read/write mode */ | |
207 | } cups_raster_t; | |
208 | ||
209 | ||
210 | /* | |
211 | * Prototypes... | |
212 | */ | |
213 | ||
214 | extern void cupsRasterClose(cups_raster_t *r); | |
215 | extern cups_raster_t *cupsRasterOpen(int fd, cups_mode_t mode); | |
216 | extern unsigned cupsRasterReadHeader(cups_raster_t *r, | |
217 | cups_page_header_t *h); | |
218 | extern unsigned cupsRasterReadPixels(cups_raster_t *r, | |
219 | unsigned char *p, unsigned len); | |
220 | extern unsigned cupsRasterWriteHeader(cups_raster_t *r, | |
221 | cups_page_header_t *h); | |
222 | extern unsigned cupsRasterWritePixels(cups_raster_t *r, | |
223 | unsigned char *p, unsigned len); | |
224 | ||
cb985dd0 | 225 | # ifdef __cplusplus |
226 | } | |
227 | # endif /* __cplusplus */ | |
228 | ||
cfb0ab24 | 229 | #endif /* !_CUPS_RASTER_H_ */ |
230 | ||
231 | /* | |
efb2f309 | 232 | * End of "$Id: raster.h,v 1.3 2002/01/02 17:59:01 mike Exp $". |
cfb0ab24 | 233 | */ |