pdfResetDeviceNChannelMask
Reset the DeviceN channel mask to all-on.
void pdfResetDeviceNChannelMask(PDFHandle pdf)
This function sets the DeviceN channel mask so that all channels are "on".
The pdfGetDeviceNToRGBBitmap
uses a mask that controls which color
channels are included in the conversion. Channels that are "on" are
included; channels that are "off" do not contribute to the output
pixels. The channels are the same as reported by
pdfGetDeviceNChannelName
. The mask only affects the output of
pdfGetDeviceNToRGBBitmap
.
The DeviceN channel mask is automatically reset (all channels "on") on
each call to pdfConvertPageToDeviceNImage
,
pdfConvertPageToDeviceNImageWithAlpha
,
pdfConvertRegionToDeviceNImage
, or
pdfConvertRegionToDeviceNImageWithAlpha
.
C:
int nChannels, i;
char *channelName;
unsigned int channelCMYK;
PDFImageHeader hdr;
char *bits;
int err;
err = pdfConvertPageToDeviceNImage(pdf, pageNum, dpi);
if (err != pdfOk) {
/* handle the error */
...
}
pdfResetDeviceNChannelMask(pdf);
nChannels = pdfGetNumDeviceNChannels(pdf);
for (i = 0; i < nChannels; ++i) {
channelName = pdfGetDeviceNChannelName(pdf, i);
if ( ... ) {
pdfSetDeviceNChannelMask(pdf, 1);
} else {
pdfSetDeviceNChannelMask(pdf, 0);
}
}
pdfGetDeviceNToRGBBitmap(pdf, 4, &hdr, &bits);
... use the bitmap ...
/* the bitmap memory must be freed when you are finished */
pdfFreeMemory(bits);
/* free the internal storage used by pdfConvertPageToDeviceNImage */
pdfClearDeviceNImage(pdf);