Previous Next


                                              214
      CHAPTER 4                                                                  Graphics



      In general, the operators that set graphics state parameters simply store them un-
      changed for later use by the painting operators. However, some parameters have
      special properties or behavior:

      • Most parameters must be of the correct type or have values that fall within a
        certain range.
      • Parameters that are numeric values, such as the current color, line width, and
        miter limit, are forced into valid range, if necessary. However, they are not ad-
        justed to reflect capabilities of the raster output device, such as resolution or
        number of distinguishable colors. Painting operators perform such adjust-
        ments, but the adjusted values are not stored back into the graphics state.
      • Paths are internal objects that are not directly represented in PDF.
      Note: As indicated in Tables 4.2 and 4.3, some of the parameters—color space, color,
      and overprint—have two values, one used for stroking (of paths and text objects)
      and one for all other painting operations. The two parameter values can be set inde-
      pendently, allowing for operations such as combined filling and stroking of the same
      path with different colors. Except where noted, a term such as current color should
      be interpreted to refer to whichever color parameter applies to the operation being
      performed. When necessary, the individual color parameters are distinguished ex-
      plicitly as the stroking color and the nonstroking color.


4.3.1 Graphics State Stack

      A well-structured PDF document typically contains many graphical elements
      that are essentially independent of each other and sometimes nested to multiple
      levels. The graphics state stack allows these elements to make local changes to the
      graphics state without disturbing the graphics state of the surrounding environ-
      ment. The stack is a LIFO (last in, first out) data structure in which the contents
      of the graphics state can be saved and later restored using the following operators:

      • The q operator pushes a copy of the entire graphics state onto the stack.
      • The Q operator restores the entire graphics state to its former value by popping
        it from the stack.

Previous Next