2 <!-- SECTION: Specifications -->
4 <TITLE>CUPS Raster Format
</TITLE>
8 <P>CUPS raster files are device-dependent raster image files that
9 contain a PostScript page device dictionary and device-dependent
10 raster imagery for each page in the document. These files are
11 used to transfer raster data from the PostScript and image file
12 RIPs to device-dependent filters that convert the raster data to
13 a printable format.
</P>
15 <P>CUPS
1.0 and
1.1 used a version
1 raster format. CUPS
1.2
16 introduces a version
2 format that is a superset of the version
1
17 format. Applications using the CUPS Imaging API (the cupsRaster*
18 functions) can read both formats without code changes.
</P>
20 <P>The registered MIME media type for CUPS raster files is
21 <CODE>application/vnd.cups-raster
</CODE>.
</P>
24 <H2 CLASS=
"title"><A NAME=
"V1">Version
1 Raster File Format
</A></H2>
26 <P>A version
1 raster file begins with a
32-bit synchronization
27 word:
0x52615374 (
"RaSt") for big-endian architectures and
28 0x74536152 (
"tSaR") for little-endian architectures. The writer
29 of the raster file will use the native word order, and the reader
30 is responsible for detecting a reversed word order file and
31 swapping bytes as needed. The CUPS Imaging API raster functions
32 perform this function automatically.
</P>
34 <P>Following the synchronization word are a series of raster
35 pages. Each page starts with a page device dictionary header and
36 is followed immediately by the (uncompressed, raw) raster data
39 <DIV CLASS=
"table"><TABLE SUMMARY=
"CUPS Version 1 Raster Page Device Dictionary">
40 <CAPTION>Table
1: CUPS Version
1 Raster Page Device Dictionary
</CAPTION>
51 <TD>Media class string
</TD>
57 <TD>Media color string
</TD>
63 <TD>Media type string
</TD>
69 <TD>Output type string
</TD>
73 <TD>Unsigned Integer
</TD>
74 <TD>AdvanceDistance
</TD>
75 <TD>0 to
2<SUP>32</SUP> -
1 points
</TD>
79 <TD>Unsigned Integer
</TD>
81 <TD>0 = Never advance roll
<BR>
82 1 = Advance roll after file
<BR>
83 2 = Advance roll after job
<BR>
84 3 = Advance roll after set
<BR>
85 4 = Advance roll after page
</TD>
89 <TD>Unsigned Integer
</TD>
91 <TD>0 = do not collate copies
<BR>
92 1 = collate copies
</TD>
96 <TD>Unsigned Integer
</TD>
98 <TD>0 = Never cut media
<BR>
99 1 = Cut roll after file
<BR>
100 2 = Cut roll after job
<BR>
101 3 = Cut roll after set
<BR>
102 4 = Cut roll after page
</TD>
106 <TD>Unsigned Integer
</TD>
108 <TD>0 = Print single-sided
<BR>
109 1 = Print double-sided
</TD>
113 <TD>Unsigned Integers (
2)
</TD>
114 <TD>HWResolution
</TD>
115 <TD>Horizontal and vertical resolution in dots-per-inch.
</TD>
119 <TD>Unsigned Integers (
4)
</TD>
120 <TD>ImagingBoundingBox
</TD>
121 <TD>Four integers giving the left, bottom, right, and top positions
122 of the page bounding box in points
</TD>
126 <TD>Unsigned Integer
</TD>
128 <TD>0 = Do not insert separator sheets
<BR>
129 1 = Insert separator sheets
</TD>
133 <TD>Unsigned Integer
</TD>
135 <TD>0 = Do no jog pages
<BR>
136 1 = Jog pages after file
<BR>
137 2 = Jog pages after job
<BR>
138 3 = Jog pages after set
</TD>
142 <TD>Unsigned Integer
</TD>
144 <TD>0 = Top edge is first
<BR>
145 1 = Right edge is first
<BR>
146 2 = Bottom edge is first
<BR>
147 3 = Left edge is first
</TD>
151 <TD>Unsigned Integers (
2)
</TD>
153 <TD>Left and bottom origin of image in points
</TD>
157 <TD>Unsigned Integer
</TD>
159 <TD>0 = Do not manually feed media
<BR>
160 1 = Manually feed media
</TD>
164 <TD>Unsigned Integer
</TD>
165 <TD>MediaPosition
</TD>
166 <TD>Input slot position from
0 to N
</TD>
170 <TD>Unsigned Integer
</TD>
172 <TD>Media weight in grams per meter squared
</TD>
176 <TD>Unsigned Integer
</TD>
178 <TD>0 = Do not mirror prints
<BR>
179 1 = Mirror prints
</TD>
183 <TD>Unsigned Integer
</TD>
184 <TD>NegativePrint
</TD>
185 <TD>0 = Do not invert prints
<BR>
186 1 = Invert prints
</TD>
190 <TD>Unsigned Integer
</TD>
192 <TD>1 to
2<SUP>32</SUP> -
1</TD>
196 <TD>Unsigned Integer
</TD>
198 <TD>0 = Do not rotate page
<BR>
199 1 = Rotate page counter-clockwise
<BR>
200 2 = Turn page upside down
<BR>
201 3 = Rotate page clockwise
</TD>
205 <TD>Unsigned Integer
</TD>
206 <TD>OutputFaceUp
</TD>
207 <TD>0 = Output face down
<BR>
208 1 = Output face up
</TD>
212 <TD>Unsigned Integers (
2)
</TD>
214 <TD>Width and length in points
</TD>
218 <TD>Unsigned Integer
</TD>
220 <TD>0 = Print composite image
<BR>
221 1 = Print color separations
</TD>
225 <TD>Unsigned Integer
</TD>
227 <TD>0 = Do not change trays if selected tray is empty
<BR>
228 1 = Change trays if selected tray is empty
</TD>
232 <TD>Unsigned Integer
</TD>
234 <TD>0 = Do not rotate even pages when duplexing
<BR>
235 1 = Rotate even pages when duplexing
</TD>
239 <TD>Unsigned Integer
</TD>
241 <TD>Width of page image in pixels
</TD>
245 <TD>Unsigned Integer
</TD>
247 <TD>Height of page image in pixels
</TD>
251 <TD>Unsigned Integer
</TD>
252 <TD>cupsMediaType
</TD>
253 <TD>Driver-specific
0 to
2<SUP>32</SUP> -
1</TD>
257 <TD>Unsigned Integer
</TD>
258 <TD>cupsBitsPerColor
</TD>
259 <TD>1,
2,
4,
8 bits for version
1 raster files
<BR>
260 1,
2,
4,
8, and
16 bits for version
2 raster files
</TD>
264 <TD>Unsigned Integer
</TD>
265 <TD>cupsBitsPerPixel
</TD>
266 <TD>1 to
32 bits for version
1 raster files
<BR>
267 1 to
64 bits for version
2 raster files
</TD>
271 <TD>Unsigned Integer
</TD>
272 <TD>cupsBytesPerLine
</TD>
273 <TD>1 to
2<SUP>32</SUP> -
1 bytes
</TD>
277 <TD>Unsigned Integer
</TD>
278 <TD>cupsColorOrder
</TD>
279 <TD>0 = chunky pixels (CMYK CMYK CMYK)
<BR>
280 1 = banded pixels (CCC MMM YYY KKK)
<BR>
281 2 = planar pixels (CCC... MMM... YYY... KKK...)
</TD>
285 <TD>Unsigned Integer
</TD>
286 <TD>cupsColorSpace
</TD>
324 <TD>Unsigned Integer
</TD>
325 <TD>cupsCompression
</TD>
326 <TD>Driver-specific
0 to
2<SUP>32</SUP> -
1</TD>
330 <TD>Unsigned Integer
</TD>
331 <TD>cupsRowCount
</TD>
332 <TD>Driver-specific
0 to
2<SUP>32</SUP> -
1</TD>
336 <TD>Unsigned Integer
</TD>
338 <TD>Driver-specific
0 to
2<SUP>32</SUP> -
1</TD>
342 <TD>Unsigned Integer
</TD>
344 <TD>Driver-specific
0 to
2<SUP>32</SUP> -
1</TD>
349 <H2 CLASS=
"title"><A NAME=
"V2">Version
2 Raster File Format
</A></H2>
351 <P>A version
2 raster file begins with a
32-bit synchronization
352 word:
0x52615332 (
"RaS2") for big-endian architectures and
353 0x32536152 (
"2SaR") for little-endian architectures. The writer
354 of the raster file will use the native word order, and the reader
355 is responsible for detecting a reversed word order file and
356 swapping bytes as needed. The CUPS Imaging API raster functions
357 perform this function automatically.
</P>
359 <P>Following the synchronization word are a series of raster
360 pages. Each page starts with a version
2 page device dictionary
361 header and is followed immediately by the compressed raster data
364 <DIV CLASS=
"table"><TABLE SUMMARY=
"CUPS Version 2 Raster Page Device Dictionary">
365 <CAPTION>Table
2: CUPS Version
2 Raster Page Device Dictionary
</CAPTION>
374 <TD>Version
1 header data
</TD>
379 <TD>Unsigned Integer
</TD>
380 <TD>cupsNumColors
</TD>
381 <TD>1 to
6 colors
</TD>
385 <TD>IEEE Single Precision
</TD>
386 <TD>cupsBorderlessScalingFactor
</TD>
387 <TD>0.0 or
1.0 or greater
</TD>
391 <TD>IEEE Single Precision (
2)
</TD>
392 <TD>cupsPageSize
</TD>
393 <TD>Width and length in points
</TD>
397 <TD>IEEE Single Precision (
4)
</TD>
398 <TD>cupsImagingBBox
</TD>
399 <TD>Four floating point numbers giving the left, bottom,
400 right, and top positions of the page bounding box in
405 <TD>Unsigned Integers (
16)
</TD>
407 <TD>16 driver-defined integer values
</TD>
411 <TD>IEEE Single Precision (
16)
</TD>
413 <TD>16 driver-defined floating point values
</TD>
417 <TD>C Strings (
16x64)
</TD>
419 <TD>16 driver-defined strings
</TD>
424 <TD>cupsMarkerType
</TD>
425 <TD>Ink/toner type string
</TD>
430 <TD>cupsRenderingIntent
</TD>
431 <TD>Color rendering intent string
</TD>
436 <TD>cupsPageSizeName
</TD>
437 <TD>Page size name/keyword string from PPD
</TD>
441 <H3><A NAME=
"COMPRESSION">Compressed Raster Data Format
</A></H3>
443 <P>The version
2 raster data is compressed using a modified TIFF
444 packbits algorithm. Lines are grouped into an integral number of
445 color values based upon the
<CODE>cupsColorOrder
</CODE>
448 <DIV CLASS=
"table"><TABLE SUMMARY=
"Color Value Sizes">
450 <TH>cupsColorOrder
</TH>
451 <TH>Bytes per color value
</TH>
455 <TD>(
<CODE>cupsBitsPerPixel
</CODE> +
7) /
8</TD>
459 <TD>(
<CODE>cupsBitsPerColor
</CODE> +
7) /
8</TD>
463 <TD>(
<CODE>cupsBitsPerColor
</CODE> +
7) /
8</TD>
467 <P>Each line of raster data begins with a repetition count from
1
468 to
256 that is encoded using a single byte of
"count - 1".
</P>
470 <P>After the repetition count, whole color values for that line
471 are run-length encoded using the TIFF packbits algorithm.
1 to
472 128 repeated colors are encoded using an initial byte of
"count -
473 1" followed by the color value byte(s).
2 to
128 non-repeating
474 colors are encoded using an initial byte of
"257 - count"
475 followed by the color value bytes.
</P>
479 <H2 CLASS=
"title"><A NAME=
"HISTORY">Change History
</A></H2>
481 <H3>Changes in CUPS
1.2</H3>
485 <li>Bumped raster version to
2</li>
487 <li>Added RGBW colorspace
</li>
489 <li>Added
16 bit per color support
</li>
491 <li>Added cupsNumColors, cupsBorderlessScalingFactor,
492 cupsPageSize, cupsImagingBBox, cupsInteger, cupsReal,
493 cupsString, cupsMarkerType, cupsRenderingIntent, and
494 cupsPageSizeName attributes to the page device
497 <li>Added raster data compression
</li>
499 <li>Added data type column to device dictionary
504 <h3>Changes in CUPS
1.1.19</h3>
508 <li>Added ICC and CIE colorspaces.
</li>