Graphics Programs Reference
In-Depth Information
Transparency
PDF has a sophisticated but complicated transparency mechanism which works in
multiple color spaces, allows different types of blending, and supports grouped trans-
parencies. We only consider simple transparency here.
There are no specific transparency operators so we use the gs operator to load the fill
transparency level from the /ca entry in the /ExtGState entry in the page's resources.
The /ExtGState entry is a dictionary of collections of external graphics state , which we
can load in using the gs operator.
For our example, the resources consist of just the /ExtGState entry, with a single
collection of state, called /gs1 . It contains just the /ca entry for fill transparency:
<< /ExtGState
<< /gs1
<< /ca 0.5 >> Half transparent
>>
>>
Here is the corresponding content stream:
2.0 w Select 2pt line width
/gs1 gs Select /gs1 from external graphics state
0.75 g Select light Gray
200 250 m 300 350 400 450 500 250 c
400 250 300 200 y h B
1 0 0 1 100 100 cm
200 250 m 300 350 400 450 500 250 c
400 250 300 200 y h B
The result is shown in Figure 5-11 . The transparency is defined so that 0 means wholly
transparent, and 1 wholly opaque. The stroke transparency may be altered with /CA in
place of (or in addition to) /ca .
Shadings and Patterns
As well as plain colors, PDF allows various patterns to be used to fill and stroke objects:
Tiling patterns , where a pattern cell is replicated over the page.
Shading patterns , where a gradient between colors is used to fill an object. There
are many types, with many options and settings:
Function-based
Axial
Radial
Free-form Gouraud-shaded triangle mesh
Lattice-form Gouraud-shaded triangle mesh
Coons patch mesh
Tensor-product patch mesh
Search WWH ::




Custom Search