DynaPDF Manual - Page 223

Previous Page 222   Index   Next Page 224

Function Reference
Page 223 of 839
UI32 pdfConvColor(
const double* Color,
// Array of color components
UI32 NumComps,
// Number of color components
TExtColorSpace SourceCS, // Source color space
const void* IColorSpace, // Pointer to internal color space object
TExtColorSpace DestCS)
// Destination color space
The function converts a color of a PDF color space to a device color space. The function was
originally designed to convert colors of a PDF color space which was returned by the content parser,
but it is also possible to use the function stand alone, e.g. to calculate a spot color of a DeviceN or
Separation color space.
If used with the content parser, the required parameters Color, NumComps, SourceCS, and IColorSpace
are provided in the TSetFillColor or TSetStrokeColor callback functions. See ParseContent() for
further information.
The parameter DestCS defines the destination color space into which the color should be converted.
The destination color space must be a device color space (esDeviceGray, esDeviceRGB, or
If the function should be used stand alone, the parameters SourceCS and IColorSpace are provided in
the TPDFColorSpaceObj structure, see GetColorSpaceObj() for further information.
The array Color represents a color defined in the PDF color space. The array must be at least
NumInComponents values long. The number of color components is provided in the
TPDFColorSpaceObj structure.
The color components must be defined in the range of the color space, that is typically 0 through 1
for Device, ICCBased, Calibrated, DeviceN, NChannel, and Separation color spaces.
The default range of a Lab color space is [0..100, -128..127, -128..127] . The range of the L channel is
fixed, it ranges always from 0 though 100. The range of the a and b components can be restricted if
the color space contains a Range array.
The range of an Indexed color space is 0 through NumColors - 1. In any case, values which fall
outside the valid range will be adjusted to the nearest valid value.
In most cases the function is used to calculate the color of spot colorants. Spot colors can be defined
in Separation, DeviceN, and NChannel color spaces. NChannel is an extended DeviceN color space
that contains always attributed while they are optional for DeviceN color spaces. The attributes
dictionary of a DeviceN or NChannel color space lists all spot colorants in an array of Separation
color spaces (see GetColorSpaceObj()). Use the Separation colorspaces to calculate the color values
in this case. If a DeviceN color space contains no attributes dictionary then it is still possible to
enumerate and calculate the color values of spot colorants which are used by the color space but it is
some more work.

Previous topic: CloseTag, ComputeBBox, ConnectPageBreakEvent

Next topic: ConvertColors