-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaterial-overlay.scm
325 lines (290 loc) · 10.9 KB
/
material-overlay.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
(define list-material-mo-dir '("Carbon fiber" "Aluminium Brushed" "Aluminium Brushed Light" "Blue Jeans" "Washed Jeans" "Dark Jeans" "Bovination 2.99" "Camouflage 2.99" "Plasma" "Patchwork" "Diffraction" "Pizza"))
(cond ((not (defined? 'gimp-context-set-pattern-ng)) (define (gimp-context-set-pattern-ng value)
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(gimp-context-set-pattern value)
(gimp-context-set-pattern (car (gimp-pattern-get-by-name value)))
))))
(cond ((not (defined? 'gimp-context-set-gradient-ng)) (define (gimp-context-set-gradient-ng value)
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(gimp-context-set-gradient value)
(gimp-context-set-gradient (car (gimp-gradient-get-by-name value)))
))))
(define (material-mo-carbon fond) (begin
(gimp-context-set-pattern-ng "Parque #3")
(gimp-drawable-fill fond FILL-PATTERN)
(gimp-drawable-desaturate fond 1)
(gimp-drawable-brightness-contrast fond -0.5 0.15)
))
(define (material-mo-bovination-2 fond image) (begin
(plug-in-solid-noise 0 image fond 0 0 (random 65535) 1 16 4)
(gimp-drawable-equalize fond 0)
; (gimp-drawable-threshold fond HISTOGRAM-VALUE 0 1)
;(gimp-brightness-contrast fond 0 127) ; cambiare!
(gimp-drawable-brightness-contrast fond 0 0.5)
;(gimp-drawable-levels fond 0 0.1 0.4 FALSE 0.1 0.1 0.2 FALSE)
(gimp-drawable-brightness-contrast fond 0 0.5)
(gimp-drawable-brightness-contrast fond 0 0.5)
;(gimp-drawable-levels fond 0 0 0.4 FALSE 0.1 0.1 0.2 FALSE)
(gimp-drawable-brightness-contrast fond 0 0.5)
(gimp-layer-set-lock-alpha fond TRUE)
(plug-in-oilify 1 image fond 20 0)
))
(define (material-mo-camo2 fond image) (begin
(gimp-selection-none image)
(define color1 '(136 125 52))
(define color2 '(62 82 22))
(define color3 '(50 28 0))
;(gimp-context-set-paint-mode LAYER-MODE-NORMAL-LEGACY)
(gimp-context-set-paint-mode LAYER-MODE-NORMAL)
(material-mo-bovination-2 fond image)
(gimp-image-select-color image 0 fond '(255 255 255) )
(gimp-selection-grow image 2)
(gimp-context-set-foreground color1 )
(gimp-drawable-edit-fill fond FILL-FOREGROUND)
(gimp-selection-invert image)
(gimp-context-set-foreground color2 )
(gimp-drawable-edit-fill fond FILL-FOREGROUND)
(gimp-selection-none image)
(gimp-image-select-color image 0 fond color1)
(gimp-selection-grow image 2)
(material-mo-bovination-2 fond image)
(gimp-selection-none image)
(gimp-image-select-color image 0 fond '(0 0 0) )
(gimp-selection-grow image 2)
(gimp-context-set-foreground color1 )
(gimp-drawable-edit-fill fond FILL-FOREGROUND)
(gimp-selection-none image)
(gimp-image-select-color image 0 fond '(255 255 255))
(gimp-selection-grow image 2)
(gimp-context-set-foreground color3 )
(gimp-drawable-edit-fill fond FILL-FOREGROUND)
(gimp-selection-none image)
(gimp-layer-set-lock-alpha fond TRUE)
(plug-in-oilify 1 image fond 20 0)
))
(define (material-mo-alubrushed fond image) (begin
(gimp-context-set-pattern-ng "Blue Squares")
(gimp-drawable-fill fond FILL-PATTERN)
(gimp-drawable-desaturate fond 1)
(gimp-drawable-brightness-contrast fond -0.5 0.15)
(gimp-selection-none image)
(plug-in-gauss-iir TRUE image fond 20 TRUE TRUE)
(plug-in-randomize-hurl 0 image fond 50 50 TRUE 0)
(plug-in-mblur 0 image fond 0 25 0 0 0)
(gimp-drawable-colorize-hsl fond 0 0 10 )
;(script-fu-colorize 0 image fond 959595 1)
))
(define (material-mo-alubrushed-light fond image) (begin
;(gimp-context-set-gradient "Flare Rays Size 1")
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(gimp-context-set-gradient "Rounded edge")
(gimp-context-set-gradient (car (gimp-gradient-get-by-name "Rounded Edge")))
)
(gimp-context-set-gradient-repeat-mode 0)
(gimp-drawable-edit-gradient-fill
fond
;BLEND-FG-TRANSPARENT
;LAYER-MODE-NORMAL-LEGACY
0 ;GRADIENT-LINEAR
0 ; 100
0
;REPEAT-NONE
;FALSE
;FALSE
1
0
0 ;FALSE
0
0
(car (gimp-drawable-get-width fond))
0
)
(gimp-drawable-desaturate fond 1)
(gimp-drawable-brightness-contrast fond -0.5 0.15)
(gimp-selection-none image)
(plug-in-gauss-iir TRUE image fond 20 TRUE TRUE)
(plug-in-randomize-hurl 0 image fond 5 5 TRUE 0)
(plug-in-mblur 0 image fond 0 25 0 0 0)
(gimp-drawable-colorize-hsl fond 0 0 10 )
))
(define (material-mo-blue-jeans fond image col-opt) (begin
; (gimp-context-set-gradient-ng "Rounded edge")
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(gimp-context-set-gradient "Rounded edge")
(gimp-context-set-gradient (car (gimp-gradient-get-by-name "Rounded Edge")))
)
(gimp-context-set-gradient-repeat-mode 2)
(gimp-drawable-edit-gradient-fill
fond
;BLEND-FG-TRANSPARENT
;LAYER-MODE-NORMAL-LEGACY
0 ;GRADIENT-LINEAR
0 ; 100
0
;REPEAT-NONE
;FALSE
;FALSE
1
0
0 ;FALSE
0
0
5
5
)
(gimp-drawable-brightness-contrast fond -0.5 0.15)
(plug-in-randomize-hurl 0 image fond 5 5 TRUE 0)
(gimp-drawable-desaturate fond 1)
(plug-in-gauss-iir TRUE image fond 3 TRUE TRUE)
;(gimp-drawable-colorize-hsl fond 230 36 20 )
(if (= col-opt 0)
(begin (gimp-drawable-colorize-hsl fond 230 36 20 )
(gimp-drawable-brightness-contrast fond -0.1 0.3))
)
(if (= col-opt 1)
(begin(gimp-drawable-colorize-hsl fond 230 36 20 )
(gimp-drawable-brightness-contrast fond -0.1 0.1))
)
(if (= col-opt 2)
(begin (gimp-drawable-colorize-hsl fond 10 10 10)
(gimp-drawable-brightness-contrast fond -0.1 0.3)
(gimp-drawable-desaturate fond 1))
)
))
(define (material-mo-plasma fond image) (begin
;(gimp-layer-set-lock-alpha fond TRUE)
(plug-in-plasma 1 image fond (rand 999999999) 7) ; Add plasma
))
(define (material-mo-patchwork fond image) (begin
(plug-in-plasma 1 image fond (rand 999999999) 7) ; Add plasma
(plug-in-cubism 1 image fond 6 10 0)
))
(define (material-mo-pizza fond image) (begin
;(gimp-layer-set-lock-alpha fond TRUE)
(material-mo-bovination-2 fond image)
(gimp-selection-none image)
(gimp-image-select-color image 0 fond '(0 0 0) )
(gimp-selection-grow image 3)
(gimp-context-set-foreground '(255 0 0) )
(gimp-drawable-edit-fill fond FILL-FOREGROUND)
(gimp-selection-none image)
(gimp-layer-set-lock-alpha fond TRUE)
(plug-in-oilify 1 image fond 20 0)
))
(define (material-mo-diffraction fond image)
(begin
(set! *seed* (car (gettimeofday))) ; Random Number Seed From Clock (*seed* is global)
(random-next) ; Next Random Number Using Seed
(plug-in-diffraction 1 image fond .815 1.221 1.123 (+ .821 (rand 2)) (+ .821 (rand 2)) (+ .974 (rand 2)) .610 .677 .636 .066 (+ 27.126 (rand 20)) (+ -0.437 (rand 1)))
))
(define (script-fu-layerfx-material-mo-overlay img
drawable
color
opacity
mode
merge)
(gimp-image-undo-group-start img)
(let* ((origfgcolor (car (gimp-context-get-foreground)))
(origselection (car (gimp-selection-save img)))
(drwwidth (car (gimp-drawable-get-width drawable)))
(drwheight (car (gimp-drawable-get-height drawable)))
(layername (car (gimp-item-get-name drawable)))
(drwoffsets (gimp-drawable-get-offsets drawable))
(colorlayer (car (gimp-layer-new img drwwidth drwheight (cond ((= (car (gimp-image-get-base-type img)) 0) 1) ((= (car (gimp-image-get-base-type img)) 1) 3)) (string-append layername "-color") opacity (get-blending-mode mode))))
(origmask 0)
(alphamask 0)
)
(add-over-layer img colorlayer drawable)
(gimp-layer-set-offsets colorlayer (car drwoffsets) (cadr drwoffsets))
(gimp-selection-all img)
;(gimp-context-set-foreground color)
(if (= color 0)
(material-mo-carbon colorlayer)
)
(
if ( = color 1)
(material-mo-alubrushed colorlayer img)
)
(
if ( = color 2)
(material-mo-alubrushed-light colorlayer img)
)
(
if ( = color 3)
(material-mo-blue-jeans colorlayer img 0)
)
(
if ( = color 4)
(material-mo-blue-jeans colorlayer img 1)
)
( if ( = color 5)
(material-mo-blue-jeans colorlayer img 2)
)
(if (= color 6)
(material-mo-bovination-2 colorlayer img))
(if (= color 7)
(material-mo-camo2 colorlayer img))
(if (= color 8)
(material-mo-plasma colorlayer img)
)
(if (= color 9)
(material-mo-patchwork colorlayer img)
)
(if (= color 10)
(material-mo-diffraction colorlayer img)
)
(if (= color 11)
(material-mo-pizza colorlayer img)
)
;(gimp-drawable-edit-fill colorlayer 0)
(gimp-selection-none img)
(if (= merge 1)
(begin
(set! origmask (car (gimp-layer-get-mask drawable)))
(if (> origmask -1)
(begin
(set! origmask (car (gimp-channel-copy origmask)))
(gimp-layer-remove-mask drawable 1)
)
)
(set! alphamask (car (gimp-layer-create-mask drawable 3)))
(set! colorlayer (car (gimp-image-merge-down img colorlayer 0)))
(gimp-item-set-name colorlayer layername)
(gimp-layer-add-mask colorlayer alphamask)
(gimp-layer-remove-mask colorlayer 0)
(if (> origmask -1)
(gimp-layer-add-mask colorlayer origmask)
)
)
(begin
(gimp-image-select-item img 2 drawable)
(if (> (car (gimp-layer-get-mask drawable)) -1)
(gimp-image-select-item img 3 (car (gimp-layer-get-mask drawable)))
)
(set! alphamask (car (gimp-layer-create-mask colorlayer 4)))
(gimp-layer-add-mask colorlayer alphamask)
(gimp-layer-remove-mask colorlayer 0)
)
)
(gimp-context-set-foreground origfgcolor)
(gimp-image-select-item img 2 origselection)
(gimp-image-remove-channel img origselection)
(gimp-displays-flush)
)
(gimp-image-undo-group-end img)
)
(script-fu-register "script-fu-layerfx-material-mo-overlay"
"Material Overlay..."
"Overlays a material over a layer."
"vitforlinux"
"based on Jonathan Stipe work"
"January 2022"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-OPTION "Fill with Material" list-material-mo-dir
SF-ADJUSTMENT "Opacity" '(100 0 100 1 10 1 0)
SF-OPTION "Blending Mode" '("Normal" "Dissolve" "Multiply" "Divide" "Screen" "Overlay" "Dodge" "Burn" "Hard Light" "Soft Light" "Grain Extract" "Grain Merge" "Difference" "Addition" "Subtract" "Darken Only" "Lighten Only" "Hue" "Saturation" "Color" "Value")
SF-TOGGLE "Merge with layer" FALSE)
(script-fu-menu-register "script-fu-layerfx-material-mo-overlay" "<Image>/Layer/Layer Effects By Jon Stipe 299/")
;(script-fu-menu-register "script-fu-layerfx-material-mo-overlay" "<Layers>/Layer Effects By Jon Stipe 299/")