22.03.2015 Views

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

DLI Implementation and Reference Guide - Datalogics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12.16 <strong>DLI</strong> <strong>Implementation</strong> <strong>and</strong> <strong>Reference</strong> <strong>Guide</strong><br />

Conversion between Models<br />

Concepts <strong>and</strong> Facilities: <strong>Guide</strong> to the DL Pager Composition System<br />

On some occasions, it is useful to be able to convert color values between color<br />

spaces. This does not occur often, as most composition engines permit only a single<br />

definition of color, but you may occasionally, for example, need to collapse colors to<br />

fewer models, such as when using grayscale in place of RGB when the color selected is<br />

a gray.<br />

The folowing examples assume a gray image encoded as RGB or CMYK.<br />

Collapsing RGB to Gray<br />

If all three channels of the RGB color are the same value, then the color specified is a<br />

gray. It may be simulated in gray by using that value as the gray color value.<br />

"C" Example: Collapsing RGB to Gray<br />

if (State->fillColorSpec.space) == GlobalRGBSpace)<br />

{<br />

if ((State->fillColorSpec.value.color[1] ==<br />

State->fillColorSpec.value.color[2]) &&<br />

(State->fillColorSpec.value.color[2] ==<br />

State->fillColorSpec.value.color[3]))<br />

{<br />

State->fillColorSpec.Space = GlobalGraySpace;<br />

}<br />

}<br />

Collapsing CMYK To Gray<br />

If the first three channels of the CMYK color are the same, then the color is gray. The<br />

amount is 1 minus the sum of one of the first three channels, plus the fourth channel.<br />

If this is less than zero, then the amount is zero.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!