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 / title-header.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  6.2 KB  |  177 lines

  1. ; GIMP - The GNU Image Manipulation Program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ;
  4. ; Bump-mapped title script --- create a bump-mapped title image for web pages
  5. ; Copyright (C) 1997 Federico Mena Quintero
  6. ; federico@nuclecu.unam.mx
  7. ; ************************************************************************
  8. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  9. ; For use with GIMP 1.1.
  10. ;
  11. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  12. ; The call to gimp-context-set-background has been given a real layer
  13. ; (although it is not used) otherwise gimp 1.1 crashed.
  14. ; ************************************************************************
  15. ;
  16. ; This program is free software: you can redistribute it and/or modify
  17. ; it under the terms of the GNU General Public License as published by
  18. ; the Free Software Foundation; either version 3 of the License, or
  19. ; (at your option) any later version.
  20. ;
  21. ; This program is distributed in the hope that it will be useful,
  22. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24. ; GNU General Public License for more details.
  25. ;
  26. ; You should have received a copy of the GNU General Public License
  27. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  28.  
  29.  
  30. (define (script-fu-title-header text
  31.                                 size
  32.                                 fontname
  33.                                 gradient-reverse)
  34.   (let* (; Parameters
  35.  
  36.          (padding 8)
  37.          (fade-width 64)
  38.  
  39.          ; Image
  40.  
  41.          (img (car (gimp-image-new 256 256 RGB)))
  42.  
  43.          ; Text layer
  44.  
  45.          (text-layer (car (gimp-text-fontname
  46.                            img
  47.                            -1
  48.                            0
  49.                            0
  50.                            text
  51.                            padding
  52.                            TRUE
  53.                            size
  54.                            PIXELS
  55.                            fontname)))
  56.          (text-width (car (gimp-drawable-width text-layer)))
  57.          (text-height (car (gimp-drawable-height text-layer)))
  58.  
  59.          ; Sizes
  60.  
  61.          (text-layers-offset (/ text-height 2))
  62.  
  63.          (img-width (+ text-layers-offset text-width fade-width))
  64.          (img-height text-height)
  65.  
  66.          ; Additional layers
  67.  
  68.          (bg-layer (car (gimp-layer-new img img-width img-height RGBA-IMAGE
  69.                                         "bg-layer" 100 NORMAL-MODE)))
  70.          (bumpmap-layer (car (gimp-layer-new img
  71.                                              text-width
  72.                                              text-height
  73.                                              RGBA-IMAGE
  74.                                              "bumpmap-layer"
  75.                                              100
  76.                                              NORMAL-MODE)))
  77.          (fore-layer (car (gimp-layer-new img text-width text-height RGBA-IMAGE
  78.                                           "fore-layer" 100 NORMAL-MODE)))
  79.        )
  80.  
  81.     (gimp-context-push)
  82.  
  83.     ; Create image
  84.  
  85.     (gimp-image-undo-disable img)
  86.     (gimp-image-resize img img-width img-height 0 0)
  87.  
  88.     (gimp-image-add-layer img bg-layer -1)
  89.     (gimp-image-add-layer img bumpmap-layer -1)
  90.     (gimp-image-add-layer img fore-layer -1)
  91. ;    (gimp-image-add-layer img text-layer -1)
  92.     (gimp-image-raise-layer img text-layer)
  93.     (gimp-image-raise-layer img text-layer)
  94.     (gimp-image-raise-layer img text-layer)
  95.     (gimp-layer-set-offsets bg-layer 0 0)
  96.     (gimp-layer-set-offsets text-layer text-layers-offset 0)
  97.     (gimp-layer-set-offsets bumpmap-layer text-layers-offset 0)
  98.     (gimp-layer-set-offsets fore-layer text-layers-offset 0)
  99.  
  100.     ; Create bumpmap layer
  101.  
  102.     (gimp-context-set-background '(0 0 0))
  103.     (gimp-edit-fill bumpmap-layer BACKGROUND-FILL)
  104.     (gimp-selection-layer-alpha text-layer)
  105.     (gimp-context-set-background '(255 255 255))
  106.     (gimp-edit-fill bumpmap-layer BACKGROUND-FILL)
  107.     (gimp-selection-none img)
  108.     (plug-in-gauss-rle RUN-NONINTERACTIVE img bumpmap-layer 4.0 TRUE TRUE)
  109.  
  110.     ; Fore layer, bumpmap
  111.  
  112.     (gimp-context-set-background '(255 255 255))
  113.     (gimp-edit-fill fore-layer BACKGROUND-FILL)
  114.     (plug-in-bump-map RUN-NONINTERACTIVE img fore-layer bumpmap-layer 135.0 45.0 4 0 0 0 0 FALSE FALSE 0)
  115.  
  116.     ; Text layer
  117.  
  118.     (gimp-drawable-set-visible text-layer TRUE)
  119.     (gimp-layer-set-lock-alpha text-layer TRUE)
  120.  
  121.     (gimp-edit-blend text-layer CUSTOM-MODE NORMAL-MODE
  122.                      GRADIENT-LINEAR 100 0 REPEAT-NONE gradient-reverse
  123.                      FALSE 0.2 3 TRUE
  124.                      padding padding
  125.                      (- text-width padding 1) (- text-height padding 1))
  126.  
  127.     ; Semicircle at the left
  128.  
  129.     (gimp-context-set-background '(0 0 0))
  130.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  131.  
  132.     (gimp-ellipse-select img 0 0 text-height text-height CHANNEL-OP-REPLACE TRUE FALSE 0)
  133.     (gimp-context-set-background (car (gimp-image-pick-color img text-layer
  134.                                                              text-layers-offset 0
  135.                                                              TRUE FALSE 0)))
  136.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  137.  
  138.     ; Fade-out gradient at the right
  139.  
  140.     (gimp-rect-select img (- img-width fade-width) 0 fade-width text-height
  141.                       CHANNEL-OP-REPLACE FALSE 0)
  142.     (gimp-context-set-foreground (car (gimp-context-get-background)))
  143.     (gimp-context-set-background '(0 0 0))
  144.  
  145.     (gimp-edit-blend bg-layer FG-BG-RGB-MODE NORMAL-MODE
  146.                      GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
  147.                      FALSE 0.2 3 TRUE
  148.                      (- img-width fade-width) 0 (- img-width 1) 0)
  149.  
  150.     (gimp-selection-none img)
  151.  
  152.     ; Done
  153.  
  154. ;    (gimp-image-flatten img)
  155.     (gimp-image-undo-enable img)
  156.     (gimp-display-new img)
  157.  
  158.     (gimp-context-pop)
  159.   )
  160. )
  161.  
  162. (script-fu-register "script-fu-title-header"
  163.   _"Web Title Header..."
  164.   _"Create a decorative web title header"
  165.   "Federico Mena Quintero"
  166.   "Federico Mena Quintero"
  167.   "June 1997"
  168.   ""
  169.   SF-STRING     _"Text"               "Hello world!"
  170.   SF-ADJUSTMENT _"Font size (pixels)" '(32 2 256 1 10 0 0)
  171.   SF-FONT       _"Font"               "Sans"
  172.   SF-TOGGLE     _"Gradient reverse"   FALSE
  173. )
  174.  
  175. (script-fu-menu-register "script-fu-title-header"
  176.                          "<Image>/File/Create/Logos")
  177.