;;; Plugin  : Rods-wood - for Gimp-2.8
;;; Author  : Rod Detmer
;;; Date    : September 4th 2012
;;; Revision: 1.0
;;; 					
;;; Latest version at: http://www.gimpchat.com
;;; Required : Gimp 2.8
;;;
;;; Description: 
;;; Applies a wood effect
;;; -----------------------------------------------------------------------------
;;; Change Log:
;;; Version-1.0
;;;
;;; License:
;;; 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 (script-fu-rods-wood image layer WoodClouds WoodNoise WoodGlow)
  (gimp-image-undo-group-start image)
  (gimp-layer-resize-to-image-size layer)
  
  (gimp-selection-layer-alpha layer)
  (plug-in-plasma RUN-NONINTERACTIVE image layer 0 WoodClouds)
  (gimp-desaturate layer)
  (gimp-selection-none image) 
  (plug-in-hsv-noise RUN-NONINTERACTIVE image layer 1 0 10 WoodNoise)
  (gimp-curves-spline layer 1 6 (list->vector (list 32 154 62 73 98 161 157 93 188 166 252 251)))
  ;(gimp-curves-spline layer 0 6 #(32 62 98 157 188 252))

  ;(gimp-desaturate layer)
  ;(gimp-curves-spline layer 1 6 (list->vector (list 32 154 62 73 98 161 157 93 188 166 252 251)))
  (gimp-selection-layer-alpha layer) 
  (gimp-image-rotate image 0)

  ;(gimp-selection-layer-alpha layer) 
  (plug-in-wind RUN-NONINTERACTIVE image layer 2 0 2 1 1)

  (gimp-image-rotate image 2)
  ;(gimp-colorize layer 205 55 15) 
  ;(gimp-desaturate layer)
  ;(gimp-curves-spline layer 1 6 (list->vector (list 32 154 62 73 98 161 157 93 188 166 252 251)))
  (gimp-colorize layer 20 40 -50) 

  ;(gimp-selection-none image) 

  (gimp-selection-none image) 
  ;(python-layer-fx-drop-shadow 1 image layer '(0 0 0) 85 0 0 0 5 DrpShadowBlur DrpShadowAngle DropShadowDistance 0 0)
  ;(script-fu-drop-shadow 1 image layer DropShadowx DropShadowy 5 '(0 0 0) DrpShadowOpacty 0)

  (plug-in-unsharp-mask RUN-NONINTERACTIVE image layer 5.0 0.50 WoodGlow)
  (python-layer-fx-bevel-emboss 1 image layer 1 65 0 23 0 120 30 1 '(255 255 255) SCREEN-MODE 0 '(0 0 0) MULTIPLY-MODE 54 0 0 "Warning!" 100 100 0 0)
  ;(gimp-selection-layer-alpha layer)
  ;(python-layer-fx-inner-glow 1 image layer '(85 65 45) 75 0 0 0 1 11.8 14 1)
  ;(gimp-selection-none image)  
  (gimp-displays-flush image)
  (gimp-image-undo-group-end image)
)

(script-fu-register
 "script-fu-rods-wood"
 "<Image>/Script-Fu/Text Effects/Wood Effect"
 "Applies a wood effect"
 "Rod Detmer"
 "Rod Detmer"
 "September 2012" 
 "RGB* GRAY*"
 SF-IMAGE "The Image" 0
 SF-DRAWABLE "The Layer" 0
 ;SF-ADJUSTMENT "Bevel Size" '(23 1 250 1 10 0 SF-SLIDER) ;SF-ADJUSTMENT "Shadow Opacity" '(65 0 100 1 10 0 0)
;SF-ADJUSTMENT "Shadow Distance (px)" '(5 -10000 10000 1 10 0 1)
;SF-ADJUSTMENT "Shadow Angle" '(120 -180 180 1 10 0 1)
;SF-ADJUSTMENT "Shadow Blur" '(5 -10000 10000 1 10 0 1)
 SF-ADJUSTMENT "Wood Noise" '(15 0 255 1 10 0 0)
 SF-ADJUSTMENT "Wood Edge Glow (set higher for less glow)" '(2.0 0 10 1 10 0 0)
;SF-ADJUSTMENT "Wood Hue " '(201 0 360)
 SF-ADJUSTMENT "Wood Cloudiness (set higher for defined bark look)" '(2 0.1 7.0 1 10 0 0)

)
