1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- SECTION: Programming --> 4<head> 5 <title>Printer Driver API </title> 6 <meta name="keywords" content="Programming"> 7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 8 <meta name="creator" content="Mini-XML v2.7"> 9<style type="text/css"><!-- 10BODY { 11 font-family: lucida grande, geneva, helvetica, arial, sans-serif; 12} 13 14H1, H2, H3, H4, H5, H6, P, TD, TH { 15 font-family: lucida grande, geneva, helvetica, arial, sans-serif; 16} 17 18KBD { 19 font-family: monaco, courier, monospace; 20 font-weight: bold; 21} 22 23PRE { 24 font-family: monaco, courier, monospace; 25} 26 27PRE.command { 28 border: dotted thin #7f7f7f; 29 margin-left: 36pt; 30 padding: 10px; 31} 32 33P.compact { 34 margin: 0; 35} 36 37P.example { 38 font-style: italic; 39 margin-left: 36pt; 40} 41 42PRE.example { 43 background: #eeeeee; 44 border: dotted thin #999999; 45 margin-left: 36pt; 46 padding: 10pt; 47} 48 49PRE.command EM, PRE.example EM { 50 font-family: lucida grande, geneva, helvetica, arial, sans-serif; 51} 52 53P.command { 54 font-family: monaco, courier, monospace; 55 margin-left: 36pt; 56} 57 58P.formula { 59 font-style: italic; 60 margin-left: 36pt; 61} 62 63BLOCKQUOTE { 64 background: #eeeeee; 65 border: solid thin #999999; 66 padding: 10pt; 67} 68 69A IMG { 70 border: none; 71} 72 73A:link:hover IMG { 74 background: #f0f0f0; 75 border-radius: 10px; 76 -moz-border-radius: 10px; 77} 78 79A:link, A:visited { 80 font-weight: normal; 81 text-decoration: none; 82} 83 84A:link:hover, A:visited:hover, A:active { 85 text-decoration: underline; 86} 87 88SUB, SUP { 89 font-size: 50%; 90} 91 92TR.data, TD.data, TR.data TD { 93 margin-top: 10pt; 94 padding: 5pt; 95 border-bottom: solid 1pt #999999; 96} 97 98TR.data TH { 99 border-bottom: solid 1pt #999999; 100 padding-top: 10pt; 101 padding-left: 5pt; 102 text-align: left; 103} 104 105DIV.table TABLE { 106 border: solid thin #999999; 107 border-collapse: collapse; 108 border-spacing: 0; 109 margin-left: auto; 110 margin-right: auto; 111} 112 113DIV.table CAPTION { 114 caption-side: top; 115 font-size: 120%; 116 font-style: italic; 117 font-weight: bold; 118 margin-left: auto; 119 margin-right: auto; 120} 121 122DIV.table TABLE TD { 123 border: solid thin #cccccc; 124 padding-top: 5pt; 125} 126 127DIV.table TABLE TH { 128 background: #cccccc; 129 border: none; 130 border-bottom: solid thin #999999; 131} 132 133DIV.figure TABLE { 134 margin-left: auto; 135 margin-right: auto; 136} 137 138DIV.figure CAPTION { 139 caption-side: bottom; 140 font-size: 120%; 141 font-style: italic; 142 font-weight: bold; 143 margin-left: auto; 144 margin-right: auto; 145} 146 147TH.label { 148 text-align: right; 149 vertical-align: top; 150} 151 152TH.sublabel { 153 text-align: right; 154 font-weight: normal; 155} 156 157HR { 158 border: solid thin; 159} 160 161SPAN.info { 162 background: black; 163 border: thin solid black; 164 color: white; 165 font-size: 80%; 166 font-style: italic; 167 font-weight: bold; 168 white-space: nowrap; 169} 170 171H2 SPAN.info, H3 SPAN.info, H4 SPAN.info { 172 float: right; 173 font-size: 100%; 174} 175 176H1.title { 177} 178 179H2.title, H3.title { 180 border-bottom: solid 2pt #000000; 181} 182 183DIV.indent, TABLE.indent { 184 margin-top: 2em; 185 margin-left: auto; 186 margin-right: auto; 187 width: 90%; 188} 189 190TABLE.indent { 191 border-collapse: collapse; 192} 193 194TABLE.indent TD, TABLE.indent TH { 195 padding: 0; 196} 197 198TABLE.list { 199 border-collapse: collapse; 200 margin-left: auto; 201 margin-right: auto; 202 width: 90%; 203} 204 205TABLE.list TH { 206 background: white; 207 border-bottom: solid thin #cccccc; 208 color: #444444; 209 padding-top: 10pt; 210 padding-left: 5pt; 211 text-align: left; 212 vertical-align: bottom; 213 white-space: nowrap; 214} 215 216TABLE.list TH A { 217 color: #4444cc; 218} 219 220TABLE.list TD { 221 border-bottom: solid thin #eeeeee; 222 padding-top: 5pt; 223 padding-left: 5pt; 224} 225 226TABLE.list TR:nth-child(even) { 227 background: #f8f8f8; 228} 229 230TABLE.list TR:nth-child(odd) { 231 background: #f4f4f4; 232} 233 234DT { 235 margin-left: 36pt; 236 margin-top: 12pt; 237} 238 239DD { 240 margin-left: 54pt; 241} 242 243DL.category DT { 244 font-weight: bold; 245} 246 247P.summary { 248 margin-left: 36pt; 249 font-family: monaco, courier, monospace; 250} 251 252DIV.summary TABLE { 253 border: solid thin #999999; 254 border-collapse: collapse; 255 border-spacing: 0; 256 margin: 10px; 257} 258 259DIV.summary TABLE TD, DIV.summary TABLE TH { 260 border: solid thin #999999; 261 padding: 5px; 262 text-align: left; 263 vertical-align: top; 264} 265 266DIV.summary TABLE THEAD TH { 267 background: #eeeeee; 268} 269 270/* API documentation styles... */ 271div.body h1 { 272 margin: 0; 273} 274div.body h2 { 275 margin-top: 1.5em; 276} 277div.body h3, div.body h4, div.body h5 { 278 margin-bottom: 0.5em; 279 margin-top: 1.5em; 280} 281.class, .enumeration, .function, .struct, .typedef, .union { 282 border-bottom: solid thin #999999; 283 margin-bottom: 0; 284 margin-top: 2em; 285} 286.description { 287 margin-top: 0.5em; 288} 289code, p.code, pre, ul.code li { 290 font-family: monaco, courier, monospace; 291 font-size: 90%; 292} 293ul.code, ul.contents, ul.subcontents { 294 list-style-type: none; 295 margin: 0; 296 padding-left: 0; 297} 298ul.code li { 299 margin: 0; 300} 301ul.contents > li { 302 margin-top: 1em; 303} 304ul.contents li ul.code, ul.contents li ul.subcontents { 305 padding-left: 2em; 306} 307div.body dl { 308 margin-left: 0; 309 margin-top: 0; 310} 311div.body dt { 312 font-style: italic; 313 margin-left: 0; 314 margin-top: 0; 315} 316div.body dd { 317 margin-bottom: 0.5em; 318} 319 320/* This is just for the HTML files generated with the framedhelp target */ 321div.contents { 322 background: #e8e8e8; 323 border: solid thin black; 324 padding: 10px; 325} 326div.contents h1 { 327 font-size: 110%; 328} 329div.contents h2 { 330 font-size: 100%; 331} 332div.contents ul.contents { 333 font-size: 80%; 334} 335div.contents ul.subcontents li { 336 margin-left: 1em; 337 text-indent: -1em; 338} 339--></style> 340</head> 341<body> 342<div class='body'> 343<!-- 344 "$Id$" 345 346 Driver API header for CUPS. 347 348 Copyright 2009 by Apple Inc. 349 350 These coded instructions, statements, and computer programs are the 351 property of Apple Inc. and are protected by Federal copyright 352 law. Distribution and use rights are outlined in the file "LICENSE.txt" 353 which should have been included with this file. If this file is 354 file is missing or damaged, see the license at "http://www.cups.org/". 355--> 356 357<h1 class='title'>Driver API</h1> 358 359<div class='summary'><table summary='General Information'> 360<thead> 361<tr> 362 <th>Header</th> 363 <th>cups/driver.h</th> 364</tr> 365</thead> 366<tbody> 367<tr> 368 <th>Library</th> 369 <td>-lcupsdriver</td> 370</tr> 371<tr> 372 <th>See Also</th> 373 <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td> 374</tr> 375</tbody> 376</table></div> 377<h2 class="title">Contents</h2> 378<ul class="contents"> 379<li><a href="#OVERVIEW">Overview</a></li> 380<li><a href="#FUNCTIONS">Functions</a><ul class="code"> 381 <li><a href="#cupsCMYKDelete" title="Delete a color separation.">cupsCMYKDelete</a></li> 382 <li><a href="#cupsCMYKDoBlack" title="Do a black separation...">cupsCMYKDoBlack</a></li> 383 <li><a href="#cupsCMYKDoCMYK" title="Do a CMYK separation...">cupsCMYKDoCMYK</a></li> 384 <li><a href="#cupsCMYKDoGray" title="Do a grayscale separation...">cupsCMYKDoGray</a></li> 385 <li><a href="#cupsCMYKDoRGB" title="Do an sRGB separation...">cupsCMYKDoRGB</a></li> 386 <li><a href="#cupsCMYKLoad" title="Load a CMYK color profile from PPD attributes.">cupsCMYKLoad</a></li> 387 <li><a href="#cupsCMYKNew" title="Create a new CMYK color separation.">cupsCMYKNew</a></li> 388 <li><a href="#cupsCMYKSetBlack" title="Set the transition range for CMY to black.">cupsCMYKSetBlack</a></li> 389 <li><a href="#cupsCMYKSetCurve" title="Set a color transform curve using points.">cupsCMYKSetCurve</a></li> 390 <li><a href="#cupsCMYKSetGamma" title="Set a color transform curve using gamma and density.">cupsCMYKSetGamma</a></li> 391 <li><a href="#cupsCMYKSetInkLimit" title="Set the limit on the amount of ink.">cupsCMYKSetInkLimit</a></li> 392 <li><a href="#cupsCMYKSetLtDk" title="Set light/dark ink transforms.">cupsCMYKSetLtDk</a></li> 393 <li><a href="#cupsCheckBytes" title="Check to see if all bytes are zero.">cupsCheckBytes</a></li> 394 <li><a href="#cupsCheckValue" title="Check to see if all bytes match the given value.">cupsCheckValue</a></li> 395 <li><a href="#cupsDitherDelete" title="Free a dithering buffer.">cupsDitherDelete</a></li> 396 <li><a href="#cupsDitherLine" title="Dither a line of pixels...">cupsDitherLine</a></li> 397 <li><a href="#cupsDitherNew" title="Create an error-diffusion dithering buffer.">cupsDitherNew</a></li> 398 <li><a href="#cupsFindAttr" title="Find a PPD attribute based on the colormodel, 399media, and resolution.">cupsFindAttr</a></li> 400 <li><a href="#cupsLutDelete" title="Free the memory used by a lookup table.">cupsLutDelete</a></li> 401 <li><a href="#cupsLutLoad" title="Load a LUT from a PPD file.">cupsLutLoad</a></li> 402 <li><a href="#cupsLutNew" title="Make a lookup table from a list of pixel values.">cupsLutNew</a></li> 403 <li><a href="#cupsPackHorizontal" title="Pack pixels horizontally...">cupsPackHorizontal</a></li> 404 <li><a href="#cupsPackHorizontal2" title="Pack 2-bit pixels horizontally...">cupsPackHorizontal2</a></li> 405 <li><a href="#cupsPackHorizontalBit" title="Pack pixels horizontally by bit...">cupsPackHorizontalBit</a></li> 406 <li><a href="#cupsPackVertical" title="Pack pixels vertically...">cupsPackVertical</a></li> 407 <li><a href="#cupsRGBDelete" title="Delete a color separation.">cupsRGBDelete</a></li> 408 <li><a href="#cupsRGBDoGray" title="Do a grayscale separation...">cupsRGBDoGray</a></li> 409 <li><a href="#cupsRGBDoRGB" title="Do a RGB separation...">cupsRGBDoRGB</a></li> 410 <li><a href="#cupsRGBLoad" title="Load a RGB color profile from a PPD file.">cupsRGBLoad</a></li> 411 <li><a href="#cupsRGBNew" title="Create a new RGB color separation.">cupsRGBNew</a></li> 412</ul></li> 413<li><a href="#TYPES">Data Types</a><ul class="code"> 414 <li><a href="#cups_cmyk_t" title="Simple CMYK lookup table">cups_cmyk_t</a></li> 415 <li><a href="#cups_dither_t" title="Dithering State">cups_dither_t</a></li> 416 <li><a href="#cups_lut_t" title="Lookup Table for Dithering">cups_lut_t</a></li> 417 <li><a href="#cups_rgb_t" title="Color separation lookup table">cups_rgb_t</a></li> 418 <li><a href="#cups_sample_t" title="Color sample point">cups_sample_t</a></li> 419</ul></li> 420<li><a href="#STRUCTURES">Structures</a><ul class="code"> 421 <li><a href="#cups_cmyk_s" title="Simple CMYK lookup table">cups_cmyk_s</a></li> 422 <li><a href="#cups_dither_s" title="Dithering State">cups_dither_s</a></li> 423 <li><a href="#cups_lut_s" title="Lookup Table for Dithering">cups_lut_s</a></li> 424 <li><a href="#cups_rgb_s" title="Color separation lookup table">cups_rgb_s</a></li> 425 <li><a href="#cups_sample_s" title="Color sample point">cups_sample_s</a></li> 426</ul></li> 427<li><a href="#VARIABLES">Variables</a><ul class="code"> 428 <li><a href="#cups_scmy_lut[256]" title="sRGB gamma lookup table (inverted)">cups_scmy_lut[256]</a></li> 429 <li><a href="#cups_srgb_lut[256]" title="sRGB gamma lookup table">cups_srgb_lut[256]</a></li> 430</ul></li> 431</ul> 432<!-- 433 "$Id$" 434 435 Driver API introduction for CUPS. 436 437 Copyright 2009 by Apple Inc. 438 439 These coded instructions, statements, and computer programs are the 440 property of Apple Inc. and are protected by Federal copyright 441 law. Distribution and use rights are outlined in the file "LICENSE.txt" 442 which should have been included with this file. If this file is 443 file is missing or damaged, see the license at "http://www.cups.org/". 444--> 445 446<h2 class='title'><a name='OVERVIEW'>Overview</a></h2> 447 448<p>The driver API provides common dithering, color conversion, and utility 449functions for CUPS drivers.</p> 450<h2 class="title"><a name="FUNCTIONS">Functions</a></h2> 451<h3 class="function"><a name="cupsCMYKDelete">cupsCMYKDelete</a></h3> 452<p class="description">Delete a color separation.</p> 453<p class="code"> 454void cupsCMYKDelete (<br> 455 <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk<br> 456);</p> 457<h4 class="parameters">Parameters</h4> 458<dl> 459<dt>cmyk</dt> 460<dd class="description">Color separation</dd> 461</dl> 462<h3 class="function"><a name="cupsCMYKDoBlack">cupsCMYKDoBlack</a></h3> 463<p class="description">Do a black separation...</p> 464<p class="code"> 465void cupsCMYKDoBlack (<br> 466 const <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 467 const unsigned char *input,<br> 468 short *output,<br> 469 int num_pixels<br> 470);</p> 471<h4 class="parameters">Parameters</h4> 472<dl> 473<dt>cmyk</dt> 474<dd class="description">Color separation</dd> 475<dt>input</dt> 476<dd class="description">Input grayscale pixels</dd> 477<dt>output</dt> 478<dd class="description">Output Device-N pixels</dd> 479<dt>num_pixels</dt> 480<dd class="description">Number of pixels</dd> 481</dl> 482<h3 class="function"><a name="cupsCMYKDoCMYK">cupsCMYKDoCMYK</a></h3> 483<p class="description">Do a CMYK separation...</p> 484<p class="code"> 485void cupsCMYKDoCMYK (<br> 486 const <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 487 const unsigned char *input,<br> 488 short *output,<br> 489 int num_pixels<br> 490);</p> 491<h4 class="parameters">Parameters</h4> 492<dl> 493<dt>cmyk</dt> 494<dd class="description">Color separation</dd> 495<dt>input</dt> 496<dd class="description">Input grayscale pixels</dd> 497<dt>output</dt> 498<dd class="description">Output Device-N pixels</dd> 499<dt>num_pixels</dt> 500<dd class="description">Number of pixels</dd> 501</dl> 502<h3 class="function"><a name="cupsCMYKDoGray">cupsCMYKDoGray</a></h3> 503<p class="description">Do a grayscale separation...</p> 504<p class="code"> 505void cupsCMYKDoGray (<br> 506 const <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 507 const unsigned char *input,<br> 508 short *output,<br> 509 int num_pixels<br> 510);</p> 511<h4 class="parameters">Parameters</h4> 512<dl> 513<dt>cmyk</dt> 514<dd class="description">Color separation</dd> 515<dt>input</dt> 516<dd class="description">Input grayscale pixels</dd> 517<dt>output</dt> 518<dd class="description">Output Device-N pixels</dd> 519<dt>num_pixels</dt> 520<dd class="description">Number of pixels</dd> 521</dl> 522<h3 class="function"><a name="cupsCMYKDoRGB">cupsCMYKDoRGB</a></h3> 523<p class="description">Do an sRGB separation...</p> 524<p class="code"> 525void cupsCMYKDoRGB (<br> 526 const <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 527 const unsigned char *input,<br> 528 short *output,<br> 529 int num_pixels<br> 530);</p> 531<h4 class="parameters">Parameters</h4> 532<dl> 533<dt>cmyk</dt> 534<dd class="description">Color separation</dd> 535<dt>input</dt> 536<dd class="description">Input grayscale pixels</dd> 537<dt>output</dt> 538<dd class="description">Output Device-N pixels</dd> 539<dt>num_pixels</dt> 540<dd class="description">Number of pixels</dd> 541</dl> 542<h3 class="function"><a name="cupsCMYKLoad">cupsCMYKLoad</a></h3> 543<p class="description">Load a CMYK color profile from PPD attributes.</p> 544<p class="code"> 545<a href="#cups_cmyk_t">cups_cmyk_t</a> *cupsCMYKLoad (<br> 546 ppd_file_t *ppd,<br> 547 const char *colormodel,<br> 548 const char *media,<br> 549 const char *resolution<br> 550);</p> 551<h4 class="parameters">Parameters</h4> 552<dl> 553<dt>ppd</dt> 554<dd class="description">PPD file</dd> 555<dt>colormodel</dt> 556<dd class="description">ColorModel value</dd> 557<dt>media</dt> 558<dd class="description">MediaType value</dd> 559<dt>resolution</dt> 560<dd class="description">Resolution value</dd> 561</dl> 562<h4 class="returnvalue">Return Value</h4> 563<p class="description">CMYK color separation</p> 564<h3 class="function"><a name="cupsCMYKNew">cupsCMYKNew</a></h3> 565<p class="description">Create a new CMYK color separation.</p> 566<p class="code"> 567<a href="#cups_cmyk_t">cups_cmyk_t</a> *cupsCMYKNew (<br> 568 int num_channels<br> 569);</p> 570<h4 class="parameters">Parameters</h4> 571<dl> 572<dt>num_channels</dt> 573<dd class="description">Number of color components</dd> 574</dl> 575<h4 class="returnvalue">Return Value</h4> 576<p class="description">New CMYK separation or NULL</p> 577<h3 class="function"><a name="cupsCMYKSetBlack">cupsCMYKSetBlack</a></h3> 578<p class="description">Set the transition range for CMY to black.</p> 579<p class="code"> 580void cupsCMYKSetBlack (<br> 581 <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 582 float lower,<br> 583 float upper<br> 584);</p> 585<h4 class="parameters">Parameters</h4> 586<dl> 587<dt>cmyk</dt> 588<dd class="description">CMYK color separation</dd> 589<dt>lower</dt> 590<dd class="description">No black ink</dd> 591<dt>upper</dt> 592<dd class="description">Only black ink</dd> 593</dl> 594<h3 class="function"><a name="cupsCMYKSetCurve">cupsCMYKSetCurve</a></h3> 595<p class="description">Set a color transform curve using points.</p> 596<p class="code"> 597void cupsCMYKSetCurve (<br> 598 <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 599 int channel,<br> 600 int num_xypoints,<br> 601 const float *xypoints<br> 602);</p> 603<h4 class="parameters">Parameters</h4> 604<dl> 605<dt>cmyk</dt> 606<dd class="description">CMYK color separation</dd> 607<dt>channel</dt> 608<dd class="description">Color channel</dd> 609<dt>num_xypoints</dt> 610<dd class="description">Number of X,Y points</dd> 611<dt>xypoints</dt> 612<dd class="description">X,Y points</dd> 613</dl> 614<h3 class="function"><a name="cupsCMYKSetGamma">cupsCMYKSetGamma</a></h3> 615<p class="description">Set a color transform curve using gamma and density.</p> 616<p class="code"> 617void cupsCMYKSetGamma (<br> 618 <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 619 int channel,<br> 620 float gamval,<br> 621 float density<br> 622);</p> 623<h4 class="parameters">Parameters</h4> 624<dl> 625<dt>cmyk</dt> 626<dd class="description">CMYK color separation</dd> 627<dt>channel</dt> 628<dd class="description">Ink channel</dd> 629<dt>gamval</dt> 630<dd class="description">Gamma correction</dd> 631<dt>density</dt> 632<dd class="description">Maximum density</dd> 633</dl> 634<h3 class="function"><a name="cupsCMYKSetInkLimit">cupsCMYKSetInkLimit</a></h3> 635<p class="description">Set the limit on the amount of ink.</p> 636<p class="code"> 637void cupsCMYKSetInkLimit (<br> 638 <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 639 float limit<br> 640);</p> 641<h4 class="parameters">Parameters</h4> 642<dl> 643<dt>cmyk</dt> 644<dd class="description">CMYK color separation</dd> 645<dt>limit</dt> 646<dd class="description">Limit of ink</dd> 647</dl> 648<h3 class="function"><a name="cupsCMYKSetLtDk">cupsCMYKSetLtDk</a></h3> 649<p class="description">Set light/dark ink transforms.</p> 650<p class="code"> 651void cupsCMYKSetLtDk (<br> 652 <a href="#cups_cmyk_t">cups_cmyk_t</a> *cmyk,<br> 653 int channel,<br> 654 float light,<br> 655 float dark<br> 656);</p> 657<h4 class="parameters">Parameters</h4> 658<dl> 659<dt>cmyk</dt> 660<dd class="description">CMYK color separation</dd> 661<dt>channel</dt> 662<dd class="description">Dark ink channel (+1 for light)</dd> 663<dt>light</dt> 664<dd class="description">Light ink only level</dd> 665<dt>dark</dt> 666<dd class="description">Dark ink only level</dd> 667</dl> 668<h3 class="function"><a name="cupsCheckBytes">cupsCheckBytes</a></h3> 669<p class="description">Check to see if all bytes are zero.</p> 670<p class="code"> 671int cupsCheckBytes (<br> 672 const unsigned char *bytes,<br> 673 int length<br> 674);</p> 675<h4 class="parameters">Parameters</h4> 676<dl> 677<dt>bytes</dt> 678<dd class="description">Bytes to check</dd> 679<dt>length</dt> 680<dd class="description">Number of bytes to check</dd> 681</dl> 682<h4 class="returnvalue">Return Value</h4> 683<p class="description">1 if they match</p> 684<h3 class="function"><a name="cupsCheckValue">cupsCheckValue</a></h3> 685<p class="description">Check to see if all bytes match the given value.</p> 686<p class="code"> 687int cupsCheckValue (<br> 688 const unsigned char *bytes,<br> 689 int length,<br> 690 const unsigned char value<br> 691);</p> 692<h4 class="parameters">Parameters</h4> 693<dl> 694<dt>bytes</dt> 695<dd class="description">Bytes to check</dd> 696<dt>length</dt> 697<dd class="description">Number of bytes to check</dd> 698<dt>value</dt> 699<dd class="description">Value to check</dd> 700</dl> 701<h4 class="returnvalue">Return Value</h4> 702<p class="description">1 if they match</p> 703<h3 class="function"><a name="cupsDitherDelete">cupsDitherDelete</a></h3> 704<p class="description">Free a dithering buffer.</p> 705<p class="code"> 706void cupsDitherDelete (<br> 707 <a href="#cups_dither_t">cups_dither_t</a> *d<br> 708);</p> 709<h4 class="parameters">Parameters</h4> 710<dl> 711<dt>d</dt> 712<dd class="description">Dithering buffer</dd> 713</dl> 714<h4 class="discussion">Discussion</h4> 715<p class="discussion">Returns 0 on success, -1 on failure.</p> 716<h3 class="function"><a name="cupsDitherLine">cupsDitherLine</a></h3> 717<p class="description">Dither a line of pixels...</p> 718<p class="code"> 719void cupsDitherLine (<br> 720 <a href="#cups_dither_t">cups_dither_t</a> *d,<br> 721 const <a href="#cups_lut_t">cups_lut_t</a> *lut,<br> 722 const short *data,<br> 723 int num_channels,<br> 724 unsigned char *p<br> 725);</p> 726<h4 class="parameters">Parameters</h4> 727<dl> 728<dt>d</dt> 729<dd class="description">Dither data</dd> 730<dt>lut</dt> 731<dd class="description">Lookup table</dd> 732<dt>data</dt> 733<dd class="description">Separation data</dd> 734<dt>num_channels</dt> 735<dd class="description">Number of components</dd> 736<dt>p</dt> 737<dd class="description">Pixels</dd> 738</dl> 739<h3 class="function"><a name="cupsDitherNew">cupsDitherNew</a></h3> 740<p class="description">Create an error-diffusion dithering buffer.</p> 741<p class="code"> 742<a href="#cups_dither_t">cups_dither_t</a> *cupsDitherNew (<br> 743 int width<br> 744);</p> 745<h4 class="parameters">Parameters</h4> 746<dl> 747<dt>width</dt> 748<dd class="description">Width of output in pixels</dd> 749</dl> 750<h4 class="returnvalue">Return Value</h4> 751<p class="description">New state array</p> 752<h3 class="function"><a name="cupsFindAttr">cupsFindAttr</a></h3> 753<p class="description">Find a PPD attribute based on the colormodel, 754media, and resolution.</p> 755<p class="code"> 756ppd_attr_t *cupsFindAttr (<br> 757 ppd_file_t *ppd,<br> 758 const char *name,<br> 759 const char *colormodel,<br> 760 const char *media,<br> 761 const char *resolution,<br> 762 char *spec,<br> 763 int specsize<br> 764);</p> 765<h4 class="parameters">Parameters</h4> 766<dl> 767<dt>ppd</dt> 768<dd class="description">PPD file</dd> 769<dt>name</dt> 770<dd class="description">Attribute name</dd> 771<dt>colormodel</dt> 772<dd class="description">Color model</dd> 773<dt>media</dt> 774<dd class="description">Media type</dd> 775<dt>resolution</dt> 776<dd class="description">Resolution</dd> 777<dt>spec</dt> 778<dd class="description">Final selection string</dd> 779<dt>specsize</dt> 780<dd class="description">Size of string buffer</dd> 781</dl> 782<h4 class="returnvalue">Return Value</h4> 783<p class="description">Matching attribute or NULL</p> 784<h3 class="function"><a name="cupsLutDelete">cupsLutDelete</a></h3> 785<p class="description">Free the memory used by a lookup table.</p> 786<p class="code"> 787void cupsLutDelete (<br> 788 <a href="#cups_lut_t">cups_lut_t</a> *lut<br> 789);</p> 790<h4 class="parameters">Parameters</h4> 791<dl> 792<dt>lut</dt> 793<dd class="description">Lookup table to free</dd> 794</dl> 795<h3 class="function"><a name="cupsLutLoad">cupsLutLoad</a></h3> 796<p class="description">Load a LUT from a PPD file.</p> 797<p class="code"> 798<a href="#cups_lut_t">cups_lut_t</a> *cupsLutLoad (<br> 799 ppd_file_t *ppd,<br> 800 const char *colormodel,<br> 801 const char *media,<br> 802 const char *resolution,<br> 803 const char *ink<br> 804);</p> 805<h4 class="parameters">Parameters</h4> 806<dl> 807<dt>ppd</dt> 808<dd class="description">PPD file</dd> 809<dt>colormodel</dt> 810<dd class="description">Color model</dd> 811<dt>media</dt> 812<dd class="description">Media type</dd> 813<dt>resolution</dt> 814<dd class="description">Resolution</dd> 815<dt>ink</dt> 816<dd class="description">Ink name</dd> 817</dl> 818<h4 class="returnvalue">Return Value</h4> 819<p class="description">New lookup table</p> 820<h3 class="function"><a name="cupsLutNew">cupsLutNew</a></h3> 821<p class="description">Make a lookup table from a list of pixel values.</p> 822<p class="code"> 823<a href="#cups_lut_t">cups_lut_t</a> *cupsLutNew (<br> 824 int num_values,<br> 825 const float *values<br> 826);</p> 827<h4 class="parameters">Parameters</h4> 828<dl> 829<dt>num_values</dt> 830<dd class="description">Number of values</dd> 831<dt>values</dt> 832<dd class="description">Lookup table values</dd> 833</dl> 834<h4 class="returnvalue">Return Value</h4> 835<p class="description">New lookup table</p> 836<h4 class="discussion">Discussion</h4> 837<p class="discussion">Returns a pointer to the lookup table on success, NULL on failure.</p> 838<h3 class="function"><a name="cupsPackHorizontal">cupsPackHorizontal</a></h3> 839<p class="description">Pack pixels horizontally...</p> 840<p class="code"> 841void cupsPackHorizontal (<br> 842 const unsigned char *ipixels,<br> 843 unsigned char *obytes,<br> 844 int width,<br> 845 const unsigned char clearto,<br> 846 const int step<br> 847);</p> 848<h4 class="parameters">Parameters</h4> 849<dl> 850<dt>ipixels</dt> 851<dd class="description">Input pixels</dd> 852<dt>obytes</dt> 853<dd class="description">Output bytes</dd> 854<dt>width</dt> 855<dd class="description">Number of pixels</dd> 856<dt>clearto</dt> 857<dd class="description">Initial value of bytes</dd> 858<dt>step</dt> 859<dd class="description">Step value between pixels</dd> 860</dl> 861<h3 class="function"><a name="cupsPackHorizontal2">cupsPackHorizontal2</a></h3> 862<p class="description">Pack 2-bit pixels horizontally...</p> 863<p class="code"> 864void cupsPackHorizontal2 (<br> 865 const unsigned char *ipixels,<br> 866 unsigned char *obytes,<br> 867 int width,<br> 868 const int step<br> 869);</p> 870<h4 class="parameters">Parameters</h4> 871<dl> 872<dt>ipixels</dt> 873<dd class="description">Input pixels</dd> 874<dt>obytes</dt> 875<dd class="description">Output bytes</dd> 876<dt>width</dt> 877<dd class="description">Number of pixels</dd> 878<dt>step</dt> 879<dd class="description">Stepping value</dd> 880</dl> 881<h3 class="function"><a name="cupsPackHorizontalBit">cupsPackHorizontalBit</a></h3> 882<p class="description">Pack pixels horizontally by bit...</p> 883<p class="code"> 884void cupsPackHorizontalBit (<br> 885 const unsigned char *ipixels,<br> 886 unsigned char *obytes,<br> 887 int width,<br> 888 const unsigned char clearto,<br> 889 const unsigned char bit<br> 890);</p> 891<h4 class="parameters">Parameters</h4> 892<dl> 893<dt>ipixels</dt> 894<dd class="description">Input pixels</dd> 895<dt>obytes</dt> 896<dd class="description">Output bytes</dd> 897<dt>width</dt> 898<dd class="description">Number of pixels</dd> 899<dt>clearto</dt> 900<dd class="description">Initial value of bytes</dd> 901<dt>bit</dt> 902<dd class="description">Bit to check</dd> 903</dl> 904<h3 class="function"><a name="cupsPackVertical">cupsPackVertical</a></h3> 905<p class="description">Pack pixels vertically...</p> 906<p class="code"> 907void cupsPackVertical (<br> 908 const unsigned char *ipixels,<br> 909 unsigned char *obytes,<br> 910 int width,<br> 911 const unsigned char bit,<br> 912 const int step<br> 913);</p> 914<h4 class="parameters">Parameters</h4> 915<dl> 916<dt>ipixels</dt> 917<dd class="description">Input pixels</dd> 918<dt>obytes</dt> 919<dd class="description">Output bytes</dd> 920<dt>width</dt> 921<dd class="description">Number of input pixels</dd> 922<dt>bit</dt> 923<dd class="description">Output bit</dd> 924<dt>step</dt> 925<dd class="description">Number of bytes between columns</dd> 926</dl> 927<h3 class="function"><a name="cupsRGBDelete">cupsRGBDelete</a></h3> 928<p class="description">Delete a color separation.</p> 929<p class="code"> 930void cupsRGBDelete (<br> 931 <a href="#cups_rgb_t">cups_rgb_t</a> *rgbptr<br> 932);</p> 933<h4 class="parameters">Parameters</h4> 934<dl> 935<dt>rgbptr</dt> 936<dd class="description">Color separation</dd> 937</dl> 938<h3 class="function"><a name="cupsRGBDoGray">cupsRGBDoGray</a></h3> 939<p class="description">Do a grayscale separation...</p> 940<p class="code"> 941void cupsRGBDoGray (<br> 942 <a href="#cups_rgb_t">cups_rgb_t</a> *rgbptr,<br> 943 const unsigned char *input,<br> 944 unsigned char *output,<br> 945 int num_pixels<br> 946);</p> 947<h4 class="parameters">Parameters</h4> 948<dl> 949<dt>rgbptr</dt> 950<dd class="description">Color separation</dd> 951<dt>input</dt> 952<dd class="description">Input grayscale pixels</dd> 953<dt>output</dt> 954<dd class="description">Output Device-N pixels</dd> 955<dt>num_pixels</dt> 956<dd class="description">Number of pixels</dd> 957</dl> 958<h3 class="function"><a name="cupsRGBDoRGB">cupsRGBDoRGB</a></h3> 959<p class="description">Do a RGB separation...</p> 960<p class="code"> 961void cupsRGBDoRGB (<br> 962 <a href="#cups_rgb_t">cups_rgb_t</a> *rgbptr,<br> 963 const unsigned char *input,<br> 964 unsigned char *output,<br> 965 int num_pixels<br> 966);</p> 967<h4 class="parameters">Parameters</h4> 968<dl> 969<dt>rgbptr</dt> 970<dd class="description">Color separation</dd> 971<dt>input</dt> 972<dd class="description">Input RGB pixels</dd> 973<dt>output</dt> 974<dd class="description">Output Device-N pixels</dd> 975<dt>num_pixels</dt> 976<dd class="description">Number of pixels</dd> 977</dl> 978<h3 class="function"><a name="cupsRGBLoad">cupsRGBLoad</a></h3> 979<p class="description">Load a RGB color profile from a PPD file.</p> 980<p class="code"> 981<a href="#cups_rgb_t">cups_rgb_t</a> *cupsRGBLoad (<br> 982 ppd_file_t *ppd,<br> 983 const char *colormodel,<br> 984 const char *media,<br> 985 const char *resolution<br> 986);</p> 987<h4 class="parameters">Parameters</h4> 988<dl> 989<dt>ppd</dt> 990<dd class="description">PPD file</dd> 991<dt>colormodel</dt> 992<dd class="description">Color model</dd> 993<dt>media</dt> 994<dd class="description">Media type</dd> 995<dt>resolution</dt> 996<dd class="description">Resolution</dd> 997</dl> 998<h4 class="returnvalue">Return Value</h4> 999<p class="description">New color profile</p> 1000<h3 class="function"><a name="cupsRGBNew">cupsRGBNew</a></h3> 1001<p class="description">Create a new RGB color separation.</p> 1002<p class="code"> 1003<a href="#cups_rgb_t">cups_rgb_t</a> *cupsRGBNew (<br> 1004 int num_samples,<br> 1005 <a href="#cups_sample_t">cups_sample_t</a> *samples,<br> 1006 int cube_size,<br> 1007 int num_channels<br> 1008);</p> 1009<h4 class="parameters">Parameters</h4> 1010<dl> 1011<dt>num_samples</dt> 1012<dd class="description">Number of samples</dd> 1013<dt>samples</dt> 1014<dd class="description">Samples</dd> 1015<dt>cube_size</dt> 1016<dd class="description">Size of LUT cube</dd> 1017<dt>num_channels</dt> 1018<dd class="description">Number of color components</dd> 1019</dl> 1020<h4 class="returnvalue">Return Value</h4> 1021<p class="description">New color separation or NULL</p> 1022<h2 class="title"><a name="TYPES">Data Types</a></h2> 1023<h3 class="typedef"><a name="cups_cmyk_t">cups_cmyk_t</a></h3> 1024<p class="description">Simple CMYK lookup table</p> 1025<p class="code"> 1026typedef struct <a href="#cups_cmyk_s">cups_cmyk_s</a> cups_cmyk_t; 1027</p> 1028<h3 class="typedef"><a name="cups_dither_t">cups_dither_t</a></h3> 1029<p class="description">Dithering State</p> 1030<p class="code"> 1031typedef struct <a href="#cups_dither_s">cups_dither_s</a> cups_dither_t; 1032</p> 1033<h3 class="typedef"><a name="cups_lut_t">cups_lut_t</a></h3> 1034<p class="description">Lookup Table for Dithering</p> 1035<p class="code"> 1036typedef struct <a href="#cups_lut_s">cups_lut_s</a> cups_lut_t; 1037</p> 1038<h3 class="typedef"><a name="cups_rgb_t">cups_rgb_t</a></h3> 1039<p class="description">Color separation lookup table</p> 1040<p class="code"> 1041typedef struct <a href="#cups_rgb_s">cups_rgb_s</a> cups_rgb_t; 1042</p> 1043<h3 class="typedef"><a name="cups_sample_t">cups_sample_t</a></h3> 1044<p class="description">Color sample point</p> 1045<p class="code"> 1046typedef struct <a href="#cups_sample_s">cups_sample_s</a> cups_sample_t; 1047</p> 1048<h2 class="title"><a name="STRUCTURES">Structures</a></h2> 1049<h3 class="struct"><a name="cups_cmyk_s">cups_cmyk_s</a></h3> 1050<p class="description">Simple CMYK lookup table</p> 1051<p class="code">struct cups_cmyk_s {<br> 1052 unsigned char black_lut[256];<br> 1053 short *channels[CUPS_MAX_CHAN];<br> 1054 unsigned char color_lut[256];<br> 1055 int ink_limit;<br> 1056 int num_channels;<br> 1057};</p> 1058<h4 class="members">Members</h4> 1059<dl> 1060<dt>black_lut[256] </dt> 1061<dd class="description">Black generation LUT</dd> 1062<dt>channels[CUPS_MAX_CHAN] </dt> 1063<dd class="description">Lookup tables</dd> 1064<dt>color_lut[256] </dt> 1065<dd class="description">Color removal LUT</dd> 1066<dt>ink_limit </dt> 1067<dd class="description">Ink limit</dd> 1068<dt>num_channels </dt> 1069<dd class="description">Number of components</dd> 1070</dl> 1071<h3 class="struct"><a name="cups_dither_s">cups_dither_s</a></h3> 1072<p class="description">Dithering State</p> 1073<p class="code">struct cups_dither_s {<br> 1074 int errors[96];<br> 1075 int row;<br> 1076 int width;<br> 1077};</p> 1078<h4 class="members">Members</h4> 1079<dl> 1080<dt>errors[96] </dt> 1081<dd class="description">Error values</dd> 1082<dt>row </dt> 1083<dd class="description">Current row</dd> 1084<dt>width </dt> 1085<dd class="description">Width of buffer</dd> 1086</dl> 1087<h3 class="struct"><a name="cups_lut_s">cups_lut_s</a></h3> 1088<p class="description">Lookup Table for Dithering</p> 1089<p class="code">struct cups_lut_s {<br> 1090 int error;<br> 1091 short intensity;<br> 1092 short pixel;<br> 1093};</p> 1094<h4 class="members">Members</h4> 1095<dl> 1096<dt>error </dt> 1097<dd class="description">Error from desired value</dd> 1098<dt>intensity </dt> 1099<dd class="description">Adjusted intensity</dd> 1100<dt>pixel </dt> 1101<dd class="description">Output pixel value</dd> 1102</dl> 1103<h3 class="struct"><a name="cups_rgb_s">cups_rgb_s</a></h3> 1104<p class="description">Color separation lookup table</p> 1105<p class="code">struct cups_rgb_s {<br> 1106 unsigned char black[CUPS_MAX_RGB];<br> 1107 int cache_init;<br> 1108 unsigned char ****colors;<br> 1109 int cube_index[256];<br> 1110 int cube_mult[256];<br> 1111 int cube_size;<br> 1112 int num_channels;<br> 1113 unsigned char white[CUPS_MAX_RGB];<br> 1114};</p> 1115<h4 class="members">Members</h4> 1116<dl> 1117<dt>black[CUPS_MAX_RGB] </dt> 1118<dd class="description">Cached black (sRGB = 0,0,0)</dd> 1119<dt>cache_init </dt> 1120<dd class="description">Are cached values initialized?</dd> 1121<dt>colors </dt> 1122<dd class="description">4-D array of sample values</dd> 1123<dt>cube_index[256] </dt> 1124<dd class="description">Index into cube for a given sRGB value</dd> 1125<dt>cube_mult[256] </dt> 1126<dd class="description">Multiplier value for a given sRGB value</dd> 1127<dt>cube_size </dt> 1128<dd class="description">Size of color cube (2-N) on a side</dd> 1129<dt>num_channels </dt> 1130<dd class="description">Number of colors per sample</dd> 1131<dt>white[CUPS_MAX_RGB] </dt> 1132<dd class="description">Cached white (sRGB = 255,255,255)</dd> 1133</dl> 1134<h3 class="struct"><a name="cups_sample_s">cups_sample_s</a></h3> 1135<p class="description">Color sample point</p> 1136<p class="code">struct cups_sample_s {<br> 1137 unsigned char colors[CUPS_MAX_RGB];<br> 1138 unsigned char rgb[3];<br> 1139};</p> 1140<h4 class="members">Members</h4> 1141<dl> 1142<dt>colors[CUPS_MAX_RGB] </dt> 1143<dd class="description">Color values</dd> 1144<dt>rgb[3] </dt> 1145<dd class="description">sRGB values</dd> 1146</dl> 1147<h2 class="title"><a name="VARIABLES">Variables</a></h2> 1148<h3 class="variable"><a name="cups_scmy_lut[256]">cups_scmy_lut[256]</a></h3> 1149<p class="description">sRGB gamma lookup table (inverted)</p> 1150<p class="code">extern const unsigned char cups_scmy_lut[256];</p> 1151<h3 class="variable"><a name="cups_srgb_lut[256]">cups_srgb_lut[256]</a></h3> 1152<p class="description">sRGB gamma lookup table</p> 1153<p class="code">extern const unsigned char cups_srgb_lut[256];</p> 1154</div> 1155</body> 1156</html> 1157