|
20 | 20 | palette
|
21 | 21 | gradient
|
22 | 22 | create-path?)
|
23 |
| - (let* ( (create-path (not (zero? create-path?))) |
| 23 | + |
| 24 | + (let* ( |
| 25 | + (create-path (not (zero? create-path?))) |
24 | 26 | (color-mode (+ (* 2 colormodea) randomb))
|
25 | 27 | (width (car (gimp-drawable-width drawable)))
|
26 | 28 | (height (car (gimp-drawable-height drawable)))
|
|
51 | 53 | (gimp-image-undo-group-start image)
|
52 | 54 | (gimp-context-push)
|
53 | 55 | (set! old-fg (car (gimp-context-get-foreground)))
|
54 |
| - (gimp-message "started") |
| 56 | + ;(gimp-message "started") |
55 | 57 | (gimp-context-set-paint-method "gimp-paintbrush")
|
56 | 58 | (gimp-context-set-paint-mode LAYER-MODE-NORMAL)
|
57 |
| - (set! brush (car (gimp-brush-new "sg mystic temporary"))) |
58 |
| - (gimp-brush-set-shape brush BRUSH-GENERATED-CIRCLE) |
59 |
| - (gimp-brush-set-hardness brush 0.99) |
60 |
| - (gimp-brush-set-aspect-ratio brush 1.0) |
61 |
| - (gimp-brush-set-spacing brush 20.0) |
62 |
| - (gimp-brush-set-radius brush (round (/ thickness 2))) |
| 59 | + (set! brush (car (gimp-context-get-brush))) |
| 60 | + ;(set! brush (car (gimp-brush-new "sg mystic temporary"))) |
| 61 | + ;(gimp-brush-set-shape brush BRUSH-GENERATED-CIRCLE) |
| 62 | + ;(gimp-brush-set-spikes brush 2) |
| 63 | + ;(gimp-brush-set-hardness brush 0.99) |
| 64 | + ;(gimp-brush-set-aspect-ratio brush 1.0) |
| 65 | + ;(gimp-brush-set-spacing brush 20.0) |
| 66 | + ;(gimp-brush-set-radius brush (round (/ thickness 2))) |
63 | 67 | ;(gimp-brushes-refresh)
|
64 | 68 |
|
65 |
| - ;(gimp-brush-set-radius brush 2.0) |
66 |
| - (gimp-context-set-brush brush) ; was brush not "temporary" |
| 69 | + (gimp-context-set-brush-size thickness) |
| 70 | + ;(gimp-context-set-brush brush) ; was brush not "temporary" |
| 71 | + |
| 72 | + ;(gimp-brush-set-radius brush 8.0) |
| 73 | + ;(gimp-brushes-refresh) |
67 | 74 |
|
68 | 75 | (gimp-context-set-foreground old-fg)
|
69 | 76 | (gimp-context-set-opacity 100.0)
|
70 | 77 |
|
| 78 | + (gimp-context-set-palette palette) |
| 79 | + (gimp-context-set-gradient gradient) |
| 80 | + |
71 | 81 | ;(gimp-message "line 56")
|
72 | 82 | (set! path (car (gimp-vectors-new image (string-append (number->string number-of-points)
|
73 | 83 | "pt mystic rose" ))))
|
|
111 | 121 | ;(gimp-message "line 106 using fg")
|
112 | 122 | )
|
113 | 123 | ((= color-mode 1) ; random color
|
| 124 | + (gimp-message "line 108 - random color") |
114 | 125 | (gimp-context-set-foreground (list (rand 255) (rand 255) (rand 255))) ; were all random 256
|
115 | 126 | ;(gimp-message "line 100 random color")
|
116 | 127 | )
|
117 | 128 | ((= color-mode 2) ; palette - color-index is offset into palette
|
118 | 129 | ;(gimp-message "line 103 - palette")
|
119 | 130 | (gimp-context-set-foreground
|
120 |
| - (car (gimp-palette-entry-get-color palette (floor (modulo color-index (- num-palette-entries 1))))) ) |
| 131 | + (car (gimp-palette-entry-get-color palette (floor (modulo color-index (- num-palette-entries 0))))) ) |
121 | 132 | )
|
122 | 133 | ((= color-mode 3) ; palette random - choose random color from specified palette
|
123 | 134 | ;(gimp-message "line 108 - palette random")
|
| 135 | + (gimp-context-set-palette palette) |
124 | 136 | (gimp-context-set-foreground
|
125 |
| - (car (gimp-palette-entry-get-color palette (rand (- num-palette-entries 1)))) ) ; was rand dum-pal-entr |
| 137 | + (car (gimp-palette-entry-get-color palette (- (rand (- num-palette-entries 0)) 1))) ) ; was rand dum-pal-entr |
126 | 138 | )
|
127 | 139 | ((= color-mode 4) ; gradient - color-index is offset into specified gradient
|
128 | 140 | ;(gimp-message "line 113 - gradient color")
|
|
135 | 147 | (quit)
|
136 | 148 | )
|
137 | 149 | )
|
| 150 | + (gimp-context-set-gradient gradient) |
138 | 151 | (let* ((color-vector (cadr (gimp-gradient-get-custom-samples gradient
|
139 | 152 | 1
|
140 | 153 | (vector (/ color-index num-strokes))
|
|
148 | 161 | )
|
149 | 162 | ((= color-mode 5) ; gradient random - random color from specified gradient
|
150 | 163 | ;(gimp-message "line 134 - gradient random")
|
| 164 | + (gimp-context-set-gradient gradient) |
151 | 165 | (let* ((color-vector (cadr (gimp-gradient-get-custom-samples gradient
|
152 | 166 | 1
|
153 | 167 | (vector (/ (random num-strokes) num-strokes))
|
|
205 | 219 | ; )
|
206 | 220 | ;)
|
207 | 221 |
|
208 |
| - (gimp-message "Good finish OK") |
| 222 | + ;(gimp-message "Good finish OK") |
209 | 223 | (gimp-context-pop)
|
210 | 224 | (gimp-image-undo-group-end image)
|
211 | 225 | (gimp-displays-flush)
|
| 226 | + (gc) ; garbage cleanup; temp brush was used |
212 | 227 | )
|
213 | 228 | )
|
214 | 229 |
|
|
222 | 237 | SF-IMAGE "Image" 0
|
223 | 238 | SF-DRAWABLE "Layer" 0
|
224 | 239 | SF-ADJUSTMENT "Number of points" '(12 3 179 1 10 0 1)
|
225 |
| - SF-ADJUSTMENT "Line thickness (not used)" '(4 1 20 1 3 0 1) |
| 240 | + SF-ADJUSTMENT "Line thickness (overides brush size)" '(4 1 210 1 3 0 1) |
226 | 241 | SF-TOGGLE "Random?" FALSE
|
227 | 242 | SF-OPTION "Color method" '("Foreground" "Palette" "Gradient")
|
228 | 243 | SF-PALETTE "Palette" "Default"
|
|
0 commit comments