Graphics Programs Reference
In-Depth Information
Figure 5-7. The DeviceGray color space
Transformations
So far, we've seen operators that alter the graphics state of all the operators that follow
them. In order to allow us to group together graphics objects with their attributes (such
as color), we can bracket a group of operators with the q and Q operators. The q operator
puts aside the current graphics state. The state may then be altered, objects painted,
and so on— as usual. When the Q operator is invoked, the previous saved state is
restored. The q/Q pairs may be nested, one pair inside another:
0.75 g Change to light Gray fill
250 250 100 100 re f
q Save the graphics state
0.25 g Change to dark Gray fill
350 250 100 100 re f
Q Retrieve the previous graphics state
450 250 100 100 re f Light Gray again
The q/Q operators in a stream must form balanced pairs (with the exception that, at the
end of a graphics stream, any remaining Q operators may be omitted). The result is
shown in Figure 5-8 .
 
Search WWH ::




Custom Search