Marc Lehmann > Gimp-1.211 > examples/frame_reshuffle

Download:
Gimp-1.211.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: Gimp-2.31

DESCRIPTION ^

This function re-orders the layer stack using either a builtin function (only reversal is available at the moment, contact me if you find another useful function) or a custom one.

REVERSE (1) will reverse the order of layers (it is equivalent to the custom function -i).

SHIFT (2) will shift the sequence by the amount (positive or negative) indicated in the custom field. It is equivalent to the custom function ( i + custom ) % n.

If you specify CUSTOM (0) as function than you can use the "custom" argument to specify any function you like. Any i is replaced by the index of the layer (0..n-1), any n is replaced by the total number of layers. The function returns the new position of the layer, which is measured relative to all other positions, i.e. your function can return values 0.1, 0.7 and 0.3 for layers 0, 1 and 2 respectively, and the new order will be 0, 2 and 1.

Examples:

 -i        # reverse the order of layers
 (i+5)%n   # shift the order of frames by 5
syntax highlighting: