home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / gradient-bevel-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2000-12-27  |  5.0 KB  |  129 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. ;  Gradient Bevel v0.1  04/08/98
  16. ;  by Brian McFee <keebler@wco.com>
  17. ;  Create cool glossy bevelly text
  18.  
  19. (define (apply-gradient-bevel-logo-effect img
  20.                       logo-layer
  21.                       b-size
  22.                       bevel-height
  23.                       bevel-width
  24.                       bg-color)
  25.   (let* ((width (car (gimp-drawable-width logo-layer)))
  26.      (height (car (gimp-drawable-height logo-layer)))
  27.          (indentX (+ b-size 12))
  28.      (indentY (+ b-size (/ height 8)))
  29.      (bg-layer (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
  30.      (blur-layer (car (gimp-layer-new img width height RGBA_IMAGE "Blur" 100 NORMAL)))
  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 blur-layer 1)
  36.  
  37.     (gimp-selection-all img)
  38.     (gimp-palette-set-background bg-color)
  39.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  40.     (gimp-selection-none img)
  41.  
  42.     (gimp-layer-set-preserve-trans blur-layer TRUE)
  43.     (gimp-palette-set-background '(255 255 255))
  44.     (gimp-selection-all img)
  45.     (gimp-edit-fill blur-layer BG-IMAGE-FILL)
  46.     (gimp-edit-clear blur-layer)
  47.     (gimp-selection-none img)
  48.     (gimp-layer-set-preserve-trans blur-layer FALSE)
  49.     (gimp-selection-layer-alpha logo-layer)
  50.     (gimp-edit-fill blur-layer BG-IMAGE-FILL)
  51.     (plug-in-gauss-rle 1 img blur-layer bevel-width 1 1)
  52.     (gimp-selection-none img)
  53.     (gimp-palette-set-background '(127 127 127))
  54.     (gimp-palette-set-foreground '(255 255 255))
  55.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  56.     (gimp-selection-all img)
  57.     (gimp-blend logo-layer FG-BG-RGB NORMAL RADIAL 95 0 REPEAT-NONE FALSE 0 0 indentX indentY indentX (- height indentY))
  58.     (gimp-selection-none img)
  59.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  60.     (plug-in-bump-map 1 img logo-layer blur-layer 115 bevel-height 5 0 0 0 15 TRUE FALSE 0)
  61.     (gimp-layer-set-offsets blur-layer 5 5)
  62.     (gimp-invert blur-layer)
  63.     (gimp-layer-set-opacity blur-layer 50.0)
  64.     (gimp-image-set-active-layer img logo-layer)
  65.     (gimp-palette-set-background old-bg)
  66.     (gimp-palette-set-foreground old-fg)))
  67.  
  68. (define (script-fu-gradient-bevel-logo-alpha img
  69.                          logo-layer
  70.                          b-size
  71.                          bevel-height
  72.                          bevel-width
  73.                          bg-color)
  74.   (begin
  75.     (gimp-undo-push-group-start img)
  76.     (apply-gradient-bevel-logo-effect img logo-layer b-size
  77.                       bevel-height bevel-width bg-color)
  78.     (gimp-undo-push-group-end img)
  79.     (gimp-displays-flush)))
  80.  
  81. (script-fu-register "script-fu-gradient-bevel-logo-alpha"
  82.             _"<Image>/Script-Fu/Alpha to Logo/Gradient Bevel..."
  83.             "Makes Shiny Bevelly text"
  84.             "Brian McFee <keebler@wco.com>"
  85.             "Brian McFee"
  86.             "April 1998"
  87.             "RGBA"
  88.                     SF-IMAGE      "Image" 0
  89.                     SF-DRAWABLE   "Drawable" 0
  90.             SF-ADJUSTMENT _"Border Size (pixels)" '(22 1 300 1 10 0 1)
  91.             SF-ADJUSTMENT _"Bevel Height (Sharpness)" '(40 1 250 1 10 0 1)
  92.             SF-ADJUSTMENT _"Bevel Width" '(2.5 1 200 1 10 1 1)
  93.             SF-COLOR      _"Background Color" '(255 255 255)
  94.             )
  95.  
  96. (define (script-fu-gradient-bevel-logo text
  97.                        size
  98.                        font
  99.                        bevel-height
  100.                        bevel-width
  101.                        bg-color)
  102.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  103.          (border (/ size 4))
  104.      (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  105.     (gimp-image-undo-disable img)
  106.     (gimp-layer-set-name text-layer text)
  107.     (apply-gradient-bevel-logo-effect img text-layer border
  108.                       bevel-height bevel-width bg-color)
  109.     (gimp-image-undo-enable img)
  110.     (gimp-display-new img)))
  111.  
  112. (script-fu-register "script-fu-gradient-bevel-logo"
  113.             _"<Toolbox>/Xtns/Script-Fu/Logos/Gradient Bevel..."
  114.             "Makes Shiny Bevelly text"
  115.             "Brian McFee <keebler@wco.com>"
  116.             "Brian McFee"
  117.             "April 1998"
  118.             ""
  119.             SF-STRING     _"Text" "Moo"
  120.             SF-ADJUSTMENT _"Font Size (pixels)" '(90 2 1000 1 10 0 1)
  121.             SF-FONT       _"Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*"
  122.             SF-ADJUSTMENT _"Bevel Height (Sharpness)" '(40 1 250 1 10 0 1)
  123.             SF-ADJUSTMENT _"Bevel Width" '(2.5 1 200 1 10 1 1)
  124.             SF-COLOR      _"Background Color" '(255 255 255)
  125.             )
  126.