DynaPDF Manual - Page 226

Previous Page 225   Index   Next Page 227

Function Reference
Page 226 of 787
How to define CalGray colors?
Since CalGray colors consist of only one component which ranges from 0 to 255 the colors can be
defined as if you would use DeviceGray. No further conversion function is required.
How to define CalcRGB colors?
CalRGB can be used in the same way as DeviceRGB. Each component of a CalRGB color space
ranges from 0 to 255. Use the macro PDF_RGB() to convert color components to a 32 bit integer.
Other programming languages than C/C++ support mostly a function like rgb() which does
essentially the same as the C macro PDF_RGB().
How to define Lab colors?
The Lab color space is a three component space where each component supports different ranges:
L*
0 to 100
a* -128 to 127
b* -128 to 127
The ranges above define the maximum ranges which can be used in a Lab color space. In
comparison to RGB each component is defined as signed char while in RGB each component is
defined as unsigned char. C/C++ programmers can still use the macro PDF_RGB() to convert Lab
colors to 32 bit integers.
If you use another programming language it is usually best to convert negative component values to
unsigned char before passing the value to a function like rgb().
Example:
if (component_value < 0)
result = 256 + component_value; // Note that we add a negative number!
else
result = component_value;
Notice:
Non-device color spaces cannot be used for interactive objects such as annotations or form fields.
The active color space must always be changed to a device color space before creating interactive
objects; see SetColorSpace(). Note also that annotations support DeviceRGB only. Form fields
support DeviceGray, DeviceRGB, and DeviceCMYK.
Remarks:
Use the function SetExtColorSpace() to activate the color space in the graphics state. To set a color of
a CIE-based color space convert the color value to a 32 bit integer as described above and pass the
result to SetFillColor(), SetStrokeColor(), or SetColors().
 

Previous topic: CreateCIEColorSpace

Next topic: CreateColItemDate, CreateColItemNumber

Start Chat