All Manuals > CAPI User Guide and Reference Manual > 13 Drawing - Graphics Ports

NextPrevUpTopContentsIndex

13.3 Graphics state

The graphics-state object associated with each port holds values for parameters such as foreground , background , operation , thickness , scale-thickness , mask and font which affect graphics ports drawing to that port.

The full set of parameters is described under graphics-state.

13.3.1 Setting the graphics state

The graphics state values associated with a drawing function call are set by one of three mechanisms.

  1. Enumeration in the drawing function call. For example:
  2. (draw-line port
     1 1 100 100  
               :thickness 10
               :scale-thickness nil
               :foreground :red)
  3. Bound using macros such as with-graphics-state. For example:
  4. (with-graphics-state (port
     :thickness 10
                               :scale-thickness nil
                               :foreground :red)
      (draw-line port
     1 1 100 100)
      (draw-rectangle port
     2 2 40 50 :filled t))

    For common cases of locally changing the transform in the graphics state, there are specific macros:

  5. with-graphics-transform just changes the transform like with-graphics-state with :transform.
  6. with-graphics-transform-reset allows you to ignore surrounding transformations.
  7. with-graphics-translation, with-graphics-post-translation, with-graphics-scale and with-graphics-rotation perform commonly-used transformations.
  8. with-graphics-mask affects specifically the masking slots.
  9. Set by the set-graphics-state function. For example:
(set-graphics-state port
 :thickness 10
                    :scale-thickness nil
                    :foreground :red)

The first two mechanisms change the graphics state temporarily. The last one changes it permanently in port , effectively altering the "default" state.


CAPI User Guide and Reference Manual (Macintosh version) - 25 Feb 2015

NextPrevUpTopContentsIndex