Xojo Conferences

DynaPDF Manual - Page 200

Previous Page 199   Index   Next Page 201

Function Reference
Page 200 of 770
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.
DeviceN and Separation color spaces are subtractive color spaces. Thus, a tint value of 0.0 denotes
the lightest color that can be achieved with a given colorant, and 1.0 denotes the darkest.
If you want to calculate the color of a spot colorant then initialize the color channel that corresponds
to the spot colorant to 1.0 and the remaining channels to 0.0, if any.
Now it is important to know what is a spot colorant? A Separation color space supports two special
colorant names: All and None. The value All refers to all channels of the output device and None
produces no visible output.
DeviceN supports 5 reserved values: the colorant names Cyan, Magenty, Yellow, and Black are
always treated as device colorants, and the special colorant name None produces no visible output.
All other colorant names are considered as spot colorants. Colorant names must be compared case-
So, if you want to calculate the color value of a spot colorant, then you must first compare the
colorant names against the reserved or special colorant names of the color space. If a spot color was
found, initialize that color channel to 1.0 and all others to 0.0. Continue until all colorants of the color
space were visited, see example below.
Return values:
If the function succeeds the return value is the color value defined in the destination color space. If
the function fails the return value is zero without further error indication. However, the function
cannot fail if valid values were passed to the function.
Example (C++):
// Returns true if the colorant is a spot colorant
bool IsSpotColor(const char* Colorant, bool Separation)
if (Separation)
return (strcmp(Colorant, "None") && strcmp(Colorant, "All"));
return (strcmp(Colorant, "Cyan") && strcmp(Colorant, "Magenta")
&& strcmp(Colorant, "Yellow") && strcmp(Colorant, "Black")
&& strcmp(Colorant, "None"));

Previous topic: ConnectPageBreakEvent, ConvColor

Next topic: ConvertColors