|
23 | 23 | ; Rel 0.01 - Initial Release
|
24 | 24 | ; Rel 0.02 - Added Alpha-to-Logo script, Improved Logo script, and changed name to Snow Cover.scm
|
25 | 25 | ; Rel 0.03 - Updated to Gimp-2.10.22
|
| 26 | +; Rel 0.04 - Updated to GIMP-2.10.36 on 2/12/2023 |
26 | 27 | ;
|
27 | 28 | ; Gradients blend direction list
|
28 | 29 | (define list-blend-dir '("Left to Right" "Top to Bottom" "Diagonal to centre" "Diagonal from centre"))
|
|
41 | 42 | ;
|
42 | 43 | (define (script-fu-snow-cover-alpha image layer
|
43 | 44 | depth
|
| 45 | + snowupdown |
44 | 46 | conserve
|
45 | 47 | )
|
46 | 48 |
|
|
55 | 57 | (snowtop-layer 0)
|
56 | 58 | (snowshadow-layer 0)
|
57 | 59 | (ver 2.8)
|
| 60 | + (adjustoffset 1) |
| 61 | + (calcoffset 0) |
58 | 62 | )
|
| 63 | + ;(gimp-message "Snow cover alpha start") |
| 64 | + (gimp-progress-pulse) |
59 | 65 | (cond ((not (defined? 'gimp-image-get-item-position)) (set! ver 2.6))) ;define the gimp version
|
60 | 66 |
|
61 | 67 | (gimp-context-push)
|
62 | 68 | (gimp-context-set-paint-method "gimp-paintbrush")
|
63 |
| - (cond ((defined? 'gimp-context-set-dynamics) (gimp-context-set-dynamics "Dynamics Off"))) |
| 69 | + ;(cond ((defined? 'gimp-context-set-dynamics) (gimp-context-set-dynamics "Dynamics Off"))) |
| 70 | + (gimp-context-set-dynamics "Dynamics Off") |
64 | 71 | (gimp-context-set-foreground '(0 0 0))
|
65 | 72 | (gimp-context-set-background '(255 255 255))
|
66 | 73 |
|
67 |
| - ;;;;begin the script |
| 74 | + ;;;;begin the script |
68 | 75 | (cond ((= ver 2.8) (gimp-image-select-item image 2 layer))
|
69 | 76 | (else (gimp-selection-layer-alpha layer))
|
70 |
| - ) ;endcond |
| 77 | + ) ;endcond |
| 78 | + |
| 79 | + ;(gimp-message "line74") |
| 80 | + ;(gimp-display-new image) |
| 81 | + ;(gimp-displays-flush) |
| 82 | + ;(quit) |
| 83 | + (gimp-progress-update 0.2) |
| 84 | + |
71 | 85 | (set! snow-layer (car (gimp-layer-new image width height RGBA-IMAGE "Snow Template" 100 LAYER-MODE-NORMAL)))
|
72 | 86 | (include-layer image snow-layer layer 0) ;stack 0=above 1=below
|
73 | 87 | (gimp-edit-fill snow-layer FILL-BACKGROUND)
|
| 88 | + |
| 89 | + |
74 | 90 | (gimp-layer-set-offsets snow-layer 0 (- 0 depth))
|
75 | 91 | (gimp-edit-clear snow-layer)
|
76 | 92 | (gimp-selection-none image)
|
77 | 93 | (gimp-selection-layer-alpha snow-layer)
|
| 94 | + |
| 95 | + ; optional grow the selection - make into another adjust value >0 |
| 96 | + ;(gimp-selection-grow image 2) |
| 97 | + ; |
78 | 98 | (script-fu-distress-selection image
|
79 | 99 | snow-layer
|
80 | 100 | 127 ;Threshold (bigger 1<-->255 smaller)
|
|
83 | 103 | 2 ;Smooth (2 1 150 1 10 0 1)
|
84 | 104 | TRUE ;Smooth horizontally TRUE
|
85 | 105 | TRUE) ;Smooth vertically TRUE
|
| 106 | + |
| 107 | + ; alt distress |
| 108 | + ;(script-fu-distress-selection image |
| 109 | + ; snow-layer |
| 110 | + ; 127 ;Threshold (bigger 1<-->255 smaller) |
| 111 | + ; 2 ;Spread (8 0 1000 1 10 0 1) |
| 112 | + ; 4 ;Granularity (1 is low) (4 1 25 1 10 0 1) |
| 113 | + ; 2 ;Smooth (2 1 150 1 10 0 1) |
| 114 | + ; TRUE ;Smooth horizontally TRUE |
| 115 | + ; TRUE) ;Smooth vertically TRUE |
| 116 | + |
| 117 | + |
| 118 | + |
86 | 119 | (gimp-item-set-visible snow-layer FALSE)
|
87 | 120 |
|
88 | 121 | (set! snowtop-layer (car (gimp-layer-new image width height RGBA-IMAGE "Snow Topping" 100 LAYER-MODE-NORMAL)))
|
89 |
| - (include-layer image snowtop-layer snow-layer 0) ;stack 0=above 1=below |
| 122 | + (include-layer image snowtop-layer snow-layer 0) ;stack 0=above 1=below |
90 | 123 | (gimp-context-set-background '(243 243 255))
|
91 | 124 | (gimp-edit-fill snowtop-layer FILL-BACKGROUND)
|
92 | 125 | (gimp-selection-none image)
|
93 | 126 | (plug-in-gauss-rle2 RUN-NONINTERACTIVE image snowtop-layer 3 3)
|
94 | 127 | (cond ((= ver 2.8)
|
95 |
| - (gimp-context-set-sample-threshold-int 25) |
96 |
| - (gimp-context-set-antialias TRUE) |
97 |
| - (gimp-image-select-color image 2 snowtop-layer '(243 243 255))) |
98 |
| - (else (gimp-by-color-select snowtop-layer '(243 243 255) 25 2 TRUE FALSE 0 FALSE)) |
| 128 | + (gimp-context-set-sample-threshold-int 55) ; was 25 |
| 129 | + (gimp-context-set-antialias TRUE) |
| 130 | + (gimp-image-select-color image 2 snowtop-layer '(243 243 255)) |
| 131 | + ) |
| 132 | + (else (gimp-by-color-select snowtop-layer '(243 243 255) 25 2 TRUE FALSE 0 FALSE)) |
99 | 133 | ) ;endcond
|
100 | 134 | (gimp-edit-fill snowtop-layer FILL-BACKGROUND)
|
101 | 135 |
|
102 | 136 | (set! snowshadow-layer (car (gimp-layer-new image width height RGBA-IMAGE "Snow Shadow" 100 LAYER-MODE-NORMAL)))
|
103 | 137 | (include-layer image snowshadow-layer snowtop-layer 0) ;stack 0=above 1=below
|
104 | 138 | (gimp-context-set-background '(149 149 207))
|
105 | 139 | (gimp-edit-fill snowshadow-layer FILL-BACKGROUND)
|
106 |
| - (gimp-layer-set-offsets snowshadow-layer 0 (/ depth 2)) |
| 140 | + ;(gimp-layer-set-offsets snowshadow-layer 0 (+ 0 5)) |
| 141 | + (gimp-layer-set-offsets snowshadow-layer 0 (/ depth 2.0)) ; was depth/2 |
| 142 | + ; |
| 143 | + ;(gimp-layer-set-offsets snowshadow-layer 0 snowupdown) |
| 144 | + |
107 | 145 | (gimp-edit-clear snowshadow-layer)
|
108 | 146 | (gimp-layer-set-offsets snowshadow-layer 0 -1)
|
109 | 147 | (gimp-selection-invert image)
|
|
113 | 151 | (gimp-selection-none image)
|
114 | 152 | (plug-in-gauss-rle2 RUN-NONINTERACTIVE image snowtop-layer 3 3)
|
115 | 153 |
|
116 |
| - ;;;;finish the script |
117 |
| - (if (= conserve FALSE) (begin |
| 154 | + ;(gimp-message "line154") |
| 155 | + ;(gimp-display-new image) |
| 156 | + ;(gimp-displays-flush) |
| 157 | + ;(quit) |
| 158 | + (gimp-progress-update 0.4) |
| 159 | + |
| 160 | + (set! calcoffset (+ 0 snowupdown)) |
| 161 | + (gimp-layer-set-offsets snowshadow-layer 0 calcoffset ) |
| 162 | + (gimp-layer-set-offsets snowtop-layer 0 calcoffset) |
| 163 | + ;(gimp-layer-set-offsets snow-layer 0 calcoffset) |
| 164 | + |
| 165 | + ;(gimp-message "line162") |
| 166 | + ;(gimp-display-new image) |
| 167 | + ;(gimp-displays-flush) |
| 168 | + ;(quit) |
| 169 | + (gimp-progress-update 0.8) |
| 170 | + |
| 171 | + ;;;;finish the script |
| 172 | + (if (= conserve FALSE) |
| 173 | + (begin |
118 | 174 | (gimp-image-remove-layer image snow-layer)
|
119 | 175 | (set! layer (car (gimp-image-merge-down image snowtop-layer EXPAND-AS-NECESSARY)))
|
120 | 176 | (set! layer (car (gimp-image-merge-down image snowshadow-layer EXPAND-AS-NECESSARY)))
|
|
123 | 179 | (cond ((= ver 2.8) (gimp-item-set-name layer (string-append layer-name "\nSnow")))
|
124 | 180 | (else (gimp-drawable-set-name layer (string-append layer-name "\nSnow")))
|
125 | 181 | ) ;endcond
|
| 182 | + (gimp-progress-update 1.0) |
126 | 183 |
|
127 | 184 | (gimp-displays-flush)
|
128 | 185 | (gimp-image-undo-group-end image)
|
|
140 | 197 | "RGB*"
|
141 | 198 | SF-IMAGE "image" 0
|
142 | 199 | SF-DRAWABLE "drawable" 0
|
143 |
| - SF-ADJUSTMENT "Snow Depth" '(10 0 50 1 10 0 0) |
| 200 | + SF-ADJUSTMENT "Snow Depth" '(10 0 70 1 10 0 0) |
| 201 | + SF-ADJUSTMENT "Snow Depth updown adjustment" '(2 -50 50 1 10 0 0) |
144 | 202 | SF-TOGGLE "Keep the Layers" FALSE
|
145 | 203 | )
|
146 | 204 |
|
|
159 | 217 | gradient-type
|
160 | 218 | reverse
|
161 | 219 | blendir
|
| 220 | + thinfontadjust |
| 221 | + additionaladjustment |
162 | 222 | conserve
|
163 | 223 | )
|
164 | 224 | (let* (
|
|
182 | 242 | (x2 0)
|
183 | 243 | (y2 0)
|
184 | 244 | (ver 2.8)
|
| 245 | + (calcoffset 0) |
| 246 | + (adjustoffset 0) |
| 247 | + (shrinkamount 3) |
185 | 248 | )
|
| 249 | + |
| 250 | + ;(gimp-message "snow cover logo start") |
| 251 | + (gimp-progress-update 0.05) |
186 | 252 | (cond ((not (defined? 'gimp-image-get-item-position)) (set! ver 2.6))) ;define the gimp version
|
187 | 253 |
|
188 | 254 | (gimp-context-push)
|
|
205 | 271 | ;;;;start of script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
206 | 272 | ;;;;save the selection
|
207 | 273 | (cond ((= ver 2.8) (gimp-image-select-item image 2 text-layer))
|
208 |
| - (else (gimp-selection-layer-alpha text-layer))) |
| 274 | + (else (gimp-selection-layer-alpha text-layer))) |
| 275 | + |
209 | 276 | (set! text-selection (car (gimp-selection-save image))) ;(gimp-selection-load text-selection)
|
210 | 277 | (gimp-selection-none image)
|
211 | 278 |
|
|
214 | 281 | (include-layer image innermap text-layer 1) ;stack 0=above 1=below
|
215 | 282 | (gimp-context-set-foreground '(255 255 255))
|
216 | 283 | (gimp-edit-fill innermap FILL-FOREGROUND)
|
| 284 | + |
| 285 | + ; added by karlhof26 |
| 286 | + ;(gimp-message "line222") |
| 287 | + (gimp-progress-update 0.4) |
| 288 | + ; calc offsets to allow fine tuning |
| 289 | + ;(set! calcoffset (+ (- 0 depth) adjustoffset)) |
| 290 | + ; adjust the exact position by a few pixels; positive for down;neg for up |
| 291 | + ;(gimp-layer-set-offsets innermap 0 snowupdown) |
| 292 | + |
217 | 293 | (gimp-selection-load text-selection)
|
218 |
| - (gimp-selection-shrink image 3) |
| 294 | + (if (= thinfontadjust TRUE) |
| 295 | + (begin |
| 296 | + ;no shrink; shrink is off |
| 297 | + ) |
| 298 | + (begin |
| 299 | + ;default for normal and fat fonts |
| 300 | + (gimp-selection-shrink image shrinkamount) |
| 301 | + ) |
| 302 | + ) |
219 | 303 | (gimp-context-set-foreground '(0 0 0))
|
220 | 304 | (gimp-edit-fill innermap FILL-FOREGROUND)
|
221 | 305 | (gimp-selection-none image)
|
|
241 | 325 | 1)
|
242 | 326 |
|
243 | 327 | (gimp-selection-load text-selection)
|
244 |
| - (gimp-selection-shrink image 2) |
| 328 | + (if (= thinfontadjust TRUE) |
| 329 | + (begin |
| 330 | + ; it is off |
| 331 | + ) |
| 332 | + (begin |
| 333 | + (gimp-selection-shrink image (- shrinkamount 1)) |
| 334 | + ) |
| 335 | + ) |
| 336 | + |
245 | 337 | (set! masktext (car (gimp-layer-create-mask text-layer ADD-MASK-SELECTION)))
|
246 | 338 | (gimp-layer-add-mask text-layer masktext)
|
247 | 339 | (gimp-selection-none image)
|
248 | 340 | (plug-in-gauss-rle2 1 image masktext 1 1)
|
249 | 341 | (gimp-layer-remove-mask text-layer MASK-APPLY)
|
| 342 | + |
| 343 | + (gimp-progress-update 0.7) |
| 344 | + ;(gimp-message "line260") |
| 345 | + ;(gimp-display-new image) |
| 346 | + ;(gimp-displays-flush) |
| 347 | + ;(quit); |
| 348 | + |
250 | 349 | (gimp-image-remove-layer image innermap)
|
251 | 350 | (gimp-image-remove-channel image text-selection)
|
252 | 351 |
|
253 | 352 |
|
254 | 353 | ;;;;create the background layer
|
255 | 354 | ;;;;create the background layer
|
256 | 355 | (cond ((not (= bkg-type 0))
|
257 |
| - (set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL))) |
258 |
| - (include-layer image bkg-layer text-layer 1) ;stack 0=above 1=below |
| 356 | + (set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL))) |
| 357 | + (include-layer image bkg-layer text-layer 1) ;stack 0=above 1=below |
| 358 | + (gimp-progress-update 0.75) |
| 359 | + ;(gimp-message "line 274 bkg not 0") |
259 | 360 | )
|
260 | 361 | ) ;endcond
|
261 | 362 | (gimp-context-set-pattern pattern)
|
262 | 363 | (gimp-context-set-background bkg-color)
|
263 | 364 | (gimp-context-set-gradient gradient)
|
| 365 | + |
264 | 366 | (if (or (= bkg-type 3) (= bkg-type 4))
|
265 | 367 | (begin
|
266 | 368 | (gimp-context-set-foreground active-fg)
|
|
289 | 391 | (gimp-edit-blend bkg-layer BLEND-CUSTOM LAYER-MODE-NORMAL gradient-type 100 0 REPEAT-NONE reverse FALSE 3 0.2 TRUE x1 y1 x2 y2)
|
290 | 392 | )
|
291 | 393 | ) ;endif
|
292 |
| - |
293 |
| - |
294 |
| - |
| 394 | + |
| 395 | + (gimp-progress-update 0.8) |
| 396 | + ;(gimp-message "line351") |
| 397 | + ;(gimp-display-new image) |
| 398 | + ;(gimp-displays-flush) |
| 399 | + ;(quit); |
| 400 | + ;(gimp-message "line314 off to alpha") |
| 401 | + |
| 402 | + (if (> depth 26) |
| 403 | + (begin |
| 404 | + ;(gimp-message "setadjust for large snow depths") |
| 405 | + (set! adjustoffset (+ additionaladjustment (round (* 0.52 depth)))) ; worked at 0.60 |
| 406 | + ) |
| 407 | + (begin |
| 408 | + ;(gimp-message "setadjust for small snow depths") |
| 409 | + (set! adjustoffset additionaladjustment) |
| 410 | + ) |
| 411 | + ) |
295 | 412 | ;;;;resize the text-layer
|
296 | 413 | (gimp-image-set-active-layer image text-layer)
|
297 | 414 | (script-fu-snow-cover-alpha image
|
298 | 415 | text-layer
|
299 | 416 | depth
|
| 417 | + adjustoffset |
300 | 418 | conserve)
|
301 | 419 | ; (gimp-layer-resize-to-image-size text-layer)
|
302 | 420 |
|
|
313 | 431 | )
|
314 | 432 | )
|
315 | 433 | (script-fu-register "script-fu-snow-cover-logo"
|
316 |
| - "Snow Cover Logo..." |
317 |
| - "Create a Logo covered in a snow drift \nfile: Snow Cover.scm" |
318 |
| - "Graechan" |
319 |
| - "Graechan - http://gimpchat.com" |
320 |
| - "Dec 2013" |
321 |
| - "" |
322 |
| - SF-TEXT "Text" "SEASONS\nGREETINGS" |
323 |
| - SF-COLOR "Text color" '(255 0 0) |
324 |
| - SF-FONT "Font" "Arial Bold" |
325 |
| - SF-ADJUSTMENT "Font size (pixels)" '(250 6 500 1 1 0 1) |
326 |
| - SF-ADJUSTMENT "Snow Depth" '(10 0 50 1 10 0 0) |
327 |
| - SF-OPTION "Background Type" '("None" "Color" "Pattern" "Gradient" "Active Gradient") |
328 |
| - SF-PATTERN "Pattern" "Pink Marble" |
329 |
| - SF-COLOR "Background color" "Blue" |
330 |
| - SF-GRADIENT "Background Gradient" "Abstract 3" |
331 |
| - SF-ENUM "Gradient Fill Mode" '("GradientType" "gradient-linear") |
332 |
| - SF-TOGGLE "Reverse the Gradient" FALSE |
333 |
| - SF-OPTION "Blend Direction" list-blend-dir |
334 |
| - SF-TOGGLE "Keep the Layers" FALSE |
| 434 | + "Snow Cover Logo..." |
| 435 | + "Create a Logo covered in a snow drift. Turn thin font adjustment on for very thin fonts. Use addtionaladjustment to lower snow onto letters. \nfile: Snow Cover.scm" |
| 436 | + "Graechan" |
| 437 | + "Graechan - http://gimpchat.com" |
| 438 | + "Dec 2013" |
| 439 | + "" |
| 440 | + SF-TEXT "Text" "SEASONS\nGREETINGS" |
| 441 | + SF-COLOR "Text color" '(255 0 0) |
| 442 | + SF-FONT "Font" "Arial Bold" |
| 443 | + SF-ADJUSTMENT "Font size (pixels)" '(250 6 500 1 1 0 1) |
| 444 | + SF-ADJUSTMENT "Snow Depth" '(10 0 50 1 10 0 0) |
| 445 | + SF-OPTION "Background Type" '("None" "Color" "Pattern" "Gradient" "Active Gradient") |
| 446 | + SF-PATTERN "Pattern" "Pink Marble" |
| 447 | + SF-COLOR "Background color" "Blue" |
| 448 | + SF-GRADIENT "Background Gradient" "Abstract 3" |
| 449 | + SF-ENUM "Gradient Fill Mode" '("GradientType" "gradient-linear") |
| 450 | + SF-TOGGLE "Reverse the Gradient" FALSE |
| 451 | + SF-OPTION "Blend Direction" list-blend-dir |
| 452 | + SF-TOGGLE "Thin font adjustment " FALSE |
| 453 | + SF-ADJUSTMENT "Additional adjustment" '(1 -30 70 1 10 0 0) |
| 454 | + SF-TOGGLE "Keep the Layers" FALSE |
| 455 | + |
335 | 456 | )
|
336 | 457 |
|
337 | 458 | (script-fu-menu-register "script-fu-snow-cover-logo" "<Image>/Script-Fu/Logos" )
|
|
0 commit comments