FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Object described on page has changed in 8.2.
8.1 version

draw-arrowhead

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:

Example

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-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
The object described on this page has been modified in the 8.2 release; see the Release Notes.
Created 2016.6.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Object described on page has changed in 8.2.
8.1 version