; ; shrink-stripes.scm - Fill a selection with alternating stripes of ; fg and bg colors ; ; ;;; -------------------------------------------------------------------- ;;; version 0.1 by Jeff Trefftzs ;;; - Initial relase ;;; version 0.2 Raymond Ostertag ;;; - ported to Gimp 2.0 ;;; ;;; -------------------------------------------------------------------- ;;; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; Define the function: (define (script-fu-shrink-stripes inImage inLayer inWidth1 inWidth2 inColor1 inColor2) (let* ( (oldbg (car (gimp-palette-get-background))) (oldfg (car (gimp-palette-get-foreground))) (step (list inWidth1 inWidth2)) ) (gimp-image-undo-group-start inImage) (gimp-palette-set-foreground inColor1) (gimp-palette-set-background inColor2) (if (= TRUE (car(gimp-selection-is-empty inImage))) (gimp-selection-all inImage) ) (while (= TRUE (car(gimp-selection-bounds inImage))) (begin (gimp-edit-bucket-fill inLayer FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) ;; Swap colors (set! tempcolor (car (gimp-palette-get-background))) (gimp-palette-set-background (car (gimp-palette-get-foreground))) (gimp-palette-set-foreground tempcolor) (gimp-selection-shrink inImage (car step)) (set! step (list (cadr step) (car step))) ) ) (gimp-palette-set-background oldbg) (gimp-palette-set-foreground oldfg) (gimp-image-undo-group-end inImage) (gimp-displays-flush) ) ) (script-fu-register "script-fu-shrink-stripes" _"/Script-Fu/Selection/Shaped Stripes..." "Fills the selection with the foreground color, shrinks by the specified radius, swaps foreground and background colors, and continues until the whole selection is filled with stripes." "Jeff Trefftzs" "Copyright 2001, Jeff Trefftzs" "June 17, 2001" "RGB* GRAY* INDEXED*" SF-IMAGE "The Image" 0 SF-DRAWABLE "The Layer" 0 SF-ADJUSTMENT "Stripe Width" '(3 1 255 1 10 0 1) SF-ADJUSTMENT "Stripe Width" '(3 1 255 1 10 0 1) SF-COLOR "Color 1" '(0 0 0 0) SF-COLOR "Color 2" '(255 255 255) )