Previous Next


                                       295
SECTION 4.6                                                                 Patterns



pattern defines its own color information, no additional operands representing
color components are specified to SCN or scn. For example, if P1 is the name of a
pattern resource in the current resource dictionary, the following code establishes
it as the current nonstroking color:

  /Pattern cs
  /P1 scn

Subsequent executions of nonstroking painting operators, such as f (fill), Tj (show
text), or Do (paint external object) with an image mask, use the designated pat-
tern to tile the areas to be painted.

Example 4.23 defines a page (object 5) that paints three circles and a triangle
using a colored tiling pattern (object 15) over a yellow background. The pattern
consists of the symbols for the four suits of playing cards (spades, hearts, dia-
monds, and clubs), which are character glyphs taken from the ZapfDingbats font
(see Section D.5, “ZapfDingbats Set and Encoding”); the pattern’s content stream
specifies the color of each glyph. Plate 8 shows the results.

Example 4.23

  5 0 obj                                        % Page object
     << /Type /Page
         /Parent 2 0 R
         /Resources 10 0 R
         /Contents 30 0 R
         /CropBox [ 0 0 225 225 ]
     >>
  endobj

  10 0 obj                                       % Resource dictionary for page
     << /Pattern << /P1 15 0 R >>
     >>
  endobj

Previous Next