RFX-GIMP

Check-in [4754a5b716]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed so both start and end of transition are fully exposed frames.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4754a5b71655e6841c12ec604c2a50f159850f9e
User & Date: saul 2012-06-09 08:35:24
Context
2012-06-09
13:20
Fixed when pieces appear (previously they appeared one frame too late). check-in: cc8a371e9b user: saul tags: trunk
08:35
Fixed so both start and end of transition are fully exposed frames. check-in: 4754a5b716 user: saul tags: trunk
04:56
Script to transition using jigsaw pieces. check-in: e11499d94c user: saul tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to scripts/jigsaw.script.

24
25
26
27
28
29
30

31
32
33
34
35
36
37
...
227
228
229
230
231
232
233

234
235
236
237
238
239
240
...
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287

288
289
290
291
292
293
294
295
296
297
298
299
300









301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
326
327
328
gimp
</requires>

<params>
horiz_pieces|Horizontal pieces|num0|0|0|1000000|
vert_pieces|Vertical pieces|num0|0|0|1000000|
curvey_edges|Curvey edges|bool|0|

</params>

<param_window>
layout|p0|p1|
layout|p2|
layout|hseparator|
layout|p3|p4|
................................................................................
  );
</pre>

<loop>
# $p0 - Horizontal pieces
# $p1 - Vertical pieces
# $p2 - Curved edges (boolean)


&rfx_sendmsg (
  qq{
    (begin
      (when (= $frame $start)
        (define rfx-jigsaw-pieces '())
        (define rfx-jigsaw-keyframes '())
................................................................................
                                         jigsaw-image 
                                         (car (gimp-image-get-active-vectors jigsaw-image)) ))
                                rfx-jigsaw-pieces ))
                    (col-loop (pred col)) )))))
          (gimp-image-delete jigsaw-image) 
          )
        ;; randomize the list of pieces
        (let ((number-of-pieces (length rfx-jigsaw-pieces)))
          (set! rfx-jigsaw-pieces 
                (let loop ((lis rfx-jigsaw-pieces)
                           (k number-of-pieces) )
                  (if (zero? k)
                    lis
                    (let ((index (random number-of-pieces)))
                      (loop (append (list-tail lis index)
                                    (list-tail (reverse lis) (- (length lis)  index)) )
                            (pred k) ))))))
        (let ((next-keyframe (make-progressor $start (/ (- $end $start) (* $p0 $p1)))))

          (set! rfx-jigsaw-keyframes (map next-keyframe rfx-jigsaw-pieces))
          )
        )
      (let* ((input-file (string-append "$curtmpdir" DIR-SEPARATOR "$in"))
             (image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file)))
             (layer (car (gimp-image-get-active-layer image)))
             (input-file2 (string-append "$in2"))
             (image2 (car (gimp-file-load RUN-NONINTERACTIVE input-file2 input-file2)))
             (b-layer (car (gimp-layer-new-from-drawable 
                                (car (gimp-image-get-active-layer image2)) 
                                image ))) )
        (gimp-image-undo-disable image)
        (gimp-image-add-layer image b-layer 1)









        (gimp-image-delete image2)

        (gimp-layer-add-alpha layer)
        (gimp-selection-none image)

        (let loop ((keyframes rfx-jigsaw-keyframes)
                   (pieces rfx-jigsaw-pieces) )
          (unless (null? keyframes)
            (let ((path (vector-ref (cadr (gimp-vectors-import-from-string image 
                                                              (car pieces)
                                                              -1
                                                              TRUE
                                                              FALSE ))
                                    0 )))
              (gimp-vectors-to-selection path CHANNEL-OP-ADD TRUE FALSE 0 0)
              (loop (cdr keyframes)
                    (cdr pieces) ))))
        (gimp-selection-grow image 1)

        (gimp-edit-clear layer)
        (when (and (pair? (cdr rfx-jigsaw-keyframes))
                   (>= $frame (cadr rfx-jigsaw-keyframes)) )
          (set! rfx-jigsaw-keyframes (cdr rfx-jigsaw-keyframes)) )

        (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)
        (rfx-save-frame image "$out") 
        )
      )
    }







>







 







>







 







|









|
>













>
>
>
>
>
>
>
>
>





|

|







|


>
|
|
|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
gimp
</requires>

<params>
horiz_pieces|Horizontal pieces|num0|0|0|1000000|
vert_pieces|Vertical pieces|num0|0|0|1000000|
curvey_edges|Curvey edges|bool|0|
clip_position|Clipboard positioning|string_list|0|Normal|Centered|Scaled|
</params>

<param_window>
layout|p0|p1|
layout|p2|
layout|hseparator|
layout|p3|p4|
................................................................................
  );
</pre>

<loop>
# $p0 - Horizontal pieces
# $p1 - Vertical pieces
# $p2 - Curved edges (boolean)
# $p3 - Clipboard position (normal, centered, scaled)

&rfx_sendmsg (
  qq{
    (begin
      (when (= $frame $start)
        (define rfx-jigsaw-pieces '())
        (define rfx-jigsaw-keyframes '())
................................................................................
                                         jigsaw-image 
                                         (car (gimp-image-get-active-vectors jigsaw-image)) ))
                                rfx-jigsaw-pieces ))
                    (col-loop (pred col)) )))))
          (gimp-image-delete jigsaw-image) 
          )
        ;; randomize the list of pieces
        (let ((number-of-pieces (* $p0 $p1)))
          (set! rfx-jigsaw-pieces 
                (let loop ((lis rfx-jigsaw-pieces)
                           (k number-of-pieces) )
                  (if (zero? k)
                    lis
                    (let ((index (random number-of-pieces)))
                      (loop (append (list-tail lis index)
                                    (list-tail (reverse lis) (- (length lis)  index)) )
                            (pred k) ))))))
        (let ((next-keyframe (make-progressor $start (/ (- $end $start) (succ (* $p0 $p1))))))
          (next-keyframe) ; start with fully shown clipboard
          (set! rfx-jigsaw-keyframes (map next-keyframe rfx-jigsaw-pieces))
          )
        )
      (let* ((input-file (string-append "$curtmpdir" DIR-SEPARATOR "$in"))
             (image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file)))
             (layer (car (gimp-image-get-active-layer image)))
             (input-file2 (string-append "$in2"))
             (image2 (car (gimp-file-load RUN-NONINTERACTIVE input-file2 input-file2)))
             (b-layer (car (gimp-layer-new-from-drawable 
                                (car (gimp-image-get-active-layer image2)) 
                                image ))) )
        (gimp-image-undo-disable image)
        (gimp-image-add-layer image b-layer 1)
        (cond 
          ((= $p3 1) ; centered
            (gimp-layer-set-offsets b-layer 
                                    (/ (- $width (car (gimp-drawable-width b-layer))) 2)
                                    (/ (- $height (car (gimp-drawable-height b-layer))) 2) ))
          ((= $p3 2) ; scaled
            (gimp-layer-scale-full b-layer $width $height TRUE INTERPOLATION-CUBIC)
            (gimp-layer-set-offsets b-layer 0 0) ))
        
        (gimp-image-delete image2)

        (gimp-layer-add-alpha layer)
        (gimp-selection-none image)

        (let loop ((number-of-keyframes (length rfx-jigsaw-keyframes))
                   (pieces rfx-jigsaw-pieces) )
          (unless (zero? number-of-keyframes)
            (let ((path (vector-ref (cadr (gimp-vectors-import-from-string image 
                                                              (car pieces)
                                                              -1
                                                              TRUE
                                                              FALSE ))
                                    0 )))
              (gimp-vectors-to-selection path CHANNEL-OP-ADD TRUE FALSE 0 0)
              (loop (pred number-of-keyframes)
                    (cdr pieces) ))))
        (gimp-selection-grow image 1)
        (if (pair? rfx-jigsaw-keyframes)
          (gimp-edit-clear layer) )
        (when (and (pair? rfx-jigsaw-keyframes)
                   (>= $frame (car rfx-jigsaw-keyframes)) )
          (set! rfx-jigsaw-keyframes (cdr rfx-jigsaw-keyframes)) )

        (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)
        (rfx-save-frame image "$out") 
        )
      )
    }

Changes to transitions/jigsaw.loop.

1
2
3

4
5
6
7
8
9
10
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
69
70









71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
# $p0 - Horizontal pieces
# $p1 - Vertical pieces
# $p2 - Curved edges (boolean)


&rfx_sendmsg (
  qq{
    (begin
      (when (= $frame $start)
        (define rfx-jigsaw-pieces '())
        (define rfx-jigsaw-keyframes '())
................................................................................
                                         jigsaw-image 
                                         (car (gimp-image-get-active-vectors jigsaw-image)) ))
                                rfx-jigsaw-pieces ))
                    (col-loop (pred col)) )))))
          (gimp-image-delete jigsaw-image) 
          )
        ;; randomize the list of pieces
        (let ((number-of-pieces (length rfx-jigsaw-pieces)))
          (set! rfx-jigsaw-pieces 
                (let loop ((lis rfx-jigsaw-pieces)
                           (k number-of-pieces) )
                  (if (zero? k)
                    lis
                    (let ((index (random number-of-pieces)))
                      (loop (append (list-tail lis index)
                                    (list-tail (reverse lis) (- (length lis)  index)) )
                            (pred k) ))))))
        (let ((next-keyframe (make-progressor $start (/ (- $end $start) (* $p0 $p1)))))

          (set! rfx-jigsaw-keyframes (map next-keyframe rfx-jigsaw-pieces))
          )
        )
      (let* ((input-file (string-append "$curtmpdir" DIR-SEPARATOR "$in"))
             (image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file)))
             (layer (car (gimp-image-get-active-layer image)))
             (input-file2 (string-append "$in2"))
             (image2 (car (gimp-file-load RUN-NONINTERACTIVE input-file2 input-file2)))
             (b-layer (car (gimp-layer-new-from-drawable 
                                (car (gimp-image-get-active-layer image2)) 
                                image ))) )
        (gimp-image-undo-disable image)
        (gimp-image-add-layer image b-layer 1)









        (gimp-image-delete image2)

        (gimp-layer-add-alpha layer)
        (gimp-selection-none image)

        (let loop ((keyframes rfx-jigsaw-keyframes)
                   (pieces rfx-jigsaw-pieces) )
          (unless (null? keyframes)
            (let ((path (vector-ref (cadr (gimp-vectors-import-from-string image 
                                                              (car pieces)
                                                              -1
                                                              TRUE
                                                              FALSE ))
                                    0 )))
              (gimp-vectors-to-selection path CHANNEL-OP-ADD TRUE FALSE 0 0)
              (loop (cdr keyframes)
                    (cdr pieces) ))))
        (gimp-selection-grow image 1)

        (gimp-edit-clear layer)
        (when (and (pair? (cdr rfx-jigsaw-keyframes))
                   (>= $frame (cadr rfx-jigsaw-keyframes)) )
          (set! rfx-jigsaw-keyframes (cdr rfx-jigsaw-keyframes)) )

        (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)
        (rfx-save-frame image "$out") 
        )
      )
    }
  );



>







 







|









|
>













>
>
>
>
>
>
>
>
>





|

|







|


>
|
|
|








1
2
3
4
5
6
7
8
9
10
11
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# $p0 - Horizontal pieces
# $p1 - Vertical pieces
# $p2 - Curved edges (boolean)
# $p3 - Clipboard position (normal, centered, scaled)

&rfx_sendmsg (
  qq{
    (begin
      (when (= $frame $start)
        (define rfx-jigsaw-pieces '())
        (define rfx-jigsaw-keyframes '())
................................................................................
                                         jigsaw-image 
                                         (car (gimp-image-get-active-vectors jigsaw-image)) ))
                                rfx-jigsaw-pieces ))
                    (col-loop (pred col)) )))))
          (gimp-image-delete jigsaw-image) 
          )
        ;; randomize the list of pieces
        (let ((number-of-pieces (* $p0 $p1)))
          (set! rfx-jigsaw-pieces 
                (let loop ((lis rfx-jigsaw-pieces)
                           (k number-of-pieces) )
                  (if (zero? k)
                    lis
                    (let ((index (random number-of-pieces)))
                      (loop (append (list-tail lis index)
                                    (list-tail (reverse lis) (- (length lis)  index)) )
                            (pred k) ))))))
        (let ((next-keyframe (make-progressor $start (/ (- $end $start) (succ (* $p0 $p1))))))
          (next-keyframe) ; start with fully shown clipboard
          (set! rfx-jigsaw-keyframes (map next-keyframe rfx-jigsaw-pieces))
          )
        )
      (let* ((input-file (string-append "$curtmpdir" DIR-SEPARATOR "$in"))
             (image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file)))
             (layer (car (gimp-image-get-active-layer image)))
             (input-file2 (string-append "$in2"))
             (image2 (car (gimp-file-load RUN-NONINTERACTIVE input-file2 input-file2)))
             (b-layer (car (gimp-layer-new-from-drawable 
                                (car (gimp-image-get-active-layer image2)) 
                                image ))) )
        (gimp-image-undo-disable image)
        (gimp-image-add-layer image b-layer 1)
        (cond 
          ((= $p3 1) ; centered
            (gimp-layer-set-offsets b-layer 
                                    (/ (- $width (car (gimp-drawable-width b-layer))) 2)
                                    (/ (- $height (car (gimp-drawable-height b-layer))) 2) ))
          ((= $p3 2) ; scaled
            (gimp-layer-scale-full b-layer $width $height TRUE INTERPOLATION-CUBIC)
            (gimp-layer-set-offsets b-layer 0 0) ))
        
        (gimp-image-delete image2)

        (gimp-layer-add-alpha layer)
        (gimp-selection-none image)

        (let loop ((number-of-keyframes (length rfx-jigsaw-keyframes))
                   (pieces rfx-jigsaw-pieces) )
          (unless (zero? number-of-keyframes)
            (let ((path (vector-ref (cadr (gimp-vectors-import-from-string image 
                                                              (car pieces)
                                                              -1
                                                              TRUE
                                                              FALSE ))
                                    0 )))
              (gimp-vectors-to-selection path CHANNEL-OP-ADD TRUE FALSE 0 0)
              (loop (pred number-of-keyframes)
                    (cdr pieces) ))))
        (gimp-selection-grow image 1)
        (if (pair? rfx-jigsaw-keyframes)
          (gimp-edit-clear layer) )
        (when (and (pair? rfx-jigsaw-keyframes)
                   (>= $frame (car rfx-jigsaw-keyframes)) )
          (set! rfx-jigsaw-keyframes (cdr rfx-jigsaw-keyframes)) )

        (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)
        (rfx-save-frame image "$out") 
        )
      )
    }
  );