Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 201

Previous Page 200   Index   Next Page 202

Function Reference
Page 201 of 770
// Helper function to process the spot colors in DeviceN, NChannel, and
// Separation color spaces
void ProcessColorSpace(TPDFColorSpaceObj &CS)
{
UI32 i, color;
double inClr[32] = {0}; // More than 32 channels cannot occur!
for (i = 0; i < CS.ColorantsCount; i++)
{
if (IsSpotColor((char*)CS.Colorants[i], CS.Type == esSeparation))
{
inClr[i] = 1.0;
// Do something with the color...
color = pdfConvColor(inClr,
CS.NumInComponents,
CS.Type,
CS.IColorSpaceObj,
esDeviceCMYK);
inClr[i] = 0.0;
}
}
}
void EnumSpotColors(const void* PDF)
{
UI32 j;
SI32 i, count;
TPDFColorSpaceObj cs;
TDeviceNAttributes at;
count = pdfGetColorSpaceCount(PDF);
for (i = 0; i < count; i++)
{
if (pdfGetColorSpaceObj(PDF, i, &cs))
{
switch(cs.Type)
{
case esDeviceN:
case esNChannel:
{
if (cs.IAttributes)
{
// Process the separation color spaces directly
if (pdfGetDeviceNAttributes(cs.IAttributes, &at))
{
for (j = 0; j < at.SeparationsCount; j++)
{
if (pdfGetColorSpaceObjEx(at.Separations[j],&cs))
ProcessColorSpace(cs);
}
}
continue;
}
}
case esSeparation: ProcessColorSpace(cs); continue;
default:
continue;
}
}
}
}
 

Previous topic: ConnectPageBreakEvent, ConvColor

Next topic: ConvertColors