; GIMP - The GNU Image Manipulation Program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; 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.
;
;
;
;
; Script can be found under Filters > Blur > Gaussian Blur All Layers...



; Define the Function

(define (fp-script-fu-gauss-blur-all
	img		 
				drawable
				horizontal
				vertical
				)

; Declare the Variables

	(let* (
		    	(theSelection 0)
	
		)	




(gimp-context-push)
(gimp-image-undo-group-start img)
(set! theSelection (car (gimp-selection-save img)))
(gimp-selection-none img)


(map (lambda (x) (plug-in-gauss-rle2 RUN-NONINTERACTIVE img x  horizontal vertical)) (vector->list (cadr (gimp-image-get-layers img))))

(gimp-image-set-active-layer img drawable)
(gimp-selection-load theSelection)
(gimp-image-remove-channel img theSelection)

(gimp-image-undo-group-end img)

(gimp-context-pop)

(gimp-displays-flush)


  )
)

(script-fu-register "fp-script-fu-gauss-blur-all"
  "<Image>/Script-Fu/Blur/Gaussian Blur All Layers..."
  "Run Gaussian Blur filter on all layers in an image."
  "Art Wade"
  "Art Wade"
  "February 11, 2010"
  "RGB* GRAY*"
  SF-IMAGE       	"Image" 0
  SF-DRAWABLE    	"Drawable" 0
  SF-ADJUSTMENT	"Horizontal Blur" '(5.0 0.0 10000.0 1 1 1)  
  SF-ADJUSTMENT	"Vertical Blur" '(5.0 0.0 10000.0 1 1 1)  

)


                         
