;;; Procedure: ;;; forbid ;;; Parameters: ;;; image, the identifier for an image ;;; drawable, a drawable part of the image (i.e., a layer) ;;; 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 is 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 forbid (lambda (image drawable 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) (flatten image))) (script-fu-register "forbid" "/Script-Fu/Sample/Forbidden Sign" "Draws the legendary forbidden sign" "Samuel A. Rebelsky" "Copyright (c) 2001-2006 Samuel A. Rebelsky. All Rights Reserved" "Tuesday, 23 October 2006" "RGB" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-VALUE "Center X" "100" SF-VALUE "Center Y" "100" SF-VALUE "Radius" "50")