5.2 Creating Graphics Contexts

To create a graphics context, use create-gcontext.



create-gcontext &key :arc-mode :background (:cache-p t) :cap-style :clip-mask :clip-ordering :clip-x :clip-y :dash-offset :dashes :drawable :exposures :fill-rule :fill-style :font :foreground :function :join-style :line-style :line-width :plane-mask :stipple :subwindow-mode :tile :ts-x :ts-y Function
        
:cache-p
Specifies if this graphics context should be cached locally by CLX. If nil then the state is not cached, otherwise a local cache is kept.
:drawable
The drawable whose root and depth are to be associated with this graphics context. This is a required keyword argument.
:arc-mode, :background, :cap-style, :clip-mask, :clip-ordering, :clip-x, :clip-y, :dash-offset, :dashes, :exposures, :fill-rule, :fill-style, :font, :foreground, :function, :join-style, :line-style, :line-width, :plane-mask, :stipple, :subwindow-mode, :tile, :ts-x, :ts-y
Initial attribute values for the graphics context.

Creates, initializes, and returns a graphics context (gcontext). The graphics context can only be used with destination drawables having the same root and depth as the specified :drawable. If :cache-p is non-nil, the graphics context state is cached locally, and changing a component has no effect unless the new value differs from the cached value. Changes to a graphics context (setf and with-gcontext) are always deferred regardless of the cache mode and sent to the server only when required by a local operation or by an explicit call to force-gcontext-changes.

All of the graphics context components are set to the values that are specified by the keyword arguments, except that a value of nil causes the default value to be used. These default values are as follows:

Component Default Value
arc-mode :pie-slice
background 1
cap-style :butt
clip-mask :none
clip-ordering :unsorted
clip-x 0
clip-y 0
dash-offset 0
dashes 4 (that is, the list '(4, 4))
exposures :on
fill-rule :even-odd
fill-style :solid
font server dependent
foreground 0
function boole-1
join-style :miter
line-style :solid
line-width 0
plane-mask A bit mask of all ones
stipple Pixmap of unspecified size filled with ones
subwindow-mode :clip-by-children
tile Pixmap of an unspecified size filled with the foreground pixel (that is, the client-specified pixel if any, or else 0)
ts-x 0
ts-y 0

Note that foreground and background do not default to any values that are likely to be useful on a color display. Since specifying a nil value means use the default, this implies for clip-mask that an empty rectangle sequence cannot be specified as an empty list; :none must be used instead. Specifying a stringable for font causes an implicit open-font call to occur.

gcontext
Type gcontext.