home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / gimp-headers.scm.z / gimp-headers.scm
Encoding:
GIMP Script-Fu Script  |  1999-07-21  |  6.0 KB  |  169 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. (define (script-fu-headers-gimp-org text font weight slant width font-size text-color high-color side-color shadow-color crop rm-bg index num-colors)
  31.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  32.      (text-layer (car (gimp-text img -1 0 0
  33.                      text 30 TRUE font-size PIXELS
  34.                      "*" font weight slant width "*")))
  35.      (width (car (gimp-drawable-width text-layer)))
  36.      (height (car (gimp-drawable-height text-layer)))
  37.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  38.      (old-fg (car (gimp-palette-get-foreground)))
  39.      (old-bg (car (gimp-palette-get-background))))
  40.     
  41.     (gimp-image-disable-undo img)
  42.     (gimp-image-resize img width height 0 0)
  43.     (gimp-image-add-layer img bg-layer 1)
  44.     (gimp-layer-set-preserve-trans text-layer TRUE)
  45.     (gimp-palette-set-background text-color)
  46.     (gimp-edit-fill img text-layer)
  47.  
  48.     (gimp-palette-set-background '(255 255 255))
  49.     (gimp-edit-fill img bg-layer)
  50.  
  51.     (let* ((highlight-layer (car (gimp-layer-copy text-layer TRUE)))
  52.        (side-layer (car (gimp-layer-copy text-layer TRUE)))
  53.        (shadow-layer (car (gimp-layer-copy text-layer TRUE))))
  54.  
  55.       (gimp-image-add-layer img highlight-layer 1)
  56.       (gimp-layer-set-preserve-trans highlight-layer TRUE)
  57.       
  58.       (gimp-image-add-layer img side-layer 1)
  59.       (gimp-layer-set-preserve-trans side-layer TRUE)
  60.       
  61.       (gimp-image-add-layer img shadow-layer 1)
  62.       (gimp-layer-set-preserve-trans shadow-layer TRUE)
  63.       
  64.       (gimp-palette-set-background high-color)
  65.       (gimp-edit-fill img highlight-layer)
  66.       (gimp-layer-translate highlight-layer -1 -1)
  67.       
  68.       (gimp-palette-set-background side-color)
  69.       (gimp-edit-fill img side-layer)
  70.       (gimp-layer-translate side-layer 1 1)
  71.  
  72.       (gimp-palette-set-background shadow-color)
  73.       (gimp-edit-fill img shadow-layer)
  74.       (gimp-layer-translate shadow-layer 5 5)
  75.       
  76.       (gimp-layer-set-preserve-trans shadow-layer FALSE)
  77.       (plug-in-gauss-rle 1 img shadow-layer 5 TRUE TRUE)
  78.       (gimp-layer-set-opacity shadow-layer 60)
  79.       (gimp-image-lower-layer img shadow-layer)
  80.       (gimp-image-lower-layer img shadow-layer))
  81.   
  82.  
  83.     (set! text-layer (car (gimp-image-flatten img)))
  84.     (gimp-layer-add-alpha text-layer)       
  85.       
  86.  
  87.     (if (= rm-bg TRUE)
  88.     (begin   
  89.       (gimp-by-color-select img text-layer '(255 255 255)
  90.                 1 REPLACE TRUE FALSE 0 FALSE)
  91.       (gimp-edit-clear img text-layer)
  92.       (gimp-selection-clear img)))
  93.         
  94.     (if (= crop TRUE)
  95.      (plug-in-autocrop 1 img text-layer))
  96.  
  97.     (if (= index TRUE)
  98.     (gimp-convert-indexed img TRUE num-colors))
  99.     
  100.  
  101.     (gimp-palette-set-foreground old-fg)
  102.     (gimp-palette-set-background old-bg)
  103.     (gimp-image-enable-undo img)
  104.     (gimp-display-new img)
  105.     
  106.     ))
  107.  
  108.  
  109. (define (script-fu-big-header-gimp-org text font font-size text-color
  110.                     high-color side-color shadow-color
  111.                     crop rm-bg index num-colors)
  112.   (script-fu-headers-gimp-org (string-append " " text)
  113.                   font "bold" "i" "normal" font-size
  114.                   text-color high-color side-color shadow-color
  115.                   crop rm-bg index num-colors))  
  116.  
  117.  
  118. (define (script-fu-small-header-gimp-org text font font-size text-color
  119.                     high-color side-color shadow-color
  120.                     crop rm-bg index num-colors)
  121.   (script-fu-headers-gimp-org text font "medium" "r" "normal"
  122.                   font-size text-color high-color
  123.                   side-color shadow-color
  124.                   crop rm-bg index num-colors))  
  125.  
  126.  
  127. (script-fu-register "script-fu-big-header-gimp-org"
  128.             "<Toolbox>/Xtns/Script-Fu/Web page themes/Gimp.Org/Big Header"
  129.             "Big Gimp.org Header"
  130.             "Adrian Likins & Jens Lautenbacher"
  131.             "Adrian Likins & Jens Lautenbacher"
  132.             "1997"
  133.             ""
  134.             SF-VALUE "Text String" "\"gimp.org\""
  135.             SF-VALUE "Font" "\"times\""
  136.             SF-VALUE "Font size" "50"
  137.             SF-COLOR "Text Color" '(82 108 159)
  138.             SF-COLOR "Higlight Color" '(190 220 250)
  139.             SF-COLOR "Dark Color" '(46 74 92)
  140.             SF-COLOR "Shadow Color" '(0 0 0)
  141.             SF-TOGGLE "AutoCrop?" TRUE
  142.             SF-TOGGLE "Remove Background" TRUE
  143.             SF-TOGGLE "Index image?" TRUE
  144.             SF-VALUE "# of colors" "15")
  145.  
  146. (script-fu-register "script-fu-small-header-gimp-org"
  147.             "<Toolbox>/Xtns/Script-Fu/Web page themes/Gimp.Org/Small Header"
  148.             "Small Gimp.org Header"
  149.             "Adrian Likins & Jens Lautenbacher"
  150.             "Adrian Likins & Jens Lautenbacher"
  151.             "1997"
  152.             ""
  153.             SF-VALUE "Text String" "\"gimp.org\""
  154.             SF-VALUE "Font" "\"helvetica\""
  155.             SF-VALUE "Font size" "24"
  156.             SF-COLOR "Text Color" '(135 220 220)
  157.             SF-COLOR "Higlight Color" '(210 240 245)
  158.             SF-COLOR "Dark Color" '(46 74 92)
  159.             SF-COLOR "Shadow Color" '(0 0 0)
  160.             SF-TOGGLE "AutoCrop?" TRUE
  161.             SF-TOGGLE "Remove Background" TRUE
  162.             SF-TOGGLE "Index image?" TRUE
  163.             SF-VALUE "# of colors" "15"
  164.             SF-VALUE "select-by-color threshold" "1")
  165.  
  166.