DynaPDF Manual - Page 543
Previous Page 542 Index Next Page 544
Page 543 of 821
The flags must be added to the parameter ColorCount with a binary or operator:
= 256 | rifRGBData | rifByteAligned;
// C/C++, C#
= 256 or rifRGBData or rifByteAligned
// Visual Basic
DWORD colorCount := 256 or rifRGBData or rifByteAligned; // Delphi
The above example specifies that the image data starts with a color table with 256 RGB colors and
the following scanlines are byte aligned.
If the image has a color depth of 24 or 32 bits per pixel the pixel data must be defined in BGR or
BGRA (BGR Alpha) or RGB or RGBA format depending on whether the flag rifRGBData was set.
The alpha component will be converted to a soft mask to preserve the alpha channel. However,
alpha components in a color table will be ignored at this time.
If a 32 bit image should be interpreted as CMYK image then set the flag rifCMYKData.
A color table in BGRA or RGB format must precede the image data if BitsPerPixel is 4 or 8 and
depending on whether the flag rifRGBData was set. The parameter ColorCount specifies the number
of colors in the color table. It is also possible to insert a gray scale image. BitsPerPixel must be 8 in
this case, and ColorCount must be zero. No color table must precede the image data in this case.
If the color depth is 1, 16, 24, or 32 bits per pixel no color table must be present. The parameter
ColorCount will be ignored for these images, it should be set to 0.
If the image height is a positive value the image is treated from bottom to top. Top-down images can
be mirrored by setting the image height to a negative value.
If the active color space is a device color space the image will be converted into that color space if
necessary (with exception of 1 bit images).
For all other color spaces the image data must be defined in the active color space. 1 bit images can
also be used with Separation color spaces. See also Color Space and Images. However, all other color
spaces require 8 bits per color component.
A color table cannot be prepended if the image is defined in a non device color space but it is
possible to create an indexed color space for the image (see CreateIndexedColorSpace()) and to
activate it with SetExtColorSpace() before the image will be inserted. The image data must contain 8
bit indexes into the color table in this case.
If the active color space is DeviceN, the image can contain up to 32 color components (256 bits per
pixel). Images with more than 4 color components are always Flate compressed.
How to calculate the image size?
The calculation of the image size should be easy as possible. In most cases, images must be inserted
with exact proportions. Therefore, all image functions support two special values to make the
calculation easier. The width and height can be calculated as follows:
Previous topic: InsertRawImage
Next topic: InsertRawImageEx