; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; Glow ; Copyright (c) 1997 Adrian Likins ; aklikins@eos.ncsu.ed ; ; Makes a "glow" around the outside of the current selection. ; ; 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. ; ; Changed on June 15, 2000 by Kevin Cozens ; Updated for GIMP 1.1.26 ; ; Changed on January 29, 2004 by Kevin Cozens ; Updated for GIMP 2.0pre3 (define (script-fu-glow image drawable glow-radius feather-radius glow-color glow-opacity keep-selection seperate-layer) (let* ( (type (car (gimp-drawable-type-with-alpha drawable))) (old-gradient (car (gimp-gradients-get-gradient))) (old-fg (car (gimp-palette-get-foreground))) (old-bg (car (gimp-palette-get-background)))) (gimp-image-undo-disable image) (gimp-layer-add-alpha drawable) (if (= (car (gimp-selection-is-empty image)) TRUE) (begin (gimp-selection-layer-alpha drawable) (set! active-selection (car (gimp-selection-save image))) (set! from-selection FALSE)) (begin (set! from-selection TRUE) (set! active-selection (car (gimp-selection-save image))))) (set! selection-bounds (gimp-selection-bounds image)) (set! select-offset-x (cadr selection-bounds)) (set! select-offset-y (caddr selection-bounds)) (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y)) (set! buffer (+ (* glow-radius 2) (* feather-radius 2) 2)) (set! select-height (+ select-height buffer)) (set! select-width (+ select-width buffer)) (set! select-offset-x (- select-offset-x (/ buffer 2))) (set! select-offset-y (- select-offset-y (/ buffer 2))) (if (= seperate-layer TRUE) (begin (set! effect-layer (car (gimp-layer-new image select-width select-height type "glow layer" 100 NORMAL-MODE))) (gimp-layer-set-offsets effect-layer select-offset-x select-offset-y) (gimp-image-add-layer image effect-layer -1) (gimp-selection-none image) (gimp-edit-clear effect-layer) (gimp-selection-load active-selection) (gimp-image-set-active-layer image effect-layer )) (begin (gimp-edit-copy drawable))) (set! active-layer (car (gimp-image-get-active-layer image))) (gimp-selection-grow image glow-radius) (gimp-selection-feather image feather-radius) (gimp-palette-set-background glow-color) (gimp-edit-fill active-layer BACKGROUND-FILL) (if (= seperate-layer TRUE) (begin (gimp-selection-load active-selection) (gimp-edit-clear active-layer) (gimp-layer-set-opacity active-layer glow-opacity)) (begin (gimp-selection-load active-selection) (let ((floating-sel (car (gimp-edit-paste active-layer FALSE)))) (gimp-floating-sel-anchor floating-sel)) (gimp-selection-load active-selection))) (gimp-gradients-set-gradient old-gradient) (gimp-palette-set-background old-bg) (gimp-palette-set-foreground old-fg) (if (= keep-selection FALSE) (gimp-selection-none image)) (gimp-image-undo-enable image) (gimp-image-set-active-layer image drawable) (gimp-image-remove-channel image active-selection) (gimp-displays-flush))) (script-fu-register "script-fu-glow" "/Script-Fu/Decor/Glow" "Makes a \"glow\" around the outside of the current selection." "Adrian Likins " "Adrian Likins" "10/12/97" "RGB RGBA GRAY GRAYA" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-VALUE "Glow Radius" "2" SF-VALUE "Feather Radius" "10" SF-COLOR "Glow Color" '(255 255 255) SF-VALUE "Glow Opacity (only for seperate layer)" "100" SF-TOGGLE "Keep Selection?" TRUE SF-TOGGLE "Seperate Layer?" TRUE)