~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/camo.scm

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
; Chris Gutteridge (cjg@ecs.soton.ac.uk)
5
5
; At ECS Dept, University of Southampton, England.
6
6
 
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.
11
11
;
12
12
; This program is distributed in the hope that it will be useful,
15
15
; GNU General Public License for more details.
16
16
;
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/>.
20
19
 
21
20
 
22
21
(define (script-fu-camo-pattern inSize inGrain inColor1 inColor2 inColor3 inSmooth inFlatten)
32
31
        )
33
32
 
34
33
    (gimp-context-push)
 
34
    (gimp-context-set-defaults)
35
35
 
36
 
    (gimp-image-add-layer theImage baseLayer 0)
 
36
    (gimp-image-insert-layer theImage baseLayer 0 0)
37
37
 
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)
40
40
 
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)
43
43
 
44
44
    (gimp-selection-all theImage)
45
45
    (gimp-context-set-background inColor1)
46
46
    (gimp-drawable-fill baseLayer BACKGROUND-FILL)
47
47
 
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)
54
54
 
55
55
    (set! theBlur (- 16 inGrain))
56
56
 
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)
67
66
 
68
67
 
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)