loadMPDeviceNChannels
Get the list of DeviceN color channels used on a page (multi-pass DeviceN API).
loadMPDeviceNChannels([in] int page)
This function analyzes the specified page and constructs a list of all
DeviceN color channels (CMYK + spot colors) used on that page. The
resulting list can be read with the
getNumMPDeviceNChannels
and getMPDeviceNChannelName
functions.
The "MP" in the function names refers to multi-pass DeviceN
rasterization support. These functions are different from
getNumDeviceNChannels
and getDeviceNChannelName
, which
look at the list of channels used in the most recent DeviceN
rasterization (via convertPageToDeviceNImage
, etc).
XpdfRasterizer is limited to rasterizing 32 color channels (4 CMYK channels + 28 spot channels) at a time. Normally, any channels beyond those 32 are converted to CMYK. The multi-pass support allows running multiple passes to rasterize any number of channels.
C#:
// Print the list of all channels used on <page>.
// This list may contain more than 32 channels.
rast.loadMPDeviceNChannels(page);
int nChannels = rast.getNumMPDeviceNChannels();
for (i = 0; i < nChannels; ++i) {
string name = rast.getMPDeviceNChannelName(i);
... channel <i> = <name> ...
}
// All rasterizations include CMYK as the first four channels, and
// the limit is 32 channels, which means we can rasterize 28 spot
// channels per run. For the first run we write the CMYK bitmaps;
// for subsequent runs we skip them (they'll be identical).
int i = 4;
do {
// rasterize CMYK (channels 0..3) + spot channels i .. i+28
rast.resetMPDeviceNChannelList();
for (int j = i; j < i + 28 && j < nChannels; ++j) {
rast.addMPDeviceNChannel(rast.getMPDeviceNChannelName(j));
}
rast.convertPageToDeviceNImage(page, dpi);
for (int j = (i == 4) ? 0 : 4; j < rast.getNumDeviceNChannels(pdf); ++j) {
string channelName = rast.getDeviceNChannelName(pdf, j);
stdole.IPicture pic = rast.getDeviceNPicture(j);
... use the bitmap for <channelName> ...
}
rast.clearDeviceNImage(pdf);
i += 28;
} while (i < nChannels);