[gimp-data-extras] Issue #360 - scripts that require brushes that GIMP no longer installs



commit d2007e44aae2eae898d843eea436d94eda3e77d4
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jul 14 13:54:09 2019 +0200

    Issue #360 - scripts that require brushes that GIMP no longer installs
    
    carved-logo.scm: apply slightly modified patch from Carol Spears which
    replaces hardcoding round brush names by creating a brush on the fly
    and setting its radius.

 scripts/carved-logo.scm | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/scripts/carved-logo.scm b/scripts/carved-logo.scm
index 20625a5..343d416 100644
--- a/scripts/carved-logo.scm
+++ b/scripts/carved-logo.scm
@@ -4,16 +4,6 @@
 ;   http://www.peachpit.com
 
 
-(define (carve-brush brush-size)
-  (cond ((<= brush-size 5) "Circle (05)")
-        ((<= brush-size 7) "Circle (07)")
-        ((<= brush-size 9) "Circle (09)")
-        ((<= brush-size 11) "Circle (11)")
-        ((<= brush-size 13) "Circle (13)")
-        ((<= brush-size 15) "Circle (15)")
-        ((<= brush-size 17) "Circle (17)")
-        ((> brush-size 17) "Circle (19)")))
-
 (define (carve-scale val scale)
   (* (sqrt val) scale))
 
@@ -30,6 +20,7 @@
         (offy (carve-scale size 0.25))
         (feather (carve-scale size 0.3))
         (brush-size (carve-scale size 0.3))
+        (brush-name (car (gimp-brush-new "Carveed Logo")))
         (b-size (+ (carve-scale size 0.5) padding))
         (layer1 (car (gimp-image-get-active-drawable img)))
         (mask-layer (car (gimp-text-fontname img -1 0 0 text b-size TRUE size PIXELS font)))
@@ -79,7 +70,17 @@
     (set! mask-fat (car (gimp-channel-copy mask)))
     (gimp-image-insert-channel img mask-fat -1 0)
     (gimp-image-select-item img CHANNEL-OP-REPLACE mask-fat)
-    (gimp-context-set-brush (carve-brush brush-size))
+
+    (gimp-brush-set-shape brush-name BRUSH-GENERATED-CIRCLE)
+    (gimp-brush-set-spikes brush-name 2)
+    (gimp-brush-set-hardness brush-name 1.0)
+    (gimp-brush-set-spacing brush-name 25)
+    (gimp-brush-set-aspect-ratio brush-name 1)
+    (gimp-brush-set-angle brush-name 0)
+    (cond (<= brush-size 17) (gimp-brush-set-radius brush-name (\ brush-size 2))
+         (else gimp-brush-set-radius brush-name (\ 19 2)))
+    (gimp-context-set-brush brush-name)
+
     (gimp-context-set-foreground '(255 255 255))
     (gimp-edit-stroke mask-fat)
     (gimp-selection-none img)
@@ -151,6 +152,8 @@
     (gimp-item-set-name cast-shadow-layer _"Cast Shadow")
     (gimp-item-set-name inset-layer _"Inset")
 
+    (gimp-brush-delete brush-name)
+
     (gimp-display-new img)
     (gimp-image-undo-enable img)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]