1
; The GIMP -- an image manipulation program
2
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
; Beveled pattern bullet for web pages
5
; Copyright (C) 1997 Federico Mena Quintero
6
; federico@nuclecu.unam.mx
8
; This program is free software; you can redistribute it and/or modify
9
; it under the terms of the GNU General Public License as published by
10
; the Free Software Foundation; either version 2 of the License, or
11
; (at your option) any later version.
13
; This program is distributed in the hope that it will be useful,
14
; but WITHOUT ANY WARRANTY; without even the implied warranty of
15
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
; 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.
23
(define (script-fu-beveled-pattern-bullet diameter pattern transparent)
24
(let* ((img (car (gimp-image-new diameter diameter RGB)))
25
(background (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bullet" 100 NORMAL-MODE)))
26
(bumpmap (car (gimp-layer-new img diameter diameter RGBA-IMAGE "Bumpmap" 100 NORMAL-MODE))))
30
(gimp-image-undo-disable img)
31
(gimp-image-add-layer img background -1)
32
(gimp-image-add-layer img bumpmap -1)
34
; Create pattern layer
36
(gimp-context-set-background '(0 0 0))
37
(gimp-edit-fill background BACKGROUND-FILL)
38
(gimp-context-set-pattern pattern)
39
(gimp-edit-bucket-fill background PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
41
; Create bumpmap layer
43
(gimp-edit-fill bumpmap BACKGROUND-FILL)
45
(gimp-context-set-background '(127 127 127))
46
(gimp-ellipse-select img 1 1 (- diameter 2) (- diameter 2) CHANNEL-OP-REPLACE TRUE FALSE 0)
47
(gimp-edit-fill bumpmap BACKGROUND-FILL)
49
(gimp-context-set-background '(255 255 255))
50
(gimp-ellipse-select img 2 2 (- diameter 4) (- diameter 4) CHANNEL-OP-REPLACE TRUE FALSE 0)
51
(gimp-edit-fill bumpmap BACKGROUND-FILL)
53
(gimp-selection-none img)
57
(plug-in-bump-map 1 img background bumpmap 135 45 2 0 0 0 0 TRUE FALSE 0)
61
(gimp-context-set-background '(0 0 0))
62
(gimp-ellipse-select img 0 0 diameter diameter CHANNEL-OP-REPLACE TRUE FALSE 0)
63
(gimp-selection-invert img)
64
(gimp-edit-clear background)
65
(gimp-selection-none img)
67
(gimp-image-set-active-layer img background)
68
(gimp-image-remove-layer img bumpmap)
70
(if (= transparent FALSE)
71
(gimp-image-flatten img))
73
(gimp-image-undo-enable img)
74
(gimp-display-new img)
79
(script-fu-register "script-fu-beveled-pattern-bullet"
81
"Beveled pattern bullet"
82
"Federico Mena Quintero"
83
"Federico Mena Quintero"
86
SF-ADJUSTMENT _"Diameter" '(16 1 150 1 10 0 1)
87
SF-PATTERN _"Pattern" "Wood"
88
SF-TOGGLE _"Transparent background" FALSE)
90
(script-fu-menu-register "script-fu-beveled-pattern-bullet"
91
_"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Beveled Pattern")