4
4
; Chris Gutteridge (cjg@ecs.soton.ac.uk)
5
5
; At ECS Dept, University of Southampton, England.
7
; This program is free software; you can redistribute it and/or modify
7
; This program is free software: you can redistribute it and/or modify
8
8
; it under the terms of the GNU General Public License as published by
9
; the Free Software Foundation; either version 2 of the License, or
9
; the Free Software Foundation; either version 3 of the License, or
10
10
; (at your option) any later version.
12
12
; This program is distributed in the hope that it will be useful,
15
15
; GNU General Public License for more details.
17
17
; You should have received a copy of the GNU General Public License
18
; along with this program; if not, write to the Free Software
19
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
; along with this program. If not, see <http://www.gnu.org/licenses/>.
22
21
(define (script-fu-camo-pattern inSize inGrain inColor1 inColor2 inColor3 inSmooth inFlatten)
34
33
(gimp-context-push)
34
(gimp-context-set-defaults)
36
(gimp-image-add-layer theImage baseLayer 0)
36
(gimp-image-insert-layer theImage baseLayer 0 0)
38
38
(set! thickLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thick Layer" 100 NORMAL-MODE)))
39
(gimp-image-add-layer theImage thickLayer 0)
39
(gimp-image-insert-layer theImage thickLayer 0 0)
41
41
(set! thinLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Camo Thin Layer" 100 NORMAL-MODE)))
42
(gimp-image-add-layer theImage thinLayer 0)
42
(gimp-image-insert-layer theImage thinLayer 0 0)
44
44
(gimp-selection-all theImage)
45
45
(gimp-context-set-background inColor1)
46
46
(gimp-drawable-fill baseLayer BACKGROUND-FILL)
48
48
(plug-in-solid-noise RUN-NONINTERACTIVE
49
theImage thickLayer 1 0 (rand 65536) 1 inGrain inGrain)
49
theImage thickLayer 1 0 (rand 65536) 1 inGrain inGrain)
50
50
(plug-in-solid-noise RUN-NONINTERACTIVE
51
theImage thinLayer 1 0 (rand 65536) 1 inGrain inGrain)
51
theImage thinLayer 1 0 (rand 65536) 1 inGrain inGrain)
52
52
(gimp-threshold thickLayer 127 255)
53
53
(gimp-threshold thinLayer 145 255)
55
55
(set! theBlur (- 16 inGrain))
57
57
(gimp-context-set-background inColor2)
58
(gimp-by-color-select thickLayer
59
'(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
58
(gimp-image-select-color theImage CHANNEL-OP-REPLACE thickLayer '(0 0 0))
60
59
(gimp-edit-clear thickLayer)
61
60
(gimp-selection-invert theImage)
62
61
(gimp-edit-fill thickLayer BACKGROUND-FILL)
69
68
(gimp-context-set-background inColor3)
70
(gimp-by-color-select thinLayer '(0 0 0) 127 CHANNEL-OP-REPLACE TRUE FALSE 0 FALSE)
69
(gimp-image-select-color theImage CHANNEL-OP-REPLACE thinLayer '(0 0 0))
71
70
(gimp-edit-clear thinLayer)
72
71
(gimp-selection-invert theImage)
73
72
(gimp-edit-fill thinLayer BACKGROUND-FILL)