; See  http://gimpchat.com/viewtopic.php?f=9&t=6205&sid=d7f9fe8c77454db326c62382d9ff588f

(define selffilename "\n- akovia-3d.scm")

; this is the main routine
(define (script-fu_akovia_3d 
		Image 
		Drawable
		hl-color
		hl-o
		sh-color
		sh-o
		int-x
		int-y
		int-b 
		dsh
		ds-color 
		ds-x 
		ds-y 
		ds-b 
		ds-o
		)
	
  (if (= (car (gimp-selection-is-empty Image)) TRUE)
	(begin
		(gimp-message "The current image doesn't have a SELECTION.\n\nThis plugin works on a \nSELECTED AREA of the image.")
	)
  (begin; START OF PROCESSING
  ;(let* 
   (gimp-image-undo-group-start Image) ; make all the following steps into a single undo step

   (gimp-selection-layer-alpha Drawable)
   (gimp-selection-invert Image)
   (script-fu-drop-shadow Image Drawable int-x int-y int-b hl-color sh-o FALSE)
   (script-fu-drop-shadow Image Drawable (* -1 int-x) (* -1 int-y) int-b sh-color hl-o FALSE)
   ;(gimp-selection-invert Image)
   (gimp-selection-none Image)
   ; Create shadow layer on request
   (if (= dsh TRUE)
   (begin
   (script-fu-drop-shadow Image Drawable ds-x ds-y ds-b ds-color ds-o FALSE)
   ))
   ;(gimp-selection-none Image)
   
   (gimp-image-undo-group-end Image) ; Finished the script so close the undo buffer
   (gimp-displays-flush)
   ); end of BEGIN
  ); end of first IF (checking for a selection)
;)
)
(script-fu-register "script-fu_akovia_3d"
   _"akovia 3d r1..."
  (string-append "akovia 3D" selffilename)
  "GimpChat"
  "GPL License"
  "15/01/2013"
  "RGB* GRAY*"
  SF-IMAGE        "Input Image" 0
  SF-DRAWABLE     "Input Drawable" 0
  SF-COLOR       _"Internal Highlight Color"     '(255 255 255)
  SF-ADJUSTMENT  _"Internal Highlight Opacity"   '(35 0 100 1 10 0 0)
  SF-COLOR       _"Internal Shadow Color"        '(0 0 0)
  SF-ADJUSTMENT  _"Internal Shadow Opacity"      '(80 0 100 1 10 0 0)
  SF-ADJUSTMENT  _"Internal Offset X"            '(3 1 1000 1 10 0 1)
  SF-ADJUSTMENT  _"Internal Offset Y"            '(3 1 1000 1 10 0 1)
  SF-ADJUSTMENT  _"Internal Blur Radius"         '(4 0 100 1 10 0 1)
  SF-TOGGLE      _"Include Drop Shadow ?"         TRUE
  SF-COLOR       _"Drop Shadow Color"            '(0 0 0)
  SF-ADJUSTMENT  _"Drop Shadow X"                '(4 1 1000 1 10 0 1)
  SF-ADJUSTMENT  _"Drop Shadow Y"                '(4 1 1000 1 10 0 1)
  SF-ADJUSTMENT  _"Drop Shadow Blur Radius"      '(5 0 100 1 10 0 1)
  SF-ADJUSTMENT  _"Drop Shadow Opacity"          '(80 0 100 1 10 0 0)

)

(script-fu-menu-register "script-fu_akovia_3d" "<Image>/Script-Fu/Effects Selection")