pdfRemoveDeviceNChannel
Remove a DeviceN color channel.
void pdfRemoveDeviceNChannel(PDFHandle pdf, int channelIdx)
This function removes (sets to zero) one color channel of the DeviceN
image generated by the last call to
pdfConvertPageToDeviceNImage
.
This is useful to remove one or more channels before calling
pdfGetDeviceNToRGBBitmap
.
The channel mask functions, pdfResetDeviceNChannelMask
and
pdfSetDeviceNChannelMask
, provide equivalent functionality and are
more efficient.
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 */
...
}
nChannels = pdfGetNumDeviceNChannels(pdf);
for (i = 0; i < nChannels; ++i) {
channelName = pdfGetDeviceNChannelName(pdf, i);
if ( ... ) {
pdfRemoveDeviceNChannel(pdf, i);
}
}
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);