; This file is part of the Skin Generator, Copyright (c) 2004 Alexander R. Pruss
;
; 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


(define (my-rotate img drawable x1 y1 w h angle)
        (gimp-rect-select img x1 y1 w h REPLACE 0 0)
        (if (= 0 (car (gimp-selection-is-empty img)))
              (begin
               (set! floater (car (gimp-selection-float drawable 0 0)))
               (plug-in-rotate FALSE img floater angle FALSE)
               (gimp-floating-sel-anchor floater)
              )
        )
)


(define (skins-do-rotations img drawable angle)
;; Graffiti
        (my-rotate img drawable 5 8 42 42 angle)
        (my-rotate img drawable 273 8 42 42 angle)
        (my-rotate img drawable 5 64 42 42 angle)
        (my-rotate img drawable 273 64 42 42 angle)
;;
        (my-rotate img drawable 54 112 16 16 angle)
        (my-rotate img drawable 250 112 16 16 angle)
;; SB
        (my-rotate img drawable 2 134 24 24 angle)
        (my-rotate img drawable 26 134 24 24 angle)
        (my-rotate img drawable 50 134 24 24 angle)
        (my-rotate img drawable 74 134 24 24 angle)
        (my-rotate img drawable 128 134 24 24 angle)
        (my-rotate img drawable 180 134 24 24 angle)
;        (my-rotate img drawable 102 134 24 24 angle)
)

(script-fu-register "skins-do-rotations"
		    _"<Image>/Script-Fu/Skins/Rotate icons"
		    "Rotate icons"
		    "Alex Pruss"
		    "Alex Pruss"
		    "August, 2004"
		    "RGB* INDEXED* GRAY*"
		    SF-IMAGE    "Image"    0
            SF-DRAWABLE "Drawable"    0
            SF-VALUE    "angle: 90 (1), 180 (2) or 270 (3)" "1")
