Previous Next
350
CHAPTER 4 Graphics
define the image being clipped as a pattern, make it the current color, and then
paint the explicit mask as an image whose ImageMask entry is true. In any case, the
PDF 1.3 features allow masked images to be placed on the page regardless of the
complexity of the clipping path.
In the transparent imaging model, a fourth type of masking effect, soft masking, is
available through the SMask entry (PDF 1.4) or the SMaskInData entry (PDF 1.5)
in the image dictionary; see Section 7.5.4, “Specifying Soft Masks,” for further
discussion.
Stencil Masking
An image mask (an image XObject whose ImageMask entry is true) is a mono-
chrome image in which each sample is specified by a single bit. However, instead
of being painted in opaque black and white, the image mask is treated as a stencil
mask that is partly opaque and partly transparent. Sample values in the image do
not represent black and white pixels; rather, they designate places on the page that
should either be marked with the current color or masked out (not marked at all).
Areas that are masked out retain their former contents. The effect is like applying
paint in the current color through a cut-out stencil, which lets the paint reach the
page in some places and masks it out in others.
An image mask differs from an ordinary image in the following significant ways:
• The image dictionary does not contain a ColorSpace entry because sample
values represent masking properties (1 bit per sample) rather than colors.
• The value of the BitsPerComponent entry must be 1.
• The Decode entry determines how the source samples are to be interpreted. If
the Decode array is [ 0 1 ] (the default for an image mask), a sample value of 0
marks the page with the current color, and a 1 leaves the previous contents un-
changed. If the Decode array is [ 1 0 ], these meanings are reversed.
One of the most important uses of stencil masking is for painting character
glyphs represented as bitmaps. Using such a glyph as a stencil mask transfers only
its “black” bits to the page, leaving the “white” bits (which are really just back-
ground) unchanged. For reasons discussed in Section 5.5.4, “Type 3 Fonts,” an
image mask, rather than an image, should almost always be used to paint glyph
bitmaps.
Previous Next