-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path300_skywriting.scm
268 lines (228 loc) · 9.79 KB
/
300_skywriting.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
;Modernized with ModernizeMatic7 for Gimp 2.10.22 by vitforlinux.wordpress.com - dont remove
; Fix code for gimp 2.99.6 working in 2.10
(cond ((not (defined? 'gimp-drawable-get-width)) (define gimp-drawable-get-width gimp-drawable-width)))
(cond ((not (defined? 'gimp-drawable-get-height)) (define gimp-drawable-get-height gimp-drawable-height)))
(cond ((not (defined? 'gimp-text-fontname)) (define (gimp-text-fontname fn1 fn2 fn3 fn4 fn5 fn6 fn7 fn8 PIXELS fn9) (gimp-text-font fn1 fn2 fn3 fn4 fn5 fn6 fn7 fn8 fn9))))
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(define sffont "QTHelvet-Black Heavy")
(define sffont "QTHelvet-Black"))
(define (apply-gauss2 img drawable x y)
(cond ((not(defined? 'plug-in-gauss))
(gimp-drawable-merge-new-filter drawable "gegl:gaussian-blur" 0 LAYER-MODE-REPLACE 1.0
"std-dev-x" (* x 0.32) "std-dev-y" (* y 0.32) "filter" "auto"))
(else
(plug-in-gauss 1 img drawable x y 0)
)))
; Define the function:
(define (script-fu-skywriting-300 inText inSize inFont justification letter-spacing line-spacing grow-text outline color foption scolor grad pat)
; backup the current colours and brushes so we
; can restore them later
(gimp-context-push)
; create an image and a layer in that image
(let* (
(buffer 30)
(img (car (gimp-image-new 256 256 RGB)))
(theText (car (gimp-text-fontname img -1 buffer buffer inText (+ (/ inSize 10) 10) 1 inSize PIXELS inFont)))
(width (car (gimp-drawable-get-width theText)))
(height (car (gimp-drawable-get-height theText)))
(imwidth (+ width buffer buffer))
(imheight (+ height buffer buffer))
(justification (cond ((= justification 0) 2)
((= justification 1) 0)
((= justification 2) 1)
((= justification 3) 3)))
)
(gimp-text-layer-set-letter-spacing theText letter-spacing) ; Set Letter Spacing
(gimp-text-layer-set-justification theText justification) ; Text Justification (Rev Value)
(gimp-text-layer-set-line-spacing theText line-spacing) ; Set Line Spacing
(gimp-layer-resize theText (+(car (gimp-drawable-get-width theText)) buffer buffer ) (+ (car (gimp-drawable-get-height theText)) buffer buffer ) 0 0) ;add
(gimp-image-resize img (car (gimp-drawable-get-width theText)) (car (gimp-drawable-get-height theText)) 0 0) ;add
;;;;;; SHRINK/GROW text
(cond ((> grow-text 0)
(gimp-selection-none img)
(gimp-image-select-item img 2 theText)
(gimp-selection-grow img (round grow-text))
(gimp-drawable-edit-fill theText FILL-FOREGROUND)
)
((< grow-text 0)
(gimp-selection-none img)
(gimp-image-select-item img 2 theText)
(gimp-drawable-edit-clear theText)
(gimp-selection-shrink img (- grow-text))
(gimp-drawable-edit-fill theText FILL-FOREGROUND)
))
;;; outline
(cond ((> outline 0)
(gimp-selection-none img)
(gimp-image-select-item img 2 theText)
(gimp-selection-shrink img (round outline))
(gimp-drawable-edit-clear theText)
(gimp-image-select-item img 2 theText)
))
(script-fu-skywriting-300core img theText inSize color foption scolor grad pat)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CLEAN UP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gimp-context-pop)
(gimp-display-new img) ; make the image appear
(gimp-selection-none img) ; deselect everything
(gimp-image-clean-all img) ; clear the UNDO buffer
)
)
; Register the function with the GIMP:
(script-fu-register
"script-fu-skywriting-300"
"Skywriting 300 LOGO"
"Writing with clouds"
"My Name"
"Copyright stuff"
"Date"
""
SF-TEXT "Text" "Skywriting"
SF-ADJUSTMENT "Font size" '(200 2 1000 1 10 0 0)
SF-FONT "Font" sffont
SF-OPTION _"Text Justification" '("Centered" "Left" "Right" "Fill")
SF-ADJUSTMENT "Letter Spacing" '(0 -50 50 1 5 0 0)
SF-ADJUSTMENT "Line Spacing" '(-5 -300 300 1 10 0 0)
SF-ADJUSTMENT _"Shrink / Grow Text" '(0 -40 40 1 10 0 0)
SF-ADJUSTMENT _"Outline" '(0 0 40 1 10 0 0)
SF-COLOR "Textcolor:" '(255 255 255)
SF-OPTION "Sky mode" '(_"color" _"gradient" _"pattern")
SF-COLOR "Sky color:" '(80 80 200)
SF-GRADIENT "Sky Gradient" "Deep Sea"
SF-PATTERN "Sky Pattern" "Blue Web"
)
(script-fu-menu-register "script-fu-skywriting-300"
_"<Image>/File/Create/Logos/"
)
(define (script-fu-skywriting-300img img drawable inSize color foption scolor grad pat)
; backup the current colours and brushes so we
; can restore them later
(gimp-context-push)
(let* (
(buffer 30)
(width (car (gimp-drawable-get-width drawable)))
(height (car (gimp-drawable-get-height drawable)))
(imwidth (+ width buffer buffer))
(imheight (+ height buffer buffer))
)
; create an image and a layer in that image
(gimp-image-undo-group-start img)
(gimp-image-resize img imwidth imheight buffer buffer) ;add
(gimp-layer-resize drawable imwidth imheight (* 2 buffer) (* 2 buffer)) ;add
(script-fu-skywriting-300core img drawable inSize color foption scolor grad pat)
(gimp-image-undo-group-end img)
(gimp-context-pop)
(gimp-displays-flush)
)
)
;‰æ‘œ‰ÁH–{‘Ì
(define (script-fu-skywriting-300imgh img drawable inSize color foption scolor grad pat)
(let* (
(img2 (car (gimp-image-duplicate img)))
(drawable2 (if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(car (gimp-image-get-active-drawable img2))
(vector-ref (car (gimp-image-get-selected-drawables img2)) 0)
))
)
(gimp-image-undo-disable img2)
(gimp-layer-resize-to-image-size drawable2)
(script-fu-skywriting-300img img2 drawable2 inSize color foption scolor grad pat)
(gimp-image-undo-enable img2)
(gimp-display-new img2)
)
)
(script-fu-register
"script-fu-skywriting-300imgh"
"Skywriting 300 Alpha"
"Draws a Cloud"
"My Name"
"Copyright stuff"
"Date"
"RGBA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Size" '(120 2 1000 1 10 0 0)
SF-COLOR "Cloud color:" '(255 255 255)
SF-OPTION "Sky mode" '(_"color" _"gradient" _"pattern")
SF-COLOR "Sky color:" '(80 80 200)
SF-GRADIENT "Sky Gradient" "Deep Sea"
SF-PATTERN "Sky Pattern" "Blue Web"
)
(script-fu-menu-register "script-fu-skywriting-300imgh"
_"<Image>/Script-Fu/Alpha-to-Logo/"
)
(define (script-fu-skywriting-300core img theText inSize color foption scolor grad pat)
; backup the current colours and brushes so we
; can restore them later
(gimp-context-push)
; create an image and a layer in that image
(let* (
(buffer 30)
(width (car (gimp-drawable-get-width theText)))
(height (car (gimp-drawable-get-height theText)))
(imwidth (+ width buffer buffer))
(imheight (+ height buffer buffer))
)
;(gimp-display-new img) ; make the image appear
(define clouds1 (car (gimp-layer-new img imwidth imheight RGBA-IMAGE "Clouds1" 100 LAYER-MODE-NORMAL-LEGACY)))
(gimp-image-insert-layer img clouds1 0 0)
(gimp-selection-all img)
(gimp-drawable-edit-clear clouds1)
; (gimp-selection-all img)
; (gimp-drawable-edit-fill theText BG-IMAGE-FILL)
; (gimp-drawable-edit-clear theText)
;1.2•ÏX
; (define floatingText (car (gimp-text img theText buffer buffer inText (+ (/ inSize 12) 4) 1 inSize PIXELS "*" inFont "*" "r" "*" "*" "*" "*")))
; (define floatingText (car (gimp-text-fontname img theText buffer buffer inText 0 1 inSize PIXELS inFont)))
; (gimp-floating-sel-anchor floatingText)
(define (gen-distressed-bit thr grow)
(gimp-image-select-item img 2 theText)
(gimp-selection-grow img grow)
; (script-fu-distress-selection img clouds1 thr 10 4 2 1 1) ;none
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(script-fu-distress-selection img clouds1 thr (+ (* (/ inSize 700) 10) 8.4) (+ (* (/ inSize 400) 4) 3.1) (+ (* (/ inSize 700) 2) 1.657) 1 1) ;add
(script-fu-distress-selection img (vector clouds1) (/ thr 255) (+ (* (/ inSize 700) 10) 8.4) (+ (* (/ inSize 400) 4) 3.1) (+ (* (/ inSize 700) 2) 1.657) TRUE TRUE) ;add
)
;(gimp-edit-bucket-fill clouds1 FG-BUCKET-FILL LAYER-MODE-NORMAL-LEGACY 8 0 0 0 0)
(gimp-context-set-opacity 8)
(gimp-context-set-paint-mode LAYER-MODE-NORMAL-LEGACY)
(gimp-drawable-edit-fill clouds1 FILL-FOREGROUND)
)
(gimp-context-set-foreground color)
(map gen-distressed-bit
'(160 160 160 160 160 160 160 160 100 100 100 100)
'(000 000 000 000 000 000 000 000 000 000 000 000) )
;(gimp-image-select-item img 2 theText)
;(gimp-bucket-fill clouds1 FG-BUCKET-FILL LAYER-MODE-NORMAL-LEGACY 10 0 0 0 0)
(apply-gauss2 img clouds1 6 6)
(apply-gauss2 img clouds1 6 6)
(gimp-image-remove-layer img theText)
; (gimp-layer-delete theText) ;none 2.2
(gimp-selection-none img)
;(define cloudText (car (gimp-image-merge-visible-layers img CLIP-TO-BOTTOM-LAYER)))
(define bgLayer (car (gimp-layer-new img imwidth imheight RGBA-IMAGE "Blue" 100 LAYER-MODE-NORMAL-LEGACY)))
(gimp-image-insert-layer img bgLayer 0 1)
(gimp-selection-all img)
(gimp-context-set-foreground scolor)
;(gimp-edit-bucket-fill bgLayer FG-BUCKET-FILL LAYER-MODE-NORMAL-LEGACY 100 0 0 0 0)
(gimp-context-set-paint-mode LAYER-MODE-NORMAL-LEGACY)
(gimp-context-set-opacity 100)
(gimp-drawable-edit-fill bgLayer FILL-FOREGROUND)
(cond((= foption 1)
(gimp-context-set-gradient grad)
; (gimp-edit-blend bgLayer BLEND-CUSTOM LAYER-MODE-NORMAL-LEGACY 0 100 20 REPEAT-NONE FALSE FALSE 0 0 FALSE 0 0 0 height)
(gimp-drawable-edit-gradient-fill bgLayer GRADIENT-LINEAR 0 0 1 0 0 0 0 0 height) ; Fill with gradient
)
((= foption 2)
(gimp-image-select-item img 2 bgLayer)
;(gimp-drawable-edit-clear bgLayer)
(gimp-context-set-paint-mode LAYER-MODE-NORMAL-LEGACY )
(gimp-context-set-pattern pat)
(gimp-drawable-edit-bucket-fill bgLayer FILL-PATTERN 100 255 )
(gimp-selection-none img)
)
)
(plug-in-autocrop 0 img bgLayer)
)
)