home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 February / PCWorld_2001-02_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / beveled-pattern-heading.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2000-12-27  |  3.8 KB  |  108 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; Beveled pattern heading for web pages
  4. ; Copyright (C) 1997 Federico Mena Quintero
  5. ; federico@nuclecu.unam.mx
  6. ; This program is free software; you can redistribute it and/or modify
  7. ; it under the terms of the GNU General Public License as published by
  8. ; the Free Software Foundation; either version 2 of the License, or
  9. ; (at your option) any later version.
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. ; GNU General Public License for more details.
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program; if not, write to the Free Software
  16. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ; ************************************************************************
  18. ; Changed on Feb 4, 1999 by Piet van Oostrum <piet@cs.uu.nl>
  19. ; For use with GIMP 1.1.
  20. ; All calls to gimp-text-* have been converted to use the *-fontname form.
  21. ; The corresponding parameters have been replaced by an SF-FONT parameter.
  22. ; ************************************************************************
  23.  
  24.  
  25. (define (script-fu-beveled-pattern-heading
  26.      text text-size font pattern transparent)
  27.   (let* ((old-bg-color (car (gimp-palette-get-background)))
  28.  
  29.      (img (car (gimp-image-new 10 10 RGB)))
  30.      (textl
  31.       (car
  32.        (gimp-text-fontname img -1 0 0 text 0 TRUE text-size PIXELS font)))
  33.  
  34.      (width (car (gimp-drawable-width textl)))
  35.      (height (car (gimp-drawable-height textl)))
  36.  
  37.      (background (car (gimp-layer-new img width height RGBA_IMAGE "Background" 100 NORMAL)))
  38.      (bumpmap (car (gimp-layer-new img width height RGBA_IMAGE "Bumpmap" 100 NORMAL))))
  39.  
  40.     (gimp-image-undo-disable img)
  41.     (gimp-image-resize img width height 0 0)
  42.     (gimp-image-add-layer img background 1)
  43.     (gimp-image-add-layer img bumpmap 1)
  44.  
  45.     ; Create pattern layer
  46.  
  47.     (gimp-palette-set-background '(0 0 0))
  48.     (gimp-edit-fill background BG-IMAGE-FILL)
  49.     (gimp-patterns-set-pattern pattern)
  50.     (gimp-bucket-fill background PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  51.  
  52.     ; Create bumpmap layer
  53.  
  54.     (gimp-edit-fill bumpmap BG-IMAGE-FILL)
  55.  
  56.     (gimp-palette-set-background '(127 127 127))
  57.     (gimp-selection-layer-alpha textl)
  58.     (gimp-selection-shrink img 1)
  59.     (gimp-edit-fill bumpmap BG-IMAGE-FILL)
  60.  
  61.     (gimp-palette-set-background '(255 255 255))
  62.     (gimp-selection-layer-alpha textl)
  63.     (gimp-selection-shrink img 2)
  64.     (gimp-edit-fill bumpmap BG-IMAGE-FILL)
  65.  
  66.     (gimp-selection-none img)
  67.  
  68.     ; Bumpmap
  69.  
  70.     (plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  71.  
  72.     ; Clean up
  73.  
  74.     (gimp-palette-set-background '(0 0 0))
  75.     (gimp-selection-layer-alpha textl)
  76.     (gimp-selection-invert img)
  77.     (gimp-edit-clear background)
  78.     (gimp-selection-none img)
  79.  
  80.     (gimp-image-set-active-layer img background)
  81.     (gimp-image-remove-layer img bumpmap)
  82.     (gimp-image-remove-layer img textl)
  83.  
  84.     (if (= transparent FALSE)
  85.     (gimp-image-flatten img))
  86.  
  87.     (gimp-palette-set-background old-bg-color)
  88.     (gimp-image-undo-enable img)
  89.     (gimp-display-new img)))
  90.  
  91.  
  92. (script-fu-register "script-fu-beveled-pattern-heading"
  93.             _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern/Heading..."
  94.             "Beveled pattern heading"
  95.             "Federico Mena Quintero"
  96.             "Federico Mena Quintero"
  97.             "July 1997"
  98.             ""
  99.             SF-STRING     _"Text"               "Hello world!"
  100.             SF-ADJUSTMENT _"Font Size (pixels)" '(72 2 200 1 1 0 1)
  101.             SF-FONT       _"Font" "-*-helvetica-*-r-*-*-72-*-*-*-p-*-*-*"
  102.             SF-PATTERN    _"Pattern"            "Wood"
  103.             SF-TOGGLE     _"Transparent Background" FALSE)
  104.