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