home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / reverse-layers.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  1.6 KB  |  54 lines

  1. ; reverse-layers.scm: Reverse the order of layers in the current image.
  2. ; Copyright (C) 2006 by Akkana Peck.
  3. ;
  4. ; This program is free software: you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 3 of the License, or
  7. ; (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.  
  17. (define (script-fu-reverse-layers img drawable)
  18.   (let* (
  19.         (layers (gimp-image-get-layers img))
  20.         (num-layers (car layers))
  21.         (layer-array (cadr layers))
  22.         (i (- num-layers 1))
  23.         )
  24.  
  25.     (gimp-image-undo-group-start img)
  26.  
  27.     (while (>= i 0)
  28.            (let ((layer (aref layer-array i)))
  29.              (if (= (car (gimp-layer-is-floating-sel layer)) FALSE)
  30.                  (gimp-image-lower-layer-to-bottom img layer))
  31.            )
  32.  
  33.            (set! i (- i 1))
  34.     )
  35.  
  36.     (gimp-image-undo-group-end img)
  37.     (gimp-displays-flush)
  38.   )
  39. )
  40.  
  41. (script-fu-register "script-fu-reverse-layers"
  42.   _"Reverse Layer Order"
  43.   _"Reverse the order of layers in the image"
  44.   "Akkana Peck"
  45.   "Akkana Peck"
  46.   "August 2006"
  47.   "*"
  48.   SF-IMAGE    "Image"    0
  49.   SF-DRAWABLE "Drawable" 0
  50. )
  51.  
  52. (script-fu-menu-register "script-fu-reverse-layers"
  53.                          "<Image>/Layer/Stack")
  54.