22
22
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
(define (script-fu-make-brush-rectangular name width height spacing )
26
(let* ((img (car (gimp-image-new width height GRAY)))
27
(drawable (car (gimp-layer-new img
28
width height GRAY-IMAGE
29
"MakeBrush" 100 NORMAL-MODE)))
31
(filename (string-append gimp-directory
33
(number->string width)
35
(number->string height)
25
(define (script-fu-make-brush-rectangular name width height spacing)
27
(img (car (gimp-image-new width height GRAY)))
28
(drawable (car (gimp-layer-new img
29
width height GRAY-IMAGE
30
"MakeBrush" 100 NORMAL-MODE)))
31
(filename (string-append gimp-directory
33
(number->string width)
35
(number->string height)
38
39
(gimp-context-push)
56
57
(gimp-brushes-refresh)
57
(gimp-context-set-brush name)))
58
(gimp-context-set-brush name)
59
62
(script-fu-register "script-fu-make-brush-rectangular"
61
"Create size of brush"
62
"Seth Burgess <sjburges@ou.edu>"
66
SF-STRING _"Name" "Rectangle"
67
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
68
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
69
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
64
_"Create a rectangular brush"
65
"Seth Burgess <sjburges@ou.edu>"
69
SF-STRING _"Name" "Rectangle"
70
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
71
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
72
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
71
75
(script-fu-menu-register "script-fu-make-brush-rectangular"
72
_"<Toolbox>/Xtns/Script-Fu/Make Brush")
75
79
(define (script-fu-make-brush-rectangular-feathered name width height
77
(let* ((widthplus (+ width feathering))
78
(heightplus (+ height feathering))
79
(img (car (gimp-image-new widthplus heightplus GRAY)))
80
(drawable (car (gimp-layer-new img
81
widthplus heightplus GRAY-IMAGE
82
"MakeBrush" 100 NORMAL-MODE)))
84
(filename (string-append gimp-directory
86
(number->string width)
88
(number->string height)
90
(number->string feathering)
82
(widthplus (+ width feathering))
83
(heightplus (+ height feathering))
84
(img (car (gimp-image-new widthplus heightplus GRAY)))
85
(drawable (car (gimp-layer-new img
86
widthplus heightplus GRAY-IMAGE
87
"MakeBrush" 100 NORMAL-MODE)))
88
(filename (string-append gimp-directory
90
(number->string width)
92
(number->string height)
94
(number->string feathering)
93
98
(gimp-context-push)
99
104
(gimp-drawable-fill drawable BACKGROUND-FILL)
101
106
(cond ((< 0 feathering)
102
(gimp-rect-select img
103
(/ feathering 2) (/ feathering 2)
104
width height CHANNEL-OP-REPLACE TRUE feathering))
106
(gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0)))
107
(gimp-rect-select img
108
(/ feathering 2) (/ feathering 2)
109
width height CHANNEL-OP-REPLACE TRUE feathering))
111
(gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0)))
108
113
(gimp-context-set-background '(0 0 0))
109
114
(gimp-edit-fill drawable BACKGROUND-FILL)
114
119
(gimp-context-pop)
116
121
(gimp-brushes-refresh)
117
(gimp-context-set-brush name)))
122
(gimp-context-set-brush name)
119
126
(script-fu-register "script-fu-make-brush-rectangular-feathered"
120
_"Re_ctangular, Feathered..."
121
"Create size of brush"
122
"Seth Burgess <sjburges@ou.edu>"
126
SF-STRING _"Name" "Rectangle"
127
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
128
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
129
SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1)
130
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
127
_"Re_ctangular, Feathered..."
128
_"Create a rectangular brush with feathered edges"
129
"Seth Burgess <sjburges@ou.edu>"
133
SF-STRING _"Name" "Rectangle"
134
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
135
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
136
SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1)
137
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
132
140
(script-fu-menu-register "script-fu-make-brush-rectangular-feathered"
133
_"<Toolbox>/Xtns/Script-Fu/Make Brush")
136
144
(define (script-fu-make-brush-elliptical name width height spacing)
137
(let* ((img (car (gimp-image-new width height GRAY)))
138
(drawable (car (gimp-layer-new img
139
width height GRAY-IMAGE
140
"MakeBrush" 100 NORMAL-MODE)))
142
(filename (string-append gimp-directory
144
(number->string width)
146
(number->string height)
146
(img (car (gimp-image-new width height GRAY)))
147
(drawable (car (gimp-layer-new img
148
width height GRAY-IMAGE
149
"MakeBrush" 100 NORMAL-MODE)))
150
(filename (string-append gimp-directory
152
(number->string width)
154
(number->string height)
149
158
(gimp-context-push)
155
164
(gimp-drawable-fill drawable BACKGROUND-FILL)
156
165
(gimp-context-set-background '(0 0 0))
157
166
(gimp-ellipse-select img 0 0 width height CHANNEL-OP-REPLACE TRUE FALSE 0)
159
168
(gimp-edit-fill drawable BACKGROUND-FILL)
161
170
(file-gbr-save 1 img drawable filename "" spacing name)
164
173
(gimp-context-pop)
166
175
(gimp-brushes-refresh)
167
(gimp-context-set-brush name)))
176
(gimp-context-set-brush name)
169
180
(script-fu-register "script-fu-make-brush-elliptical"
171
"Create size of brush"
172
"Seth Burgess <sjburges@ou.edu>"
176
SF-STRING _"Name" "Ellipse"
177
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
178
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
179
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
182
_"Create an elliptical brush"
183
"Seth Burgess <sjburges@ou.edu>"
187
SF-STRING _"Name" "Ellipse"
188
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
189
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
190
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
181
193
(script-fu-menu-register "script-fu-make-brush-elliptical"
182
_"<Toolbox>/Xtns/Script-Fu/Make Brush")
185
(define (script-fu-make-brush-elliptical-feathered name width height
187
(let* ((widthplus (+ feathering width)) ; add 3 for blurring
188
(heightplus (+ feathering height))
189
(img (car (gimp-image-new widthplus heightplus GRAY)))
190
(drawable (car (gimp-layer-new img
191
widthplus heightplus GRAY-IMAGE
192
"MakeBrush" 100 NORMAL-MODE)))
194
(filename (string-append gimp-directory
196
(number->string width)
198
(number->string height)
200
(number->string feathering)
197
(define (script-fu-make-brush-elliptical-feathered name
201
(widthplus (+ feathering width)) ; add 3 for blurring
202
(heightplus (+ feathering height))
203
(img (car (gimp-image-new widthplus heightplus GRAY)))
204
(drawable (car (gimp-layer-new img
205
widthplus heightplus GRAY-IMAGE
206
"MakeBrush" 100 NORMAL-MODE)))
207
(filename (string-append gimp-directory
209
(number->string width)
211
(number->string height)
213
(number->string feathering)
203
217
(gimp-context-push)
208
222
(gimp-context-set-background '(255 255 255))
209
223
(gimp-drawable-fill drawable BACKGROUND-FILL)
211
(cond ((> feathering 0) ; keep from taking out gimp with stupid entry.
225
(cond ((> feathering 0) ; keep from taking out gimp with stupid entry.
212
226
(gimp-ellipse-select img
213
(/ feathering 2) (/ feathering 2)
214
width height CHANNEL-OP-REPLACE
215
TRUE TRUE feathering))
227
(/ feathering 2) (/ feathering 2)
228
width height CHANNEL-OP-REPLACE
229
TRUE TRUE feathering))
216
230
((<= feathering 0)
217
231
(gimp-ellipse-select img 0 0 width height
218
CHANNEL-OP-REPLACE TRUE FALSE 0)))
232
CHANNEL-OP-REPLACE TRUE FALSE 0)))
220
234
(gimp-context-set-background '(0 0 0))
221
235
(gimp-edit-fill drawable BACKGROUND-FILL)
224
238
(gimp-image-delete img)
226
240
(gimp-context-pop)
228
242
(gimp-brushes-refresh)
229
(gimp-context-set-brush name)))
243
(gimp-context-set-brush name)
231
247
(script-fu-register "script-fu-make-brush-elliptical-feathered"
232
_"Elli_ptical, Feathered..."
233
"Makes a feathered elliptical brush of specified size"
234
"Seth Burgess <sjburges@ou.edu>"
238
SF-STRING _"Name" "Ellipse"
239
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
240
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
241
SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1)
242
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0))
248
_"Elli_ptical, Feathered..."
249
_"Create an elliptical brush with feathered edges"
250
"Seth Burgess <sjburges@ou.edu>"
254
SF-STRING _"Name" "Ellipse"
255
SF-ADJUSTMENT _"Width" '(20 1 200 1 10 0 1)
256
SF-ADJUSTMENT _"Height" '(20 1 200 1 10 0 1)
257
SF-ADJUSTMENT _"Feathering" '(4 1 100 1 10 0 1)
258
SF-ADJUSTMENT _"Spacing" '(25 1 100 1 10 1 0)
244
261
(script-fu-menu-register "script-fu-make-brush-elliptical-feathered"
245
_"<Toolbox>/Xtns/Script-Fu/Make Brush")