1
; The GIMP -- an image manipulation program
1
; GIMP - The GNU Image Manipulation Program
2
2
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
4
; Button00 --- create a simple beveled Web button
5
5
; Copyright (C) 1997 Federico Mena Quintero
6
6
; federico@nuclecu.unam.mx
8
8
; This program is free software; you can redistribute it and/or modify
9
9
; it under the terms of the GNU General Public License as published by
10
10
; the Free Software Foundation; either version 2 of the License, or
11
11
; (at your option) any later version.
13
13
; This program is distributed in the hope that it will be useful,
14
14
; but WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
16
; GNU General Public License for more details.
18
18
; You should have received a copy of the GNU General Public License
19
19
; along with this program; if not, write to the Free Software
20
20
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
39
39
(cadr (cddr extents)))
41
41
(define (blend-bumpmap img
47
47
(gimp-edit-blend drawable FG-BG-RGB-MODE DARKEN-ONLY-MODE
48
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
48
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
52
52
(define (script-fu-button00 text
61
(let* ((text-extents (gimp-text-get-extents-fontname text
65
(ascent (text-ascent text-extents))
66
(descent (text-descent text-extents))
68
(img-width (+ (* 2 (+ padding bevel-width))
69
(text-width text-extents)))
70
(img-height (+ (* 2 (+ padding bevel-width))
73
(img (car (gimp-image-new img-width img-height RGB)))
75
(bumpmap (car (gimp-layer-new img
76
img-width img-height RGBA-IMAGE
77
"Bumpmap" 100 NORMAL-MODE)))
78
(gradient (car (gimp-layer-new img
79
img-width img-height RGBA-IMAGE
80
"Gradient" 100 NORMAL-MODE))))
62
(text-extents (gimp-text-get-extents-fontname text
66
(ascent (text-ascent text-extents))
67
(descent (text-descent text-extents))
69
(img-width (+ (* 2 (+ padding bevel-width))
70
(text-width text-extents)))
71
(img-height (+ (* 2 (+ padding bevel-width))
74
(img (car (gimp-image-new img-width img-height RGB)))
76
(bumpmap (car (gimp-layer-new img
77
img-width img-height RGBA-IMAGE
78
"Bumpmap" 100 NORMAL-MODE)))
79
(gradient (car (gimp-layer-new img
80
img-width img-height RGBA-IMAGE
81
"Gradient" 100 NORMAL-MODE)))
82
84
(gimp-context-push)
84
86
(gimp-image-undo-disable img)
86
88
; Create bumpmap layer
88
90
(gimp-image-add-layer img bumpmap -1)
89
91
(gimp-context-set-foreground '(0 0 0))
90
92
(gimp-context-set-background '(255 255 255))
111
113
(gimp-context-set-background lr-color)
113
115
(gimp-edit-blend gradient FG-BG-RGB-MODE NORMAL-MODE
114
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
116
0 0 (- img-width 1) (- img-height 1))
116
GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
118
0 0 (- img-width 1) (- img-height 1))
118
120
(plug-in-bump-map 1 img gradient bumpmap
119
135 45 bevel-width 0 0 0 0 TRUE pressed 0)
121
135 45 bevel-width 0 0 0 0 TRUE pressed 0)
121
123
; Create text layer
123
125
(gimp-context-set-foreground text-color)
124
126
(let ((textl (car (gimp-text-fontname
125
img -1 0 0 text 0 TRUE size PIXELS font))))
127
img -1 0 0 text 0 TRUE size PIXELS font))))
126
128
(gimp-layer-set-offsets textl
127
(+ bevel-width padding)
128
(+ bevel-width padding descent)))
129
(+ bevel-width padding)
130
(+ bevel-width padding descent)))
133
135
(gimp-image-undo-enable img)
134
136
(gimp-display-new img)
138
142
(script-fu-register "script-fu-button00"
139
_"Simple _Beveled Button..."
140
"Simple beveled button"
141
"Federico Mena Quintero"
142
"Federico Mena Quintero"
145
SF-STRING _"Text" "Hello world!"
146
SF-ADJUSTMENT _"Font size (pixels)" '(16 2 100 1 1 0 1)
147
SF-FONT _"Font" "Sans"
148
SF-COLOR _"Upper-left color" '(0 255 127)
149
SF-COLOR _"Lower-right color" '(0 127 255)
150
SF-COLOR _"Text color" '(0 0 0)
151
SF-ADJUSTMENT _"Padding" '(2 1 100 1 10 0 1)
152
SF-ADJUSTMENT _"Bevel width" '(4 1 100 1 10 0 1)
153
SF-TOGGLE _"Pressed" FALSE)
143
_"Simple _Beveled Button..."
144
_"Create a simple, beveled button graphic for webpages"
145
"Federico Mena Quintero"
146
"Federico Mena Quintero"
149
SF-STRING _"Text" "Hello world!"
150
SF-ADJUSTMENT _"Font size (pixels)" '(16 2 100 1 1 0 1)
151
SF-FONT _"Font" "Sans"
152
SF-COLOR _"Upper-left color" '(0 255 127)
153
SF-COLOR _"Lower-right color" '(0 127 255)
154
SF-COLOR _"Text color" "black"
155
SF-ADJUSTMENT _"Padding" '(2 1 100 1 10 0 1)
156
SF-ADJUSTMENT _"Bevel width" '(4 1 100 1 10 0 1)
157
SF-TOGGLE _"Pressed" FALSE
155
160
(script-fu-menu-register "script-fu-button00"
156
_"<Toolbox>/Xtns/Script-Fu/Buttons")
161
"<Toolbox>/Xtns/Buttons")