Common Lisp Interface Manager 2.0 User's Guide > Chapter 2 Drawing Graphics > 2.3 CLIM Drawing Functions

NextPrevUpTopContentsIndex

2.3.1 Arguments

point-seq is a sequence of point objects.

coord-seq is a sequence of coordinate pairs, which are real numbers. It is an error if coord-seq does not contain an even number of elements.

The drawing functions take keyword arguments specifying drawing options. For information on the drawing options, see 3.2, Using CLIM Drawing Options. If you prefer to create and use point objects, see 2.5.2, CLIM Point Objects.

draw-point [Function]	

Arguments: sheet point &key ink clipping-region transformation line-style line-thickness line-unit

draw-point* [Function]	

Arguments: sheet x y &key ink clipping-region transformation line-style line-thickness line-unit

Summary: These functions (structured and spread arguments, respectively) draw a single point on the sheet sheet at the point point (or the position ( x, y )).

The unit and thickness components of the current line style (see 3.2, Using CLIM Drawing Options) affect the drawing of the point by controlling the number of pixels used to render the point on the display device.

draw-points [Function]	

Arguments: sheet point-seq &key ink clipping-region transformation line-style line-thickness line-unit

draw-points* [Function]	

Arguments: sheet coord-seq &key ink clipping-region transformation line-style line-thickness line-unit

Summary: These functions (structured and spread arguments, respectively) draw a set of points on the sheet sheet .

For convenience and efficiency, these functions exist as equivalents to

(map nil #'(lambda (point) (draw-point sheet point)) point-seq)

and

        (do ((i 0 (+ i 2))) 
            ((= i (length coord-seq))) 
          (draw-point* sheet (elt coord-seq i) (elt coord-seq (+ i 1)))) 

 

draw-line [Function]	

Arguments: sheet point1 point2 &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

draw-line* [Function]	

Arguments: sheet x1 y1 x2 y2 &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

Summary: These functions (structured and spread arguments, respectively) draw a line segment on the sheet sheet from the point point1 to point2 (or from the position ( x1 , y1 ) to ( x2 , y2 )).

The current line style (see 3.2, Using CLIM Drawing Options) affects the drawing of the line in the obvious way, except that the joint shape has no effect. Dashed lines start dashing at point1 .

draw-lines [Function]	

Arguments: sheet point-seq &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

draw-lines* [Function]	

Arguments: sheet coord-seq &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

Summary: These functions (structured and spread arguments, respectively) draw a set of disconnected line segments. These functions are equivalent to

        (do ((i 0 (+ i 2)))
            ((= i (length point-seq))) 
          (draw-line sheet (elt point-seq i) (elt point-seq (1+ i)))) 

and

        (do ((i 0 (+ i 4))) 
            ((= i (length coord-seq))) 
          (draw-line* sheet
                      (elt coord-seq i) (elt coord-seq (+ i 1)) 
                      (elt coord-seq (+ i 2)) 
                      (elt coord-seq (+ i 3)))) 
draw-polygon [Function]	

Arguments: sheet point-seq &key (filled t ) (closed t ) i nk clipping-region transformation line-style line-thickness line-unit line-dashes line-joint-shape line-cap-shape

draw-polygon* [Function]	

Arguments: sheet coord-seq &key (filled t ) (closed t ) ink clippin g-region transformation line-style line-thickness line-unit line-dashes line-joint-shape line-cap-shape

Summary: Draws a polygon or polyline on the sheet sheet . When filled is nil , this draws a set of connected lines; otherwise, it draws a filled polygon. If closed is t (the default) and filled is nil , it ensures that a segment is drawn that connects the ending point of the last segment to the starting point of the first segment. The current line style (see 3.3, CLIM Line Styles for details) affects the drawing of unfilled polygons in the obvious way. The cap shape affects only the "open" vertices in the case when closed is nil . Dashed lines start dashing at the starting point of the first segment, and may or may not continue dashing across vertices, depending on the window system.

If filled is t , a closed polygon is drawn and filled in. In this case, closed is assumed to be t as well.

draw-rectangle[Function]	

Arguments: sheet point1 point2 &key (filled t ) ink clipping-region transformation line-style line-thickness line-unit line-dashes line-joint-shape

draw-rectangle* [Function]	

Arguments: sheet x1 y1 x2 y2 &key (filled t ) ink clipping-region transformation line-style line-thickness line-unit line-dashes line-joint-shape

Summary: Draws either a filled or unfilled rectangle on the sheet sheet that has its sides aligned with the coordinate axes of the native coordinate system. One corner of the rectangle is at the position ( x1 , y1 ) or point1 and the opposite corner is at ( x2 , y2 ) or point2. The arguments x1 , y1 , x2 , and y1 are real numbers that are canonicalized in the same way as for make-bounding-rectangle . filled is as for draw-polygon* .

The current line style (see 3.2, Using CLIM Drawing Options) affects the drawing of unfilled rectangles in the obvious way, except that the cap shape has no effect.

draw-rectangles[Function]	

Arguments: sheet points &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-joint-shape

draw-rectangles* [Function]	

Arguments: sheet position-seq &key ink clipping-region transformation line-style line-thickness line-unit line-dashes line-joint-shape

Summary: These functions (structured and spread arguments, respectively) draw a set of rectangles on the sheet sheet . points is a sequence of point objects; position-seq is a sequence of coordinate pairs. It is an error if position-seq does not contain an even number of elements.

Ignoring the drawing options, these functions are equivalent to:

        (do ((i 0 (+ i 2)))
            ((= i (length points)))
          (draw-rectangle sheet (elt points i) (elt points (1+ i))))

and

        (do ((i 0 (+ i 4)))
            ((= i (length position-seq)))
          (draw-rectangle* sheet
                           (elt position-seq i) 
                           (elt position-seq (+ i 1))
                           (elt position-seq (+ i 2)) 
                           (elt position-seq (+ i 3))))
draw-ellipse [Function]	

Arguments: sheet center-pt radius-1-dx radius-1-dy radius-2-dx radius-2-dy &key (filled t ) start-angle end-angle ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

draw-ellipse* [Function]	

Arguments: sheet center-x center-y radius-1-dx radius-1-dy radius-2-dx radius-2-dy &key (filled t ) start-angle end-angle ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

Summary: These functions (structured and spread arguments, respectively) draw an ellipse (when filled is t , the default) or an elliptical arc (when filled is nil ) on the sheet sheet . The center of the ellipse is the point center-pt (or the position ( center-x , center-y )).

Two vectors, ( radius-1-dx , radius-1-dy ) and ( radius-2-dx , radius-2-dy ) specify the bounding parallelogram of the ellipse as explained in 2.5, General Geometric Objects in CLIM All of the radii are real numbers. If the two vectors are collinear, the ellipse is not well-defined and the ellipse-not-well-defined error will be signaled. The special case of an ellipse with its major axes aligned with the coordinate axes can be obtained by setting both radius-1-dy and radius-2-dx to 0.

start-angle and end-angle are real numbers that specify an arc rather than a complete ellipse. Angles are measured with respect to the positive x axis. The elliptical arc runs positively (counter-clockwise) from start-angle to end-angle . The default for start-angle is 0; the default for end-angle is 2π.

In the case of a "filled arc" (that is, when filled is t and start-angle or end-angle are supplied and are not 0 and 2π), the figure drawn is the "pie slice" area swept out by a line from the center of the ellipse to a point on the boundary as the boundary point moves from start-angle to end-angle .

When drawing unfilled ellipses, the current line style (see 3.2, Using CLIM Drawing Options) affects the drawing in the obvious way, except that the joint shape has no effect. Dashed elliptical arcs start dashing at start-angle .

draw-circle [Function]	

Arguments: sheet center-pt radius &key (filled t ) start-angle end-angle ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

draw-circle* [Function]	

Arguments: sheet center-x center-y radius &key (filled t ) start-angle end-angle ink clipping-region transformation line-style line-thickness line-unit line-dashes line-cap-shape

Summary: These functions (structured and spread arguments, respectively) draw a circle (when filled is t , the default) or a circular arc (when filled is nil ) on the sheet sheet . The center of the circle is center-pt or ( center-x , center-y ) and the radius is radius . These are just special cases of draw-ellipse and draw-ellipse* . filled is as for draw-ellipse* .

start-angle and end-angle allow the specification of an arc rather than a complete circle in the same manner as that of the ellipse functions.

The "filled arc" behavior is the same as that of an ellipse.

draw-text [Function]	

Arguments: sheet string-or-char point &key text-style (start 0 ) end (align-x :left ) (align-y :baseline ) toward-point transform-glyphs ink clipping-region transformation text-style text-family text-face text-size

draw-text* [Function]	

Arguments: sheet string-or-char x y &key text-style (start 0 ) end (align-x :left ) (align-y :baseline ) toward-x toward-y transform-glyphs ink clipping-region transformation text-style text-family text-face text-size

Summary: The text specified by string-or-char is drawn on the sheet sheet starting at the position specified by the point point (or the position ( x, y )). The exact definition of "starting at" depends on align-x and align-y . align-x is one of :left , :center , or :right . align-y is one of :baseline , :top , :center , or :bottom . align-x defaults to :left and align-y defaults to :baseline ; with these defaults, the first glyph is drawn with its left edge and its baseline at point .

text-style defaults to nil , meaning that the text will be drawn using the current text style of the sheet's medium.

start and end specify the start and end of the string, in the case where string-or-char is a string. If start is supplied, it must be an integer that is less than the length of the string. If end is supplied, it must be an integer that is less than the length of the string, but greater than or equal to start .

Normally, glyphs are drawn from left to right no matter what transformation is in effect. toward-x or toward-y (derived from toward-point in the case of draw-text ) can be used to change the direction from one glyph to the next one. For example, if toward-x is less than the x position of point , then the glyphs will be drawn from right to left. If toward-y is greater than the y position of point , then the glyphs' baselines will be positioned one above another. More precisely, the reference point in each glyph lies on a line from point to toward-point , and the spacing of each glyph is determined by packing rectangles along that line, where each rectangle is "char-width" wide and "char-height" high.

transform-glyphs is not supported in this version of CLIM.


Common Lisp Interface Manager 2.0 User's Guide - 22 Dec 2009

NextPrevUpTopContentsIndex