Function: artist-draw-ellipse-general

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

Signature

(artist-draw-ellipse-general X1 Y1 X-RADIUS Y-RADIUS)

Documentation

Draw an ellipse with center at X1, Y1 and X-RADIUS and Y-RADIUS.

Output is an ellipse, 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 two-element vector on the form [POINT-LIST FILL-INFO].

POINT-LIST is a list of vectors on the form [X Y SAVED-CHAR NEW-CHAR]. FILL-INFO is a list of vectors on the form [X Y ELLIPSE-WIDTH-ON-THIS-LINE].

Ellipses with zero Y-RADIUS are not drawn correctly.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-draw-ellipse-general (x1 y1 x-radius y-radius)
  "Draw an ellipse with center at X1, Y1 and X-RADIUS and Y-RADIUS.

Output is an ellipse, 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 two-element vector on the form [POINT-LIST FILL-INFO].

POINT-LIST is a list of vectors on the form [X Y SAVED-CHAR NEW-CHAR].
FILL-INFO is a list of vectors on the form [X Y ELLIPSE-WIDTH-ON-THIS-LINE].

Ellipses with zero Y-RADIUS are not drawn correctly."
  (let* ((point-list   (artist-ellipse-generate-quadrant x-radius y-radius))
	 (fill-info    (artist-ellipse-compute-fill-info point-list))
	 (shape-info   (make-vector 2 0)))

    (setq point-list (artist-calculate-new-chars point-list))
    (setq point-list (artist-ellipse-mirror-quadrant point-list))
    (setq point-list (artist-ellipse-point-list-add-center x1 y1 point-list))
    (setq fill-info (artist-ellipse-fill-info-add-center x1 y1 fill-info))

    ;; Draw the ellipse
    (setq point-list
	  (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-save-chars-under-point-list point-list))))

    (aset shape-info 0 point-list)
    (aset shape-info 1 fill-info)
    (artist-make-2point-object (artist-make-endpoint x1 y1)
			       (artist-make-endpoint x-radius y-radius)
			       shape-info)))