Function: artist-draw-line

artist-draw-line is a byte-compiled function defined in artist.el.gz.

Signature

(artist-draw-line X1 Y1 X2 Y2)

Documentation

Draw a line from X1, Y1 to X2, Y2.

Output is a line, which is a list (END-POINT-1 END-POINT-2 SHAPE-INFO).

END-POINT-1 and END-POINT-2 are two-element vectors on the form [X Y]. SHAPE-INFO is a list of vectors [X Y SAVED-CHAR NEW-CHAR].

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
;;
;; Drawing and undrawing lines (any direction)
;;

(defun artist-draw-line (x1 y1 x2 y2)
  "Draw a line from X1, Y1 to X2, Y2.

Output is a line, which is a list (END-POINT-1 END-POINT-2 SHAPE-INFO).

END-POINT-1 and END-POINT-2 are two-element vectors on the form [X Y].
SHAPE-INFO is a list of vectors [X Y SAVED-CHAR NEW-CHAR]."
  (let ((endpoint1 (artist-make-endpoint x1 y1))
	(endpoint2 (artist-make-endpoint x2 y2)))
    (artist-make-2point-object
     endpoint1
     endpoint2
     (mapcar
      (lambda (coord)
	(artist-move-to-xy (artist-coord-get-x coord)
			   (artist-coord-get-y coord))
	(if artist-line-char-set
	    (artist-replace-char artist-line-char)
	  (artist-replace-char (artist-coord-get-new-char coord)))
	coord)
      (artist-modify-new-chars
       (artist-calculate-new-chars
	(artist-save-chars-under-point-list
	 (artist-eight-point x1 y1 x2 y2))))))))