-
Notifications
You must be signed in to change notification settings - Fork 1
2.21 Transparency, Opacity, Alpha Color Component and Blending
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.
This page is a copy from https://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library by Uzi Granot. The article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL). All rights to the texts and source code remain with Uzi Granot.