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 / lava.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  4.6 KB  |  135 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Lava effect
  5. ; Copyright (c) 1997 Adrian Likins
  6. ; aklikins@eos.ncsu.edu
  7. ;
  8. ; based on a idea by Sven Riedel <lynx@heim8.tu-clausthal.de>
  9. ; tweaked a bit by Sven Neumann <neumanns@uni-duesseldorf.de>
  10. ;
  11. ; This program is free software: you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 3 of the License, or
  14. ; (at your option) any later version.
  15. ;
  16. ; This program is distributed in the hope that it will be useful,
  17. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. ; GNU General Public License for more details.
  20. ;
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  23.  
  24.  
  25. (define (script-fu-lava image
  26.                         drawable
  27.                         seed
  28.                         tile_size
  29.                         mask_size
  30.                         gradient
  31.                         keep-selection
  32.                         separate-layer
  33.                         current-grad)
  34.   (let* (
  35.         (type (car (gimp-drawable-type-with-alpha drawable)))
  36.         (image-width (car (gimp-image-width image)))
  37.         (image-height (car (gimp-image-height image)))
  38.         (active-selection 0)
  39.         (selection-bounds 0)
  40.         (select-offset-x 0)
  41.         (select-offset-y 0)
  42.         (select-width 0)
  43.         (select-height 0)
  44.         (lava-layer 0)
  45.         (active-layer 0)
  46.         )
  47.  
  48.     (gimp-context-push)
  49.     (gimp-image-undo-group-start image)
  50.  
  51.     (if (= (car (gimp-drawable-has-alpha drawable)) FALSE)
  52.         (gimp-layer-add-alpha drawable)
  53.     )
  54.  
  55.     (if (= (car (gimp-selection-is-empty image)) TRUE)
  56.         (gimp-selection-layer-alpha drawable)
  57.     )
  58.  
  59.     (set! active-selection (car (gimp-selection-save image)))
  60.     (gimp-image-set-active-layer image drawable)
  61.  
  62.     (set! selection-bounds (gimp-selection-bounds image))
  63.     (set! select-offset-x (cadr selection-bounds))
  64.     (set! select-offset-y (caddr selection-bounds))
  65.     (set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
  66.     (set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
  67.  
  68.     (if (= separate-layer TRUE)
  69.         (begin
  70.           (set! lava-layer (car (gimp-layer-new image
  71.                                                 select-width
  72.                                                 select-height
  73.                                                 type
  74.                                                 "Lava Layer"
  75.                                                 100
  76.                                                 NORMAL-MODE)))
  77.  
  78.           (gimp-image-add-layer image lava-layer -1)
  79.           (gimp-layer-set-offsets lava-layer select-offset-x select-offset-y)
  80.           (gimp-selection-none image)
  81.           (gimp-edit-clear lava-layer)
  82.  
  83.           (gimp-selection-load active-selection)
  84.           (gimp-image-set-active-layer image lava-layer)
  85.         )
  86.     )
  87.  
  88.     (set! active-layer (car (gimp-image-get-active-layer image)))
  89.  
  90.     (if (= current-grad FALSE)
  91.         (gimp-context-set-gradient gradient)
  92.     )
  93.  
  94.     (plug-in-solid-noise RUN-NONINTERACTIVE image active-layer FALSE TRUE seed 2 2 2)
  95.     (plug-in-cubism RUN-NONINTERACTIVE image active-layer tile_size 2.5 0)
  96.     (plug-in-oilify RUN-NONINTERACTIVE image active-layer mask_size 0)
  97.     (plug-in-edge RUN-NONINTERACTIVE image active-layer 2 0 0)
  98.     (plug-in-gauss-rle RUN-NONINTERACTIVE image active-layer 2 TRUE TRUE)
  99.     (plug-in-gradmap RUN-NONINTERACTIVE image active-layer)
  100.  
  101.     (if (= keep-selection FALSE)
  102.         (gimp-selection-none image)
  103.     )
  104.  
  105.     (gimp-image-set-active-layer image drawable)
  106.     (gimp-image-remove-channel image active-selection)
  107.  
  108.     (gimp-image-undo-group-end image)
  109.     (gimp-context-pop)
  110.  
  111.     (gimp-displays-flush)
  112.   )
  113. )
  114.  
  115. (script-fu-register "script-fu-lava"
  116.   _"_Lava..."
  117.   _"Fill the current selection with lava"
  118.   "Adrian Likins <adrian@gimp.org>"
  119.   "Adrian Likins"
  120.   "10/12/97"
  121.   "RGB* GRAY*"
  122.   SF-IMAGE       "Image"          0
  123.   SF-DRAWABLE    "Drawable"       0
  124.   SF-ADJUSTMENT _"Seed"           '(10 1 30000 1 10 0 1)
  125.   SF-ADJUSTMENT _"Size"           '(10 0 100 1 10 0 1)
  126.   SF-ADJUSTMENT _"Roughness"      '(7 3 50 1 10 0 0)
  127.   SF-GRADIENT   _"Gradient"       "German flag smooth"
  128.   SF-TOGGLE     _"Keep selection" TRUE
  129.   SF-TOGGLE     _"Separate layer" TRUE
  130.   SF-TOGGLE     _"Use current gradient" FALSE
  131. )
  132.  
  133. (script-fu-menu-register "script-fu-lava"
  134.                          "<Image>/Filters/Render")
  135.