NextPrevUpTopContentsIndex

with-graphics-state

Macro
Summary

Binds the graphics state values of a port to a list of arguments and executes a body of code.

Package

graphics-ports

Signature

with-graphics-state ( port &rest args
&key transform foreground background
operation thickness scale-thickness dashed
dash line-end-style line-joint-style mask font
state fill-style stipple pattern mask-x mask-y )
body => result

Arguments

port

A graphics port.

body

A body of Lisp code.

Values

result

The return value of the last form executed in body .

Description

The with-graphics-state macro binds the graphics state values for the specified port to the values specified in the args list. The keyword arguments args correspond to the slots in the graphics state, as described in set-graphics-state. See the "Graphics state" section in the LispWorks CAPI User Guide for valid values for args .

For example:

(with-graphics-state (port :thickness 12 
                           :foreground fore-color) ...)

Arguments that are not supplied default to the current state of that slot in the graphics state. The arguments fill-style , stipple , pattern , mask-x and mask-y are used only on Unix.

An extra keyword argument :state can be used. The value must be a graphics state object created by a call to make-graphics-state. The contents of the graphics state object passed are used instead of the port's state.

Example
(setf gstate (make-graphics-state)) (setf (graphics-state-foreground gstate) my-color)
(with-graphics-state (port :state gstate)
  (draw-rectangle port image-1 100 100))
See also

set-graphics-state


LispWorks CAPI Reference Manual - 11 Apr 2005

NextPrevUpTopContentsIndex