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