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 / chalk.scm.z / chalk.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  3.4 KB  |  81 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; This program is free software; you can redistribute it and/or modify
  4. ; it under the terms of the GNU General Public License as published by
  5. ; the Free Software Foundation; either version 2 of the License, or
  6. ; (at your option) any later version.
  7. ; This program is distributed in the hope that it will be useful,
  8. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. ; GNU General Public License for more details.
  11. ; You should have received a copy of the GNU General Public License
  12. ; along with this program; if not, write to the Free Software
  13. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. ;
  15. ; chalk.scm  version 0.11  10/10/97
  16. ;
  17. ; Copyright (C) 1997 Manish Singh <msingh@uclink4.berkeley.edu>
  18. ;  
  19. ; Makes a logo with a chalk-like text effect.
  20.  
  21. (define (script-fu-chalk-logo text size font bg-color chalk-color)
  22.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  23.      (border (/ size 4))
  24.      (text-layer (car (gimp-text img -1 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
  25.      (width (car (gimp-drawable-width text-layer)))
  26.      (height (car (gimp-drawable-height text-layer)))
  27.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  28.      (old-fg (car (gimp-palette-get-foreground)))
  29.      (old-bg (car (gimp-palette-get-background))))
  30.  
  31.     (gimp-image-disable-undo img)
  32.     (gimp-image-resize img width height 0 0)
  33.  
  34.     (gimp-image-add-layer img bg-layer 1)
  35.     (gimp-palette-set-background bg-color)
  36.     (gimp-edit-fill img bg-layer)
  37.     (gimp-edit-clear img text-layer)
  38.  
  39.     ; is there any other way to do this?
  40.     ; the sobel edge detect won't work with the methods in other scripts
  41.     (gimp-palette-set-foreground chalk-color)
  42.     (set! float-layer (car (gimp-text img text-layer 0 0 text border TRUE size PIXELS "*" font "*" "*" "*" "*")))
  43.     (gimp-floating-sel-anchor float-layer)
  44.  
  45.     ; the actual effect
  46.     (plug-in-gauss-rle 1 img text-layer 2.0 1 1)
  47.     (plug-in-spread 1 img text-layer 5.0 5.0)
  48.     (plug-in-ripple 1 img text-layer 27 2 0 0 0 TRUE TRUE)
  49.     (plug-in-ripple 1 img text-layer 27 2 1 0 0 TRUE TRUE)
  50.     (plug-in-sobel 1 img text-layer TRUE TRUE TRUE)
  51.     (gimp-levels img text-layer 0 0 120 3.5 0 255)
  52.  
  53.     ; work-around for sobel edge detect screw-up (why does this happen?)
  54.     ; the top line of the image has some garbage instead of the bgcolor
  55.     (gimp-rect-select img 0 0 width 1 ADD FALSE 0)
  56.     (gimp-edit-clear img text-layer)
  57.     (gimp-selection-none img)
  58.  
  59.     (gimp-layer-set-preserve-trans text-layer TRUE)
  60.     (gimp-layer-set-name text-layer text)
  61.     (gimp-palette-set-background old-bg)
  62.     (gimp-palette-set-foreground old-fg)
  63.     (gimp-image-enable-undo img)
  64.     (gimp-display-new img)))
  65.  
  66. (script-fu-register "script-fu-chalk-logo"
  67.                     "<Toolbox>/Xtns/Script-Fu/Logos/Chalk"
  68.                     "Chalk scribbled logos"
  69.                     "Manish Singh <msingh@uclink4.berkeley.edu>"
  70.                     "Manish Singh"
  71.                     "October 1997"
  72.                     ""
  73.                     SF-VALUE "Text String" "\"CHALK\""
  74.                     SF-VALUE "Font Size (in pixels)" "150"
  75.                     SF-VALUE "Font" "\"Cooper\""
  76.                     SF-COLOR "Background Color" '(0 0 0)
  77.                     SF-COLOR "Chalk Color" '(255 255 255))
  78.