home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / glossy.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2000-12-27  |  9.3 KB  |  237 lines

  1. ; glossy-patterned-shadowed-and-bump-mapped-logo
  2. ; creates anything you can create with it :)
  3. ; (use it wisely, use it in peace...) 
  4. ;
  5. ; The GIMP -- an image manipulation program
  6. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  7. ;
  8. ; glossy gives a glossy outlook to your fonts (unlogical name, isn't it?)
  9. ; Copyright (C) 1998 Hrvoje Horvat
  10. ;
  11. ; This program is free software; you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 2 of the License, or
  14. ; (at your option) any later version.
  15. ;
  16. ; This program is distributed in the hope that it will be useful,
  17. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. ; GNU General Public License for more details.
  20. ;
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program; if not, write to the Free Software
  23. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. (define (apply-glossy-logo-effect img
  26.                   logo-layer
  27.                   blend-gradient-text
  28.                   blend-gradient-outline
  29.                   grow-size
  30.                   bg-color
  31.                   use-pattern-text
  32.                   pattern-text
  33.                   use-pattern-outline
  34.                   pattern-outline
  35.                   use-pattern-overlay
  36.                   pattern-overlay
  37.                   noninteractive
  38.                   shadow-toggle
  39.                   s-offset-x
  40.                   s-offset-y)
  41.   (let* ((width (car (gimp-drawable-width logo-layer)))
  42.          (height (car (gimp-drawable-height logo-layer)))
  43.          (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  44.          (grow-me (car (gimp-layer-copy logo-layer TRUE)))
  45.  
  46.          (old-gradient (car (gimp-gradients-get-active)))
  47.          (old-patterns (car (gimp-patterns-get-pattern)))
  48.          (old-fg (car (gimp-palette-get-foreground)))
  49.          (old-bg (car (gimp-palette-get-background))))
  50.  
  51.     (gimp-image-resize img width height 0 0)
  52.     (gimp-layer-set-name grow-me "Grow-me")
  53.     (gimp-image-add-layer img grow-me 1)
  54.     (gimp-image-add-layer img bg-layer 2)
  55.  
  56.     (gimp-palette-set-background bg-color)
  57.     (gimp-selection-all img)
  58.     (gimp-bucket-fill bg-layer BG-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  59.     (gimp-selection-none img)
  60.     (gimp-palette-set-background old-bg)
  61.  
  62.     (gimp-selection-layer-alpha logo-layer)
  63.  
  64. ; if we are going to use transparent gradients for text, we will (maybe) need to uncomment this
  65. ; this clears black letters first so you don't end up with black where the transparent should be
  66. ;    (gimp-edit-clear img logo-layer)
  67.  
  68.     (if (= use-pattern-text TRUE)
  69.       (begin
  70.         (gimp-patterns-set-pattern pattern-text)
  71.         (gimp-bucket-fill logo-layer PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  72.         (gimp-patterns-set-pattern old-patterns)))
  73.  
  74.     (if (= use-pattern-text FALSE)
  75.       (begin
  76.         (gimp-gradients-set-active blend-gradient-text)
  77.         (gimp-blend logo-layer CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 0 0 (+ height 5))))
  78.  
  79.     (gimp-selection-none img)
  80.  
  81.     (gimp-selection-layer-alpha grow-me)
  82.     (gimp-selection-grow img grow-size)
  83.  
  84. ; if we are going to use transparent gradients for outline, we will (maybe) need to uncomment this
  85. ; I didn't put it in the options because there are already enough settings there and anyway, transparent
  86. ; gradients will be used very rarely (if ever)
  87. ;    (gimp-edit-clear img grow-me)
  88.  
  89.     (if (= use-pattern-outline TRUE)
  90.       (begin
  91.         (gimp-patterns-set-pattern pattern-outline)
  92.         (gimp-bucket-fill grow-me PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  93.         (gimp-patterns-set-pattern old-patterns)))
  94.  
  95.     (if (= use-pattern-outline FALSE)
  96.       (begin
  97.         (gimp-gradients-set-active blend-gradient-outline)
  98.         (gimp-blend grow-me CUSTOM NORMAL LINEAR 100 0 REPEAT-NONE FALSE 0 0 0 0 0 (+ height 5))))
  99.  
  100.     (gimp-selection-none img)
  101.  
  102.     (plug-in-bump-map noninteractive img grow-me logo-layer 110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
  103.     (gimp-layer-set-mode logo-layer SCREEN)
  104.  
  105.     (if (= use-pattern-overlay TRUE)
  106.       (begin
  107.         (gimp-selection-layer-alpha grow-me)
  108.         (gimp-patterns-set-pattern pattern-overlay)
  109.         (gimp-bucket-fill grow-me PATTERN-BUCKET-FILL OVERLAY 100 0 FALSE 0 0)
  110.         (gimp-patterns-set-pattern old-patterns)
  111.         (gimp-selection-none img)))
  112.    
  113.     (if (= shadow-toggle TRUE)
  114.       (begin
  115.     (gimp-selection-layer-alpha logo-layer)
  116.     (set! dont-drop-me (car (script-fu-drop-shadow img logo-layer s-offset-x s-offset-y 15 '(0 0 0) 80 TRUE)))
  117.         (set! width (car (gimp-image-width img)))
  118.         (set! height (car (gimp-image-height img)))
  119.         (gimp-selection-none img)))
  120.  
  121.   (gimp-gradients-set-active old-gradient)
  122.   (gimp-palette-set-background old-bg)
  123.   (gimp-palette-set-foreground old-fg)))
  124.  
  125.  
  126. (define (script-fu-glossy-logo-alpha img
  127.                      logo-layer
  128.                      blend-gradient-text
  129.                      blend-gradient-outline
  130.                      grow-size
  131.                      bg-color
  132.                      use-pattern-text
  133.                      pattern-text
  134.                      use-pattern-outline
  135.                      pattern-outline
  136.                      use-pattern-overlay
  137.                      pattern-overlay
  138.                      noninteractive
  139.                      shadow-toggle
  140.                      s-offset-x
  141.                      s-offset-y)
  142.   (begin
  143.     (gimp-undo-push-group-start img)
  144.     (apply-glossy-logo-effect img logo-layer blend-gradient-text
  145.                   blend-gradient-outline grow-size bg-color
  146.                   use-pattern-text pattern-text
  147.                   use-pattern-outline pattern-outline
  148.                   use-pattern-overlay pattern-overlay
  149.                   noninteractive shadow-toggle
  150.                   s-offset-x s-offset-y)
  151.     (gimp-undo-push-group-end img)
  152.     (gimp-displays-flush)))
  153.  
  154.  
  155. (script-fu-register "script-fu-glossy-logo-alpha"
  156.                     _"<Image>/Script-Fu/Alpha to Logo/Glossy..."
  157.                     "Creates anything you can create with it :)"
  158.                     "Hrvoje Horvat (hhorvat@open.hr)"
  159.                     "Hrvoje Horvat"
  160.                     "14/04/1998"
  161.             "RGBA"
  162.                     SF-IMAGE      "Image" 0
  163.                     SF-DRAWABLE   "Drawable" 0
  164.                     SF-GRADIENT   _"Blend Gradient (Text)" "Shadows_2"
  165.                     SF-GRADIENT   _"Blend Gradient (Outline)" "Shadows_2"
  166.                     SF-ADJUSTMENT _"Outline Size" '(5 0 250 1 10 0 1)
  167.             SF-COLOR      _"Background Color" '(255 255 255)
  168.             SF-TOGGLE     _"Use Pattern for Text instead of Gradient" FALSE
  169.             SF-PATTERN    _"Pattern (Text)" "Electric Blue"
  170.             SF-TOGGLE     _"Use Pattern for Outline instead of Gradient" FALSE
  171.             SF-PATTERN    _"Pattern (Outline)" "Electric Blue"
  172.             SF-TOGGLE     _"Use Pattern Overlay" FALSE
  173.             SF-PATTERN    _"Pattern (Overlay)" "Parque #1"
  174.             SF-TOGGLE     _"Default Bumpmap Settings" TRUE
  175.             SF-TOGGLE     _"Shadow" TRUE
  176.             SF-ADJUSTMENT _"Shadow X Offset" '(8 0 100 1 10 0 1)
  177.                     SF-ADJUSTMENT _"Shadow Y Offset" '(8 0 100 1 10 0 1)
  178.             )
  179.  
  180.  
  181. (define (script-fu-glossy-logo text
  182.                    size
  183.                    font
  184.                    blend-gradient-text
  185.                    blend-gradient-outline
  186.                    grow-size
  187.                    bg-color
  188.                    use-pattern-text
  189.                    pattern-text
  190.                    use-pattern-outline
  191.                    pattern-outline
  192.                    use-pattern-overlay
  193.                    pattern-overlay
  194.                    noninteractive
  195.                    shadow-toggle
  196.                    s-offset-x
  197.                    s-offset-y)
  198.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  199.      (text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font))))
  200.     (gimp-image-undo-disable img)
  201.     (gimp-layer-set-name text-layer text)
  202.     (apply-glossy-logo-effect img text-layer blend-gradient-text
  203.                   blend-gradient-outline grow-size bg-color
  204.                   use-pattern-text pattern-text
  205.                   use-pattern-outline pattern-outline
  206.                   use-pattern-overlay pattern-overlay
  207.                   noninteractive shadow-toggle
  208.                   s-offset-x s-offset-y)
  209.     (gimp-image-undo-enable img)
  210.     (gimp-display-new img)))
  211.  
  212. (script-fu-register "script-fu-glossy-logo"
  213.                     _"<Toolbox>/Xtns/Script-Fu/Logos/Glossy..."
  214.                     "Creates anything you can create with it :)"
  215.                     "Hrvoje Horvat (hhorvat@open.hr)"
  216.                     "Hrvoje Horvat"
  217.                     "14/04/1998"
  218.                     ""
  219.                     SF-STRING     _"Text" "Galaxy"
  220.                     SF-ADJUSTMENT _"Font Size (pixels)" '(100 2 1000 1 10 0 1)
  221.                     SF-FONT       _"Font" "-*-Eras-*-r-*-*-24-*-*-*-p-*-*-*"
  222.                     SF-GRADIENT   _"Blend Gradient (Text)" "Shadows_2"
  223.                     SF-GRADIENT   _"Blend Gradient (Outline)" "Shadows_2"
  224.                     SF-ADJUSTMENT _"Outline Size" '(5 0 250 1 10 0 1)
  225.             SF-COLOR      _"Background Color" '(255 255 255)
  226.             SF-TOGGLE     _"Use Pattern for Text instead of Gradient" FALSE
  227.             SF-PATTERN    _"Pattern (Text)" "Electric Blue"
  228.             SF-TOGGLE     _"Use Pattern for Outline instead of Gradient" FALSE
  229.             SF-PATTERN    _"Pattern (Outline)" "Electric Blue"
  230.             SF-TOGGLE     _"Use Pattern Overlay" FALSE
  231.             SF-PATTERN    _"Pattern (Overlay)" "Parque #1"
  232.             SF-TOGGLE     _"Default Bumpmap Settings" TRUE
  233.             SF-TOGGLE     _"Shadow" TRUE
  234.             SF-ADJUSTMENT _"Shadow X Offset" '(8 0 100 1 10 0 1)
  235.                     SF-ADJUSTMENT _"Shadow Y Offset" '(8 0 100 1 10 0 1)
  236.             )
  237.