~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/mkbrush.scm

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
; The GIMP -- an image manipulation program
 
1
; GIMP - The GNU Image Manipulation Program
2
2
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
;
4
4
; Make-Brush - a script for the script-fu program
22
22
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
23
 
24
24
 
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)))
30
 
 
31
 
         (filename (string-append gimp-directory
32
 
                                  "/brushes/r"
33
 
                                  (number->string width)
34
 
                                  "x"
35
 
                                  (number->string height)
36
 
                                  ".gbr")))
 
25
(define (script-fu-make-brush-rectangular name width height spacing)
 
26
  (let* (
 
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
 
32
                                 "/brushes/r"
 
33
                                 (number->string width)
 
34
                                 "x"
 
35
                                 (number->string height)
 
36
                                 ".gbr"))
 
37
        )
37
38
 
38
39
    (gimp-context-push)
39
40
 
44
45
    (gimp-drawable-fill drawable BACKGROUND-FILL)
45
46
 
46
47
    (gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0)
47
 
    
 
48
 
48
49
    (gimp-context-set-background '(0 0 0))
49
50
    (gimp-edit-fill drawable BACKGROUND-FILL)
50
51
 
54
55
    (gimp-context-pop)
55
56
 
56
57
    (gimp-brushes-refresh)
57
 
    (gimp-context-set-brush name)))
 
58
    (gimp-context-set-brush name)
 
59
  )
 
60
)
58
61
 
59
62
(script-fu-register "script-fu-make-brush-rectangular"
60
 
                    _"_Rectangular..."
61
 
                    "Create size of brush"
62
 
                    "Seth Burgess <sjburges@ou.edu>"
63
 
                    "Seth Burgess"
64
 
                    "1997"
65
 
                    ""
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))
 
63
  _"_Rectangular..."
 
64
  _"Create a rectangular brush"
 
65
  "Seth Burgess <sjburges@ou.edu>"
 
66
  "Seth Burgess"
 
67
  "1997"
 
68
  ""
 
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)
 
73
)
70
74
 
71
75
(script-fu-menu-register "script-fu-make-brush-rectangular"
72
 
                         _"<Toolbox>/Xtns/Script-Fu/Make Brush")
 
76
                         "<Brushes>")
73
77
 
74
78
 
75
79
(define (script-fu-make-brush-rectangular-feathered name width height
76
 
                                                    feathering spacing)
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)))
83
 
 
84
 
         (filename (string-append gimp-directory
85
 
                                  "/brushes/r"
86
 
                                  (number->string width)
87
 
                                  "x"
88
 
                                  (number->string height)
89
 
                                  "f"
90
 
                                  (number->string feathering)
91
 
                                  ".gbr")))
 
80
                                                    feathering spacing)
 
81
  (let* (
 
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
 
89
                                 "/brushes/r"
 
90
                                 (number->string width)
 
91
                                 "x"
 
92
                                 (number->string height)
 
93
                                 "f"
 
94
                                 (number->string feathering)
 
95
                                 ".gbr"))
 
96
        )
92
97
 
93
98
    (gimp-context-push)
94
99
 
99
104
    (gimp-drawable-fill drawable BACKGROUND-FILL)
100
105
 
101
106
    (cond ((< 0 feathering)
102
 
           (gimp-rect-select img
103
 
                             (/ feathering 2) (/ feathering 2)
104
 
                             width height CHANNEL-OP-REPLACE TRUE feathering))
105
 
          ((>= 0 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))
 
110
    ((>= 0 feathering)
 
111
     (gimp-rect-select img 0 0 width height CHANNEL-OP-REPLACE FALSE 0)))
107
112
 
108
113
    (gimp-context-set-background '(0 0 0))
109
114
    (gimp-edit-fill drawable BACKGROUND-FILL)
114
119
    (gimp-context-pop)
115
120
 
116
121
    (gimp-brushes-refresh)
117
 
    (gimp-context-set-brush name)))
 
122
    (gimp-context-set-brush name)
 
123
  )
 
124
)
118
125
 
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>"
123
 
                    "Seth Burgess"
124
 
                    "1997"
125
 
                    ""
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>"
 
130
  "Seth Burgess"
 
131
  "1997"
 
132
  ""
 
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)
 
138
)
131
139
 
132
140
(script-fu-menu-register "script-fu-make-brush-rectangular-feathered"
133
 
                         _"<Toolbox>/Xtns/Script-Fu/Make Brush")
 
141
                         "<Brushes>")
134
142
 
135
143
 
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)))
141
 
 
142
 
         (filename (string-append gimp-directory
143
 
                                  "/brushes/e"
144
 
                                  (number->string width)
145
 
                                  "x"
146
 
                                  (number->string height)
147
 
                                  ".gbr")))
 
145
  (let* (
 
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
 
151
                                 "/brushes/e"
 
152
                                 (number->string width)
 
153
                                 "x"
 
154
                                 (number->string height)
 
155
                                 ".gbr"))
 
156
        )
148
157
 
149
158
    (gimp-context-push)
150
159
 
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)
158
 
    
 
167
 
159
168
    (gimp-edit-fill drawable BACKGROUND-FILL)
160
169
 
161
170
    (file-gbr-save 1 img drawable filename "" spacing name)
164
173
    (gimp-context-pop)
165
174
 
166
175
    (gimp-brushes-refresh)
167
 
    (gimp-context-set-brush name)))
 
176
    (gimp-context-set-brush name)
 
177
  )
 
178
)
168
179
 
169
180
(script-fu-register "script-fu-make-brush-elliptical"
170
 
                    _"_Elliptical..."
171
 
                    "Create size of brush"
172
 
                    "Seth Burgess <sjburges@ou.edu>"
173
 
                    "Seth Burgess"
174
 
                    "1997"
175
 
                    ""
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))
 
181
  _"_Elliptical..."
 
182
  _"Create an elliptical brush"
 
183
  "Seth Burgess <sjburges@ou.edu>"
 
184
  "Seth Burgess"
 
185
  "1997"
 
186
  ""
 
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)
 
191
)
180
192
 
181
193
(script-fu-menu-register "script-fu-make-brush-elliptical"
182
 
                         _"<Toolbox>/Xtns/Script-Fu/Make Brush")
183
 
 
184
 
 
185
 
(define (script-fu-make-brush-elliptical-feathered name width height
186
 
                                                   feathering spacing)
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)))
193
 
 
194
 
         (filename (string-append gimp-directory
195
 
                                  "/brushes/e"
196
 
                                  (number->string width)
197
 
                                  "x"
198
 
                                  (number->string height)
199
 
                                  "f"
200
 
                                  (number->string feathering)
201
 
                                  ".gbr")))
 
194
                         "<Brushes>")
 
195
 
 
196
 
 
197
(define (script-fu-make-brush-elliptical-feathered name
 
198
                                                   width height
 
199
                                                   feathering spacing)
 
200
  (let* (
 
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
 
208
                                 "/brushes/e"
 
209
                                 (number->string width)
 
210
                                 "x"
 
211
                                 (number->string height)
 
212
                                 "f"
 
213
                                 (number->string feathering)
 
214
                                 ".gbr"))
 
215
        )
202
216
 
203
217
    (gimp-context-push)
204
218
 
208
222
    (gimp-context-set-background '(255 255 255))
209
223
    (gimp-drawable-fill drawable BACKGROUND-FILL)
210
224
 
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)))
219
233
 
220
234
    (gimp-context-set-background '(0 0 0))
221
235
    (gimp-edit-fill drawable BACKGROUND-FILL)
224
238
    (gimp-image-delete img)
225
239
 
226
240
    (gimp-context-pop)
227
 
    
 
241
 
228
242
    (gimp-brushes-refresh)
229
 
    (gimp-context-set-brush name)))
 
243
    (gimp-context-set-brush name)
 
244
  )
 
245
)
230
246
 
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>"
235
 
                    "Seth Burgess"
236
 
                    "1997"
237
 
                    ""
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>"
 
251
  "Seth Burgess"
 
252
  "1997"
 
253
  ""
 
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)
 
259
)
243
260
 
244
261
(script-fu-menu-register "script-fu-make-brush-elliptical-feathered"
245
 
                         _"<Toolbox>/Xtns/Script-Fu/Make Brush")
 
262
                         "<Brushes>")