Function: artist-draw-square

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

Signature

(artist-draw-square X1 Y1 X2 Y2)

Documentation

Draw a square with corners at X1, Y1 and X2, Y2.

Output is a square, which is a list on the form
(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 four straight lines.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-draw-square (x1 y1 x2 y2)
  "Draw a square with corners at X1, Y1 and X2, Y2.

Output is a square, which is a list on the form
\(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 four straight lines."
  (let* ((artist-line-char (artist-compute-line-char))
         (artist-line-char-set artist-line-char)
         (square-corners (artist-rect-corners-squarify x1 y1 x2 y2))
	 (new-x1 (elt square-corners 0))
	 (new-y1 (elt square-corners 1))
	 (new-x2 (elt square-corners 2))
	 (new-y2 (elt square-corners 3))
	 (endpoint1 (artist-make-endpoint new-x1 new-y1))
	 (endpoint2 (artist-make-endpoint new-x2 new-y2))
	 (line1 (artist-draw-sline new-x1 new-y1 new-x2 new-y1))
	 (line2 (artist-draw-sline new-x2 new-y1 new-x2 new-y2))
	 (line3 (artist-draw-sline new-x2 new-y2 new-x1 new-y2))
	 (line4 (artist-draw-sline new-x1 new-y2 new-x1 new-y1)))
    (artist-make-2point-object endpoint1
			       endpoint2
			       (list line1 line2 line3 line4))))