Function: artist-ellipse-compute-fill-info

artist-ellipse-compute-fill-info is a byte-compiled function defined in artist.el.gz.

Signature

(artist-ellipse-compute-fill-info POINT-LIST)

Documentation

Compute fill info for ellipse around 0,0 from POINT-LIST.

The POINT-LIST is expected to cover the first quadrant.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
(defun artist-ellipse-compute-fill-info (point-list)
  "Compute fill info for ellipse around 0,0 from POINT-LIST.
The POINT-LIST is expected to cover the first quadrant."
  (let ((first-half nil)
	(both-halves nil)
	(last-y nil))

    ;; Create first half (the lower one (since y grows downwards)) from
    ;; the first quadrant.
    (mapc
     (lambda (coord)
       (let* ((x         (artist-coord-get-x coord))
	      (y         (artist-coord-get-y coord))
	      (width     (max (- (* 2 x) 1) 0))
	      (left-edge (- x width)))
	 (if (or (null last-y) (not (= y last-y)))
	     ;; This was either the first time,
	     ;; or it was the first time on a new line
	     (setq first-half
		   (append first-half
			   ;; Fill info item starts at left-edge on line y
			   (list (artist-new-fill-item left-edge y width)))))
	 (setq last-y y)))
     point-list)

    ;; Create the other half by mirroring the first half.
    (setq both-halves
	  (append first-half
		  (mapcar
		   (lambda (i)
		     (artist-new-fill-item (artist-fill-item-get-x i)
					   (- (artist-fill-item-get-y i))
					   (artist-fill-item-get-width i)))
		   ;; The cdr below is so we don't include fill-info for
		   ;;; the middle line twice
		   (cdr (reverse first-half)))))
    (artist-ellipse-remove-0-fills both-halves)))