Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 236

Previous Page 235   Index   Next Page 237

Function Reference
Page 236 of 770
const char* pcs[] = {"Cyan", "Magenta", "Yellow", "Black"};
float colors[] =
{
// The CMYK color values are taken from Adobe's Photoshop
0.38f, 0.00f, 0.34f, 0.0f, // Definition of the first spot color
1.00f, 0.56f, 0.00f, 0.0f, // Definition of the second spot color
0.00f, 0.00f, 1.00f, 0.0f
// Definition of the process color
};
pdfSetOnErrorProc(PDF, NULL, PDFError);
if (!pdfCreateNewPDF(PDF, "test.pdf")) return -2;
pdfAppend(PDF);
// We need to create the PostScript calculator function first because
// it is a required parameter of pdfCreateDeviceNColorSpace().
CreateBlendFunction(psFunc, colors, sizeof(colors) / sizeof(float));
// Create the DeviceN color space
cs = pdfCreateDeviceNColorSpace(
PDF,
// Instance pointer
cls,
// The colorants array
3,
// Number of colorants in the array
psFunc,
// Our PostScript tint transformation function
esDeviceCMYK, // Alternate color space
-1);
// No handle is required for a device color space
if (cs < 0) return cs;
// We create also Separation color spaces for the spot colors and add
// these color spaces as an attribute to the DeviceN color space:
UI32 separations[2];
// First spot color
separations [0] = pdfCreateSeparationCS(
PDF,
cls[0],
esDeviceCMYK,
-1,
PDF_CMYK(97, 0, 87, 0)); // 0.38 * 255, 0 * 255, 0.34 * 255, 0 * 255
// Second spot color
separations[1] = pdfCreateSeparationCS(
PDF,
cls[1],
esDeviceCMYK,
-1,
PDF_CMYK(255, 143, 0, 0)); // 1.0 * 255, 0.56 * 255, 0 * 0, 0 * 0
// Add the separation color spaces to the DeviceN color space.
pdfAddDeviceNSeparations(
PDF,
// Instance pointer
cs,
// DeviceN color space handle
 

Previous topic: Example 2:

Next topic: CreateExtGState