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

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; www.gimp.org web headers
  4. ; Copyright (c) 1997 Adrian Likins
  5. ; aklikins@eos.ncsu.edu
  6. ;
  7. ; based on a idea by jtl (Jens  Lautenbacher)
  8. ; and improved by jtl
  9. ;
  10. ; This program is free software; you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation; either version 2 of the License, or
  13. ; (at your option) any later version.
  14. ; This program is distributed in the hope that it will be useful,
  15. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ; GNU General Public License for more details.
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program; if not, write to the Free Software
  20. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. ;
  22. ;  **NOTE**  This fonts use some very common fonts, that are typically
  23. ;  bitmap fonts on most installations. If you want better quality versions
  24. ;  you need to grab the urw font package form www.gimp.org/fonts.html
  25. ;  and install as indicated. This will replace the some current bitmap fonts
  26. ;  with higher quality vector fonts. This is how the actual www.gimp.org
  27. ;  logos were created.
  28. ;
  29. ; ************************************************************************
  30. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  31. ; For use with GIMP 1.1.
  32. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  33. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  34. ; ************************************************************************
  35.  
  36. (define (script-fu-headers-gimp-org text font font-size text-color high-color side-color shadow-color crop rm-bg index num-colors)
  37.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  38.      (text-layer (car (gimp-text-fontname img -1 0 0
  39.                      text 30 TRUE font-size PIXELS
  40.                      font)))
  41.      (width (car (gimp-drawable-width text-layer)))
  42.      (height (car (gimp-drawable-height text-layer)))
  43.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  44.      (old-fg (car (gimp-palette-get-foreground)))
  45.      (old-bg (car (gimp-palette-get-background))))
  46.     
  47.     (gimp-image-undo-disable img)
  48.     (gimp-image-resize img width height 0 0)
  49.     (gimp-image-add-layer img bg-layer 1)
  50.     (gimp-layer-set-preserve-trans text-layer TRUE)
  51.     (gimp-palette-set-background text-color)
  52.     (gimp-edit-fill text-layer BG-IMAGE-FILL)
  53.  
  54.     (gimp-palette-set-background '(255 255 255))
  55.     (gimp-edit-fill bg-layer BG-IMAGE-FILL)
  56.  
  57.     (let* ((highlight-layer (car (gimp-layer-copy text-layer TRUE)))
  58.        (side-layer (car (gimp-layer-copy text-layer TRUE)))
  59.        (shadow-layer (car (gimp-layer-copy text-layer TRUE))))
  60.  
  61.       (gimp-image-add-layer img highlight-layer 1)
  62.       (gimp-layer-set-preserve-trans highlight-layer TRUE)
  63.       
  64.       (gimp-image-add-layer img side-layer 1)
  65.       (gimp-layer-set-preserve-trans side-layer TRUE)
  66.       
  67.       (gimp-image-add-layer img shadow-layer 1)
  68.       (gimp-layer-set-preserve-trans shadow-layer TRUE)
  69.       
  70.       (gimp-palette-set-background high-color)
  71.       (gimp-edit-fill highlight-layer BG-IMAGE-FILL)
  72.       (gimp-layer-translate highlight-layer -1 -1)
  73.       
  74.       (gimp-palette-set-background side-color)
  75.       (gimp-edit-fill side-layer BG-IMAGE-FILL)
  76.       (gimp-layer-translate side-layer 1 1)
  77.  
  78.       (gimp-palette-set-background shadow-color)
  79.       (gimp-edit-fill shadow-layer BG-IMAGE-FILL)
  80.       (gimp-layer-translate shadow-layer 5 5)
  81.       
  82.       (gimp-layer-set-preserve-trans shadow-layer FALSE)
  83.       (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
  84.       (gimp-layer-set-opacity shadow-layer 60)
  85.       (gimp-image-lower-layer img shadow-layer)
  86.       (gimp-image-lower-layer img shadow-layer))
  87.   
  88.  
  89.     (set! text-layer (car (gimp-image-flatten img)))
  90.     (gimp-layer-add-alpha text-layer)
  91.       
  92.  
  93.     (if (= rm-bg TRUE)
  94.     (begin
  95.       (gimp-by-color-select text-layer '(255 255 255)
  96.                 1 REPLACE TRUE FALSE 0 FALSE)
  97.       (gimp-edit-clear text-layer)
  98.       (gimp-selection-clear img)))
  99.         
  100.     (if (= crop TRUE)
  101.      (plug-in-autocrop 1 img text-layer))
  102.  
  103.     (if (= index TRUE)
  104.     (gimp-convert-indexed img FS-DITHER MAKE-PALETTE num-colors FALSE FALSE ""))
  105.     
  106.  
  107.     (gimp-palette-set-foreground old-fg)
  108.     (gimp-palette-set-background old-bg)
  109.     (gimp-image-undo-enable img)
  110.     (gimp-display-new img)
  111.     
  112.     ))
  113.  
  114.  
  115. (define (script-fu-big-header-gimp-org text font font-size text-color
  116.                     high-color side-color shadow-color
  117.                     crop rm-bg index num-colors)
  118.   (script-fu-headers-gimp-org (string-append " " text)
  119.                   font font-size
  120.                   text-color high-color side-color shadow-color
  121.                   crop rm-bg index num-colors))
  122.  
  123.  
  124. (define (script-fu-small-header-gimp-org text font font-size text-color
  125.                     high-color side-color shadow-color
  126.                     crop rm-bg index num-colors)
  127.   (script-fu-headers-gimp-org text font
  128.                   font-size text-color high-color
  129.                   side-color shadow-color
  130.                   crop rm-bg index num-colors))
  131.  
  132.  
  133. (script-fu-register "script-fu-big-header-gimp-org"
  134.             _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Gimp.Org/Big Header..."
  135.             "Big Gimp.org Header"
  136.             "Adrian Likins & Jens Lautenbacher"
  137.             "Adrian Likins & Jens Lautenbacher"
  138.             "1997"
  139.             ""
  140.             SF-STRING _"Text" "gimp.org"
  141.             SF-FONT   _"Font" "-*-times-*-r-*-*-24-*-*-*-p-*-*-*"
  142.             SF-ADJUSTMENT _"Font Size (pixels)" '(50 2 1000 1 10 0 1)
  143.             SF-COLOR  _"Text Color" '(82 108 159)
  144.             SF-COLOR  _"Highlight Color" '(190 220 250)
  145.             SF-COLOR  _"Dark Color" '(46 74 92)
  146.             SF-COLOR  _"Shadow Color" '(0 0 0)
  147.             SF-TOGGLE _"AutoCrop" TRUE
  148.             SF-TOGGLE _"Remove Background" TRUE
  149.             SF-TOGGLE _"Index Image" TRUE
  150.             SF-ADJUSTMENT _"Number of Colors" '(15 2 255 1 10 0 1))
  151.  
  152. (script-fu-register "script-fu-small-header-gimp-org"
  153.             _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Gimp.Org/Small Header..."
  154.             "Small Gimp.org Header"
  155.             "Adrian Likins & Jens Lautenbacher"
  156.             "Adrian Likins & Jens Lautenbacher"
  157.             "1997"
  158.             ""
  159.             SF-STRING _"Text" "gimp.org"
  160.             SF-FONT   _"Font" "-*-helvetica-*-r-*-*-24-*-*-*-p-*-*-*"
  161.             SF-ADJUSTMENT _"Font Size (pixels)" '(24 2 1000 1 10 0 1)
  162.             SF-COLOR  _"Text Color" '(135 220 220)
  163.             SF-COLOR  _"Highlight Color" '(210 240 245)
  164.             SF-COLOR  _"Dark Color" '(46 74 92)
  165.             SF-COLOR  _"Shadow Color" '(0 0 0)
  166.             SF-TOGGLE _"AutoCrop" TRUE
  167.             SF-TOGGLE _"Remove Background" TRUE
  168.             SF-TOGGLE _"Index Image" TRUE
  169.             SF-ADJUSTMENT _"Number of Colors" '(15 2 255 1 10 0 1)
  170.             SF-ADJUSTMENT _"Select-By-Color Threshold" '(1 1 256 1 10 0 1))
  171.  
  172.