Skip to content

2.21 Transparency, Opacity, Alpha Color Component and Blending

OgreTransporter edited this page Mar 2, 2020 · 1 revision

By default the PDF imaging model paints objects (shapes, lines, text and images) opaquely onto the page. Each new object completely obscure the image under it. PDF has two mechanisms to change this behavior opacity and blending. The graphic state dictionary has opacity value for stroking (pen) and non-stroking (brush) operations. The opacity value of fully opaque is 1.0 and fully transparent is 0.0. The opacity value corresponds to the alpha component of a color structure such that 1.0 is 255 alpha and 0.0 is 0 alpha. If the opacity value is 0.5 a new object painted on the page will be 50% transparent. To set opacity call the SetAlphaStroking method for lines or SetAlphaNonStroking method for shapes. Blending is a process of combining the color on the page with the color of the new item being painted. To set a bland mode call the SetBlendMode method of PdfContents. The argument is BlendMode enumeration. For full description please refer to section 7.2.4 Blend Mode of the PDF specifications document. For example please refer to OtherExample.cs page 8.

Clone this wiki locally