LispWorks CAPI Reference Manual > 2 GP Reference Entries

NextPrevUpTopContentsIndex

make-graphics-state

Function
Summary

Creates a graphics state object.

Package

graphics-ports

Signature

make-graphics-state &key transform foreground background operation thickness scale-thickness dashed dash line-end-style line-joint-style mask font fill-style stipple pattern mask-x mask-y => state

Arguments

transform

An object which determines the coordinate transformation applying to the graphics port. The default value is the unit transform which leaves the port coordinates unchanged from those used by the host window system -- origin at top left, X increasing to the right and Y increasing down the screen. Allowed values are anything returned by the transform functions , described in section "Graphics state transforms" of the LispWorks CAPI User Guide .

foreground

Determines the foreground color used in drawing functions. The value can be a pixel value, a color name symbol, a color name string or a color spec object. Using pixel values results in better performance. The default value is :black . The value :color_highlighttext is useful for drawing text with the system highlighting.

background

Determines the background color used in drawing functions which use a stipple. Valid values are the same as for foreground . The default value is :white . The value :color_highlight is useful for drawing text with the system highlighting.

operation

Determines the color combination used in the drawing primitives. Valid values are 0 to 15, being the same logical values as the op arg to the Common Lisp function boole . The default value is boole-1 . The section "Graphics state operation" in the LispWorks CAPI User Guide shows how to use operation .

stipple

A 1-bit pixmap ("bitmap") or nil (which is the default value). The bitmap is used in conjunction with the fill-style when drawing. Here, nil means that all pixels are drawn in the foreground color. A stipple is not transformed by the transform parameter. Its origin is assumed to coincide with the origin of the port. The stipple is tiled across the drawing. stipple is ignored if a pattern is given. If no fill-style is given, or it is specified as :solid , when a stipple is given, then fill-style defaults to :opaque-stippled .

fill-style

Determines how the drawing is done. The value should be one of :solid , :opaque-stippled , :stippled or :tiled . The default value :solid means that the foreground is used everywhere. :opaque-stippled means that the stipple bitmap is used with stipple 1s giving the foreground and 0s the background . :stippled means that the stipple bitmap is used with foreground where there are 1s and where the are 0s, no drawing is done. If you specify a stipple but no fill-style , or a fill-style of :solid , it defaults to :opaque-stipple .

pattern

An image the same depth as the port, or nil . If non-nil, pattern is used as the source of color for drawing instead of the foreground and background parameters. A pattern is not transformed by the transform parameter. The pattern is tiled across the drawing. When pattern is specified, the stipple value is ignored.The default value of pattern is nil .

See "Working with images" in the LispWorks CAPI User Guide for information on creating an image.

thickness

A number (defaulting to 1) specifying the thickness of lines drawn. If scale-thickness is non-nil, the value thickness is in port (transformed) coordinates, otherwise thickness is in pixels.

scale-thickness

A boolean, defaulting to t which means interpret the thickness parameter in transformed port coordinates. If scale-thickness is nil, thickness is interpreted in pixels.

dashed

A boolean, defaulting to nil . If dashed is t then lines are drawn as a dashed line using dash as the mark-space specifier.

dash

A list of two or more integer, or nil . A list of integers specifies the alternate mark and space sizes for dashed lines. These mark and space values are interpreted in pixels only. The default value of dash is (4 4) .

line-end-style

The value should be one of :butt , :round or :projecting and specifies how to draw the ends of lines. The default value is :butt .

line-joint-style

The value should be one of :bevel , :miter or :round and specifies how to draw the areas where the edges of polygons meet. The default value is :miter .

mask

The value should be nil (the default) or a list of the form ( x y width height ) , defining a rectangle inside which the drawing is done. The mask is not tiled. A mask is not transformed by the transform parameter.

mask-x

An integer specifying in window coordinates where in the port the X coordinate of the mask origin is to be considered to be. The default value is 0.

mask-y

An integer specifying in window coordinates where in the port the Y coordinate of the mask origin is to be considered to be. The default value is 0.

font

Either nil or a portable font description or font object to be used by the draw-character and draw-string functions. See "Portable font descriptions" in the LispWorks CAPI User Guide for details. The default value is nil .

Values

state

A graphics state object.

Description

The make-graphics-state function creates a graphics state object. Each graphics port has a graphics state associated with it, but you may want to create your own individual graphics states for use in specialized drawing operations. Graphics state objects do not consume local resources beyond dynamic memory for the structure (so you can be relaxed about creating them in some number if you really need to). Such objects are used in the with-graphics-state macro described below and modified using the following functions:

graphics-state-transform 
graphics-state-foreground 
graphics-state-background 
graphics-state-operation 
graphics-state-stipple 
graphics-state-pattern 
graphics-state-thickness 
graphics-state-scale-thickness 
graphics-state-dashed 
graphics-state-dash 
graphics-state-fill-style
graphics-state-line-end-style 
graphics-state-line-joint-style 
graphics-state-mask 
graphics-state-mask-x 
graphics-state-mask-y 
graphics-state-font

These are the read and write (via setf ) accessors for the graphics state slots. See "Setting the graphics state" in the LispWorks CAPI User Guide for examples.

Notes

operation is not supported for drawing text on Microsoft Windows.

stipple , fill-style , mask-x and mask-y are supported only on X11/Motif.

pattern is supported only on Microsoft Windows and X11/Motif.

operation is not supported by Cocoa/Core Graphics so this slot or argument is ignored on Cocoa.

See also

set-graphics-state


LispWorks CAPI Reference Manual - 21 Dec 2009

NextPrevUpTopContentsIndex