The section describes the various shapes and so on that you can draw with graphics ports, and lists the relevant drawing functions. The graphics state foreground parameter is used for the drawing color.
All drawing functions must be called in the same process as the pane. You will need to arrange for that explicitly in contexts other than callbacks on that pane. To call a function explicitly in the pane's process, use apply-in-pane-process, apply-in-pane-process-if-alive, execute-with-interface or execute-with-interface-if-alive.
Note: Unlike images, the foreground and background colors used when drawing shapes described in this section are not pre-multiplied. Displaying images is described in Working with images.
Note: The full set of graphics state parameters is described under graphics-state.
You can draw text with the functions draw-string and draw-character.
To control the font used, see Portable font descriptions.
You can draw straight lines with the functions draw-line and draw-lines.
You can draw arcs of an ellipse with the functions draw-arc and draw-arcs.
You can draw ellipses and polygons with the functions draw-ellipse, draw-rectangle, draw-rectangles, draw-polygon and draw-polygons.
You can specify whether a shape is drawn in outline or is filled (with the graphics state foreground color) by the argument filled .
For example, to clear a rectangular region of an output pane, do
(draw-rectangle pane x y width height
:filled t
:foreground color
:compositing-mode :copy
:shape-mode :plain)
:compositing-mode
:copy
is needed only when the color has alpha, and :foreground
color
is needed only if it is different from the
foreground
in
pane
's graphics-state.
A graphics path is a series of lines, arcs and Bézier curves that together specify one or more disconnected figures to be drawn.
You can draw a path with the function draw-path.
A path can be drawn in outline or can be filled. A path can also be used as the clipping mask.
CAPI User Guide and Reference Manual (Unix version) - 3 Aug 2017