-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmap300.scm
710 lines (638 loc) · 28.4 KB
/
Emap300.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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
;Modernized with ModernizeMatic7 for Gimp 2.10.22 by vitforlinux.wordpress.com - dont remove
; Emap rel 0.01
; Created by Graechan using the 'Environment script' from GnuTux and a highlight technique from Espers 'Science Labs'
; the default Logo font is from http://www.fontstock.net/10277/pt-banana-split.html
; Comments directed to http://gimpchat.com or http://gimpscripts.com
;
; License: GPLv3
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; To view a copy of the GNU General Public License
; visit: http://www.gnu.org/licenses/gpl.html
;
;
; ------------
;| Change Log |
; ------------
; Rel 0.01 - Initial Release
; Rel 2.99.16 - Port to Gimp 2.99.16 and 2.10.34 Vitforlinux
; Gradients blend direction list
(define list-blend-dir '("Left to Right" "Top to Bottom" "Diagonal to centre" "Diagonal from centre"))
;
; 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-image-get-width)) (define gimp-image-get-width gimp-image-width)))
(cond ((not (defined? 'gimp-image-get-height)) (define gimp-image-get-height gimp-image-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 "QTFloraline Bold")
(define sffont "QTFloraline-Bold"))
(define (apply-drop-shadow img fond x y blur color opacity number) (begin
(gimp-image-select-item img 2 fond)
(gimp-selection-translate img x y)
(gimp-selection-feather img blur)
(gimp-context-set-foreground color)
(gimp-context-set-opacity opacity)
(gimp-image-select-item img 1 fond)
(gimp-drawable-edit-fill fond FILL-FOREGROUND)
(gimp-context-set-opacity 100)
(gimp-selection-none img)
))
(define (remove-color img fond color)(begin
;(plug-in-colortoalpha RUN-NONINTERACTIVE image highlight '(128 128 128))
(gimp-image-select-color img 2 fond color)
(gimp-drawable-edit-fill fond FILL-TRANSPARENT)
(gimp-selection-none img)
))
(define (apply-gauss img drawable x y)(begin (if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(plug-in-gauss 1 img drawable x y 0)
(plug-in-gauss 1 img drawable (* x 0.32) (* y 0.32) 0) )))
; Include layer Procedure
(define (include-layer image newlayer oldlayer stack) ;stack 0=above 1=below
(cond ((defined? 'gimp-image-get-item-position) ;test for 2.8 compatability
(gimp-image-insert-layer image newlayer (car (gimp-item-get-parent oldlayer))
(+ (car (gimp-image-get-item-position image oldlayer)) stack)) ;For GIMP 2.8
)
(else
(gimp-image-insert-layer image newlayer (+ (car (gimp-image-get-item-position image oldlayer)) 0 stack)) ;For GIMP 2.6
)
) ;end cond
) ;end include layer procedure
;
;find layer by name proceedure
;
(define (script-fu-emap300-logo
text
font-in
font-size
justification
letter-spacing
line-spacing
grow-text
outline
map-type ; Environment Map Type
paint-mode ; Selected Paint Mode For Use WIth Blend Plug-in
blend-direction ; Blend Direction
blend-shape ; Blend Shape
emap-gradient ; Selected Gradient For Environment Map
texturesizex ; Drawable Width
texturesizey ; Drawable Height
blur-radius ; Gaussian Blur Radius
turbulent
hl-dist
ds-off
ds-blur
bkg-type
conserve
)
(let* (
(image (car (gimp-image-new 256 256 RGB)))
(border (/ font-size 4))
(font font-in)
(size-layer (car (gimp-text-fontname image -1 0 0 text border TRUE font-size PIXELS font)))
(final-width (car (gimp-drawable-get-width size-layer)))
(final-height (car (gimp-drawable-get-height size-layer)))
(text-layer 0)
(width 0)
(height 0)
(bkg-layer 0)
(ver 2.8)
(justification (cond ((= justification 0) 2)
((= justification 1) 0)
((= justification 2) 1)
((= justification 3) 3)))
)
;(cond ((not (defined? 'gimp-image-get-item-position)) (set! ver 2.6))) ;define the gimp version
(gimp-context-push)
(gimp-context-set-paint-mode 0)
(gimp-context-set-paint-method "gimp-paintbrush")
;(cond ((defined? 'gimp-context-set-dynamics) (gimp-context-set-dynamics "Dynamics Off")))
(cond ((defined? 'gimp-context-set-dynamics) (gimp-context-set-dynamics "Pressure Opacity")))
(if (defined? 'gimp-context-enable-dynamics) (gimp-context-enable-dynamics FALSE))
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
;;;;Add the text layer for a temporary larger Image size
(set! text-layer (car (gimp-text-fontname image -1 0 0 text (round (/ 250 4)) TRUE 250 PIXELS font)))
(gimp-item-set-name text-layer "Text")
;;;;adjust text
;(gimp-text-layer-set-justification text-layer 2)
(gimp-text-layer-set-letter-spacing text-layer letter-spacing) ; Set Letter Spacing
(gimp-text-layer-set-justification text-layer justification) ; Text Justification (Rev Value)
(gimp-text-layer-set-line-spacing text-layer line-spacing) ; Set Line Spacing
;;;;set the new width and height
(set! width (car (gimp-drawable-get-width text-layer)))
(set! height (car (gimp-drawable-get-height text-layer)))
(gimp-image-remove-layer image size-layer)
(gimp-image-resize-to-layers image)
;;;;;; SHRINK/GROW text
(cond ((> grow-text 0)
(gimp-selection-none image)
(gimp-image-select-item image 2 text-layer)
(gimp-selection-grow image (round grow-text))
(gimp-drawable-edit-fill text-layer FILL-FOREGROUND)
)
((< grow-text 0)
(gimp-selection-none image)
(gimp-image-select-item image 2 text-layer)
(gimp-drawable-edit-clear text-layer)
(gimp-selection-shrink image (- grow-text))
(gimp-drawable-edit-fill text-layer FILL-FOREGROUND)
))
;;; outline
(cond ((> outline 0)
(gimp-selection-none image)
(gimp-image-select-item image 2 text-layer)
(gimp-selection-shrink image (round outline))
(gimp-drawable-edit-clear text-layer)
(gimp-image-select-item image 2 text-layer)
))
;;;;set the text clolor
(cond ((= ver 2.8) (gimp-image-select-item image 2 text-layer))
(else (gimp-selection-layer-alpha text-layer)))
(gimp-drawable-edit-fill text-layer FILL-FOREGROUND)
(gimp-selection-none image)
;;;;begin the script
(script-fu-emap300-alpha image text-layer
map-type ; Environment Map Type
paint-mode ; Selected Paint Mode For Use WIth Blend Plug-in
blend-direction ; Blend Direction
blend-shape ; Blend Shape
emap-gradient ; Selected Gradient For Environment Map
texturesizex ; Drawable Width
texturesizey ; Drawable Height
blur-radius ; Gaussian Blur Radius
turbulent
.2
1
.5
27
hl-dist
ds-off
ds-blur
bkg-type
conserve)
;;;;Scale Image to it's original size;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gimp-image-scale image final-width final-height )
(set! width (car (gimp-image-get-width image)))
(set! height (car (gimp-image-get-height image)))
(gimp-context-pop)
(gimp-display-new image)
)
)
(script-fu-register "script-fu-emap300-logo"
"Emap Logo 300"
"The default font is from https://www.dafontfree.net/pt-banana-split-normal/f64465.htm"
"Graechan"
"Graechan - http://gimpchat.com"
"June 2011"
""
SF-TEXT "Text" "Emap"
SF-FONT "Font" sffont
SF-ADJUSTMENT "Font size (pixels)" '(250 6 500 1 1 0 1)
SF-OPTION _"Text Justification" '("Centered" "Left" "Right" "Fill")
SF-ADJUSTMENT _"Letter Spacing" '(0 -50 50 1 5 0 0)
SF-ADJUSTMENT _"Line Spacing" '(0 -300 300 1 10 0 0)
SF-ADJUSTMENT _"Shrink / Grow Text" '(0 -20 20 1 10 0 0)
SF-ADJUSTMENT _"Outline" '(0 0 20 1 10 0 0)
SF-OPTION _"Map Type" '("Topographical" "Cloud")
SF-OPTION "Blending Mode" '("Normal" "Dissolve" "Behind" "Multiply" "Screen" "Overlay" "Difference" "Addition" "Subtract" "Darken" "Lighten" "Hue" "Saturation" "Color" "Value" "Divide" "Dodge" "Burn" "Hard Light" "Soft Light" "Grain Extract" "Grain Merge")
SF-OPTION _"Blend Direction" '("Top-Botton" "Bottom-Top" "Left-Right" "Right-Left" "Diag-Top-Left" "Diag-Top-Right" "Diag-Bottom-Left" "Diag-Bottom-Right")
SF-OPTION _"Blend Shape" '("Linear""Bilinear" "Radial" "Square" "Conical-Symmetric" "Conical-Asymmetric" "Shapeburst-Angular" "Shapburst-Spherical" "Shapeburst-Dimpled" "Spiral-CW" "Spiral-CCW")
SF-GRADIENT _"Select Gradient" "Tropical Colors"
SF-ADJUSTMENT _"Horizontal Texture Size" '(2.8 1 5 .1 .5 1 1)
SF-ADJUSTMENT _"Vertical Texture Size" '(2.8 1 5 .1 .5 1 1)
SF-ADJUSTMENT _"Blur Radius" '(5 0 30 1 5 0 1)
SF-TOGGLE _"Turbulent Noise" TRUE
SF-ADJUSTMENT "Highlight Dist fr Edge" '(6 0 10 1 1 0 0)
SF-ADJUSTMENT "Drop Shadow Offset" '(8 0 50 1 1 0 1)
SF-ADJUSTMENT "Drop Shadow Blur" '(15 0 100 1 5 0 1)
SF-OPTION "Background Type" '("Transparency" "From Gradient" "Environment Map")
SF-TOGGLE "Keep the Layers" FALSE
)
(script-fu-menu-register "script-fu-emap300-logo" "<Image>/Script-Fu/Logos")
(define (script-fu-emap300-alpha image layer
map-type ; Environment Map Type
paint-mode ; Selected Paint Mode For Use WIth Blend Plug-in
blend-direction ; Blend Direction
blend-shape ; Blend Shape
emap-gradient ; Selected Gradient For Environment Map
texturesizex ; Drawable Width
texturesizey ; Drawable Height
blur-radius ; Gaussian Blur Radius
turbulent
glow
bright
shine
polish
hl-dist
ds-off
ds-blur
bkg-type
conserve)
(gimp-image-undo-group-start image)
(let* (
(width (car (gimp-image-get-width image)))
(height (car (gimp-image-get-height image)))
(bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL-LEGACY)))
(highlight (car (gimp-layer-new image width height RGBA-IMAGE "Highlight" 100 LAYER-MODE-NORMAL-LEGACY)))
(alpha (car (gimp-drawable-has-alpha layer)))
(sel (car (gimp-selection-is-empty image)))
(layer-name (cond ((defined? 'gimp-image-get-item-position) (car (gimp-item-get-name layer)))
(else (car (gimp-drawable-get-name layer)))))
(selection-channel 0)
(bump-channel 0)
(highlight-channel 0)
(auto-hsv TRUE)
(detail-level 1)
(ver 2.8)
)
(cond ((not (defined? 'gimp-image-get-item-position)) (set! ver 2.6))) ;define the gimp version
(gimp-context-push)
(gimp-context-set-paint-mode 0)
(gimp-context-set-paint-method "gimp-paintbrush")
(cond ((defined? 'gimp-context-set-dynamics) (gimp-context-set-dynamics "Pressure Opacity")))
(if (defined? 'gimp-context-enable-dynamics) (gimp-context-enable-dynamics FALSE))
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
(if (= alpha FALSE) (gimp-layer-add-alpha layer))
;;;;check that a selection was made if not make one
(if (= sel TRUE) (begin
(cond ((= ver 2.8) (gimp-image-select-item image 2 layer))
(else (gimp-selection-layer-alpha layer))
) ;endcond
)
)
;;;;create selection-channel (gimp-image-select-item image 2 selection-channel)
(set! selection-channel (car (gimp-selection-save image)))
(cond ((= ver 2.8) (gimp-item-set-name selection-channel "selection-channel"))
(else (gimp-item-set-name selection-channel "selection-channel"))
) ;endcond
;;;;create bump-channel (gimp-image-select-item image 2 bump-channel) ;---------------------------------------------create the bump channel
(set! bump-channel (car (gimp-selection-save image)))
(cond ((= ver 2.8) (gimp-item-set-name bump-channel "bump-channel"))
(else (gimp-item-set-name bump-channel "bump-channel"))
) ;endcond
(gimp-selection-none image)
;;;;begin the script
(apply-gauss image bump-channel 10 10) ;-------------------------------------blur the bump-channel
;(gimp-image-set-active-layer image layer)
(include-layer image bkg-layer layer 1) ;stack 0=above 1=below ;---------------------------------------add layer for environment map
(the-environment-map
image ; Image
bkg-layer ; Drawable
map-type ; Environment Map Type
paint-mode ; Selected Paint Mode For Use WIth Blend Plug-in
blend-direction ; Blend Direction
blend-shape ; Blend Shape
emap-gradient ; Selected Gradient For Environment Map
detail-level ; Detail Level For Solid Noise Plug-in
texturesizex ; Drawable Width
texturesizey ; Drawable Height
blur-radius ; Gaussian Blur Radius
auto-hsv ; Autostretch HSV Flag
turbulent) ; Turbulance Flag
;(set! bkg-layer (car (gimp-image-get-active-layer image)))
;(gimp-image-set-active-layer image layer)
(cond ((= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(plug-in-lighting 1
image ; IMAGE
layer ; DRAWABLE
bump-channel ; BUMP MAP (set to valid drawable)
bkg-layer ; ENVIRONMENT MAP (set to 0 if disabled)
FALSE ; ENABLE BUMPMAPPING
TRUE ; ENABLE ENVMAPPING
2 ; TYPE OF MAPPING (0=linear,1=log, 2=sinusoidal, 3=spherical)
1 ; TYPE OF LIGHTSOURCE (0=point,1=directional,3=spot,4=none)
'(255 255 255) ; LIGHTSOURCE COLOR
-1.63 ; LIGHTSOURCE POS X
-1.25 ; LIGHTSOURCE POS Y
1 ; LIGHTSOURCE POS Z
-1 ; LIGHTSOURCE DIR X
-1 ; LIGHTSOURCE DIR Y
1 ; LIGHTSOURCE DIR Z
glow ; AMBIANT INTENSITY (GLOWING)0.20
0.50 ; DIFFUSE INTENSITY (BRIGHT)0.50
bright ; DIFFUSE REFLECTIVITY (INTENSITY)1
shine ; SPECULAR REFLECTIVITY (SHINY)0.50
polish ; HIGHLIGHT (POLISHED)27
TRUE ; ANTIALIASING
FALSE ; CREATE NEW IMAGE
FALSE) ; MAKE BACKGROUND TRANSPARENT
)
(else
(plug-in-lighting
1 ;ok
image ; IMAGE ok
;1 ;ok
(vector layer ) ; DRAWABLE ok
bump-channel ; BUMP MAP (set to valid drawable)ok
bkg-layer ; ENVIRONMENT MAP (set to 0 if disabled)
FALSE ; ENABLE BUMPMAPPING ok
TRUE ; ENABLE ENVMAPPING ok
"bumpmap-sinusoidal" ; TYPE OF MAPPING (0=linear,1=log, 2=sinusoidal, 3=spherical)ok
1 ; max height bumpmapping ok
"light-directional" ;TYPE OF LIGHTSOURCE (0=point,1=directional,3=spot,4=none) ok
'(255 255 255) ; LIGHTSOURCE COLOR ok
1 ; light inteensity NEW
1.63 ; LIGHTSOURCE POS X ok
-1.25 ; LIGHTSOURCE POS Y ok
1 ; LIGHTSOURCE POS Z ok
-1 ; LIGHTSOURCE DIR X ok
-1 ; LIGHTSOURCE DIR Y ok
1 ; LIGHTSOURCE DIR Z ok
glow ; AMBIANT INTENSITY (GLOWING)0.20 ok
0.50 ; DIFFUSE INTENSITY (BRIGHT)0.50 ok
bright ; DIFFUSE REFLECTIVITY (INTENSITY)1 GUARDA QUI !! ok
shine ; SPECULAR REFLECTIVITY (SHINY)0.50
0.55 ;polish ; material HIGHLIGHT (POLISHED)27 ok
FALSE ; metallic NEW ok
TRUE ; ANTIALIASING
FALSE ; CREATE NEW IMAGE
FALSE; ; MAKE BACKGROUND TRANSPARENT
0.25) ;distance NEW ok
)
)
(plug-in-bump-map RUN-NONINTERACTIVE image layer bump-channel 135 45 40 0 0 0 0 TRUE FALSE 1) ; { LINEAR (0), SPHERICAL (1), SINUSOIDAL (2) }
;;;;create the highlight
(gimp-image-select-item image 2 selection-channel)
(include-layer image highlight layer 0) ;stack 0=above 1=below
(gimp-selection-shrink image hl-dist)
(gimp-context-set-foreground '(128 128 128))
(gimp-drawable-edit-fill highlight FILL-FOREGROUND)
;;;;create highlight-channel (gimp-image-select-item image 2 highlight-channel)
(set! highlight-channel (car (gimp-selection-save image)))
(cond ((= ver 2.8) (gimp-item-set-name highlight-channel "highlight-channel"))
(else (gimp-item-set-name highlight-channel "highlight-channel"))
) ;endcond
(gimp-selection-none image)
(apply-gauss image highlight-channel 5 5)
;(gimp-image-set-active-layer image highlight)
(plug-in-bump-map RUN-NONINTERACTIVE image highlight highlight-channel 135 15 10 0 0 0 1 TRUE FALSE 0) ;{LINEAR(0),SPHERICAL(1),SINUSOIDAL(2)}
;(plug-in-colortoalpha RUN-NONINTERACTIVE image highlight '(128 128 128))
(remove-color image highlight '(128 128 128))
;;;;add a drop shadow
;(script-fu-drop-shadow image layer ds-off ds-off ds-blur "Black" 80 FALSE)
(apply-drop-shadow image layer ds-off ds-off ds-blur "Black" 80 FALSE)
;;;;create alternate bkg
;(gimp-image-set-active-layer image bkg-layer)
(gimp-context-set-gradient emap-gradient)
(cond ((= bkg-type 0) (gimp-layer-add-alpha bkg-layer) (gimp-drawable-edit-clear bkg-layer))
((= bkg-type 1)
; (gimp-edit-blend bkg-layer BLEND-CUSTOM LAYER-MODE-NORMAL-LEGACY GRADIENT-SHAPEBURST-SPHERICAL 100 0 REPEAT-NONE FALSE FALSE 3 0.2 TRUE 0 0 (/ width 2) (/ height 2))
(gimp-drawable-edit-gradient-fill bkg-layer blend-direction
0 ; opacity
0 ; offset
1 ;
1 ;
0
0 0 (/ width 2) (/ height 2)
)
)
) ;endcond
;;;;finish the script
(if (= conserve FALSE) (begin
;(set! layer (car (gimp-image-merge-down image layer EXPAND-AS-NECESSARY)))
(set! layer (car (gimp-image-merge-down image layer EXPAND-AS-NECESSARY)))
(set! layer (car (gimp-image-merge-down image highlight EXPAND-AS-NECESSARY)))
(gimp-image-remove-channel image highlight-channel)
(gimp-image-remove-channel image bump-channel)
(gimp-image-remove-channel image selection-channel)
)) ;endif
; (cond ((= ver 2.8) (gimp-item-set-name layer (string-append layer-name "\n" emap-gradient)))
;(else (gimp-item-set-name layer (string-append layer-name "\n" emap-gradient)))
; ) ;endcond
(if (and (= conserve FALSE) (= alpha FALSE)) (gimp-layer-flatten layer))
(gimp-displays-flush)
;(gimp-image-undo-group-end image)
(gimp-context-pop)
)
)
(script-fu-register "script-fu-emap300-alpha"
"Emap Alpha 300"
"Instructions"
"Graechan"
"Graechan - http://gimpchat.com"
"2012"
"RGB*"
SF-IMAGE "image" 0
SF-DRAWABLE "drawable" 0
SF-OPTION _"Map Type" '("Topographical" "Cloud")
SF-OPTION "Blending Mode" '("Normal" "Dissolve" "Behind" "Multiply" "Screen" "Overlay" "Difference" "Addition" "Subtract" "Darken" "Lighten" "Hue" "Saturation" "Color" "Value" "Divide" "Dodge" "Burn" "Hard Light" "Soft Light" "Grain Extract" "Grain Merge")
SF-OPTION _"Blend Direction" '("Top-Botton" "Bottom-Top" "Left-Right" "Right-Left" "Diag-Top-Left" "Diag-Top-Right" "Diag-Bottom-Left" "Diag-Bottom-Right")
SF-OPTION _"Blend Shape" '("Linear""Bilinear" "Radial" "Square" "Conical-Symmetric" "Conical-Asymmetric" "Shapeburst-Angular" "Shapburst-Spherical" "Shapeburst-Dimpled" "Spiral-CW" "Spiral-CCW")
SF-GRADIENT _"Select Gradient" "Tropical Colors"
SF-ADJUSTMENT _"Horizontal Texture Size" '(2.8 1 5 .1 .5 1 1)
SF-ADJUSTMENT _"Vertical Texture Size" '(2.8 1 5 .1 .5 1 1)
SF-ADJUSTMENT _"Blur Radius" '(5 0 30 1 5 0 1)
SF-TOGGLE _"Turbulent Noise" TRUE
SF-ADJUSTMENT "Glowing" '(.2 0 100000 .01 1 2 1)
SF-ADJUSTMENT "Brightness" '(1 0 1 .01 1 2 1)
SF-ADJUSTMENT "Shiny" '(.5 0 1 .01 1 2 1)
SF-ADJUSTMENT "Polish" '(27 0 100000 .01 1 2 1)
SF-ADJUSTMENT "Highlight Dist fr Edge" '(6 0 10 1 1 0 0)
SF-ADJUSTMENT "Drop Shadow Offset" '(8 0 50 1 1 0 1)
SF-ADJUSTMENT "Drop Shadow Blur" '(15 0 100 1 5 0 1)
SF-OPTION "Background Type" '("Transparency" "From Gradient" "Environment Map")
SF-TOGGLE "Keep the Layers" FALSE
)
(script-fu-menu-register "script-fu-emap300-alpha" "<Image>/Script-Fu/Alpha-to-Logo")
(define (the-environment-map
img ; Image
drawable ; Drawable
map-type ; Environment Map Type
paint-mode ; Selected Paint Mode For Use WIth Blend Plug-in
blend-direction ; Blend Direction
blend-shape ; Blend Shape
emap-gradient ; Selected Gradient For Environment Map
detail-level ; Detail Level For Solid Noise Plug-in
texturesizex ; Drawable Width
texturesizey ; Drawable Height
blur-radius ; Gaussian Blur Radius
auto-hsv ; Autostretch HSV Flag
turbulent) ; Turbulance Flag
;
;Declare Variables
;
(let*
(
(image-height 0) ; Drawable Height For Blend Plug-in
(image-width 0) ; Drawable Width For Blend Plug-in
(xblend-start 0) ; X Blend Starting Point
(yblend-start 0) ; X Blend Starting Point
(xblend-end 0) ; X Blend Ending Point
(yblend-end 0) ; X Blend Ending Point
)
;
; Save Context
;
(gimp-context-push)
; Start Undo Group
;(gimp-undo-push-group-start img)
;(gimp-image-undo-group-start)
;
; Call Solid Noise Plug-in
;
(plug-in-solid-noise
1 ; Interactive
img ; Input Image
drawable ; Imput Drawable
TRUE ; Tileable
turbulent ; Turbulent Noise
(random 999999) ; Random Seed
detail-level ; Detail Level
texturesizex ; Horizontal Texture Size
texturesizey ; Vertical Texture Size
)
;
; Auto-stretch HSV
;
(if (= auto-hsv TRUE)
(begin
; (plug-in-autostretch-hsv 1 img drawable)
(gimp-drawable-levels-stretch drawable)
)
) ;endif
;
; Gaussian Blur
;
(if (> blur-radius 0)
(apply-gauss
img ; Image to apply blur
drawable ; Layer to apply blur
blur-radius ; Blur Radius x
blur-radius ; Blue Radius y
)
) ;endif
;
; Set Specified Gradient Active
;
(gimp-context-set-gradient emap-gradient)
;
; Environment Map Type: Topographical
;
(if (= map-type 0)
(begin
(if (= (string->number (substring (car(gimp-version)) 0 3)) 2.10)
(plug-in-gradmap 1 img drawable)
(plug-in-gradmap 1 img (vector drawable)) ) ; Map Gradient
(gimp-item-set-name drawable "EnviroMap: Topo") ; Name it
)
) ;endif
;
; Environment Map Type: Cloud
;
(if (or (> paint-mode 0) (= map-type 1))
(begin
(set! image-height (car (gimp-drawable-get-height drawable))) ; Get Height
(set! image-width (car (gimp-drawable-get-width drawable))) ; Get Width
;
; Calculate Gradient Blend Start & End Points
;
(cond ((= blend-direction 0) ; Top-Bottom
(set! xblend-start 0) ; X Blend Starting Point
(set! yblend-start 0) ; Y Blend Starting Point
(set! xblend-end 0) ; X Blend Ending Point
(set! yblend-end image-height) ; Y Blend Ending Point
)
((= blend-direction 1) ; Bottom-Top
(set! xblend-start 0) ; X Blend Starting Point
(set! yblend-start image-height) ; Y Blend Starting Point
(set! xblend-end 0) ; X Blend Ending Point
(set! yblend-end 0) ; Y Blend Ending Point
)
((= blend-direction 2) ; Left-Right
(set! xblend-start 0) ; X Blend Starting Point
(set! yblend-start 0) ; Y Blend Starting Point
(set! xblend-end image-width) ; X Blend Ending Point
(set! yblend-end 0) ; Y Blend Ending Point
)
((= blend-direction 3) ; Right-Left
(set! xblend-start image-width) ; X Blend Starting Point
(set! yblend-start 0) ; Y Blend Starting Point
(set! xblend-end 0) ; X Blend Ending Point
(set! yblend-end 0) ; Y Blend Ending Point
)
((= blend-direction 4) ; Diag-Top-Left
(set! xblend-start 0) ; X Blend Starting Point
(set! yblend-start 0) ; Y Blend Starting Point
(set! xblend-end image-width) ; X Blend Ending Point
(set! yblend-end image-height) ; Y Blend Ending Point
)
((= blend-direction 5) ; Diag-Top-Right
(set! xblend-start image-width) ; X Blend Starting Point
(set! yblend-start 0) ; Y Blend Starting Point
(set! xblend-end 0) ; X Blend Ending Point
(set! yblend-end image-height) ; Y Blend Ending Point
)
((= blend-direction 6) ; Diag-Bottom-Left
(set! xblend-start 0) ; X Blend Starting Point
(set! yblend-start image-height) ; Y Blend Starting Point
(set! xblend-end image-width) ; X Blend Ending Point
(set! yblend-end 0) ; Y Blend Ending Point
)
((= blend-direction 7) ; Diag-Bottom-Right
(set! xblend-start image-width) ; X Blend Starting Point
(set! yblend-start image-height) ; Y Blend Starting Point
(set! xblend-end 0) ; X Blend Ending Point
(set! yblend-end 0) ; Y Blend Ending Point
)
; (else
; ; For later use..
; )
) ;end cond
;
; Check Paint Mode
;
(if (= paint-mode 0)
(begin
(set! paint-mode 4) ; Normal Makes No Sense For Cloud Map So Set To Screen As Default
)
) ;endif
(gimp-drawable-edit-gradient-fill
drawable
;BLEND-CUSTOM
;LAYER-MODE-NORMAL-LEGACY
blend-shape
;100
1
1
;back-reverse
1
;3
0.2
TRUE
xblend-start ; Int32 - X Blend Starting Point
yblend-start ; Int32 - Y Blend Starting Point
xblend-end ; Int32 - X Blend Ending Point
yblend-end ; Int32 - Y Blend Ending Point
)
(gimp-item-set-name drawable "EnviroMap: Cloud") ; Name Environment Map
)
) ;endif
;
; Ensure Environment Map Does Not Have An Alpha Channel So Flatten
;
(gimp-layer-flatten drawable)
;
; End Undo Group
;
(gimp-image-undo-group-end img)
;
; Update display
;
(gimp-displays-flush)
;
; Restore Context
;
(gimp-context-pop)
) ; End let
) ; End Main Procedure