DynaPDF Manual - Page 88
Previous Page 87 Index Next Page 89
Transparency
Page 88 of 839
Blend Modes
In addition to alpha blending the PDF standard defines several predefined blend modes (PDF 1.4) to
achieve certain special effects. Like the alpha constants the blend mode is part of an extended
graphics state object. The usage is identically in comparison to alpha transparency; that means the
wished blend mode must be applied with an extended graphics state object and the only way to
disable it is to apply another extended graphics state that sets the blend mode back to bmNormal.
Blend functions are applied in a blend color space which is normally the current color space. Valid
blend color spaces are DeviceGray, DeviceRGB, DeviceCMYK, CalGray, CalRGB, and ICCBased
color spaces which are equivalent to the other ones.
Lab and corresponding ICCBased color spaces are no valid blend color spaces because the blend
functions produce no meaningful results with these color spaces.
However, the ICC profile of an ICCBased color space must contain both AToB and BToA
transformations. This condition can be problematic because there is no easy way to determine
whether this is the case. DynaPDF provides no function to determine whether an ICC profile
contains both transformations.
Notice:
Note that Adobe's Acrobat uses always color management to render device colors when a blend
mode or alpha transparency is used on a page. The default output color space is always a CMYK
color space in PDF! That means, Acrobat or Reader applies a soft-proof on the default CMYK
ICC profile if the file contains no Output Intent. Therefore, it is strongly recommended to attach
an ICC profile with AddOutputIntent() to achieve predictable results.
Note also that the result of most blend modes depend strongly on the used color space. Due to
the way how blend modes compute color values the results for additive and subtractive color
spaces are very different.
Example (C++):
SI32 PDF_CALL PDFError(const void* Data, SI32 ErrCode,
const char* ErrMessage, SI32 ErrType)
{
printf("%s\n", ErrMessage);
return 0;
}
void AddCircles(const void* PDF, SI32 Templ, TPDFExtGState &ExtGS,
SI32 DefGS, TBlendMode Mode, double &x, double &y)
{
ExtGS.BlendMode = Mode;
pdfSetExtGState(PDF, DefGS);
pdfSetFillColor(PDF, PDF_BLACK);
x += 30.0;
y -= 20.0;
Previous topic: Transparency Groups / Soft Masks
Next topic: Tables, General properties, Error Handling, Borders, Cell Spacing, Cell Padding