;;; Procedure: ;;; forbidden ;;; Parameters: ;;; image, an image ;;; layer, a layer associated with that 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 layer x y radius) ; Choose a color and paintbrush that seem appropriate. (gimp-palette-set-foreground RED) (gimp-brushes-set-brush "Circle (05)") ; Select the ellipse for the circle. Do the math to see why. ; the particular values were set. (gimp-ellipse-select image (- x radius) (- y radius) (* 2 radius) (* 2 radius) REPLACE 0 0 0) ; Draw the nice red circle. (gimp-edit-stroke layer) ; 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)))) (gimp-paintbrush layer 0 4 (float-array (- x offset) (- y offset) (+ x offset) (+ y offset)) 0 0)) ; Unselect all (gimp-selection-clear image) ; Flatten the image (let ((newlayer (gimp-image-flatten image))) ; Return the modified image/layer pair (list image newlayer)) )) (script-fu-register "forbidden" "<Image>/Script-Fu/Sample/Forbidden Sign" "Draws the legendary forbidden sign" "Samuel A. Rebelsky" "Copyright (c) 2001 Samuel A. Rebelsky. All Rights Reserved" "Tuesday, 3 April 2001" "RGB" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-VALUE "Center X" "100" SF-VALUE "Center Y" "100" SF-VALUE "Radius" "50")