DynaPDF Manual - Page 149

Previous Page 148   Index   Next Page 150

Function Reference
Page 149 of 839
= pdfAddLayerToDisplTree(PDF, root, -1, "This is a group");
pdfAddLayerToDisplTree(PDF, grp, oc1, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc2, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc3, NULL);
Normally, the second version shouldn't work since the parent node is empty but in practice both
versions produce the same result. However, many third-party viewers have problems to display the
layer tree if the title was set in the parent node (the first variant).
LBOOL pdfAddMaskImage(
const PPDF* IPDF,
// Instance pointer
UI32 BaseImage,
// Image to which the mask should be added
const void* Buffer, // Image buffer
UI32 BufSize,
// Buffer size
SI32 Stride,
// Scanline length in bytes
UI32 BitsPerPixel,
// 1 and 8 bits per pixel are supported
UI32 Width,
// Image width
UI32 Height)
// Image height
The function adds an image mask to a base image. If BitsPerPixel is 1, the image is used as an image
mask or stencil mask. The image mask specifies which areas on the page should be painted and
which should be masked out (left unchanged).
If BitsPerPixel is 8, the image is used as a soft mask. A soft mask represents an alpha channel that
ranges from 0 (transparent) through 255 (opaque).
The base and mask image need not to have the same width and height since both images are scaled
into the same destination rectangle or parallelogram so that the boundaries coincide. This makes it
possible to use a higher resolution mask with a lower resolution base image or vice versa.
If the image contains already a mask image then this mask will be replaced with the new one.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.

Previous topic: AddLayerToDisplTree

Next topic: AddObjectToLayer, AddOCGToAppEvent