Skip to content

Commit 2ad8bdf

Browse files
authored
Bug fix for context-set-feather error in Logo
1 parent 77dfa21 commit 2ad8bdf

File tree

1 file changed

+73
-38
lines changed

1 file changed

+73
-38
lines changed

Metal Mesh.scm

Lines changed: 73 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
;
1111
; This program is distributed in the hope that it will be useful,
1212
; but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
; GNU General Public License for more details.
1515
;
1616
; To view a copy of the GNU General Public License
@@ -25,6 +25,7 @@
2525
; Rel 0.03 - Bugfix for text size
2626
; Rel 0.04.3 - Added Metal type and tint options bugfix for colors and mesh shapes
2727
; Rel 0.05 - Updated to GIMP-2.10.22
28+
; Rel 0.06 - Bug fixes; updated for Gimp-2.10.34 ; this script depends on FU-chrome-image
2829
;
2930
;scaled pattern fill procedure
3031
(define (scaled-pattern-fill image drawable pattern scale)
@@ -187,7 +188,7 @@
187188
;(gimp-displays-flush)
188189
;(quit)
189190

190-
;(gimp-message "line 190")
191+
;(gimp-message "line 191")
191192
(if (< (/ size 6) 2)
192193
(set! tilespac 2.0)
193194
(set! tilespac (round (/ size 6)))
@@ -261,14 +262,14 @@
261262
(gimp-image-set-active-layer image pattern-layer)
262263
(gimp-context-set-background '(128 128 128))
263264
(gimp-edit-blend pattern-layer BLEND-FG-BG-RGB LAYER-MODE-NORMAL GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE FALSE 3 0.2 TRUE (/ width 2) 0 (/ width 2) height)
264-
(gimp-message "264")
265-
(gimp-displays-flush)
265+
;(gimp-message "line265")
266+
;(gimp-displays-flush)
266267
;(quit)
267268

268269
(gimp-selection-none image)
269270
(plug-in-bump-map RUN-NONINTERACTIVE image pattern-layer bump-channel 135 45 32 0 0 0 0 TRUE FALSE 0)
270271
(gimp-displays-flush)
271-
;(gimp-message "line271")
272+
;(gimp-message "line272")
272273

273274

274275
(plug-in-alienmap2 1 image pattern-layer 1 0 1 0 1 0 0 TRUE TRUE TRUE)
@@ -294,16 +295,17 @@
294295

295296
(script-fu-drop-shadow image pattern-layer 4 4 15 '(0 0 0) 80 FALSE)
296297
(set! shadow-layer (car (find-layer-by-name image "Drop Shadow")))
297-
;(gimp-message "line297")
298-
(gimp-displays-flush)
298+
;(gimp-message "line298")
299+
(gimp-progress-pulse)
300+
;(gimp-displays-flush)
299301
;(quit)
300302

301303
(gimp-layer-resize-to-image-size shadow-layer)
302304

303305
;;;;finish the script
304306
(if (= conserve FALSE)
305307
(begin
306-
(gimp-message "flatten process")
308+
;(gimp-message "line 308 flatten process")
307309
(set! background (car (gimp-image-merge-down image pattern-layer EXPAND-AS-NECESSARY)))
308310
(set! background (car (gimp-image-merge-down image background EXPAND-AS-NECESSARY)))
309311
(set! background (car (gimp-image-merge-down image background EXPAND-AS-NECESSARY)))
@@ -436,6 +438,7 @@
436438
(set! final-width (car (gimp-drawable-width size-layer)))
437439
(set! final-height (car (gimp-drawable-height size-layer)))
438440

441+
(gimp-progress-update 0.1)
439442
;;;Add the text layer for a temporary larger Image size
440443
(set! text-layer (car (gimp-text-fontname image -1 0 0 text (round (/ 400 4)) TRUE 400 PIXELS font)))
441444
(gimp-drawable-set-name text-layer "Text")
@@ -449,7 +452,8 @@
449452
(gimp-image-remove-layer image size-layer)
450453
(gimp-image-resize-to-layers image)
451454

452-
;(gimp-message "line452")
455+
;(gimp-message "line455")
456+
(gimp-progress-pulse)
453457
;;;create selection-channel (cond ((= ver 2.8) (gimp-image-select-item image 2 selection-channel)) (else (gimp-selection-load selection-channel)))
454458

455459
;(gimp-image-select-item image CHANNEL-OP-REPLACE text-layer))
@@ -460,13 +464,14 @@
460464
(cond ((= ver 2.8) (gimp-item-set-name selection-channel "selection-channel"))
461465
(else (gimp-item-set-name selection-channel "selection-channel"))
462466
) ;endcond
463-
;(gimp-message "line463")
467+
;(gimp-message "line467")
464468
(gimp-image-set-active-layer image text-layer)
465469
(gimp-selection-grow image edge-width)
466470
(gimp-edit-fill text-layer FILL-FOREGROUND)
467471
(gimp-selection-none image)
468472

469473
;(gimp-context-set-antialias TRUE)
474+
(gimp-progress-update 0.2)
470475

471476
;;;;begin the script
472477

@@ -479,15 +484,17 @@
479484

480485
(set! chrome-layer (car (gimp-layer-copy text-layer TRUE)))
481486
(gimp-image-insert-layer image chrome-layer 0 -1)
482-
(gimp-message "line482")
487+
;(gimp-message "line487")
483488
(gimp-image-select-color image CHANNEL-OP-REPLACE chrome-layer (car (gimp-context-get-foreground)))
484489
;(gimp-display-new image)
485490

486-
;(gimp-message "line485")
491+
;(gimp-message "line491")
492+
(gimp-progress-pulse)
493+
; this scripts depends on FU-chrome-image
487494
(FU-chrome-image image chrome-layer 95.0 16.0 4.0 TRUE TRUE TRUE) ;'(118 112 107)
488-
;(gimp-message "line486")
489-
495+
;(gimp-message "line495")
490496

497+
(gimp-progress-update 0.3)
491498
;
492499
;(gimp-image-remove-layer image (car (find-layer-by-name image "Background")))
493500
(set! text-layer (car (gimp-image-merge-down image (car (gimp-image-get-active-layer image)) EXPAND-AS-NECESSARY)))
@@ -506,6 +513,8 @@
506513

507514
(cond ((= ver 2.8) (gimp-image-select-item image CHANNEL-OP-REPLACE selection-channel)) (else (gimp-selection-load selection-channel)))
508515

516+
;(gimp-message "line516")
517+
(gimp-progress-update 0.4)
509518
(script-fu-metal-mesh-b image
510519
text-layer ;drawable
511520
text-mesh-type
@@ -516,22 +525,25 @@
516525
FALSE) ;conserve
517526

518527
;(gimp-display-new image)
519-
;(quit)
528+
(gimp-progress-pulse)
520529

521530
(set! text-layer (car (gimp-image-get-active-layer image)))
522-
531+
;(gimp-message "line531")
523532
(metal-mesh-easy-3d image
524533
text-layer ;drawable
525534
3d-size
526535
h-dir
527536
v-dir
528537
FALSE ;keep-selection-in
529538
FALSE) ;conserve
530-
539+
540+
;(gimp-message "line540")
541+
(gimp-progress-update 0.5)
531542
(set! text-layer (car (gimp-image-get-active-layer image)))
532543

533-
(cond ((not (= bkg-type 4))
534-
(mesh-pixel-frame image
544+
(if (not (= bkg-type 4))
545+
(begin
546+
(mesh-pixel-frame image
535547
text-layer ;drawable
536548
border-size
537549
FALSE ;keep-selection-in
@@ -541,8 +553,9 @@
541553

542554
(set! text-layer (car (gimp-image-get-active-layer image)))
543555

544-
;(gimp-message "line544")
556+
;(gimp-message "line556")
545557
;;;end
558+
(gimp-progress-update 0.6)
546559

547560
;;;;Scale Image to it's final size;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
548561
(set! aspect (/ final-width (car (gimp-image-width image))))
@@ -552,6 +565,8 @@
552565

553566
(if (= bkg-type 0)
554567
(begin
568+
;(gimp-message "line568")
569+
(gimp-progress-update 0.64)
555570
(script-fu-metal-mesh-b image
556571
text-layer ;drawable
557572
bkg-mesh-type
@@ -564,15 +579,18 @@
564579
(set! bkg-layer (car (gimp-image-get-active-layer image)))
565580
)
566581
) ;endif
567-
;(gimp-message "line567")
568-
582+
;(gimp-message "line582")
583+
(gimp-progress-update 0.7)
569584
;;;;create the background layer
570-
(cond ((not (or (= bkg-type 4) (= bkg-type 0)))
571-
(set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL)))
572-
(include-layer image bkg-layer text-layer 1) ;stack 0=above 1=below
585+
(if (not (or (= bkg-type 4) (= bkg-type 0)))
586+
(begin
587+
(set! bkg-layer (car (gimp-layer-new image width height RGBA-IMAGE "Background" 100 LAYER-MODE-NORMAL)))
588+
(include-layer image bkg-layer text-layer 1) ;stack 0=above 1=below
573589
)
574590
) ;endcond
575591

592+
;(gimp-message "line592")
593+
576594
(gimp-context-set-pattern pattern)
577595
(gimp-context-set-background bkg-color)
578596
(gimp-context-set-gradient gradient)
@@ -594,7 +612,7 @@
594612
(gimp-edit-blend bkg-layer BLEND-CUSTOM LAYER-MODE-NORMAL GRADIENT-LINEAR 100 0 REPEAT-NONE reverse FALSE 3 0.2 TRUE x1 y1 x2 y2)
595613
)
596614
)
597-
615+
(gimp-progress-update 0.95)
598616
(if (= merge TRUE)
599617
(begin
600618
(gimp-image-remove-channel image selection-channel)
@@ -604,7 +622,7 @@
604622
) ;endcond
605623
)
606624
) ;endif
607-
625+
(gimp-progress-update 0.99)
608626
(gimp-context-pop)
609627
(gimp-display-new image)
610628
(gimp-message "Good finish OK")
@@ -716,6 +734,7 @@
716734

717735
; (gimp-context-set-foreground color)
718736
; (gimp-edit-fill image-layer FOREGROUND-FILL)
737+
(gimp-progress-pulse)
719738

720739
(plug-in-bump-map
721740
1
@@ -746,7 +765,7 @@
746765
(gimp-image-set-active-layer image image-layer)
747766
(set! 3d-layer (car (gimp-layer-copy image-layer TRUE)))
748767
(gimp-image-insert-layer image 3d-layer 0 1)
749-
768+
(gimp-progress-pulse)
750769

751770
(set! horizontal
752771
(cond
@@ -768,6 +787,7 @@
768787

769788
(gimp-selection-none image)
770789
(while (> cnt 0)
790+
(gimp-progress-update (* 0.01 (/ 100 cnt)))
771791
(gimp-image-set-active-layer image 3d-layer)
772792
(set! copy-layer (car (gimp-layer-copy 3d-layer TRUE)))
773793
(gimp-image-add-layer image copy-layer -1)
@@ -813,7 +833,7 @@
813833
(if (= keep-selection FALSE) (gimp-selection-none image))
814834
(gimp-image-remove-channel image selection-channel)
815835
; (if (and (= conserve FALSE) (= alpha FALSE) (gimp-layer-flatten image-layer)))
816-
836+
(gimp-progress-pulse)
817837

818838
(gimp-displays-flush)
819839
(gimp-image-undo-group-end image)
@@ -844,30 +864,38 @@
844864
(frame-layer 0)
845865
)
846866

847-
(gimp-message "mesh pixel frame")
867+
;(gimp-message "mesh pixel frame")
868+
(gimp-progress-pulse)
848869
(gimp-context-push)
849870
(gimp-image-undo-group-start image)
850871
(gimp-context-set-default-colors)
851872

852873
;;;;save the selection (gimp-selection-load original-channel)
853874
(if (= sel FALSE)
854875
(begin
876+
;(gimp-message "line863")
855877
(gimp-selection-save image)
856-
(set! original-channel (car (gimp-image-get-active-drawable image)))
878+
(set! original-channel (car (gimp-image-get-active-drawable image)))
857879
(gimp-channel-set-opacity original-channel 100)
858880
(gimp-drawable-set-name original-channel "original-channel")
859881
(gimp-image-set-active-layer image image-layer)
860882
(gimp-selection-none image)
861883
)
862884
)
863885

886+
;(gimp-message "line882")
887+
(gimp-progress-pulse)
864888
(if (= alpha FALSE) (gimp-layer-add-alpha image-layer))
865889

866-
;;;;check that a selection was made and make one
890+
;;;;check that a selection was made and make one
867891
(if (= sel TRUE) (set! keep-selection FALSE))
868892

893+
;(gimp-message "line889")
869894
(gimp-context-set-feather FALSE)
870-
(gimp-context-set-feather-radius 10)
895+
(gimp-context-set-feather-radius 10 8)
896+
897+
;(gimp-message "line893")
898+
(gimp-progress-pulse)
871899
(gimp-image-select-rectangle image
872900
CHANNEL-OP-REPLACE
873901
(car (gimp-drawable-offsets image-layer))
@@ -879,16 +907,20 @@
879907
;;;;create selection-channel (gimp-selection-load selection-channel)
880908
(gimp-selection-save image)
881909
(set! selection-channel (car (gimp-image-get-active-drawable image)))
910+
;(gimp-message "line906")
882911
(gimp-channel-set-opacity selection-channel 100)
883912
(gimp-drawable-set-name selection-channel "selection-channel")
884913
(gimp-image-set-active-layer image image-layer)
885-
(gimp-selection-none image)
914+
(gimp-selection-none image)
886915

887916
;;;;begin the script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
888917
;;;;create the Gradient image
889918
(set! gradient-image (car (gimp-image-new 400 400 RGB)))
890919
(set! gradient-layer (car (gimp-layer-new gradient-image 400 400 RGBA-IMAGE "Gradient" 100 LAYER-MODE-NORMAL)))
891920
(gimp-image-insert-layer gradient-image gradient-layer 0 1)
921+
922+
;(gimp-message "line918")
923+
(gimp-progress-pulse)
892924
(plug-in-diffraction 1 gradient-image gradient-layer 0.815 1.221 1.123 0.821 0.821 0.974 1 1 1 0.066 37.126 -0.473)
893925
(plug-in-rgb-noise 1 gradient-image gradient-layer TRUE FALSE 1 1 1 0)
894926
(gimp-image-crop gradient-image 400 1 0 200)
@@ -897,9 +929,9 @@
897929

898930
;;;;run Gradient from image
899931
;(gimp-display-new gradient-image)
900-
;(gimp-message "line 900 - where's it going")
932+
;(gimp-message "line 914 - where's it going")
901933
(the-pixel-frame-gradient-from-image gradient-image gradient-layer 100 FALSE inName TRUE)
902-
;(gimp-message "line 902 - what are we deleting")
934+
;(gimp-message "line 916 - what are we deleting")
903935
;(gimp-image-delete gradient-image)
904936

905937
;;;;create the frame layer
@@ -910,15 +942,18 @@
910942
(gimp-image-insert-layer image frame-layer 0 -1)
911943
(gimp-context-set-background '(255 255 255))
912944
(gimp-drawable-fill frame-layer FILL-BACKGROUND)
945+
(gimp-progress-pulse)
913946
(gimp-context-set-gradient "Border Gradient")
914947
(gimp-edit-blend frame-layer BLEND-CUSTOM LAYER-MODE-NORMAL GRADIENT-SHAPEBURST-SPHERICAL 100 0 REPEAT-NONE FALSE FALSE 3 0.2 TRUE 0 0 width height)
915948
(gimp-gradient-delete "Border Gradient")
916949
(gimp-selection-load selection-channel)
917950
(gimp-edit-clear frame-layer)
918-
(gimp-selection-none image)
951+
(gimp-selection-none image)
919952

920953
;;;;finish the script
921-
(if (= conserve FALSE) (set! image-layer (car (gimp-image-merge-down image frame-layer EXPAND-AS-NECESSARY))))
954+
(if (= conserve FALSE)
955+
(set! image-layer (car (gimp-image-merge-down image frame-layer EXPAND-AS-NECESSARY)))
956+
)
922957
(gimp-drawable-set-name image-layer layer-name)
923958
(if (= keep-selection TRUE)(gimp-selection-load original-channel))
924959
(gimp-image-remove-channel image selection-channel)

0 commit comments

Comments
 (0)