home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 July / CHIP-1999-07.iso / software / gimp / GIMP-SET.EXE / file0442_3bb3d8_3bb8ec.bin < prev    next >
Encoding:
Text File  |  1999-02-28  |  3.2 KB  |  90 lines

  1. ; Newsprint text
  2. ; Copyright (c) 1998 Austin Donnelly <austin@greenend.org.uk>
  3. ;
  4. ;
  5. ; Based on alien glow code from Adrian Likins
  6. ; This program is free software; you can redistribute it and/or modify
  7. ; it under the terms of the GNU General Public License as published by
  8. ; the Free Software Foundation; either version 2 of the License, or
  9. ; (at your option) any later version.
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. ; GNU General Public License for more details.
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program; if not, write to the Free Software
  16. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.  
  19. (define (script-fu-speed-text string font font-size density)
  20.   (let* ((text-ext (gimp-text-get-extents-fontname string font-size PIXELS font))
  21.      (wid (+ (car text-ext) 20))
  22.      (hi  (+ (nth 1 text-ext) 20))
  23.      (img (car (gimp-image-new wid hi RGB)))
  24.      (bg-layer (car (gimp-layer-new img wid hi  RGB_IMAGE "Background" 100 NORMAL)))
  25.      (text-layer (car (gimp-layer-new img wid hi  RGBA_IMAGE "Text layer" 100 NORMAL)))
  26.      (text-mask 0)
  27.      (saved-select 0)
  28.      (cell-size (/ font-size 8))
  29.      (grey (/ (* density 255) 100))
  30.      (old-fg (car (gimp-palette-get-foreground)))
  31.      (old-bg (car (gimp-palette-get-background))))
  32.  
  33.     (gimp-image-disable-undo img)
  34.     (gimp-image-add-layer img bg-layer 1)
  35.     (gimp-image-add-layer img text-layer -1)
  36.  
  37.     (gimp-edit-clear bg-layer)
  38.     (gimp-edit-clear text-layer)
  39.  
  40.     (gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer 10 10 string 0 TRUE font-size PIXELS font)))
  41.  
  42.     ; save the selection for later
  43.     (gimp-selection-layer-alpha text-layer)
  44.     (set! saved-sel (car (gimp-selection-save img)))
  45.  
  46.     ; add layer mask
  47.     (set! text-mask (car (gimp-layer-create-mask text-layer ALPHA-MASK)))
  48.     (gimp-image-add-layer-mask img text-layer text-mask)
  49.  
  50.     ; grow the layer
  51.     (gimp-layer-set-edit-mask text-layer FALSE)
  52.     (gimp-selection-grow img 10)
  53.     (gimp-palette-set-background old-fg)
  54.     (gimp-edit-fill text-layer)
  55.  
  56.     ; feather the mask
  57.     (gimp-layer-set-edit-mask text-layer TRUE)
  58.     (gimp-selection-load saved-sel)
  59.     (gimp-selection-feather img 10)
  60.     (gimp-palette-set-background (list grey grey grey))
  61.     (gimp-edit-fill text-mask)
  62.     (gimp-edit-fill text-mask)
  63.     (gimp-edit-fill text-mask)
  64.     (gimp-selection-clear img)
  65.  
  66.     (plug-in-newsprint 1 img text-mask cell-size 0 0 0.0 1 45.0 0 45.0 0 45.0 0 5)
  67.  
  68.     (gimp-image-remove-layer-mask img text-layer APPLY)
  69.  
  70.     (gimp-palette-set-foreground old-fg)
  71.     (gimp-palette-set-background old-bg)
  72.  
  73.     (gimp-image-enable-undo img)
  74.     (gimp-display-new img)))
  75.  
  76. (script-fu-register "script-fu-speed-text"
  77.             "<Toolbox>/Xtns/Script-Fu/Logos/Speed text"
  78.             "give text a speedy effect"
  79.             "Austin Donnelly"
  80.             "Austin Donnelly"
  81.             "1998"
  82.             ""
  83.             SF-STRING "Text String" "Speed!"
  84.             SF-FONT "Font" "-*-Charter-*-r-*-*-24-*-*-*-p-*-*-*"
  85.             SF-ADJUSTMENT "Font Size (pixels)" '(100 2 1000 1 10 0 1)
  86.             SF-ADJUSTMENT "Density (%)" '(80 0 100 1 10 0 0))
  87.