;;; Procedure: ;;; forbidden ;;; Parameters: ;;; image, an image ;;; x, the x coordinate of the center of the sign ;;; y, the y coordinate of the center of the sign ;;; radius, the radius of the sign ;;; Purpose: ;;; Draws a "forbidden" sign (a circle with a slash) in ;;; red centered at the specified location. ;;; Preconditions: ;;; image and layer are initialized. ;;; x, y, and radius are not negative. ;;; Postconditions: ;;; The image now contains the specified sign. ;;; The brush and foreground color may have changed. (define forbidden (lambda (image x y radius) ; Choose a color and paintbrush that seem appropriate. (set-fgcolor RED) (set-brush "Circle (05)") ; Select the ellipse for the circle. Do the math to see why. ; the particular values were set. (select-ellipse image REPLACE (- x radius) (- y radius) (* 2 radius) (* 2 radius)) ; Draw the nice red circle. (stroke image) ; Now we're ready to draw the slash. Some math tells us that ; it's offset by radius/(sqrt 2) from the center (in each ; direction). (let ((offset (/ radius (sqrt 2)))) (line image (- x offset) (- y offset) (+ x offset) (+ y offset))) ; Unselect all (select-nothing image)))