home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / tileblur.scm.z / tileblur.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  2.6 KB  |  78 lines

  1. ;
  2. ;
  3. ;
  4. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  5. ; At ECS Dept, University of Southampton, England.
  6.  
  7. ; This program is free software; you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 2 of the License, or
  10. ; (at your option) any later version.
  11. ; This program is distributed in the hope that it will be useful,
  12. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ; GNU General Public License for more details.
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program; if not, write to the Free Software
  17. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.  
  20. (define (script-fu-tile-blur inImage inLayer inRadius inHoriz inVert inType)
  21.  
  22.    (set! theImage inImage)
  23.    (set! theLayer inLayer)
  24.    (set! theHeight (car (gimp-drawable-height theLayer)))
  25.    (set! theWidth (car (gimp-drawable-width theLayer)))
  26.  
  27.    (gimp-image-disable-undo theImage)
  28.    (gimp-layer-resize theLayer (* 3 theWidth) (* 3 theHeight) 0 0)
  29.  
  30.    (gimp-rect-select theImage 0 0 theWidth theHeight REPLACE 0 0)
  31.    (gimp-edit-cut theImage theLayer)
  32.  
  33.    (gimp-selection-none theImage)
  34.    (gimp-layer-set-offsets theLayer theWidth theHeight)
  35.  
  36.    (cjg-pasteat 1 1) (cjg-pasteat 1 2) (cjg-pasteat 1 3)
  37.    (cjg-pasteat 2 1) (cjg-pasteat 2 2) (cjg-pasteat 2 3)
  38.    (cjg-pasteat 3 1) (cjg-pasteat 3 2) (cjg-pasteat 3 3)
  39.  
  40.    (gimp-selection-none theImage)
  41.    (if (= inType FALSE) 
  42.        (plug-in-gauss-iir TRUE theImage theLayer inRadius inHoriz inVert)
  43.        (plug-in-gauss-rle TRUE theImage theLayer inRadius inHoriz inVert)
  44.    )
  45.  
  46.    (gimp-layer-resize theLayer theWidth theHeight (- 0 theWidth) (- 0 theHeight))
  47.    (gimp-layer-set-offsets theLayer 0 0)
  48.    (gimp-image-enable-undo theImage)
  49.    (gimp-displays-flush)
  50. )
  51.  
  52. (define (cjg-pasteat xoff yoff) 
  53.    (let     ((theFloat (car(gimp-edit-paste theImage theLayer 0)))) 
  54.         (gimp-layer-set-offsets theFloat (* xoff theWidth) (* yoff theHeight) )
  55.         (gimp-floating-sel-anchor theFloat)
  56.    )
  57. )
  58.  
  59. ; Register the function with the GIMP:
  60.  
  61. (script-fu-register
  62.     "script-fu-tile-blur"
  63.     "<Image>/Filters/Blur/Tilable Blur"
  64.     "foo"
  65.     "Chris Gutteridge"
  66.     "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  67.     "25th April 1998"
  68.     "RGBA RGB"
  69.     SF-IMAGE "The Image" 0
  70.     SF-DRAWABLE "The Layer" 0
  71.     SF-VALUE "Radius:" "5"
  72.     SF-TOGGLE "Blur Vertically?" TRUE
  73.     SF-TOGGLE "Blur Horizontally?" TRUE
  74.     SF-TOGGLE "Blur Type: TRUE=RLE, FALSE=IIR" FALSE
  75. )
  76.