What method should I use to draw a complete defined color image to memory?
Estimated Reading Time: 1 MinutesSuppose you want to create only a cyan or magenta color separation from an image in a PDF document. PDPageMakeSeparations() will provide PostScript separations.
Datalogics offers several sample programs that demonstrate working with color separations. In Adobe C/C++, see CreateSeparations.
Also, within the Adobe PDF Library, modern C++, Java and .NET Interface, several sample programs demonstrate how to separate colors for images.
- See Images samples, particularly DrawSeparations and EPSSeparations for modern C++
- See Images samples, particularly DrawSeparations and EPSSeparations for .NET
- See Images samples, particularly DrawSeparations and EPSSeparations for .NET Framework
- See Images samples, particularly DrawSeparations and EPSSeparations for Java
It is also easy to separate colors with your own code. For example, if you render a page to a bit map using PDPageDrawContentsToMemory() and CMYK, this code fragment:
For (Row = 0; Row < Rows; Row++)
For (Pixel = 0; Pixel < RowWide; Pixel++)
{
BitMap[(Row * RowWide * 4) + (Pixel * 4)] + 1] = 0;
BitMap[(Row * RowWide * 4) + (Pixel * 4)] + 2] = 0;
BitMap[(Row * RowWide * 4) + (Pixel * 4)] + 3] = BitMap[(Row * RowWide * 4) + (Pixel * 4)] + 0];
}
Would result in a bit map that only shows the cyan colors, and shows it as black.