home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 February / PCWorld_2001-02_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / comic-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2000-12-27  |  5.4 KB  |  142 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. ;  Comic Book Logo v0.1  04/08/98
  16. ;  by Brian McFee
  17. ;  Creates snazzy-looking text, inspired by watching a Maxx marathon :)
  18.  
  19. (define (apply-comic-logo-effect img
  20.                  logo-layer
  21.                  gradient
  22.                  ol-width
  23.                  ol-color
  24.                  bg-color)
  25.   (let* ((width (car (gimp-drawable-width logo-layer)))
  26.      (height (car (gimp-drawable-height logo-layer)))
  27.      (bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
  28.      (white-layer (car (gimp-layer-copy logo-layer 1)))
  29.      (black-layer (car (gimp-layer-copy logo-layer 1)))
  30.      (old-gradient (car (gimp-gradients-get-active)))
  31.      (old-fg (car (gimp-palette-get-foreground)))
  32.      (old-bg (car (gimp-palette-get-background))))
  33.     (gimp-image-resize img width height 0 0)
  34.     (gimp-image-add-layer img bg-layer 1)
  35.     (gimp-image-add-layer img white-layer 1)
  36.     (gimp-layer-set-name white-layer "White")
  37.     (gimp-image-add-layer img black-layer 1)
  38.     (gimp-layer-set-name black-layer "Black")
  39.   
  40.     (gimp-selection-all img)
  41.     (gimp-palette-set-background bg-color)
  42.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  43.     (gimp-selection-none img)
  44.  
  45.     (gimp-layer-set-preserve-trans white-layer TRUE)
  46.     (gimp-palette-set-background ol-color)
  47.     (gimp-selection-all img)
  48.     (gimp-edit-fill white-layer BG-IMAGE-FILL)
  49.     (gimp-layer-set-preserve-trans white-layer FALSE)
  50.     (plug-in-spread 1 img white-layer (* 3 ol-width) (* 3 ol-width))
  51.     (plug-in-gauss-rle 1 img white-layer (* 2 ol-width) 1 1)
  52.     (plug-in-threshold-alpha 1 img white-layer 0)
  53.     (gimp-selection-none img)
  54.  
  55.     (gimp-palette-set-background '(0 0 0))
  56.     (gimp-layer-set-preserve-trans black-layer TRUE)
  57.     (gimp-selection-all img)
  58.     (gimp-edit-fill black-layer BG-IMAGE-FILL)
  59.     (gimp-selection-none img)
  60.     (gimp-layer-set-preserve-trans black-layer FALSE)
  61.     (plug-in-gauss-rle 1 img black-layer ol-width 1 1)
  62.     (plug-in-threshold-alpha 1 img black-layer 0)
  63.  
  64.     (gimp-gradients-set-active gradient)
  65.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  66.     (gimp-selection-all img)
  67.     (gimp-blend logo-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 (* height 0.33333) 0 (* height 0.83333))
  68.     (plug-in-noisify 1 img logo-layer 0 0.20 0.20 0.20 0.20)
  69.     (gimp-selection-none img)
  70.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  71.     (gimp-brightness-contrast logo-layer 0 30)
  72.     (plug-in-threshold-alpha 1 img logo-layer 60)
  73.     (gimp-image-set-active-layer img logo-layer)
  74.     (gimp-gradients-set-active old-gradient)
  75.     (gimp-palette-set-background old-bg)
  76.     (gimp-palette-set-foreground old-fg)))
  77.  
  78. (define (script-fu-comic-logo-alpha img
  79.                     logo-layer
  80.                     gradient
  81.                     ol-width
  82.                     ol-color
  83.                     bg-color)
  84.   (begin
  85.     (gimp-undo-push-group-start img)
  86.     (apply-comic-logo-effect img logo-layer gradient ol-width ol-color
  87.                  bg-color)
  88.     (gimp-undo-push-group-end img)
  89.     (gimp-displays-flush)))
  90.  
  91. (script-fu-register "script-fu-comic-logo-alpha"
  92.             _"<Image>/Script-Fu/Alpha to Logo/Comic Book..."
  93.             "Comic-book Style Logos"
  94.             "Brian McFee <keebler@wco.com>"
  95.             "Brian McFee"
  96.             "April 1998"
  97.             "RGBA"
  98.                     SF-IMAGE      "Image" 0
  99.                     SF-DRAWABLE   "Drawable" 0
  100.             SF-GRADIENT   _"Gradient" "Incandescent"
  101.             SF-ADJUSTMENT _"Outline Size" '(5 1 100 1 10 0 1)
  102.             SF-COLOR      _"Outline Color" '(255 255 255)
  103.             SF-COLOR      _"Background Color" '(255 255 255)
  104.             )
  105.  
  106.  
  107. (define (script-fu-comic-logo text
  108.                   size
  109.                   font
  110.                   gradient
  111.                   ol-width
  112.                   ol-color
  113.                   bg-color)
  114.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  115.          (border (/ size 4))
  116.      (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  117.     (gimp-image-undo-disable img)
  118.     (gimp-layer-set-name text-layer text)
  119.     (apply-comic-logo-effect img text-layer gradient ol-width ol-color
  120.                  bg-color)
  121.     (gimp-image-undo-enable img)
  122.     (gimp-display-new img)))
  123.  
  124. (script-fu-register "script-fu-comic-logo"
  125.             _"<Toolbox>/Xtns/Script-Fu/Logos/Comic Book..."
  126.             "Comic-book Style Logos"
  127.             "Brian McFee <keebler@wco.com>"
  128.             "Brian McFee"
  129.             "April 1998"
  130.             ""
  131.             SF-STRING     _"Text" "Moo"
  132.             SF-ADJUSTMENT _"Font Size (pixels)" '(85 2 1000 1 10 0 1)
  133.             SF-FONT       _"Font" "-*-tribeca-*-i-*-*-24-*-*-*-p-*-*-*"
  134.             SF-GRADIENT   _"Gradient" "Incandescent"
  135.             SF-ADJUSTMENT _"Outline Size" '(5 1 100 1 10 0 1)
  136.             SF-COLOR      _"Outline Color" '(255 255 255)
  137.             SF-COLOR      _"Background Color" '(255 255 255)
  138.             )
  139.