DynaPDF Manual - Page 278

Previous Page 277   Index   Next Page 279

Function Reference
Page 278 of 839
CreateIndexedColorSpace
Syntax:
SI32 pdfCreateIndexedColorSpace(
const PPDF* IPDF,
// Instance pointer
TExtColorSpace Base,
// Base color space
SI32 Handle,
// Color space handle or -1 depending on Base
const void* ColorTable,
// Array of colors
UI32 NumColors)
// Number of colors in the array
The function creates an indexed color space which can be used for vector graphics and text output.
The parameter Base defines the underlying base color space. It can be any device or ICC-based color
space or separation space, but not a pattern space or another indexed space.
The parameter Handle must be a handle of the underlying base color space if no device color space is
used. If a device color space is used the parameter Handle is ignored.
The color table must be defined as an array of color values defined in the corresponding base color
space. For example, if the base color space is DeviceRGB, the values in the color table are to be
interpreted as red, green, and blue components; if the base color space is a CIE-based ABC space
such as a CalRGB or Lab space, the values are to be interpreted as A, B, and C components.
The number of components is taken from the base color space. The parameter NumColors defines the
number of color values defined in the array. An indexed color space cannot contain more than 256
colors.
The length of the color table in bytes must be NumColors * NumComponents.
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:
This function does not activate the color space in the graphics state. Use the function
SetExtColorSpace() to activate the color space in the graphics state. To set a color of the indexed
color space pass the color index to SetFillColor(), SetStrokeColor(), or SetColors().
Return values:
If the function succeeds the return value is a color space handle, a value greater or equal zero. If the
function fails the return value is a negative error code.
 

Previous topic: CreateImportDataAction

Next topic: CreateJSAction, CreateLaunchAction