;;; File: ;;; forbid.ss ;;; Author: ;;; Samuel A. Rebelsky ;;; Version: ;;; 1.0 of April 2001 ;;; Summary: ;;; A simple GIMP Script for drawing a "forbidden" sign. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Libraries ;;; Load my favorite GIMP utility scripts. (load "/home/rebelsky/Web/GIMP/Scripts/utils.ss") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Procedures ;;; 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 image 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 image layer 0 4 (float-array (- x offset) (- y offset) (+ x offset) (+ y offset)))) ; Unselect all (gimp-selection-clear image) ; Flatten the image (gimp-image-flatten image) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Loading (script-fu-register "forbidden" "/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")