Graphics Programs Reference
In-Depth Information
1 J Change line ending cap to rounded (code 1) from default square (code 0)
100 200 m 300 300 l 700 200 l Define new path, same shape but 100pts higher up the page
S Stroke the new line
[20] 0 d Change to 20pt dashes
100 300 m 300 400 l 700 300 l Define new path, same shape but another 100pts higher up the page
S Stroke the new line
The result is shown in Figure 5-2 .
Figure 5-2. Building lines with differing widths, end caps, join styles, and dash patterns
We've used the m operator to move to the start of the new path, and the l operator to
form two lines. Note that at this point, nothing has been drawn—the page is only
affected when we use the S operator to stroke the line. The S operator also clears the
current path.
The w operator sets the line width in the graphics state to 8 points. The J operator sets
the line endings to rounded caps. The dash pattern is set with the d operator, which
takes two operands: an array (which is a repeating sequence of dash length, gap length,
dash length etc, which are cycled through when stroking the line), and an initial offset
(the phase ) which moves the start of the pattern. In our example, there is just one entry,
so dashes and gaps are both 20pt, and the phase is 0.
 
Search WWH ::




Custom Search