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

« back to all changes in this revision

Viewing changes to plug-ins/script-fu/scripts/weave.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:
5
5
; Copyright (C) 1997 Federico Mena Quintero
6
6
; federico@nuclecu.unam.mx
7
7
;
8
 
; This program is free software; you can redistribute it and/or modify
 
8
; This program is free software: you can redistribute it and/or modify
9
9
; it under the terms of the GNU General Public License as published by
10
 
; the Free Software Foundation; either version 2 of the License, or
 
10
; the Free Software Foundation; either version 3 of the License, or
11
11
; (at your option) any later version.
12
12
;
13
13
; This program is distributed in the hope that it will be useful,
16
16
; GNU General Public License for more details.
17
17
;
18
18
; You should have received a copy of the GNU General Public License
19
 
; along with this program; if not, write to the Free Software
20
 
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
; along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
20
 
22
21
 
23
22
; Copies the specified rectangle from/to the specified drawable
30
29
                        height
31
30
                        dest-x
32
31
                        dest-y)
33
 
  (gimp-rect-select img x1 y1 width height CHANNEL-OP-REPLACE FALSE 0)
 
32
  (gimp-image-select-rectangle img CHANNEL-OP-REPLACE x1 y1 width height)
34
33
  (gimp-edit-copy drawable)
35
34
  (let ((floating-sel (car (gimp-edit-paste drawable FALSE))))
36
35
    (gimp-layer-set-offsets floating-sel dest-x dest-y)
48
47
         (img (car (gimp-image-new tile-size tile-size RGB)))
49
48
         (drawable (car (gimp-layer-new img tile-size tile-size RGB-IMAGE
50
49
                                        "Weave tile" 100 NORMAL-MODE))))
 
50
 
51
51
    (gimp-image-undo-disable img)
52
 
    (gimp-image-add-layer img drawable 0)
 
52
    (gimp-image-insert-layer img drawable 0 0)
53
53
 
54
54
    (gimp-context-set-background '(0 0 0))
55
55
    (gimp-edit-fill drawable BACKGROUND-FILL)
59
59
    (gimp-context-set-foreground '(255 255 255))
60
60
    (gimp-context-set-background (list darkness darkness darkness))
61
61
 
62
 
    (gimp-rect-select img
63
 
                      0
64
 
                      ribbon-spacing
65
 
                      (+ (* 2 ribbon-spacing) ribbon-width)
66
 
                      ribbon-width
67
 
                      CHANNEL-OP-REPLACE
68
 
                      FALSE
69
 
                      0)
 
62
    (gimp-image-select-rectangle img
 
63
                                 CHANNEL-OP-REPLACE
 
64
                                 0
 
65
                                 ribbon-spacing
 
66
                                 (+ (* 2 ribbon-spacing) ribbon-width)
 
67
                                 ribbon-width)
70
68
 
71
69
    (gimp-edit-blend drawable FG-BG-RGB-MODE NORMAL-MODE
72
70
                     GRADIENT-BILINEAR 100 (- 100 shadow-depth) REPEAT-NONE FALSE
75
73
 
76
74
    ; Create main vertical ribbon
77
75
 
78
 
    (gimp-rect-select img
79
 
                      (+ (* 2 ribbon-spacing) ribbon-width)
80
 
                      0
81
 
                      ribbon-width
82
 
                      (+ (* 2 ribbon-spacing) ribbon-width)
83
 
                      CHANNEL-OP-REPLACE
84
 
                      FALSE
85
 
                      0)
 
76
    (gimp-image-select-rectangle img
 
77
                                 CHANNEL-OP-REPLACE
 
78
                                 (+ (* 2 ribbon-spacing) ribbon-width)
 
79
                                 0
 
80
                                 ribbon-width
 
81
                                 (+ (* 2 ribbon-spacing) ribbon-width))
86
82
 
87
83
    (gimp-edit-blend drawable FG-BG-RGB-MODE NORMAL-MODE
88
84
                     GRADIENT-BILINEAR 100 (- 100 shadow-depth) REPEAT-NONE FALSE
132
128
    ; Done
133
129
 
134
130
    (gimp-image-undo-enable img)
135
 
 
136
131
    (list img drawable)))
137
132
 
138
133
; Creates a complete weaving mask
172
167
         (drawable (car (gimp-layer-new img tile-size tile-size RGB-IMAGE
173
168
                                        "Mask" 100 NORMAL-MODE))))
174
169
    (gimp-image-undo-disable img)
175
 
    (gimp-image-add-layer img drawable 0)
 
170
    (gimp-image-insert-layer img drawable 0 0)
176
171
 
177
172
    (gimp-context-set-background '(0 0 0))
178
173
    (gimp-edit-fill drawable BACKGROUND-FILL)
179
174
 
180
 
    (gimp-rect-select img r1-x1 r1-y1 r1-width r1-height CHANNEL-OP-REPLACE FALSE 0)
181
 
    (gimp-rect-select img r2-x1 r2-y1 r2-width r2-height CHANNEL-OP-ADD FALSE 0)
182
 
    (gimp-rect-select img r3-x1 r3-y1 r3-width r3-height CHANNEL-OP-ADD FALSE 0)
 
175
    (gimp-image-select-rectangle img CHANNEL-OP-REPLACE r1-x1 r1-y1 r1-width r1-height)
 
176
    (gimp-image-select-rectangle img CHANNEL-OP-ADD r2-x1 r2-y1 r2-width r2-height)
 
177
    (gimp-image-select-rectangle img CHANNEL-OP-ADD r3-x1 r3-y1 r3-width r3-height)
183
178
 
184
179
    (gimp-context-set-background '(255 255 255))
185
180
    (gimp-edit-fill drawable BACKGROUND-FILL)
275
270
  (let* ((drawable (car (gimp-layer-new img width height RGBA-IMAGE
276
271
                                        "Threads" 100 NORMAL-MODE)))
277
272
         (dense (/ density 100.0)))
278
 
    (gimp-image-add-layer img drawable -1)
 
273
    (gimp-image-insert-layer img drawable 0 -1)
279
274
    (gimp-context-set-background '(255 255 255))
280
275
    (gimp-edit-fill drawable BACKGROUND-FILL)
281
276
    (plug-in-noisify RUN-NONINTERACTIVE img drawable FALSE dense dense dense dense)
352
347
                         thread-density
353
348
                         thread-intensity)
354
349
  (let* (
355
 
        (d-img (car (gimp-drawable-get-image drawable)))
 
350
        (d-img (car (gimp-item-get-image drawable)))
356
351
        (d-width (car (gimp-drawable-width drawable)))
357
352
        (d-height (car (gimp-drawable-height drawable)))
358
353
        (d-offsets (gimp-drawable-offsets drawable))
371
366
        )
372
367
 
373
368
    (gimp-context-push)
 
369
    (gimp-context-set-feather FALSE)
374
370
 
375
371
    (gimp-selection-all w-img)
376
372
    (gimp-edit-copy w-layer)