home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / glossy.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  11.7 KB  |  295 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. ; GIMP - The GNU 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 3 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, see <http://www.gnu.org/licenses/>.
  23.  
  24. (define (apply-glossy-logo-effect img
  25.                                   logo-layer
  26.                                   blend-gradient-text
  27.                                   blend-gradient-text-reverse
  28.                                   blend-gradient-outline
  29.                                   blend-gradient-outline-reverse
  30.                                   grow-size
  31.                                   bg-color
  32.                                   use-pattern-text
  33.                                   pattern-text
  34.                                   use-pattern-outline
  35.                                   pattern-outline
  36.                                   use-pattern-overlay
  37.                                   pattern-overlay
  38.                                   noninteractive
  39.                                   shadow-toggle
  40.                                   s-offset-x
  41.                                   s-offset-y)
  42.   (let* (
  43.         (width (car (gimp-drawable-width logo-layer)))
  44.         (height (car (gimp-drawable-height logo-layer)))
  45.         (posx (- (car (gimp-drawable-offsets logo-layer))))
  46.         (posy (- (cadr (gimp-drawable-offsets logo-layer))))
  47.         (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  48.         (grow-me (car (gimp-layer-copy logo-layer TRUE)))
  49.         (dont-drop-me 0)
  50.         )
  51.  
  52.     (gimp-context-push)
  53.  
  54.     (script-fu-util-image-resize-from-layer img logo-layer)
  55.     (script-fu-util-image-add-layers img grow-me bg-layer)
  56.     (gimp-drawable-set-name grow-me "Grow-me")
  57.     (gimp-layer-translate grow-me posx posy)
  58.  
  59.     (gimp-context-set-background bg-color)
  60.     (gimp-selection-all img)
  61.     (gimp-edit-bucket-fill bg-layer BG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  62.     (gimp-selection-none img)
  63.  
  64.     (gimp-selection-layer-alpha logo-layer)
  65.  
  66. ; if we are going to use transparent gradients for text, we will (maybe) need to uncomment this
  67. ; this clears black letters first so you don't end up with black where the transparent should be
  68. ;    (gimp-edit-clear img logo-layer)
  69.  
  70.     (if (= use-pattern-text TRUE)
  71.       (begin
  72.         (gimp-context-set-pattern pattern-text)
  73.         (gimp-edit-bucket-fill logo-layer
  74.                                PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  75.       )
  76.     )
  77.  
  78.     (if (= use-pattern-text FALSE)
  79.       (begin
  80.         (gimp-context-set-gradient blend-gradient-text)
  81.  
  82.         (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
  83.                          GRADIENT-LINEAR 100 0 REPEAT-NONE
  84.                          blend-gradient-text-reverse
  85.                          FALSE 0 0 TRUE
  86.                          0 0 0 (+ height 5))
  87.       )
  88.     )
  89.  
  90.     (gimp-selection-none img)
  91.  
  92.     (gimp-selection-layer-alpha grow-me)
  93.     (gimp-selection-grow img grow-size)
  94.  
  95. ; if we are going to use transparent gradients for outline, we will (maybe) need to uncomment this
  96. ; I didn't put it in the options because there are already enough settings there and anyway, transparent
  97. ; gradients will be used very rarely (if ever)
  98. ;    (gimp-edit-clear img grow-me)
  99.  
  100.     (if (= use-pattern-outline TRUE)
  101.       (begin
  102.         (gimp-context-set-pattern pattern-outline)
  103.         (gimp-edit-bucket-fill grow-me
  104.                                PATTERN-BUCKET-FILL NORMAL-MODE 100
  105.                                0 FALSE 0 0)
  106.       )
  107.     )
  108.  
  109.     (if (= use-pattern-outline FALSE)
  110.       (begin
  111.         (gimp-context-set-gradient blend-gradient-outline)
  112.  
  113.         (gimp-edit-blend grow-me CUSTOM-MODE NORMAL-MODE
  114.                          GRADIENT-LINEAR 100 0 REPEAT-NONE
  115.                          blend-gradient-outline-reverse
  116.                          FALSE 0 0 TRUE
  117.                          0 0 0 (+ height 5))
  118.       )
  119.     )
  120.  
  121.     (gimp-selection-none img)
  122.  
  123.     (plug-in-bump-map (if (= noninteractive TRUE)
  124.               RUN-NONINTERACTIVE
  125.               RUN-INTERACTIVE)
  126.               img grow-me logo-layer
  127.                       110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
  128.     (gimp-layer-set-mode logo-layer SCREEN-MODE)
  129.  
  130.     (if (= use-pattern-overlay TRUE)
  131.       (begin
  132.         (gimp-selection-layer-alpha grow-me)
  133.         (gimp-context-set-pattern pattern-overlay)
  134.         (gimp-edit-bucket-fill grow-me PATTERN-BUCKET-FILL
  135.                                OVERLAY-MODE 100 0 FALSE 0 0)
  136.         (gimp-selection-none img)
  137.       )
  138.     )
  139.  
  140.     (if (= shadow-toggle TRUE)
  141.       (begin
  142.         (gimp-selection-layer-alpha logo-layer)
  143.         (set! dont-drop-me (car (script-fu-drop-shadow img logo-layer
  144.                                                        s-offset-x s-offset-y
  145.                                                        15 '(0 0 0) 80 TRUE)))
  146.         (set! width (car (gimp-image-width img)))
  147.         (set! height (car (gimp-image-height img)))
  148.         (gimp-selection-none img)
  149.       )
  150.     )
  151.  
  152.     (gimp-context-pop)
  153.   )
  154. )
  155.  
  156.  
  157. (define (script-fu-glossy-logo-alpha img
  158.                                      logo-layer
  159.                                      blend-gradient-text
  160.                                      blend-gradient-text-reverse
  161.                                      blend-gradient-outline
  162.                                      blend-gradient-outline-reverse
  163.                                      grow-size
  164.                                      bg-color
  165.                                      use-pattern-text
  166.                                      pattern-text
  167.                                      use-pattern-outline
  168.                                      pattern-outline
  169.                                      use-pattern-overlay
  170.                                      pattern-overlay
  171.                                      noninteractive
  172.                                      shadow-toggle
  173.                                      s-offset-x
  174.                                      s-offset-y)
  175.   (begin
  176.     (gimp-image-undo-group-start img)
  177.     (apply-glossy-logo-effect img logo-layer
  178.                               blend-gradient-text
  179.                               blend-gradient-text-reverse
  180.                               blend-gradient-outline
  181.                               blend-gradient-outline-reverse
  182.                               grow-size bg-color
  183.                               use-pattern-text pattern-text
  184.                               use-pattern-outline pattern-outline
  185.                               use-pattern-overlay pattern-overlay
  186.                               noninteractive shadow-toggle
  187.                               s-offset-x s-offset-y)
  188.     (gimp-image-undo-group-end img)
  189.     (gimp-displays-flush)
  190.   )
  191. )
  192.  
  193.  
  194. (script-fu-register "script-fu-glossy-logo-alpha"
  195.   _"Glo_ssy..."
  196.   _"Add gradients, patterns, shadows, and bump maps to the selected region (or alpha)"
  197.   "Hrvoje Horvat (hhorvat@open.hr)"
  198.   "Hrvoje Horvat"
  199.   "14/04/1998"
  200.   "RGBA"
  201.   SF-IMAGE      "Image"                     0
  202.   SF-DRAWABLE   "Drawable"                  0
  203.   SF-GRADIENT   _"Blend gradient (text)"    "Shadows 2"
  204.   SF-TOGGLE     _"Text gradient reverse"    FALSE
  205.   SF-GRADIENT   _"Blend gradient (outline)" "Shadows 2"
  206.   SF-TOGGLE     _"Outline gradient reverse" FALSE
  207.   SF-ADJUSTMENT _"Outline size"             '(5 0 250 1 10 0 1)
  208.   SF-COLOR      _"Background color"         "white"
  209.   SF-TOGGLE     _"Use pattern for text instead of gradient" FALSE
  210.   SF-PATTERN    _"Pattern (text)"           "Electric Blue"
  211.   SF-TOGGLE     _"Use pattern for outline instead of gradient" FALSE
  212.   SF-PATTERN    _"Pattern (outline)"        "Electric Blue"
  213.   SF-TOGGLE     _"Use pattern overlay"      FALSE
  214.   SF-PATTERN    _"Pattern (overlay)"        "Parque #1"
  215.   SF-TOGGLE     _"Default bumpmap settings" TRUE
  216.   SF-TOGGLE     _"Shadow"                   TRUE
  217.   SF-ADJUSTMENT _"Shadow X offset"          '(8 0 100 1 10 0 1)
  218.   SF-ADJUSTMENT _"Shadow Y offset"          '(8 0 100 1 10 0 1)
  219. )
  220.  
  221. (script-fu-menu-register "script-fu-glossy-logo-alpha"
  222.                          "<Image>/Filters/Alpha to Logo")
  223.  
  224.  
  225. (define (script-fu-glossy-logo text
  226.                                size
  227.                                font
  228.                                blend-gradient-text
  229.                                blend-gradient-text-reverse
  230.                                blend-gradient-outline
  231.                                blend-gradient-outline-reverse
  232.                                grow-size
  233.                                bg-color
  234.                                use-pattern-text
  235.                                pattern-text
  236.                                use-pattern-outline
  237.                                pattern-outline
  238.                                use-pattern-overlay
  239.                                pattern-overlay
  240.                                noninteractive
  241.                                shadow-toggle
  242.                                s-offset-x
  243.                                s-offset-y)
  244.   (let* (
  245.         (img (car (gimp-image-new 256 256 RGB)))
  246.         (text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
  247.         )
  248.     (gimp-image-undo-disable img)
  249.     (apply-glossy-logo-effect img text-layer
  250.                               blend-gradient-text
  251.                               blend-gradient-text-reverse
  252.                               blend-gradient-outline
  253.                               blend-gradient-outline-reverse
  254.                               grow-size bg-color
  255.                               use-pattern-text pattern-text
  256.                               use-pattern-outline pattern-outline
  257.                               use-pattern-overlay pattern-overlay
  258.                               noninteractive shadow-toggle
  259.                               s-offset-x s-offset-y)
  260.     (gimp-image-undo-enable img)
  261.     (gimp-display-new img)
  262.   )
  263. )
  264.  
  265. (script-fu-register "script-fu-glossy-logo"
  266.   _"Glo_ssy..."
  267.   _"Create a logo with gradients, patterns, shadows, and bump maps"
  268.   "Hrvoje Horvat (hhorvat@open.hr)"
  269.   "Hrvoje Horvat"
  270.   "14/04/1998"
  271.   ""
  272.   SF-STRING     _"Text"                     "Galaxy"
  273.   SF-ADJUSTMENT _"Font size (pixels)"       '(100 2 1000 1 10 0 1)
  274.   SF-FONT       _"Font"                     "Eras"
  275.   SF-GRADIENT   _"Blend gradient (text)"    "Shadows 2"
  276.   SF-TOGGLE     _"Text gradient reverse"    FALSE
  277.   SF-GRADIENT   _"Blend gradient (outline)" "Shadows 2"
  278.   SF-TOGGLE     _"Outline gradient reverse" FALSE
  279.   SF-ADJUSTMENT _"Outline size"             '(5 0 250 1 10 0 1)
  280.   SF-COLOR      _"Background color"         "white"
  281.   SF-TOGGLE     _"Use pattern for text instead of gradient" FALSE
  282.   SF-PATTERN    _"Pattern (text)"           "Electric Blue"
  283.   SF-TOGGLE     _"Use pattern for outline instead of gradient" FALSE
  284.   SF-PATTERN    _"Pattern (outline)"        "Electric Blue"
  285.   SF-TOGGLE     _"Use pattern overlay"      FALSE
  286.   SF-PATTERN    _"Pattern (overlay)"        "Parque #1"
  287.   SF-TOGGLE     _"Default bumpmap settings" TRUE
  288.   SF-TOGGLE     _"Shadow"                   TRUE
  289.   SF-ADJUSTMENT _"Shadow X offset"          '(8 0 100 1 10 0 1)
  290.   SF-ADJUSTMENT _"Shadow Y offset"          '(8 0 100 1 10 0 1)
  291. )
  292.  
  293. (script-fu-menu-register "script-fu-glossy-logo"
  294.                          "<Image>/File/Create/Logos")
  295.