solid-circle
Categories: Image procedures
, Circle procedures
;;; (solid-circle diameter color [description]) -> image?
;;; diameter : nonnegative-integer?
;;; color : color?
;;; description : string?
;;; Create a solid circle with the given diameter and color.
> (solid-circle 30 "blue")
> (solid-circle 40 "red")
> (beside (solid-circle 10 "purple")
(solid-circle 15 "purple")
(solid-circle 20 "purple")
(solid-circle 25 "purple")
(solid-circle 30 "purple"))
(define solid-circle
(lambda (diam color (description #f))
(solid-ellipse diam diam color
(or description
(format "a solid ~a circle with diameter ~a"
(color->color-name color)
diam)))))
(test-true "Our circle has a description"
(string? (image-description
(solid-circle 25 (rgb 10 20 30)))))
(test-equal? "Our circle has the right structure"
(image-structure
(solid-circle 25 (rgb 10 20 30)))
(list 'solid-circle 25 (rgb 10 20 30)))
(test-equal? "Our circle has the right image width"
(image-width (solid-circle 25 (rgb 10 20 30)))
25)
(test-equal? "Our circle has the right diameter"
(circle-diameter (solid-circle 25 (rgb 10 20 30)))
25)
circle?
,
outlined-circle
,
solid-ellipse
Forthcoming