home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / Topware / gimp / gimp-setup-20001226.exe / Main / beveled-pattern-bullet.scm < prev    next >
Encoding:
Text File  |  2000-12-27  |  3.1 KB  |  86 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; Beveled pattern bullet 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.  
  19. (define (script-fu-beveled-pattern-bullet diameter pattern transparent)
  20.   (let* ((old-bg-color (car (gimp-palette-get-background)))
  21.      (img (car (gimp-image-new diameter diameter RGB)))
  22.      (background (car (gimp-layer-new img diameter diameter RGBA_IMAGE "Bullet" 100 NORMAL)))
  23.      (bumpmap (car (gimp-layer-new img diameter diameter RGBA_IMAGE "Bumpmap" 100 NORMAL))))
  24.     (gimp-image-undo-disable img)
  25.     (gimp-image-add-layer img background -1)
  26.     (gimp-image-add-layer img bumpmap -1)
  27.  
  28.     ; Create pattern layer
  29.  
  30.     (gimp-palette-set-background '(0 0 0))
  31.     (gimp-edit-fill background BG-IMAGE-FILL)
  32.     (gimp-patterns-set-pattern pattern)
  33.     (gimp-bucket-fill background PATTERN-BUCKET-FILL NORMAL 100 0 FALSE 0 0)
  34.  
  35.     ; Create bumpmap layer
  36.  
  37.     (gimp-edit-fill bumpmap BG-IMAGE-FILL)
  38.  
  39.     (gimp-palette-set-background '(127 127 127))
  40.     (gimp-ellipse-select img 1 1 (- diameter 2) (- diameter 2) REPLACE TRUE FALSE 0)
  41.     (gimp-edit-fill bumpmap BG-IMAGE-FILL)
  42.  
  43.     (gimp-palette-set-background '(255 255 255))
  44.     (gimp-ellipse-select img 2 2 (- diameter 4) (- diameter 4) REPLACE TRUE FALSE 0)
  45.     (gimp-edit-fill bumpmap BG-IMAGE-FILL)
  46.  
  47.     (gimp-selection-none img)
  48.  
  49.     ; Bumpmap
  50.  
  51.     (plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
  52.  
  53.     ; Background
  54.  
  55.     (gimp-palette-set-background '(0 0 0))
  56.     (gimp-ellipse-select img 0 0 diameter diameter REPLACE TRUE FALSE 0)
  57.     (gimp-selection-invert img)
  58.     (gimp-edit-clear background)
  59.     (gimp-selection-none img)
  60.  
  61.     (gimp-image-set-active-layer img background)
  62.     (gimp-image-remove-layer img bumpmap)
  63.  
  64.     (if (= transparent FALSE)
  65.     (gimp-image-flatten img))
  66.  
  67.     (gimp-palette-set-background old-bg-color)
  68.     (gimp-image-undo-enable img)
  69.     (gimp-display-new img)))
  70.  
  71.  
  72. (script-fu-register "script-fu-beveled-pattern-bullet"
  73.             _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern/Bullet..."
  74.             "Beveled pattern bullet"
  75.             "Federico Mena Quintero"
  76.             "Federico Mena Quintero"
  77.             "July 1997"
  78.             ""
  79.             SF-ADJUSTMENT _"Diameter"               '(16 1 150 1 10 0 1)
  80.             SF-PATTERN    _"Pattern"                "Wood"
  81.             SF-TOGGLE     _"Transparent Background" FALSE)
  82.