home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 August / ENTER.ISO / files / gimp-2.0.5-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / gradient-bevel-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2004-09-26  |  5.1 KB  |  134 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-MODE)))
  30.      (blur-layer (car (gimp-layer-new img width height RGBA-IMAGE "Blur" 100 NORMAL-MODE)))
  31.      (old-fg (car (gimp-palette-get-foreground)))
  32.      (old-bg (car (gimp-palette-get-background))))
  33.  
  34.     (script-fu-util-image-resize-from-layer img logo-layer)
  35.     (gimp-image-add-layer img bg-layer 1)
  36.     (gimp-image-add-layer img blur-layer 1)
  37.  
  38.     (gimp-selection-all img)
  39.     (gimp-palette-set-background bg-color)
  40.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  41.     (gimp-selection-none img)
  42.  
  43.     (gimp-layer-set-preserve-trans blur-layer TRUE)
  44.     (gimp-palette-set-background '(255 255 255))
  45.     (gimp-selection-all img)
  46.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  47.     (gimp-edit-clear blur-layer)
  48.     (gimp-selection-none img)
  49.     (gimp-layer-set-preserve-trans blur-layer FALSE)
  50.     (gimp-selection-layer-alpha logo-layer)
  51.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  52.     (plug-in-gauss-rle 1 img blur-layer bevel-width 1 1)
  53.     (gimp-selection-none img)
  54.     (gimp-palette-set-background '(127 127 127))
  55.     (gimp-palette-set-foreground '(255 255 255))
  56.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  57.     (gimp-selection-all img)
  58.  
  59.     (gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE
  60.              GRADIENT-RADIAL 95 0 REPEAT-NONE FALSE
  61.              FALSE 0 0 TRUE
  62.              indentX indentY indentX (- height indentY))
  63.  
  64.     (gimp-selection-none img)
  65.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  66.     (plug-in-bump-map 1 img logo-layer blur-layer 115 bevel-height 5 0 0 0 15 TRUE FALSE 0)
  67.     (gimp-layer-set-offsets blur-layer 5 5)
  68.     (gimp-invert blur-layer)
  69.     (gimp-layer-set-opacity blur-layer 50.0)
  70.     (gimp-image-set-active-layer img logo-layer)
  71.     (gimp-palette-set-background old-bg)
  72.     (gimp-palette-set-foreground old-fg)))
  73.  
  74. (define (script-fu-gradient-bevel-logo-alpha img
  75.                          logo-layer
  76.                          b-size
  77.                          bevel-height
  78.                          bevel-width
  79.                          bg-color)
  80.   (begin
  81.     (gimp-image-undo-group-start img)
  82.     (apply-gradient-bevel-logo-effect img logo-layer b-size
  83.                       bevel-height bevel-width bg-color)
  84.     (gimp-image-undo-group-end img)
  85.     (gimp-displays-flush)))
  86.  
  87. (script-fu-register "script-fu-gradient-bevel-logo-alpha"
  88.             _"<Image>/Script-Fu/Alpha to Logo/Gradient Beve_l..."
  89.             "Makes Shiny Bevelly text"
  90.             "Brian McFee <keebler@wco.com>"
  91.             "Brian McFee"
  92.             "April 1998"
  93.             "RGBA"
  94.                     SF-IMAGE      "Image"                     0
  95.                     SF-DRAWABLE   "Drawable"                  0
  96.             SF-ADJUSTMENT _"Border Size (pixels)"     '(22 1 300 1 10 0 1)
  97.             SF-ADJUSTMENT _"Bevel Height (Sharpness)" '(40 1 250 1 10 0 1)
  98.             SF-ADJUSTMENT _"Bevel Width"              '(2.5 1 200 1 10 1 1)
  99.             SF-COLOR      _"Background Color"         '(255 255 255))
  100.  
  101. (define (script-fu-gradient-bevel-logo text
  102.                        size
  103.                        font
  104.                        bevel-height
  105.                        bevel-width
  106.                        bg-color)
  107.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  108.          (border (/ size 4))
  109.      (text-layer (car (gimp-text-fontname img -1 0 0 text
  110.                           border TRUE size PIXELS font))))
  111.     (gimp-image-undo-disable img)
  112.     (gimp-drawable-set-name text-layer text)
  113.     (apply-gradient-bevel-logo-effect img text-layer border
  114.                       bevel-height bevel-width bg-color)
  115.     (gimp-image-undo-enable img)
  116.     (gimp-display-new img)))
  117.  
  118. (script-fu-register "script-fu-gradient-bevel-logo"
  119.             _"<Toolbox>/Xtns/Script-Fu/Logos/Gradient Beve_l..."
  120.             "Makes Shiny Bevelly text"
  121.             "Brian McFee <keebler@wco.com>"
  122.             "Brian McFee"
  123.             "April 1998"
  124.             ""
  125.             SF-STRING     _"Text"                     "Moo"
  126.             SF-ADJUSTMENT _"Font Size (pixels)"       '(90 2 1000 1 10 0 1)
  127.             SF-FONT       _"Font"                     "Futura_Poster"
  128.             SF-ADJUSTMENT _"Bevel Height (Sharpness)" '(40 1 250 1 10 0 1)
  129.             SF-ADJUSTMENT _"Bevel Width"              '(2.5 1 200 1 10 1 1)
  130.             SF-COLOR      _"Background Color"         '(255 255 255))
  131.