DynaPDF Manual - Page 75

Previous Page 74   Index   Next Page 76

Color spaces
Page 75 of 839
Color Spaces
DynaPDF supports all color spaces defined in PDF 1.7. This section describes how color spaces can
be created and used with DynaPDF.
Color spaces in PDF can be divided into 3 types:
Device color spaces such as DeviceRGB, DeviceCMYK, and DeviceGray.
Device independent color spaces such as CalGray, CalRGB, Lab, and ICCBased. All these
color spaces are CIE based color spaces. The ICCBased color space is a special case of a CIE
based color space; it uses a color profile to convert colors into the destination space.
Special color spaces like Indexed, Separation, DeviceN, or NChannel. Pattern is also a special
color space but not listed here because DynaPDF uses separate functions to create and apply
pattern color spaces.
Device Color Spaces
The device color spaces enable a page description to specify color values that are directly related to
their representation on an output device. Color values in these spaces map directly (or by simple
conversions) to the application of device colorants, such as quantities of ink or intensities of display
phosphors. This enables a PDF document to control colors precisely for a particular device, but the
results may not be consistent from one device to another.
Device color spaces are supported within page descriptions and for interactive objects like
annotations and form fields. While form fields support all three available device color spaces,
annotations support DeviceRGB only. This behavior must be taken into account when creating such
objects. The use of an unsupported color space results in an error and the wished object is not
The use of device color spaces is very easy because no creation of a color space object is required
before such a color space can be used. All three device color spaces can be set directly with the
functions SetColorSpace(), SetFillColorSpace(), and SetStrokeColorSpace().
Once the color space was set the functions SetFillColor(), SetStrokeColor(), or SetColors() accept color
values of the particular color space:
DeviceGray controls the intensity of achromatic light, on a scale from black to white. It ranges
from 0 to 255 inclusive.
DeviceRGB controls the intensities of red, green, and blue light, the three additive primary
colors used in displays. RGB colors can be created with the macro PDF_RGB() or with
comparable functions like rgb() which are available in most programming languages. See also
Color Values.
DeviceCMYK controls the concentrations of cyan, magenta, yellow, and black inks, the four
subtractive process colors used in printing. CMYK colors can be created with the macro

Previous topic: Even-Odd Rule

Next topic: Device Independent Color Spaces, Special Color Spaces, Indexed Color Space