| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version |
Arguments: stream from-pos to-pos &key (length 20) (width 10) fill
draw-arrowhead draws a simple arrowhead at to-pos for a line that was drawn between from-pos and to-pos.
The returned values indicate the point on the line at the base of the arrowhead. This could be used to draw the associated line so that it ends at this point instead of at the tip of the arrowhead, in order to leave a sharper tip when the line is thick. There are two returned values, for the x and y coordinates or the point.
While you can draw the line first and then draw arrowheads at one or both ends, you can also draw the arrowheads first, capturning the base coordinates and then draw the line with one end the base coordinates and thus ensure the tip of the arrowhead is sharp.
The arguments are:
cg-stream
.
nil
,
t
, an RGB color object (see make-rgb), or an HLS color (see
make-hls). This
argument indicates how the arrow is to be filled.
If the value is nil
(the default), the arrow
is filled in the current background-color of the stream.
This creates the effect of a hollow arrow (with the background color
showing through the arrowhead), though in fact the interior is still
filled in order to cover over the end of the actual line that was
drawn beforehand.
If the value is t
, then the arrow is filled
with the current foreground-color of the stream,
which is the color that is always used to draw the border of the
arrowhead; this creates a solid arrow.
If the value is an RGB or HLS color object, then the arrowhead is filled with that color. This option may be used to fill the arrowhead with a different color than is used for the border of the arrowhead.
Here is an example function that draws arrows at various angles.
(defun test-arrowheads (&key (length 20)(width 10)) (let* ((window (make-window :arrows :class 'bitmap-window :title "Arrowheads" :interior (make-box 200 200 600 600) :scrollbars nil)) (pane (frame-child window)) (center #.(make-position 200 200)) coord side) (with-positions (pos1) (dotimes (j 9) (setq coord (+ 200 (* 40 (- j 4)))) (dolist (fill (list nil t)) (setq side (if fill 360 40)) (nmake-position pos1 side coord) (draw-line pane center pos1) (draw-arrowhead pane center pos1 :fill fill :length length :width width) (nmake-position pos1 coord side) (draw-line pane center pos1) (draw-arrowhead pane center pos1 :fill fill :length length :width width))))))
See also cg-drawing.htm.
Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version |