-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPsychedelic.scm
979 lines (838 loc) · 33.3 KB
/
Psychedelic.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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
;Modernized with ModernizeMatic7 for Gimp 2.10.22 by vitforlinux.wordpress.com - dont remove
; Psychedelic rel 0.05
; Created by Graechan
; Fix/Update for Gimp 2.10.22 Vitforlinux
; 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 0.02 - Added Adjustment for 3D height and check for 2.8 version
; Rel 0.03 - Added Alpha-to-Logo Script
; Rel 0.04 - Vitforlinux - Fix/Update for Gimp 2.10.22 - changeable text fill color
; Rel 0.05 - Vitforlinux - Fix text fill color when grow, and more grow.
;
; 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)))
(define (gimp-version-meets? check)
(let ((c (map string->number (strbreakup check ".")))
(v (map string->number (strbreakup (car (gimp-version)) "."))))
(if (> (car v) (car c)) #t
(if (< (car c) (car v)) #f
(if (> (cadr v) (cadr c)) #t
(if (< (cadr v) (cadr c)) #f
(if (>= (caddr v) (caddr c)) #t #f)))))))
;
; 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-add-layer image newlayer (+ (car (gimp-image-get-layer-position image oldlayer)) stack)) ;For GIMP 2.6
)
) ;end cond
) ;end add layer procedure
;
(define (script-fu-psychedelic image
drawable
text-gradient
mode
bevel-size
3d-size
shadow-size
shadow-opacity
bkg-type
bkg-gradient
blend-repititions
displace-repititions
conserve)
(cond ((not (gimp-version-meets? "2.8.0"))
(let ((handler (car (gimp-message-get-handler))))
(gimp-message-set-handler 0)
(error "You will need to Install\nGimp Version 2.8\nTo use this script")
(gimp-message-set-handler handler)))
(else
(gimp-image-undo-group-start image)
(let* (
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(original-width width)
(original-height height)
(area (* 1000 1000))
(paint-layer (car (gimp-layer-new image width height RGBA-IMAGE "Paint-Layer" 100 mode)))
(alpha (car (gimp-drawable-has-alpha drawable)))
(sel (car (gimp-selection-is-empty image)))
(layer-name (cond ((defined? 'gimp-image-get-item-position) (car (gimp-item-get-name drawable)))
(else (car (gimp-drawable-get-name drawable)))))
(bkg-layer 0)
(selection-channel 0)
(ver 2.8)
(x1 0)
(y1 0)
(iwidth 0)
(iheight 0)
(isize 0)
(cnt 0)
)
(gimp-context-push)
(gimp-context-set-paint-method "gimp-paintbrush")
(cond ((defined? 'gimp-context-set-dynamics) (gimp-context-set-dynamics "Dynamics Off")))
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
(if (= alpha FALSE) (gimp-layer-add-alpha drawable))
;;;;check that a selection was made if not make one
(if (= sel TRUE) (begin
(cond ((= ver 2.8) (gimp-image-select-item image 2 drawable))
(else (gimp-selection-layer-alpha drawable))
) ;endcond
)
)
;;;;create selection-channel (gimp-selection-load 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
(gimp-image-set-active-layer image drawable)
(set! x1 (cadr (gimp-drawable-mask-intersect drawable))) ;x coordinate of upper left corner of selection
(set! y1 (caddr (gimp-drawable-mask-intersect drawable))) ;y coordinate of upper left corner of selection
(set! iwidth (cadddr (gimp-drawable-mask-intersect drawable))) ;x width of the intersection
(set! iheight (cadr (cdddr (gimp-drawable-mask-intersect drawable)))) ;y height of the intersection
(set! isize (min iwidth iheight))
(set! cnt (- (/ isize 30) 1))
;;;;begin the script
(include-layer image paint-layer drawable 0) ;stack 0=above 1=below
(gimp-image-select-rectangle image 2 x1 y1 iwidth iheight)
(if (= ver 2.8) (gimp-context-set-dynamics "Random Color"))
(gimp-context-set-paint-method "gimp-paintbrush")
(gimp-context-set-brush "Sparks")
(gimp-context-set-brush-default-size)
(gimp-context-set-gradient text-gradient)
(gimp-edit-stroke paint-layer)
(while (> cnt 0)
(gimp-selection-shrink image 30)
(if (= (car (gimp-selection-is-empty image)) FALSE) (gimp-edit-stroke paint-layer))
(set! cnt (- cnt 1))
)
(gimp-selection-none image)
(gimp-curves-spline paint-layer 0 10 #(0 0 86 50 128 129 172 207 255 255))
(set! drawable (car (gimp-image-merge-down image paint-layer EXPAND-AS-NECESSARY)))
(gimp-selection-load selection-channel)
(gimp-selection-invert image)
(gimp-drawable-edit-clear drawable)
(gimp-selection-none image)
(the-chisel image
drawable
bevel-size ;inWidth
10 ;inSoften
1 ;inCurve
0 ;inPow
135 ;inAizmuth
30 ;inElevation
bevel-size ;inDepth
0 ;inMode
0 ;inLocation
0 ;inBlur
FALSE)
(set! drawable (car (gimp-image-get-active-layer image)))
; (gimp-curves-spline drawable 0 10 #(0 0 86 50 128 129 172 207 255 255))
(easy-3d image drawable
3d-size ;3d-size
0 ;h-dir
2 ;v-dir
FALSE ;keep-selection-in
FALSE) ;conserve
(set! drawable (car (gimp-image-get-active-layer image)))
(psychedelic-shine image drawable
shadow-size
shadow-opacity
FALSE ;keep-selection-in
FALSE) ;conserve
(set! drawable (car (gimp-image-get-active-layer image)))
;;;;create the background layer
(set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL-LEGACY)))
(include-layer image bkg-layer drawable 1) ;stack 0=above 1=below
(cond ((= bkg-type 0)
(technicolor-dream
image
bkg-layer
bkg-gradient
blend-repititions
displace-repititions
FALSE) ;keep-selection
(gimp-curves-spline bkg-layer 0 10 #(0 0 86 50 128 129 172 207 255 255))
)) ;endcond
;end
;;;;finish the script
(if (= conserve FALSE) (set! drawable (car (gimp-image-merge-down image drawable EXPAND-AS-NECESSARY))))
(cond ((= ver 2.8) (gimp-item-set-name drawable layer-name))
(else (gimp-item-set-name drawable layer-name))
) ;endcond
(gimp-image-remove-channel image selection-channel)
(if (and (= conserve FALSE) (= alpha FALSE)) (gimp-layer-flatten drawable))
(gimp-displays-flush)
(gimp-image-undo-group-end image)
(gimp-context-pop)
) ;end Variables
)) ;endCheckVersion
) ;endProcedure
(script-fu-register "script-fu-psychedelic"
"Psychedelic Alpha"
"Splatters image with paint and can generate a Background of dripping paint"
"Graechan"
"Graechan - http://gimpchat.com"
"May 2014"
"RGB*"
SF-IMAGE "image" 0
SF-DRAWABLE "drawable" 0
SF-GRADIENT "Paint Splatter Gradient" "Tropical Colors"
SF-ENUM "Paint Splatter LayerMode" '("LayerModeEffects" "hardlight-mode")
SF-ADJUSTMENT "Bevel Size" '(5 1 65 1 10 0 0)
SF-ADJUSTMENT "3D Size" '(1 1 50 1 10 0 0)
SF-ADJUSTMENT "Shadow Size" '(8 0 16 1 10 0 0)
SF-ADJUSTMENT "Shadow Opacity" '(50 0 100 1 10 0 0)
SF-OPTION "Background Type" '("Technicolor-Dream" "Transparent")
SF-GRADIENT "Background Effect Gradient" "Full saturation spectrum CCW"
SF-ADJUSTMENT "Blend Repititions" '(12 0 20 1 1 0 0)
SF-ADJUSTMENT "Displace Repititions" '(8 0 20 1 1 0 0)
SF-TOGGLE "Keep the Layers" FALSE
)
(script-fu-menu-register "script-fu-psychedelic" "<Image>/Script-Fu/Alpha-to-Logo")
;
(define (script-fu-psychedelic-logo
text
justify
letter-spacing
line-spacing
grow
font-in
font-size
text-color
text-gradient
mode
bevel-size
3d-size
shadow-size
shadow-opacity
bkg-type
bkg-gradient
blend-repititions
displace-repititions
conserve)
(cond ((not (gimp-version-meets? "2.8.0"))
(let ((handler (car (gimp-message-get-handler))))
(gimp-message-set-handler 0)
(error "You will need to Install\nGimp Version 2.8\nTo use this script")
(gimp-message-set-handler handler)))
(else
(let* (
(image (car (gimp-image-new 256 256 RGB)))
(border (/ font-size 4))
(font (if (> (string-length font-in) 0) font-in (car (gimp-context-get-font))))
(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)
(selection-channel 0)
(aspect 0)
(justify (cond ((= justify 0) 2)
((= justify 1) 0)
((= justify 2) 1)))
)
(gimp-context-push)
(gimp-context-set-paint-method "gimp-paintbrush")
(if (= ver 2.8) (gimp-context-set-dynamics "Dynamics Off"))
(gimp-context-set-foreground text-color) ;---------------------------------set text color here
(gimp-context-set-background '(255 255 255))
;;;;adjust the size-layer
(gimp-text-layer-set-justification size-layer justify)
(gimp-text-layer-set-letter-spacing size-layer letter-spacing)
(gimp-text-layer-set-line-spacing size-layer line-spacing)
(set! final-width (car (gimp-drawable-get-width size-layer)))
(set! final-height (car (gimp-drawable-get-height size-layer)))
;;;;Add the text layer for a temporary larger Image size
(set! text-layer (car (gimp-text-fontname image -1 0 0 text (round (/ 200 4)) TRUE 200 PIXELS font)))
(gimp-item-set-name text-layer "Text")
;;;;adjust text
(gimp-text-layer-set-justification text-layer justify)
(gimp-text-layer-set-letter-spacing text-layer letter-spacing)
(gimp-text-layer-set-line-spacing text-layer line-spacing)
(gimp-image-resize-to-layers image)
;;;;Expand the font if needed
(if (> grow 0)
(begin
(cond ((= ver 2.8) (gimp-image-select-item image 2 text-layer))
(else (gimp-selection-layer-alpha text-layer)))
(gimp-drawable-edit-clear text-layer)
(gimp-selection-grow image (+ grow 2))
(gimp-context-set-foreground text-color)
(gimp-drawable-edit-fill text-layer FILL-FOREGROUND)
(gimp-selection-none image)
)
)
;;;;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)
;;;;begin the script
(script-fu-psychedelic image
text-layer
text-gradient
mode
bevel-size
3d-size
shadow-size
shadow-opacity
1 ;bkg-type
bkg-gradient
blend-repititions
displace-repititions
FALSE) ;conserve
(set! text-layer (car (gimp-image-get-active-layer image)))
;;;;Scale Image to it's final size;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set! aspect (/ final-width (car (gimp-image-width image))))
(gimp-image-scale-full image final-width (* (car (gimp-image-height image)) aspect) 2)
(set! width (car (gimp-image-width image)))
(set! height (car (gimp-image-height image)))
;;;;create the background layer
(set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL-LEGACY)))
(include-layer image bkg-layer text-layer 1) ;stack 0=above 1=below
(cond ((= bkg-type 0)
(technicolor-dream
image
bkg-layer
bkg-gradient
blend-repititions
displace-repititions
FALSE) ;keep-selection
(gimp-curves-spline bkg-layer 0 10 #(0 0 86 50 128 129 172 207 255 255))
)) ;endcond
;end
;(plug-in-oilify 1 image text-layer 4 0)
(if (= conserve FALSE) (set! text-layer (car (gimp-image-merge-down image text-layer EXPAND-AS-NECESSARY))))
(gimp-item-set-name text-layer text)
(gimp-context-pop)
(gimp-display-new image)
) ;end Variables
)) ;endCheckVersion
) ;endProcedure
(script-fu-register "script-fu-psychedelic-logo"
"Psychedelic"
"Splatters text with paint and can generate a Background of dripping paint"
"Graechan"
"Graechan - http://gimpchat.com"
"May 2014"
""
SF-TEXT "Text" "GIMP"
SF-OPTION "Justify" '("Centered" "Left" "Right")
SF-ADJUSTMENT "Letter Spacing" '(50 -100 100 1 5 0 0)
SF-ADJUSTMENT "Line Spacing" '(0 -100 100 1 5 0 0)
SF-ADJUSTMENT "Expand the Font if needed" '(0 0 12 1 1 0 1)
SF-FONT "Font" "Sans Bold"
SF-ADJUSTMENT "Font size (pixels)" '(200 6 500 1 1 0 1)
SF-COLOR "Text Fill Color" '(0 0 0)
SF-GRADIENT "Text Paint Splatter Gradient" "Tropical Colors"
SF-ENUM "Paint Splatter LayerMode" '("LayerModeEffects" "hardlight-mode")
SF-ADJUSTMENT "Bevel Size" '(5 1 65 1 10 0 0)
SF-ADJUSTMENT "3D Size" '(1 1 50 1 10 0 0)
SF-ADJUSTMENT "Shadow Size" '(8 0 16 1 10 0 0)
SF-ADJUSTMENT "Shadow Opacity" '(50 0 100 1 10 0 0)
SF-OPTION "Background Type" '("Technicolor-Dream" "Transparent")
SF-GRADIENT "Background Effect Gradient" "Full saturation spectrum CCW"
SF-ADJUSTMENT "Blend Repititions" '(12 0 20 1 1 0 0)
SF-ADJUSTMENT "Displace Repititions" '(8 0 20 1 1 0 0)
SF-TOGGLE "Keep the Layers" FALSE
)
(script-fu-menu-register "script-fu-psychedelic-logo" "<Image>/Script-Fu/Logos")
;
;
;
;
(define (the-chisel img inLayer inWidth inSoften inCurve inPow inAizmuth inElevation inDepth inMode inLocation inBlur inKeepBump)
(let*
(
(varNoSelection (car (gimp-selection-is-empty img)))
(inPow (- 0 inPow))
(varSavedSelection 0)
(varBlurredSelection 0)
(varBumpmapLayer)
(varBevelLayer)
(varLoopCounter 1)
(varFillValue)
(varNumBytes 256)
(varAdjCurve (cons-array varNumBytes 'byte))
(varLayerName (car (gimp-drawable-get-name inLayer)))
)
; it begins here
(gimp-context-push)
(gimp-image-undo-group-start img)
;save selection or select all if no selection
(if (= varNoSelection TRUE)
(if (= (car (gimp-drawable-has-alpha inLayer)) TRUE) ;check for alpha
(gimp-selection-layer-alpha inLayer) ; transfer the alpha to selection
(gimp-selection-all img) ;else select the whole image
)
)
(set! varSavedSelection (car (gimp-selection-save img)))
(set! varBumpmapLayer (car (gimp-layer-new-from-drawable inLayer img)))
(gimp-item-set-name varBumpmapLayer (string-append varLayerName " bumpmap"))
(gimp-image-insert-layer img varBumpmapLayer 0 -1)
(if (= inLocation 1) ;if outside, enlarge the layer canvas
(gimp-layer-resize varBumpmapLayer (+ (car (gimp-drawable-get-width inLayer)) (* 2 inWidth))
(+ (car (gimp-drawable-get-height inLayer)) (* 2 inWidth))
inWidth
inWidth)
)
;blur selection for soft chisel
(gimp-selection-feather img inSoften)
(set! varBlurredSelection (car (gimp-selection-save img)))
;when shrinking check selection size and reset inWidth if necessary
(when (= inLocation 0)
(set! varLoopCounter inWidth)
(gimp-selection-shrink img varLoopCounter)
(while (= (car (gimp-selection-is-empty img)) TRUE)
(set! varLoopCounter (- varLoopCounter 1))
(gimp-selection-load varBlurredSelection)
(gimp-selection-shrink img varLoopCounter)
(gimp-progress-set-text "Checking Carve Size...")
(gimp-progress-pulse)
)
(gimp-progress-set-text "")
(set! inWidth (min inWidth varLoopCounter))
(gimp-selection-load varBlurredSelection)
)
; create bevel in bumpmap layer black to white
(gimp-context-set-foreground '(0 0 0))
(gimp-drawable-fill varBumpmapLayer FILL-FOREGROUND)
(set! varLoopCounter 1)
(while (<= varLoopCounter inWidth)
;inCurve of 0 will be flat, inCurve of 1 is a quarter round, inCurve of -1 is a quarter round fillet
(set! varFillValue (* (pow (+ (* (- (sin (* (/ varLoopCounter inWidth) (tan 1))) (/ varLoopCounter inWidth)) inCurve) (/ varLoopCounter inWidth)) (pow 2 inPow)) 255))
;avoid distortion
(gimp-selection-load varBlurredSelection)
(if (= inLocation 0)
(gimp-selection-shrink img (- varLoopCounter 1)) ;inside
(gimp-selection-grow img (- inWidth (- varLoopCounter 1))) ;outside
)
(gimp-context-set-foreground (list varFillValue varFillValue varFillValue)) ;shade of grey
(if (= (car (gimp-selection-is-empty img)) FALSE)
(gimp-drawable-edit-fill varBumpmapLayer FILL-FOREGROUND)
(gimp-drawable-edit-fill varBumpmapLayer FILL-FOREGROUND) ; second time to blend better
(set! varLoopCounter (+ inWidth 1))
)
(set! varLoopCounter (+ varLoopCounter 1))
)
;finish up with white
(gimp-context-set-foreground (list 255 255 255)) ;white
(gimp-selection-load varBlurredSelection)
(if (= inLocation 0)
(gimp-selection-shrink img inWidth) ;inside
)
(if (= (car (gimp-selection-is-empty img)) FALSE)
(gimp-drawable-edit-fill varBumpmapLayer FILL-FOREGROUND)
(gimp-drawable-edit-fill varBumpmapLayer FILL-FOREGROUND) ; second time to blend better
)
(gimp-selection-none img)
;make bevel from bumpmap
(set! varBevelLayer (car (gimp-layer-new-from-drawable inLayer img)))
(gimp-item-set-name varBevelLayer (string-append varLayerName " bevel"))
(gimp-image-insert-layer img varBevelLayer 0 -1)
(if (= inLocation 1) ;if outside, enlarge the layer canvas
(gimp-layer-resize varBevelLayer (+ (car (gimp-drawable-get-width inLayer)) (* 2 inWidth))
(+ (car (gimp-drawable-get-height inLayer)) (* 2 inWidth))
inWidth
inWidth)
)
(gimp-context-set-foreground '(127 127 127))
(gimp-drawable-fill varBevelLayer FILL-FOREGROUND)
(plug-in-bump-map RUN-NONINTERACTIVE img varBevelLayer varBumpmapLayer inAizmuth inElevation inDepth 0 0 0 0
TRUE (cond ((= inMode 0) FALSE) ((= inMode 1) TRUE)) 0)
(gimp-layer-set-mode varBevelLayer HARDLIGHT-MODE)
(gimp-layer-set-opacity varBevelLayer 80)
;delete outside the desired bevel
(if (= inLocation 0)
(begin ;inside
(gimp-selection-load varSavedSelection)
(gimp-selection-invert img)
(if (= (car (gimp-selection-is-empty img)) FALSE)
(gimp-drawable-edit-clear varBevelLayer)
)
(gimp-selection-load varSavedSelection)
(gimp-selection-shrink img inWidth)
(if (= (car (gimp-selection-is-empty img)) FALSE)
(gimp-drawable-edit-clear varBevelLayer)
)
)
(begin ;outside
(gimp-selection-load varSavedSelection)
(if (= (car (gimp-selection-is-empty img)) FALSE)
(gimp-drawable-edit-clear varBevelLayer)
)
(gimp-selection-load varSavedSelection)
(gimp-selection-grow img inWidth)
(gimp-selection-invert img)
(if (= (car (gimp-selection-is-empty img)) FALSE)
(gimp-drawable-edit-clear varBevelLayer)
)
)
)
; blur if desired
(when (> inBlur 0)
(gimp-selection-load varBlurredSelection)
(if (= inLocation 1)
(gimp-selection-invert img)
)
(plug-in-gauss RUN-NONINTERACTIVE img varBevelLayer inBlur inBlur 0)
(gimp-selection-none img)
)
;delete bumpmap layer
(if (= inKeepBump TRUE)
(gimp-item-set-visible varBumpmapLayer FALSE)
(gimp-image-remove-layer img varBumpmapLayer)
)
;load initial selection back up
(if (= varNoSelection TRUE)
(gimp-selection-none img)
(begin
(gimp-selection-load varSavedSelection)
)
)
;and delete the channels
(gimp-image-remove-channel img varSavedSelection)
(gimp-image-remove-channel img varBlurredSelection)
; (gimp-image-set-active-layer img inLayer)
(set! inLayer (car (gimp-image-merge-down img varBevelLayer EXPAND-AS-NECESSARY))) ;edit by graechan for this script only
;done
(gimp-progress-end)
(gimp-image-undo-group-end img)
(gimp-displays-flush)
(gimp-context-pop)
)
)
;
(define (easy-3d image drawable
3d-size
h-dir
v-dir
keep-selection-in
conserve
)
(let* (
(image-layer (car (gimp-image-get-active-layer image)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(alpha (car (gimp-drawable-has-alpha image-layer)))
(sel (car (gimp-selection-is-empty image)))
(layer-name (cond ((defined? 'gimp-image-get-item-position) (car (gimp-item-get-name image-layer)))
(else (car (gimp-drawable-get-name image-layer)))))
(keep-selection keep-selection-in)
(selection-channel 0)
(innermap 0)
(image-mask 0)
(ver 2.8)
(ok TRUE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(3d-layer 0)
(copy-layer 0)
(cnt 3d-size)
(horizontal 0)
(vertical 0)
)
(gimp-context-push)
(gimp-image-undo-group-start image)
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
(if (= alpha FALSE) (gimp-layer-add-alpha image-layer))
;;;;check that a selection was made if not make one
(if (= sel TRUE) (set! keep-selection FALSE))
(if (= sel TRUE) (begin
(cond ((= ver 2.8) (gimp-image-select-item image 2 image-layer))
(else (gimp-selection-layer-alpha image-layer)))
)) ;endif
;;;;save the selection
(set! selection-channel (car (gimp-selection-save image))) ;(gimp-selection-load selection-channel)
(gimp-selection-none image)
; creating map (inner shape)
(set! innermap (car (gimp-layer-new image width height RGB-IMAGE "iMap" 100 LAYER-MODE-NORMAL-LEGACY)))
(include-layer image innermap image-layer 1) ;stack 0=above 1=below
(gimp-context-set-foreground '(255 255 255))
(gimp-drawable-edit-fill innermap FILL-FOREGROUND)
(gimp-selection-load selection-channel)
(gimp-selection-shrink image 3)
(gimp-context-set-foreground '(0 0 0))
(gimp-drawable-edit-fill innermap FILL-FOREGROUND)
(gimp-selection-none image)
(plug-in-gauss-rle2 1 image innermap 6 6)
; (gimp-context-set-foreground color)
; (gimp-drawable-edit-fill image-layer FILL-FOREGROUND)
(plug-in-bump-map
1
image
image-layer
innermap
135
32
5
0
0
0
0
1
1
0)
(gimp-selection-load selection-channel)
(gimp-selection-shrink image 2)
(set! image-mask (car (gimp-layer-create-mask image-layer ADD-MASK-SELECTION)))
(gimp-layer-add-mask image-layer image-mask)
(gimp-selection-none image)
(plug-in-gauss-rle2 1 image image-mask 1 1)
(gimp-layer-remove-mask image-layer MASK-APPLY)
(gimp-image-remove-layer image innermap)
;;;;begin the 3d script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gimp-image-set-active-layer image image-layer)
(set! 3d-layer (car (gimp-layer-copy image-layer TRUE)))
(gimp-image-insert-layer image 3d-layer 0 1)
(set! horizontal
(cond
(( equal? h-dir 0 ) 1) ;right
(( equal? h-dir 1 ) 0) ;neutral
(( equal? h-dir 2 ) -1) ;left
)
)
(set! vertical
(cond
(( equal? v-dir 0 ) 1) ;bottom
(( equal? v-dir 1 ) 0) ;neutral
(( equal? v-dir 2 ) -1) ;top
)
)
(gimp-selection-none image)
(while (> cnt 0)
(gimp-image-set-active-layer image 3d-layer)
(set! copy-layer (car (gimp-layer-copy 3d-layer TRUE)))
(gimp-image-insert-layer image copy-layer 0 -1)
(gimp-drawable-transform-2d
copy-layer ;The affected drawable
0 ;X coordinate of the transformation center
0 ;Y coordinate of the transformation center
1 ;Amount to scale in x direction
1 ;Amount to scale in y direction
0 ;The angle of rotation (radians)
horizontal ;X coordinate of where the center goes
vertical ;Y coordinate of where the center goes
0 ;Direction of transformation { TRANSFORM-FORWARD (0), TRANSFORM-BACKWARD (1) }
2 ;Type of interpolation { INTERPOLATION-NONE (0), INTERPOLATION-LINEAR (1), INTERPOLATION-CUBIC (2), INTERPOLATION-LANCZOS (3) }
TRUE ;This parameter is ignored, supersampling is performed based on the interpolation type (TRUE or FALSE)
3 ;Maximum recursion level used for supersampling (3 is a nice value) (recursion-level >= 1)
0) ;How to clip results { TRANSFORM-RESIZE-ADJUST (0), TRANSFORM-RESIZE-CLIP (1), TRANSFORM-RESIZE-CROP (2), TRANSFORM-RESIZE-CROP-WITH-ASPECT (3) }
(set! 3d-layer (car (gimp-image-merge-down image copy-layer EXPAND-AS-NECESSARY)))
(set! cnt (- cnt 1))
)
(if (or (= h-dir 0) (= v-dir 0)) (gimp-brightness-contrast 3d-layer 40 0))
(gimp-layer-set-offsets image-layer (cond
((= h-dir 2) (- 0 3d-size))
((= h-dir 0) 3d-size)
(else 0)) ;endcond
(cond
((= v-dir 2) (- 0 3d-size))
((= v-dir 0) 3d-size)
(else 0)) ;endcond
)
;;;;finish the script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (= conserve FALSE) (begin
(set! image-layer (car (gimp-image-merge-down image image-layer EXPAND-AS-NECESSARY)))
(gimp-layer-resize-to-image-size image-layer)))
(cond ((= ver 2.8) (gimp-item-set-name image-layer (string-append layer-name "-3D")))
(else (gimp-item-set-name image-layer (string-append layer-name "-3D")))
) ;endcond
(gimp-selection-load selection-channel)
(if (= keep-selection FALSE) (gimp-selection-none image))
(gimp-image-remove-channel image selection-channel)
; (if (and (= conserve FALSE) (= alpha FALSE) (gimp-layer-flatten image-layer)))
(gimp-displays-flush)
(gimp-image-undo-group-end image)
(gimp-context-pop)
)
)
(define (psychedelic-shine image drawable
shadow-size
shadow-opacity
keep-selection-in
conserve)
(let* (
(image-layer (car (gimp-image-get-active-layer image)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(sel (car (gimp-selection-is-empty image)))
(alpha (car (gimp-drawable-has-alpha image-layer)))
(keep-selection keep-selection-in)
(layer-name (car (gimp-drawable-get-name image-layer)))
(img-layer 0)
(img-channel 0)
(bkg-layer 0)
(shadow-layer 0)
(tmp-layer 0)
)
(gimp-context-push)
(gimp-image-undo-group-start image)
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
(if (= alpha FALSE) (gimp-layer-add-alpha image-layer))
(if (= sel TRUE) (set! keep-selection FALSE))
(if (= sel TRUE) (gimp-selection-layer-alpha image-layer))
(set! img-layer (car (gimp-layer-new image width height RGBA-IMAGE "img-layer" 100 LAYER-MODE-NORMAL-LEGACY)))
(gimp-image-insert-layer image img-layer 0 -1)
(gimp-drawable-fill img-layer FILL-BACKGROUND)
(gimp-drawable-edit-fill img-layer FILL-FOREGROUND)
;;;;create channel
(gimp-selection-save image)
(set! img-channel (car (gimp-image-get-active-drawable image)))
(gimp-channel-set-opacity img-channel 100)
(gimp-item-set-name img-channel "img-channel")
(gimp-image-set-active-layer image img-layer)
(gimp-item-set-name image-layer "Original Image")
;;;;create the background layer
(set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL-LEGACY)))
(gimp-image-insert-layer image bkg-layer 0 1)
;;;;apply the image effects
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
(plug-in-gauss-rle2 RUN-NONINTERACTIVE image img-layer 12 12)
(plug-in-emboss RUN-NONINTERACTIVE image img-layer 225 84 10 TRUE)
(gimp-selection-invert image)
(gimp-drawable-edit-clear img-layer)
(gimp-selection-invert image)
(plug-in-colortoalpha RUN-NONINTERACTIVE image img-layer '(254 254 254));;fefefe
(plug-in-gauss-rle2 RUN-NONINTERACTIVE image img-channel 15 15)
(plug-in-blur RUN-NONINTERACTIVE image img-layer)
(gimp-image-set-active-layer image bkg-layer)
(plug-in-displace RUN-NONINTERACTIVE image bkg-layer 8 8 TRUE TRUE img-channel img-channel 1)
(gimp-image-remove-layer image bkg-layer)
;;;;create the shadow
(if (> shadow-size 0)
(begin
(script-fu-drop-shadow image img-layer shadow-size shadow-size shadow-size '(0 0 0) shadow-opacity FALSE)
(set! tmp-layer (car (gimp-layer-new image width height RGBA-IMAGE "temp" 100 LAYER-MODE-NORMAL-LEGACY)))
(gimp-image-insert-layer image tmp-layer 0 -1)
(gimp-image-raise-layer image tmp-layer)
(gimp-image-merge-down image tmp-layer CLIP-TO-IMAGE)
(set! shadow-layer (car (gimp-image-get-active-drawable image)))
(gimp-image-lower-layer image shadow-layer)
)
)
(if (= conserve FALSE)
(begin
(set! img-layer (car (gimp-image-merge-down image img-layer EXPAND-AS-NECESSARY)))
(if (> shadow-size 0) (set! img-layer (car (gimp-image-merge-down image img-layer EXPAND-AS-NECESSARY))))
(gimp-item-set-name img-layer layer-name)
)
)
(if (= keep-selection FALSE) (gimp-selection-none image))
(gimp-image-remove-channel image img-channel)
(if (and (= conserve FALSE) (= alpha FALSE) (gimp-layer-flatten img-layer)))
(gimp-image-undo-group-end image)
(gimp-context-pop)
;(gimp-display-new image)
(gimp-displays-flush)
)
)
;
(define (technicolor-dream
image
layer
gradient
blend-repititions
displace-repititions
keep-selection
)
(gimp-image-undo-group-start image)
(let* (
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(noise (car (gimp-layer-new image width height RGBA-IMAGE "Solid Noise" 100 LAYER-MODE-NORMAL-LEGACY)))
(sel (car (gimp-selection-is-empty image)))
(saved-selection 0)
(cnt blend-repititions)
(width-box 0)
(height-box 0)
(ver 2.8)
(x1 0)
(y1 0)
(x2 0)
(y2 0)
)
(gimp-context-push)
(gimp-context-set-paint-method "gimp-paintbrush")
(if (= ver 2.8) (gimp-context-set-dynamics "Dynamics Off"))
(gimp-context-set-foreground '(0 0 0))
(gimp-context-set-background '(255 255 255))
(cond ((= sel TRUE) (set! keep-selection FALSE))
(else (set! saved-selection (car (gimp-selection-save image)))
(gimp-selection-none image)))
;;;;begin the script here--------------------------------------------------------------------------------------------------------
(gimp-layer-add-alpha layer)
(gimp-drawable-edit-clear layer)
(gimp-drawable-fill layer FILL-BACKGROUND)
(gimp-context-set-gradient gradient)
(while (> cnt 0)
(set! width-box (round (random width )))
(set! height-box (round (random height)))
; set the arrays
(set! x1 width-box)
(set! y1 height-box)
(set! x2 (+ width-box 5))
(set! y2 (+ height-box 5))
(gimp-edit-blend layer BLEND-CUSTOM LAYER-MODE-DIFFERENCE-LEGACY GRADIENT-CONICAL-SYMMETRIC 100 0 REPEAT-NONE FALSE FALSE 3 0.2 TRUE x1 y1 x2 y2)
(set! cnt (- cnt 1))
) ;endwhile
(cond ((= ver 2.8) ;insert or add the new layer
(gimp-image-insert-layer image noise 0 1)) ;new 2.8
(else (gimp-image-insert-layer image noise 0 1)) ;new 2.6
) ;endcond
(plug-in-solid-noise 1 image noise FALSE FALSE 1611597286 1 (/ width 100) (/ height 100))
(gimp-image-set-active-layer image layer)
(set! cnt displace-repititions)
(while (> cnt 0)
(plug-in-displace 1
image
layer ;drawable
0 ;amount-x Displace multiplier for X or radial direction
50 ;amount-y Displace multiplier for Y or tangent (degrees) direction
TRUE ;do-x Displace in X or radial direction?
TRUE ;Displace in Y or tangent direction?
noise ;displace-map-x Displacement map for X or radial direction[drawable]
noise ;displace-map-y Displacement map for Y or tangent direction[drawable]
2) ;Edge behavior { WRAP (1), SMEAR (2), BLACK (3) }
(set! cnt (- cnt 1))
) ;endwhile
(gimp-image-remove-layer image noise)
(if (= keep-selection TRUE) (gimp-selection-load saved-selection))
(if (= sel FALSE) (gimp-image-remove-channel image saved-selection))
(gimp-displays-flush)
(gimp-image-undo-group-end image)
(gimp-context-pop)
)
)