]>
Commit | Line | Data |
---|---|---|
4744bd90 | 1 | <HTML> |
2 | <!-- SECTION: Specifications --> | |
3 | <HEAD> | |
4 | <TITLE>CUPS Raster Format</TITLE> | |
f301802f | 5 | <LINK REL="STYLESHEET" TYPE="test/css" HREF="../cups.css"> |
4744bd90 | 6 | </HEAD> |
7 | <BODY> | |
8 | ||
9 | <P>CUPS raster files are device-dependent raster image files that | |
10 | contain a PostScript page device dictionary and device-dependent | |
11 | raster imagery for each page in the document. These files are | |
12 | used to transfer raster data from the PostScript and image file | |
13 | RIPs to device-dependent filters that convert the raster data to | |
14 | a printable format.</P> | |
15 | ||
16 | <P>CUPS 1.0 and 1.1 used a version 1 raster format. CUPS 1.2 | |
ed486911 | 17 | introduces version 2 (compressed) and version 3 (uncompressed) |
18 | formats that are a superset of the version 1 format. Applications | |
19 | using the CUPS Imaging API (the cupsRaster* functions) can read | |
20 | all formats without code changes.</P> | |
4744bd90 | 21 | |
22 | <P>The registered MIME media type for CUPS raster files is | |
23 | <CODE>application/vnd.cups-raster</CODE>.</P> | |
24 | ||
25 | ||
26 | <H2 CLASS="title"><A NAME="V1">Version 1 Raster File Format</A></H2> | |
27 | ||
28 | <P>A version 1 raster file begins with a 32-bit synchronization | |
29 | word: 0x52615374 ("RaSt") for big-endian architectures and | |
30 | 0x74536152 ("tSaR") for little-endian architectures. The writer | |
31 | of the raster file will use the native word order, and the reader | |
32 | is responsible for detecting a reversed word order file and | |
33 | swapping bytes as needed. The CUPS Imaging API raster functions | |
34 | perform this function automatically.</P> | |
35 | ||
36 | <P>Following the synchronization word are a series of raster | |
37 | pages. Each page starts with a page device dictionary header and | |
38 | is followed immediately by the (uncompressed, raw) raster data | |
39 | for that page.</P> | |
40 | ||
41 | <DIV CLASS="table"><TABLE SUMMARY="CUPS Version 1 Raster Page Device Dictionary"> | |
f301802f | 42 | <CAPTION><A NAME="TABLE1">Table 1: CUPS Version 1 Raster Page Device Dictionary</A></CAPTION> |
43 | <THEAD> | |
4744bd90 | 44 | <TR> |
45 | <TH>Bytes</TH> | |
46 | <TH>Type</TH> | |
47 | <TH>Description</TH> | |
48 | <TH>Values</TH> | |
49 | </TR> | |
f301802f | 50 | </THEAD> |
51 | <TBODY> | |
4744bd90 | 52 | <TR> |
53 | <TD>0-63</TD> | |
54 | <TD>C String</TD> | |
55 | <TD>MediaClass</TD> | |
56 | <TD>Media class string</TD> | |
57 | </TR> | |
58 | <TR> | |
59 | <TD>64-127</TD> | |
60 | <TD>C String</TD> | |
61 | <TD>MediaColor</TD> | |
62 | <TD>Media color string</TD> | |
63 | </TR> | |
64 | <TR> | |
65 | <TD>128-191</TD> | |
66 | <TD>C String</TD> | |
67 | <TD>MediaType</TD> | |
68 | <TD>Media type string</TD> | |
69 | </TR> | |
70 | <TR> | |
71 | <TD>192-255</TD> | |
72 | <TD>C String</TD> | |
73 | <TD>OutputType</TD> | |
74 | <TD>Output type string</TD> | |
75 | </TR> | |
76 | <TR> | |
77 | <TD>256-259</TD> | |
78 | <TD>Unsigned Integer</TD> | |
79 | <TD>AdvanceDistance</TD> | |
80 | <TD>0 to 2<SUP>32</SUP> - 1 points</TD> | |
81 | </TR> | |
82 | <TR> | |
83 | <TD>260-263</TD> | |
84 | <TD>Unsigned Integer</TD> | |
85 | <TD>AdvanceMedia</TD> | |
86 | <TD>0 = Never advance roll<BR> | |
87 | 1 = Advance roll after file<BR> | |
88 | 2 = Advance roll after job<BR> | |
89 | 3 = Advance roll after set<BR> | |
90 | 4 = Advance roll after page</TD> | |
91 | </TR> | |
92 | <TR> | |
93 | <TD>264-267</TD> | |
94 | <TD>Unsigned Integer</TD> | |
95 | <TD>Collate</TD> | |
96 | <TD>0 = do not collate copies<BR> | |
97 | 1 = collate copies</TD> | |
98 | </TR> | |
99 | <TR> | |
100 | <TD>268-271</TD> | |
101 | <TD>Unsigned Integer</TD> | |
102 | <TD>CutMedia</TD> | |
103 | <TD>0 = Never cut media<BR> | |
104 | 1 = Cut roll after file<BR> | |
105 | 2 = Cut roll after job<BR> | |
106 | 3 = Cut roll after set<BR> | |
107 | 4 = Cut roll after page</TD> | |
108 | </TR> | |
109 | <TR> | |
110 | <TD>272-275</TD> | |
111 | <TD>Unsigned Integer</TD> | |
112 | <TD>Duplex</TD> | |
113 | <TD>0 = Print single-sided<BR> | |
114 | 1 = Print double-sided</TD> | |
115 | </TR> | |
116 | <TR> | |
117 | <TD>276-283</TD> | |
118 | <TD>Unsigned Integers (2)</TD> | |
119 | <TD>HWResolution</TD> | |
120 | <TD>Horizontal and vertical resolution in dots-per-inch.</TD> | |
121 | </TR> | |
122 | <TR> | |
123 | <TD>284-299</TD> | |
124 | <TD>Unsigned Integers (4)</TD> | |
125 | <TD>ImagingBoundingBox</TD> | |
126 | <TD>Four integers giving the left, bottom, right, and top positions | |
127 | of the page bounding box in points</TD> | |
128 | </TR> | |
129 | <TR> | |
130 | <TD>300-303</TD> | |
131 | <TD>Unsigned Integer</TD> | |
132 | <TD>InsertSheet</TD> | |
133 | <TD>0 = Do not insert separator sheets<BR> | |
134 | 1 = Insert separator sheets</TD> | |
135 | </TR> | |
136 | <TR> | |
137 | <TD>304-307</TD> | |
138 | <TD>Unsigned Integer</TD> | |
139 | <TD>Jog</TD> | |
140 | <TD>0 = Do no jog pages<BR> | |
141 | 1 = Jog pages after file<BR> | |
142 | 2 = Jog pages after job<BR> | |
143 | 3 = Jog pages after set</TD> | |
144 | </TR> | |
145 | <TR> | |
146 | <TD>308-311</TD> | |
147 | <TD>Unsigned Integer</TD> | |
148 | <TD>LeadingEdge</TD> | |
149 | <TD>0 = Top edge is first<BR> | |
150 | 1 = Right edge is first<BR> | |
151 | 2 = Bottom edge is first<BR> | |
152 | 3 = Left edge is first</TD> | |
153 | </TR> | |
154 | <TR> | |
155 | <TD>312-319</TD> | |
156 | <TD>Unsigned Integers (2)</TD> | |
157 | <TD>Margins</TD> | |
158 | <TD>Left and bottom origin of image in points</TD> | |
159 | </TR> | |
160 | <TR> | |
161 | <TD>320-323</TD> | |
162 | <TD>Unsigned Integer</TD> | |
163 | <TD>ManualFeed</TD> | |
164 | <TD>0 = Do not manually feed media<BR> | |
165 | 1 = Manually feed media</TD> | |
166 | </TR> | |
167 | <TR> | |
168 | <TD>324-327</TD> | |
169 | <TD>Unsigned Integer</TD> | |
170 | <TD>MediaPosition</TD> | |
171 | <TD>Input slot position from 0 to N</TD> | |
172 | </TR> | |
173 | <TR> | |
174 | <TD>328-331</TD> | |
175 | <TD>Unsigned Integer</TD> | |
176 | <TD>MediaWeight</TD> | |
177 | <TD>Media weight in grams per meter squared</TD> | |
178 | </TR> | |
179 | <TR> | |
180 | <TD>332-335</TD> | |
181 | <TD>Unsigned Integer</TD> | |
182 | <TD>MirrorPrint</TD> | |
183 | <TD>0 = Do not mirror prints<BR> | |
184 | 1 = Mirror prints</TD> | |
185 | </TR> | |
186 | <TR> | |
187 | <TD>336-339</TD> | |
188 | <TD>Unsigned Integer</TD> | |
189 | <TD>NegativePrint</TD> | |
190 | <TD>0 = Do not invert prints<BR> | |
191 | 1 = Invert prints</TD> | |
192 | </TR> | |
193 | <TR> | |
194 | <TD>340-343</TD> | |
195 | <TD>Unsigned Integer</TD> | |
196 | <TD>NumCopies</TD> | |
197 | <TD>1 to 2<SUP>32</SUP> - 1</TD> | |
198 | </TR> | |
199 | <TR> | |
200 | <TD>344-347</TD> | |
201 | <TD>Unsigned Integer</TD> | |
202 | <TD>Orientation</TD> | |
203 | <TD>0 = Do not rotate page<BR> | |
204 | 1 = Rotate page counter-clockwise<BR> | |
205 | 2 = Turn page upside down<BR> | |
206 | 3 = Rotate page clockwise</TD> | |
207 | </TR> | |
208 | <TR> | |
209 | <TD>348-351</TD> | |
210 | <TD>Unsigned Integer</TD> | |
211 | <TD>OutputFaceUp</TD> | |
212 | <TD>0 = Output face down<BR> | |
213 | 1 = Output face up</TD> | |
214 | </TR> | |
215 | <TR> | |
216 | <TD>352-359</TD> | |
217 | <TD>Unsigned Integers (2)</TD> | |
218 | <TD>PageSize</TD> | |
219 | <TD>Width and length in points</TD> | |
220 | </TR> | |
221 | <TR> | |
222 | <TD>360-363</TD> | |
223 | <TD>Unsigned Integer</TD> | |
224 | <TD>Separations</TD> | |
225 | <TD>0 = Print composite image<BR> | |
226 | 1 = Print color separations</TD> | |
227 | </TR> | |
228 | <TR> | |
229 | <TD>364-367</TD> | |
230 | <TD>Unsigned Integer</TD> | |
231 | <TD>TraySwitch</TD> | |
232 | <TD>0 = Do not change trays if selected tray is empty<BR> | |
233 | 1 = Change trays if selected tray is empty</TD> | |
234 | </TR> | |
235 | <TR> | |
236 | <TD>368-371</TD> | |
237 | <TD>Unsigned Integer</TD> | |
238 | <TD>Tumble</TD> | |
239 | <TD>0 = Do not rotate even pages when duplexing<BR> | |
240 | 1 = Rotate even pages when duplexing</TD> | |
241 | </TR> | |
242 | <TR> | |
243 | <TD>372-375</TD> | |
244 | <TD>Unsigned Integer</TD> | |
245 | <TD>cupsWidth</TD> | |
246 | <TD>Width of page image in pixels</TD> | |
247 | </TR> | |
248 | <TR> | |
249 | <TD>376-379</TD> | |
250 | <TD>Unsigned Integer</TD> | |
251 | <TD>cupsHeight</TD> | |
252 | <TD>Height of page image in pixels</TD> | |
253 | </TR> | |
254 | <TR> | |
255 | <TD>380-383</TD> | |
256 | <TD>Unsigned Integer</TD> | |
257 | <TD>cupsMediaType</TD> | |
258 | <TD>Driver-specific 0 to 2<SUP>32</SUP> - 1</TD> | |
259 | </TR> | |
260 | <TR> | |
261 | <TD>384-387</TD> | |
262 | <TD>Unsigned Integer</TD> | |
263 | <TD>cupsBitsPerColor</TD> | |
264 | <TD>1, 2, 4, 8 bits for version 1 raster files<BR> | |
265 | 1, 2, 4, 8, and 16 bits for version 2 raster files</TD> | |
266 | </TR> | |
267 | <TR> | |
268 | <TD>388-391</TD> | |
269 | <TD>Unsigned Integer</TD> | |
270 | <TD>cupsBitsPerPixel</TD> | |
271 | <TD>1 to 32 bits for version 1 raster files<BR> | |
272 | 1 to 64 bits for version 2 raster files</TD> | |
273 | </TR> | |
274 | <TR> | |
275 | <TD>392-395</TD> | |
276 | <TD>Unsigned Integer</TD> | |
277 | <TD>cupsBytesPerLine</TD> | |
278 | <TD>1 to 2<SUP>32</SUP> - 1 bytes</TD> | |
279 | </TR> | |
280 | <TR> | |
281 | <TD>396-399</TD> | |
282 | <TD>Unsigned Integer</TD> | |
283 | <TD>cupsColorOrder</TD> | |
284 | <TD>0 = chunky pixels (CMYK CMYK CMYK)<BR> | |
285 | 1 = banded pixels (CCC MMM YYY KKK)<BR> | |
286 | 2 = planar pixels (CCC... MMM... YYY... KKK...)</TD> | |
287 | </TR> | |
288 | <TR> | |
289 | <TD>400-403</TD> | |
290 | <TD>Unsigned Integer</TD> | |
291 | <TD>cupsColorSpace</TD> | |
f301802f | 292 | <TD>0 = white (sRGB)<BR> |
293 | 1 = RGB (sRGB)<BR> | |
294 | 2 = RGBA (sRGB)<BR> | |
4744bd90 | 295 | 3 = black<BR> |
296 | 4 = CMY<BR> | |
297 | 5 = YMC<BR> | |
298 | 6 = CMYK<BR> | |
299 | 7 = YMCK<BR> | |
300 | 8 = KCMY<BR> | |
301 | 9 = KCMYcm<BR> | |
302 | 10 = GMCK<BR> | |
303 | 11 = GMCS<BR> | |
304 | 12 = WHITE<BR> | |
305 | 13 = GOLD<BR> | |
306 | 14 = SILVER<BR> | |
307 | 15 = CIE XYZ<BR> | |
308 | 16 = CIE Lab<BR> | |
f301802f | 309 | 17 = RGBW (sRGB)<BR> |
310 | 32 = ICC1 (CIE Lab with hint for 1 color)<BR> | |
311 | 33 = ICC2 (CIE Lab with hint for 2 colors)<BR> | |
312 | 34 = ICC3 (CIE Lab with hint for 3 colors)<BR> | |
313 | 35 = ICC4 (CIE Lab with hint for 4 colors)<BR> | |
314 | 36 = ICC5 (CIE Lab with hint for 5 colors)<BR> | |
315 | 37 = ICC6 (CIE Lab with hint for 6 colors)<BR> | |
316 | 38 = ICC7 (CIE Lab with hint for 7 colors)<BR> | |
317 | 39 = ICC8 (CIE Lab with hint for 8 colors)<BR> | |
318 | 40 = ICC9 (CIE Lab with hint for 9 colors)<BR> | |
319 | 41 = ICCA (CIE Lab with hint for 10 colors)<BR> | |
320 | 42 = ICCB (CIE Lab with hint for 11 colors)<BR> | |
321 | 43 = ICCC (CIE Lab with hint for 12 colors)<BR> | |
322 | 44 = ICCD (CIE Lab with hint for 13 colors)<BR> | |
323 | 45 = ICCE (CIE Lab with hint for 14 colors)<BR> | |
324 | 46 = ICCF (CIE Lab with hint for 15 colors)<BR> | |
4744bd90 | 325 | </TD> |
326 | </TR> | |
327 | <TR> | |
328 | <TD>404-407</TD> | |
329 | <TD>Unsigned Integer</TD> | |
330 | <TD>cupsCompression</TD> | |
331 | <TD>Driver-specific 0 to 2<SUP>32</SUP> - 1</TD> | |
332 | </TR> | |
333 | <TR> | |
334 | <TD>408-411</TD> | |
335 | <TD>Unsigned Integer</TD> | |
336 | <TD>cupsRowCount</TD> | |
337 | <TD>Driver-specific 0 to 2<SUP>32</SUP> - 1</TD> | |
338 | </TR> | |
339 | <TR> | |
340 | <TD>412-415</TD> | |
341 | <TD>Unsigned Integer</TD> | |
342 | <TD>cupsRowFeed</TD> | |
343 | <TD>Driver-specific 0 to 2<SUP>32</SUP> - 1</TD> | |
344 | </TR> | |
345 | <TR> | |
346 | <TD>416-419</TD> | |
347 | <TD>Unsigned Integer</TD> | |
348 | <TD>cupsRowStep</TD> | |
349 | <TD>Driver-specific 0 to 2<SUP>32</SUP> - 1</TD> | |
350 | </TR> | |
f301802f | 351 | </TBODY> |
4744bd90 | 352 | </TABLE></DIV> |
353 | ||
354 | ||
355 | <H2 CLASS="title"><A NAME="V2">Version 2 Raster File Format</A></H2> | |
356 | ||
357 | <P>A version 2 raster file begins with a 32-bit synchronization | |
358 | word: 0x52615332 ("RaS2") for big-endian architectures and | |
359 | 0x32536152 ("2SaR") for little-endian architectures. The writer | |
360 | of the raster file will use the native word order, and the reader | |
361 | is responsible for detecting a reversed word order file and | |
362 | swapping bytes as needed. The CUPS Imaging API raster functions | |
363 | perform this function automatically.</P> | |
364 | ||
365 | <P>Following the synchronization word are a series of raster | |
366 | pages. Each page starts with a version 2 page device dictionary | |
367 | header and is followed immediately by the compressed raster data | |
368 | for that page.</P> | |
369 | ||
370 | <DIV CLASS="table"><TABLE SUMMARY="CUPS Version 2 Raster Page Device Dictionary"> | |
f301802f | 371 | <CAPTION><A NAME="TABLE2">Table 2: CUPS Version 2 Raster Page Device Dictionary</A></CAPTION> |
372 | <THEAD> | |
4744bd90 | 373 | <TR> |
374 | <TH>Bytes</TH> | |
375 | <TH>Type</TH> | |
376 | <TH>Description</TH> | |
377 | <TH>Values</TH> | |
378 | </TR> | |
f301802f | 379 | </THEAD> |
380 | <TBODY> | |
4744bd90 | 381 | <TR> |
382 | <TD>0-419</TD> | |
383 | <TD>Version 1 header data</TD> | |
384 | <TD>See Table 1</TD> | |
385 | </TR> | |
386 | <TR> | |
387 | <TD>420-423</TD> | |
388 | <TD>Unsigned Integer</TD> | |
389 | <TD>cupsNumColors</TD> | |
390 | <TD>1 to 6 colors</TD> | |
391 | </TR> | |
392 | <TR> | |
393 | <TD>424-427</TD> | |
394 | <TD>IEEE Single Precision</TD> | |
395 | <TD>cupsBorderlessScalingFactor</TD> | |
396 | <TD>0.0 or 1.0 or greater</TD> | |
397 | </TR> | |
398 | <TR> | |
399 | <TD>428-435</TD> | |
400 | <TD>IEEE Single Precision (2)</TD> | |
401 | <TD>cupsPageSize</TD> | |
402 | <TD>Width and length in points</TD> | |
403 | </TR> | |
404 | <TR> | |
405 | <TD>436-451</TD> | |
406 | <TD>IEEE Single Precision (4)</TD> | |
407 | <TD>cupsImagingBBox</TD> | |
408 | <TD>Four floating point numbers giving the left, bottom, | |
409 | right, and top positions of the page bounding box in | |
410 | points</TD> | |
411 | </TR> | |
412 | <TR> | |
413 | <TD>452-515</TD> | |
414 | <TD>Unsigned Integers (16)</TD> | |
415 | <TD>cupsInteger</TD> | |
416 | <TD>16 driver-defined integer values</TD> | |
417 | </TR> | |
418 | <TR> | |
419 | <TD>516-579</TD> | |
420 | <TD>IEEE Single Precision (16)</TD> | |
421 | <TD>cupsReal</TD> | |
422 | <TD>16 driver-defined floating point values</TD> | |
423 | </TR> | |
424 | <TR> | |
425 | <TD>580-1603</TD> | |
426 | <TD>C Strings (16x64)</TD> | |
427 | <TD>cupsString</TD> | |
428 | <TD>16 driver-defined strings</TD> | |
429 | </TR> | |
430 | <TR> | |
431 | <TD>1604-1667</TD> | |
432 | <TD>C String</TD> | |
433 | <TD>cupsMarkerType</TD> | |
434 | <TD>Ink/toner type string</TD> | |
435 | </TR> | |
436 | <TR> | |
437 | <TD>1668-1731</TD> | |
438 | <TD>C String</TD> | |
439 | <TD>cupsRenderingIntent</TD> | |
440 | <TD>Color rendering intent string</TD> | |
441 | </TR> | |
442 | <TR> | |
443 | <TD>1732-1795</TD> | |
444 | <TD>C String</TD> | |
445 | <TD>cupsPageSizeName</TD> | |
446 | <TD>Page size name/keyword string from PPD</TD> | |
447 | </TR> | |
f301802f | 448 | </TBODY> |
4744bd90 | 449 | </TABLE></DIV> |
450 | ||
451 | <H3><A NAME="COMPRESSION">Compressed Raster Data Format</A></H3> | |
452 | ||
453 | <P>The version 2 raster data is compressed using a modified TIFF | |
454 | packbits algorithm. Lines are grouped into an integral number of | |
455 | color values based upon the <CODE>cupsColorOrder</CODE> | |
456 | setting:</P> | |
457 | ||
458 | <DIV CLASS="table"><TABLE SUMMARY="Color Value Sizes"> | |
f301802f | 459 | <CAPTION><A NAME="TABLE3">Table 3: Color Value Sizes</A></CAPTION> |
4744bd90 | 460 | <TR> |
461 | <TH>cupsColorOrder</TH> | |
462 | <TH>Bytes per color value</TH> | |
463 | </TR> | |
464 | <TR> | |
465 | <TD>0 (chunky)</TD> | |
466 | <TD>(<CODE>cupsBitsPerPixel</CODE> + 7) / 8</TD> | |
467 | </TR> | |
468 | <TR> | |
469 | <TD>1 (banded)</TD> | |
470 | <TD>(<CODE>cupsBitsPerColor</CODE> + 7) / 8</TD> | |
471 | </TR> | |
472 | <TR> | |
473 | <TD>2 (planar)</TD> | |
474 | <TD>(<CODE>cupsBitsPerColor</CODE> + 7) / 8</TD> | |
475 | </TR> | |
476 | </TABLE></DIV> | |
477 | ||
478 | <P>Each line of raster data begins with a repetition count from 1 | |
479 | to 256 that is encoded using a single byte of "count - 1".</P> | |
480 | ||
481 | <P>After the repetition count, whole color values for that line | |
482 | are run-length encoded using the TIFF packbits algorithm. 1 to | |
483 | 128 repeated colors are encoded using an initial byte of "count - | |
484 | 1" followed by the color value byte(s). 2 to 128 non-repeating | |
485 | colors are encoded using an initial byte of "257 - count" | |
486 | followed by the color value bytes.</P> | |
487 | ||
488 | ||
ed486911 | 489 | <H2 CLASS="title"><A NAME="V3">Version 3 Raster File Format</A></H2> |
490 | ||
491 | <P>A version 3 raster file begins with a 32-bit synchronization | |
492 | word: 0x52615333 ("RaS3") for big-endian architectures and | |
493 | 0x33536152 ("3SaR") for little-endian architectures. The writer | |
494 | of the raster file will use the native word order, and the reader | |
495 | is responsible for detecting a reversed word order file and | |
496 | swapping bytes as needed. The CUPS Imaging API raster functions | |
497 | perform this function automatically.</P> | |
498 | ||
499 | <P>Following the synchronization word are a series of raster | |
500 | pages. Each page starts with a version 2 page device dictionary | |
501 | header and is followed immediately by the uncompressed raster data | |
502 | for that page.</P> | |
503 | ||
504 | ||
f301802f | 505 | <H2 CLASS="title"><A NAME="ENCODING">Pixel Value Coding</A></H2> |
506 | ||
507 | <P>The following sections describe the encoding and decoding of | |
508 | the color values in a CUPS raster file. In general, colors are | |
509 | packed into the minimum number of bytes, with special | |
510 | consideration provided for efficiency of encoding and access. | |
511 | Multi-byte values are stored in the native byte order and | |
512 | automatically swapped as needed when reading them using the CUPS | |
513 | imaging API.</P> | |
514 | ||
515 | <H3>CUPS_ORDER_CHUNKED</H3> | |
516 | ||
517 | <P>The chunked order provides the pixel value packed in a single | |
518 | place. Pixel values with 8 or more bits per color are stored as | |
519 | an array of colors in order, e.g. for | |
520 | <CODE>CUPS_CSPACE_RGB</CODE> you will see 8/16-bits of red, then | |
521 | blue, then green, then red, green, blue, etc. Pixel values with | |
522 | less than 8 bits per color are packed together as shown in Table | |
523 | 4. <I>Multi-byte pixel values are stored in the native word | |
524 | order, just as for 16-bit color values.</I></P> | |
525 | ||
526 | <DIV CLASS="table"><TABLE SUMMARY="Chunked Color Values"> | |
527 | <CAPTION><A NAME="TABLE4">Table 4: Chunked Color Values</A></CAPTION> | |
528 | <THEAD> | |
529 | <TR> | |
530 | <TH>Bits</TH> | |
531 | <TH>1-color</TH> | |
532 | <TH>3-color</TH> | |
533 | <TH>4-color</TH> | |
534 | <TH>6-color</TH> | |
535 | </TR> | |
536 | </THEAD> | |
537 | <TBODY> | |
538 | <TR> | |
539 | <TD>1</TD> | |
540 | <TD>W/W/W/W/W/W/W/W</TD> | |
541 | <TD>0RGB/0RGB</TD> | |
542 | <TD>CMYK/CMYK</TD> | |
543 | <TD>00KCMYcm</TD> | |
544 | </TR> | |
545 | <TR> | |
546 | <TD>2</TD> | |
547 | <TD>WW/WW/WW/WW</TD> | |
548 | <TD>00RRGGBB</TD> | |
549 | <TD>CCMMYYKK</TD> | |
550 | <TD>N/A</TD> | |
551 | </TR> | |
552 | <TR> | |
553 | <TD>4</TD> | |
554 | <TD>WWWW/WWWW</TD> | |
555 | <TD>0000RRRRGGGGBBBB<BR> | |
556 | <I>(multi-byte)</I></TD> | |
557 | <TD>CCCCMMMMYYYYKKKK<BR> | |
558 | <I>(multi-byte)</I></TD> | |
559 | <TD>N/A</TD> | |
560 | </TR> | |
561 | </TBODY> | |
562 | </TABLE></DIV> | |
563 | ||
564 | <H3>CUPS_ORDER_BANDED</H3> | |
565 | ||
566 | <P>The banded order provides each color as a separate line of | |
567 | data. Each color plane for a line is written in sequence, e.g. | |
568 | for the <CODE>CUPS_CSPACE_CMYK</CODE> colorspace you would see | |
569 | all of the cyan pixels for a line followed by the magenta, | |
570 | yellow, and black pixels for that line. This is repeated for all | |
571 | of the lines on the page. Color values are packed starting with | |
572 | the most-significant bit (MSB) first.</P> | |
573 | ||
574 | <H3>CUPS_ORDER_PLANAR</H3> | |
575 | ||
576 | <P>The planar order provides each color as a separate page of | |
577 | data using a shared page header. Each color plane for a page is | |
578 | written in sequence, e.g. for the <CODE>CUPS_CSPACE_CMYK</CODE> | |
579 | colorspace you would see all of the cyan pixels for a page | |
580 | followed by the magenta, yellow, and black pixels for that page. | |
581 | Color values are packed starting with the most-significant bit | |
582 | (MSB) first. Each line starts on an 8-bit boundary.</P> | |
583 | ||
584 | <H3>CUPS_CSPACE_W, CUPS_CSPACE_RGB, CUPS_CSPACE_RGBA, and | |
585 | CUPS_CSPACE_RGBW</H3> | |
586 | ||
587 | <P>These colorspaces use the sRGB colorspace definition and | |
588 | whitepoint.</P> | |
589 | ||
590 | <H3>CUPS_CSPACE_KCMYcm</H3> | |
591 | ||
592 | <P>When <CODE>cupsBitsPerColor</CODE> is 1, 6 color planes are | |
593 | provided - black, cyan, magenta, yellow, light cyan, and light | |
594 | magenta. When <CODE>cupsBitsPerColor</CODE> is greater than 1, 4 | |
595 | color planes are provided using the <CODE>CUPS_CSPACE_KCMY</CODE> | |
596 | colorspace instead.</P> | |
597 | ||
598 | <P>When <CODE>cupsColorOrder</CODE> is | |
599 | <CODE>CUPS_ORDER_CHUNKED</CODE>, bit 5 corresponds to black and | |
600 | bit 0 corresponds to light magenta. For | |
601 | <CODE>CUPS_ORDER_BANDED</CODE> and | |
602 | <CODE>CUPS_ORDER_PLANAR</CODE>, each color plane is encoded | |
603 | separately.</P> | |
604 | ||
605 | <H3>CUPS_CSPACE_CIELab and CUPS_CSPACE_ICCn</H3> | |
606 | ||
607 | <P>These colorspaces map a CIE Lab color value with a D65 | |
608 | whitepoint to either a 8- or 16-bit per color chunked | |
609 | (<CODE>CUPS_ORDER_CHUNKED</CODE>) format; the banded | |
610 | (<CODE>CUPS_ORDER_BANDED</CODE>) and planar | |
611 | (<CODE>CUPS_ORDER_PLANAR</CODE>) color orders are not | |
612 | supported.</P> | |
613 | ||
614 | <P>The values are encoded and decoded using the following | |
615 | formulas:</P> | |
616 | ||
617 | <UL> | |
618 | ||
619 | <LI>8-bit Encoding:<BR> | |
620 | <I>L8 = 2.55 * L + 0.5<BR> | |
621 | a8 = a + 128.5<BR> | |
622 | b8 = b + 128.5<BR> | |
623 | </I></LI> | |
624 | ||
625 | <LI>8-bit Decoding:<BR> | |
626 | <I>L = L8 / 2.55<BR> | |
627 | a = a8 - 128<BR> | |
628 | b = b8 - 128<BR> | |
629 | </I></LI> | |
630 | ||
631 | <LI>16-bit Encoding:<BR> | |
632 | <I>L16 = 655.35 * L + 0.5<BR> | |
633 | a16 = 256 * (a + 128) + 0.5<BR> | |
634 | b16 = 256 * (b + 128) + 0.5<BR> | |
635 | </I></LI> | |
636 | ||
637 | <LI>16-bit Decoding:<BR> | |
638 | <I>L = L16 / 655.35<BR> | |
639 | a = a16 / 256 - 128<BR> | |
640 | b = b16 / 256 - 128<BR> | |
641 | </I></LI> | |
642 | ||
643 | </UL> | |
644 | ||
645 | <H3>CUPS_CSPACE_CIEXYZ</H3> | |
646 | ||
647 | <P>These colorspaces map a CIE XYZ color value with a D65 | |
648 | whitepoint to either a 8- or 16-bit per color chunked | |
649 | (<CODE>CUPS_ORDER_CHUNKED</CODE>) format; the banded | |
650 | (<CODE>CUPS_ORDER_BANDED</CODE>) and planar | |
651 | (<CODE>CUPS_ORDER_PLANAR</CODE>) color orders are not | |
652 | supported.</P> | |
653 | ||
654 | <P>The values are encoded and decoded using the following | |
655 | formulas:</P> | |
656 | ||
657 | <UL> | |
658 | ||
659 | <LI>8-bit Encoding:<BR> | |
660 | <I>X8 = 231.8181 * X + 0.5<BR> | |
661 | Y8 = 231.8181 * Y + 0.5<BR> | |
662 | Z8 = 231.8181 * Z + 0.5<BR> | |
663 | </I></LI> | |
664 | ||
665 | <LI>8-bit Decoding:<BR> | |
666 | <I>X = X8 / 231.8181<BR> | |
667 | Y = Y8 / 231.8181<BR> | |
668 | Z = Z8 / 231.8181<BR> | |
669 | </I></LI> | |
670 | ||
671 | <LI>16-bit Encoding:<BR> | |
672 | <I>X16 = 59577.2727 * X + 0.5<BR> | |
673 | Y16 = 59577.2727 * Y + 0.5<BR> | |
674 | Z16 = 59577.2727 * Z + 0.5<BR> | |
675 | </I></LI> | |
676 | ||
677 | <LI>16-bit Decoding:<BR> | |
678 | <I>X = X16 / 59577.2727<BR> | |
679 | Y = Y16 / 59577.2727<BR> | |
680 | Z = Z16 / 59577.2727<BR> | |
681 | </I></LI> | |
682 | ||
683 | </UL> | |
684 | ||
685 | <P>The scaling factor for XYZ values is 1/1.1, or 231.8181 for | |
686 | 8-bit values and 59577.2727 for 16-bit values. This allows for a | |
687 | slight overflow of XYZ values when converting from RGB, improving | |
688 | accuracy.</P> | |
689 | ||
4744bd90 | 690 | |
691 | <H2 CLASS="title"><A NAME="HISTORY">Change History</A></H2> | |
692 | ||
ed486911 | 693 | <H3>Changes in CUPS 1.2.2</H3> |
694 | ||
695 | <ul> | |
696 | ||
697 | <li>Added version 3 (uncompressed) format.</li> | |
698 | ||
699 | </ul> | |
700 | ||
701 | ||
f301802f | 702 | <H3>Changes in CUPS 1.2.1</H3> |
703 | ||
704 | <ul> | |
705 | ||
706 | <li>Added new sections on coding pixel values.</li> | |
707 | ||
708 | <li>Clarified definitions of color spaces.</li> | |
709 | ||
710 | </ul> | |
711 | ||
712 | ||
4744bd90 | 713 | <H3>Changes in CUPS 1.2</H3> |
714 | ||
715 | <ul> | |
716 | ||
717 | <li>Bumped raster version to 2</li> | |
718 | ||
719 | <li>Added RGBW colorspace</li> | |
720 | ||
721 | <li>Added 16 bit per color support</li> | |
722 | ||
723 | <li>Added cupsNumColors, cupsBorderlessScalingFactor, | |
724 | cupsPageSize, cupsImagingBBox, cupsInteger, cupsReal, | |
725 | cupsString, cupsMarkerType, cupsRenderingIntent, and | |
726 | cupsPageSizeName attributes to the page device | |
727 | dictionary</li> | |
728 | ||
729 | <li>Added raster data compression</li> | |
730 | ||
731 | <li>Added data type column to device dictionary | |
732 | documentation.</li> | |
733 | ||
734 | </ul> | |
735 | ||
736 | <h3>Changes in CUPS 1.1.19</h3> | |
737 | ||
738 | <ul> | |
739 | ||
740 | <li>Added ICC and CIE colorspaces.</li> | |
741 | ||
742 | </ul> | |
743 | ||
744 | </BODY> | |
745 | </HTML> |