30
30
; == Script by Gregory M. Ross ==
31
31
; ===============================================================
32
32
33
- (define (script-fu-60's-text string font-name font-size bg-color gradient1 reverse1 style1 gradient2 reverse2 style2)
33
+ (define (script-fu-60s-text thestring
34
+ font-name
35
+ font-size
36
+ bg-color
37
+ gradient1
38
+ reverse1
39
+ style1
40
+ gradientdirectionoption
41
+ gradient2
42
+ reverse2
43
+ style2
44
+ mapgradient
45
+ mapgradientreverse
46
+ secondgradientaction
47
+ mapgradientaction
48
+ dropshadowaction)
34
49
35
50
(let* (
36
- (text-ext (gimp-text-get-extents-fontname string font-size 0 font-name)) ; Get extents of the bounding box for the specified text in pixels.
51
+ (text-ext (gimp-text-get-extents-fontname thestring font-size 0 font-name)) ; Get extents of the bounding box for the specified text in pixels.
37
52
(wide (+ (car text-ext) 20 )) ; wide = text width + 20 pixels
38
53
(high (+ (cadr text-ext) 20 )) ; high = text height + 20 pixels
39
54
(img (car (gimp-image-new wide high 0 ))) ; define new rgb image called "img"
43
58
(dupe-layer (car (gimp-layer-new img wide high 1 " Gradient Map" 100 6 ))) ; define new rgba layer named "Gradient Map"
44
59
(text-layer (car (gimp-layer-new img wide high 1 " Text" 100 0 ))) ; define new rgba layer named "Text"
45
60
(shadow-layer (car (gimp-layer-new img wide high 1 " Shadow" 80 0 ))) ; define new rgba layer named "Shadow" with 80% opacity
61
+
62
+ (widthfactor1 0.5 )
63
+ (heightfactor1 0.8 )
64
+ (widthfactor2 0.1 )
65
+ (heightfactor2 0.5 )
46
66
)
47
67
48
68
63
83
(gimp-edit-clear shadow-layer)
64
84
(gimp-edit-clear text-layer)
65
85
(gimp-edit-clear gradient-layer)
66
- (gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer 10 10 string 0 TRUE font-size PIXELS font-name)))
86
+ (gimp-floating-sel-anchor (car (gimp-text-fontname img text-layer 10 10 thestring 0 TRUE font-size PIXELS font-name)))
67
87
68
88
; Create gradient effect
69
89
70
90
(gimp-context-set-gradient gradient1)
71
91
92
+ ; (gimp-message (number->string style1))
93
+ ; (gimp-message (number->string wide))
94
+ ; (gimp-message (number->string high))
72
95
; (gimp-edit-blend gradient-layer 3 0 style1 100 0 0 reverse1 FALSE 0 0 TRUE 0 0 wide high)
73
- (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE 0 0 wide high)
74
- (gimp-context-set-gradient gradient2)
75
- ; (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-DIFFERENCE style2 100 0 0 reverse2 FALSE 0 0 TRUE 0 (/ high 2) (/ wide 2) (/ high 2))
76
- (gimp-edit-blend gradient2-layer BLEND-CUSTOM LAYER-MODE-LINEAR-LIGHT style2 100 0 REPEAT-SAWTOOTH reverse2 FALSE 0 0 TRUE 1 (* high 0.25 ) (* wide 0.15 ) (* high 0.25 ))
96
+ ; (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE 0 0 wide high)
97
+
98
+ ; (gimp-message "checking direction option")
99
+ (cond ((= gradientdirectionoption 0 )
100
+ ; (gimp-message "GradDir Option0")
101
+ (set! widthfactor1 0.0 )
102
+ (set! heightfactor1 0.5 )
103
+ (set! widthfactor2 1.0 )
104
+ (set! heightfactor2 0.5 )
105
+ )
106
+ ((= gradientdirectionoption 1 )
107
+ ; (gimp-message "GradDir Option1 vertical")
108
+ (set! widthfactor1 0.5 )
109
+ (set! heightfactor1 0.0 )
110
+ (set! widthfactor2 0.5 )
111
+ (set! heightfactor2 1.0 )
112
+ )
113
+ ((= gradientdirectionoption 2 )
114
+ ; (gimp-message "GradDir Option2 halfway down")
115
+ (set! widthfactor1 0.0 )
116
+ (set! heightfactor1 0.5 )
117
+ (set! widthfactor2 0.0 )
118
+ (set! heightfactor2 1.0 )
119
+ )
120
+ ((= gradientdirectionoption 3 )
121
+ ; (gimp-message "GradDir Option3 High slant")
122
+ (set! widthfactor1 0.10 )
123
+ (set! heightfactor1 0.20 )
124
+ (set! widthfactor2 0.12 )
125
+ (set! heightfactor2 0.40 )
126
+ )
127
+ ((= gradientdirectionoption 4 )
128
+ ; (gimp-message "GradDir Option4 Good for radial")
129
+ (set! widthfactor1 0.0 )
130
+ (set! heightfactor1 0.5 )
131
+ (set! widthfactor2 0.25 )
132
+ (set! heightfactor2 0.65 )
133
+ )
134
+ ((= gradientdirectionoption 5 )
135
+ ; (gimp-message "GradDir Option5 TopL BottomR")
136
+ (set! widthfactor1 0.0 )
137
+ (set! heightfactor1 0.0 )
138
+ (set! widthfactor2 1.0 )
139
+ (set! heightfactor2 0.99 )
140
+ )
141
+ ((= gradientdirectionoption 6 )
142
+ ; (gimp-message "option 6")
143
+ (set! widthfactor1 (/ (rand 99 ) 100 ))
144
+ (set! heightfactor1 (/ (rand 99 ) 100 ))
145
+ (set! widthfactor2 (/ (rand 99 ) 100 ))
146
+ (set! heightfactor2 (/ (rand 99 ) 100 ))
147
+ ; (gimp-message (number->string widthfactor1))
148
+ )
149
+ ((= gradientdirectionoption 7 ) ; narrow line
150
+ ; (gimp-message "option 7")
151
+ (set! widthfactor1 0.46 )
152
+ (set! heightfactor1 0.5 )
153
+ (set! widthfactor2 0.54 )
154
+ (set! heightfactor2 0.55 )
155
+ )
156
+ )
157
+
158
+
159
+ (cond
160
+ ((= style1 0 )
161
+ ; (gimp-message "style=0")
162
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 1 reverse1 FALSE 0 0 TRUE (* wide widthfactor1) (* high heightfactor1) (* wide widthfactor2) (* high heightfactor2))
163
+ )
164
+ ((= style1 1 )
165
+ ; (gimp-message "style=1") ; bi-linear - have added a repeat and angled - will consider a set of options (widths and heights) for each
166
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 1 reverse1 FALSE 0 0 TRUE 0 (* high 0.5 ) (* wide 0.25 ) (* high 0.65 ))
167
+ )
168
+ ((= style1 2 )
169
+ ; (gimp-message "style=2") ; radial
170
+ ; (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE 0 0 wide high)
171
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 1 reverse1 FALSE 0 0 TRUE (* wide widthfactor1) (* high heightfactor1) (* wide widthfactor2) (* high heightfactor2))
172
+ )
173
+ ((= style1 3 )
174
+ ; (gimp-message "style=3") ; square
175
+ ; (gimp-message "Squaredebug")
176
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 REPEAT-SAWTOOTH reverse1 FALSE 0 0 TRUE (* wide 0.5 ) (* high 0.5 ) (* wide 0.53 ) (* high 0.2 ))
177
+ )
178
+ ((= style1 4 )
179
+ ; (gimp-message "style=4") ; conical sym
180
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE (* wide 0.50 ) (* high 0.45 ) (* wide 0.81 ) (* high 0.65 ))
181
+ )
182
+ ((= style1 5 )
183
+ ; (gimp-message "style=5") ; conical (asymm)
184
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE (* wide 0.5 ) (* high 0.5 ) (* wide 0.75 ) (* high 0.5 ))
185
+ )
186
+ ((= style1 6 )
187
+ ; (gimp-message "style=6") ; shaped (angular)
188
+ ; (gimp-message "Squaredebug")
189
+ ; (gimp-layer-set-mode gradient-layer LAYER-MODE-NORMAL)
190
+
191
+ ; NB shaped gradients require a selection
192
+ (gimp-selection-all img)
193
+ ; (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE (* wide 0.5) (* high 0.5) (* wide 0.8) (* high 0.5))
194
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL-LEGACY style1 100 0 0 TRUE TRUE 1 1 TRUE (* wide 0.1 ) (* high 0.1 ) (* wide 0.85 ) (* high 0.5 ))
195
+ )
196
+ ((= style1 7 )
197
+ ; (gimp-message "style=7") ; shaped (?)
198
+ (gimp-selection-all img)
199
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE (* wide 0.5 ) (* high 0.5 ) (* wide 0.75 ) (* high 0.5 ))
200
+ )
201
+ (else
202
+ (begin
203
+ ; (gimp-message "style=else")
204
+ (gimp-selection-all img)
205
+ (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-NORMAL style1 100 0 0 reverse1 FALSE 0 0 TRUE (* wide 0.25 ) 0 (* wide 0.5 ) (* high 0.5 ))
206
+ )
207
+ )
208
+ )
209
+
210
+ ; (gimp-message "line142")
211
+ ; (gimp-display-new img)
212
+ ; (quit)
213
+
214
+ (if (= secondgradientaction TRUE)
215
+ (begin
216
+ ; added to address various styles requiring a selection
217
+ (gimp-selection-all img)
218
+
219
+ (gimp-context-set-gradient gradient2)
220
+ ; (gimp-edit-blend gradient-layer BLEND-CUSTOM LAYER-MODE-DIFFERENCE style2 100 0 0 reverse2 FALSE 0 0 TRUE 0 (/ high 2) (/ wide 2) (/ high 2))
221
+ ; (gimp-edit-blend gradient2-layer BLEND-CUSTOM LAYER-MODE-DIFFERENCE style2 100 0 REPEAT-SAWTOOTH reverse2 FALSE 0 0 TRUE 1 (* high 0.25) (* wide 0.15) (* high 0.25))
222
+ (gimp-edit-blend gradient2-layer BLEND-CUSTOM LAYER-MODE-DIFFERENCE style2 100 0 REPEAT-SAWTOOTH reverse2 FALSE 0 0 TRUE (* wide widthfactor1) (* high heightfactor1) (* wide widthfactor2) (* high heightfactor2))
223
+ ; Linear-lght
224
+ (gimp-selection-none img)
225
+ )
226
+ )
227
+
77
228
78
229
; Create Gradient Map
230
+ (if (= mapgradientaction TRUE)
231
+ (begin
232
+
233
+ ; (gimp-context-set-gradient "Three bars sin")
234
+ (gimp-context-set-gradient mapgradient)
235
+ (gimp-item-set-visible bg-layer FALSE)
236
+ (gimp-edit-copy-visible img)
237
+ (gimp-image-insert-layer img dupe-layer 0 -1)
238
+ (gimp-edit-clear dupe-layer)
239
+ (gimp-image-raise-layer-to-top img dupe-layer)
240
+ (gimp-edit-paste dupe-layer img)
241
+ (gimp-floating-sel-anchor (car (gimp-image-get-floating-sel img)))
242
+ (plug-in-gradmap 1 img dupe-layer)
243
+ )
244
+ )
245
+
246
+ (if (= secondgradientaction TRUE)
247
+ (begin
248
+ (gimp-layer-set-mode gradient2-layer LAYER-MODE-ADDITION)
249
+ (gimp-layer-set-opacity gradient2-layer 62.0 )
250
+ )
251
+ )
252
+
253
+
254
+ ; (gimp-message "DEBUG crashout")
255
+ ; (gimp-display-new img)
256
+ ; (quit)
79
257
80
- (gimp-context-set-gradient " Three bars sin" )
81
- (gimp-item-set-visible bg-layer FALSE)
82
- (gimp-edit-copy-visible img)
83
- (gimp-image-insert-layer img dupe-layer 0 -1)
84
- (gimp-edit-clear dupe-layer)
85
- (gimp-image-raise-layer-to-top img dupe-layer)
86
- (gimp-edit-paste dupe-layer img)
87
- (gimp-floating-sel-anchor (car (gimp-image-get-floating-sel img)))
88
- (plug-in-gradmap 1 img dupe-layer)
89
-
90
- (gimp-layer-set-mode gradient2-layer LAYER-MODE-ADDITION)
91
- (gimp-layer-set-opacity gradient2-layer 62.0 )
92
258
; Clean up jagged edges
93
259
94
260
(gimp-selection-layer-alpha text-layer)
95
261
(gimp-selection-shrink img 1 )
96
262
(gimp-selection-invert img)
97
- (gimp-edit-clear dupe-layer)
263
+ (if (= mapgradientaction TRUE)
264
+ (begin
265
+ (gimp-edit-clear dupe-layer)
266
+ )
267
+ )
98
268
(gimp-edit-clear gradient-layer)
99
269
(gimp-edit-clear text-layer)
100
270
(gimp-selection-invert img)
101
271
102
272
; Create drop shadow
103
-
104
- ; (gimp-bucket-fill shadow-layer 0 0 100 0 FALSE 0 0)
105
- (gimp-edit-bucket-fill shadow-layer BUCKET-FILL-FG 0 100 0 FALSE 0 0 )
106
- (gimp-selection-none img)
107
- (plug-in-gauss 1 img shadow-layer 20 20 0 )
108
- (gimp-drawable-offset shadow-layer FALSE 1 8 8 )
273
+ (if (= dropshadowaction TRUE)
274
+ (begin
275
+ ; (gimp-bucket-fill shadow-layer 0 0 100 0 FALSE 0 0)
276
+ (gimp-edit-bucket-fill shadow-layer BUCKET-FILL-FG 0 100 0 FALSE 0 0 )
277
+ (gimp-selection-none img)
278
+ (plug-in-gauss 1 img shadow-layer 20 20 0 )
279
+ (gimp-drawable-offset shadow-layer FALSE 1 8 8 )
280
+ )
281
+ )
109
282
110
283
; Turn on background layers visibility
111
284
121
294
122
295
; Setup user interface
123
296
124
- (script-fu-register " script-fu-60's -text"
297
+ (script-fu-register " script-fu-60s -text"
125
298
" 60's Text"
126
299
" Gives text a psychadelic 60's effect. \n file: 60's Text.scm"
127
300
" Gregory M. Ross"
128
301
" Gregory M. Ross"
129
302
" March 23, 2009"
130
303
" "
131
- SF-STRING " Text" " Gimp Rocks! "
304
+ SF-STRING " Text" " Gimp60Gimp "
132
305
SF-FONT " Font" " Arial Bold"
133
306
SF-ADJUSTMENT " Font Size (pixels)" ' (100 2 1000 1 10 0 1 )
134
307
SF-COLOR " Background Color" ' (255 255 255 )
139
312
" Shaped (angular)" " Shaped (spherical)"
140
313
" Shaped (dimpled)" " Spiral (cw)"
141
314
" Spiral (ccw)" )
315
+ SF-OPTION " Gradient Direction option" ' (" Horizontal" " Vertical" " Option2 - Halfway Down" " Option3 - High slant"
316
+ " Option4 - Good for Radial"
317
+ " Option5 - slanted topL to bottomR" " Option6 - random" " Option7 - narrow" )
142
318
SF-GRADIENT " Gradient 2" " Three bars sin"
143
319
SF-TOGGLE " Gradient reverse" FALSE
144
320
SF-OPTION " Gradient Style" ' (" Linear" " Bi-linear" " Radial" " Square"
145
321
" Conical (sym)" " Conical (asym)"
146
322
" Shaped (angular)" " Shaped (spherical)"
147
323
" Shaped (dimpled)" " Spiral (cw)"
148
324
" Spiral (ccw)" )
325
+ SF-GRADIENT " Map Gradient" " Three bars sin"
326
+ SF-TOGGLE " Map Gradient reverse" FALSE
327
+ SF-TOGGLE " 2) Do SecondGradient Step" TRUE
328
+ SF-TOGGLE " 3) Do MapGradient Gradient Step" TRUE
329
+ SF-TOGGLE " 4) Do Drop shadow Step" TRUE
149
330
)
150
- (script-fu-menu-register " script-fu-60's -text"
331
+ (script-fu-menu-register " script-fu-60s -text"
151
332
" <Toolbox>/Script-Fu/Logos" )
152
333
153
334
; end of script
0 commit comments