1Prima::Image::Animate(3U)ser Contributed Perl DocumentatiPornima::Image::Animate(3)
2
3
4
6 Prima::Image::Animate - animate gif and webp files
7
9 The module provides high-level access to GIF and WebP animation
10 sequences.
11
13 use Prima qw(Application Image::Animate);
14 my $x = Prima::Image::Animate->load($ARGV[0]);
15 die $@ unless $x;
16 my ( $X, $Y) = ( 0, 100);
17 my $want_background = 1; # 0 for eventual transparency
18 my $background = $::application-> get_image( $X, $Y, $x-> size);
19 $::application-> begin_paint;
20
21 while ( my $info = $x-> next) {
22 my $frame = $background-> dup;
23 $frame-> begin_paint;
24 $x-> draw_background( $frame, 0, 0) if $want_background;
25 $x-> draw( $frame, 0, 0);
26 $::application-> put_image( $X, $Y, $frame);
27
28 $::application-> sync;
29 select(undef, undef, undef, $info-> {delay});
30 }
31
32 $::application-> put_image( $X, $Y, $g);
33
34 new $CLASS, %OPTIONS
35 Creates an empty animation container. If $OPTIONS{images} is given, it
36 is expected to be an array of images, best if loaded from gif files
37 with "loadExtras" and "iconUnmask" parameters set ( see
38 Prima::image-load for details).
39
40 load $SOURCE, %OPTIONS
41 Loads GIF or WebP animation sequence from file or stream $SOURCE.
42 Options are the same as understood by "Prima::Image::load", and are
43 passed down to it.
44
45 add $IMAGE
46 Appends an image frame to the container.
47
48 bgColor
49 Return the background color specified by the sequence as the preferred
50 background color to use when there is no specific background to
51 superimpose the animation to.
52
53 current
54 Return index of the current frame
55
56 draw $CANVAS, $X, $Y
57 Draws the current composite frame on $CANVAS at the given coordinates.
58
59 draw_background $CANVAS, $X, $Y
60 Fills the background on $CANVAS at the given coordinates if file
61 provides that. Returns whether the canvas was tainted or not.
62
63 height
64 Returns height of the composite frame.
65
66 icon
67 Creates and returns an icon object off the current composite frame.
68
69 image
70 Creates and returns an image object off the current composite frame.
71 The transparent pixels on the image are replaced with the preferred
72 background color.
73
74 is_stopped
75 Returns true if the animation sequence was stopped, false otherwise.
76 If the sequence was stopped, the only way to restart it is to call
77 "reset".
78
79 length
80 Returns total animation length (without repeats) in seconds.
81
82 loopCount [ INTEGER ]
83 Sets and returns number of loops left, undef for indefinite.
84
85 next
86 Advances one animation frame. The step triggers changes to the
87 internally kept AND and XOR masks that create effect of transparency,
88 if needed. The method return a hash, where the following field are
89 initialized:
90
91 left, bottom, right, top
92 Coordinates of the changed area since the last frame was updated.
93
94 delay
95 Time ins seconds how long the frame is expected to be displayed.
96
97 reset
98 Resets the animation sequence. This call is necessary either when image
99 sequence was altered, or when sequence display restart is needed.
100
101 size
102 Returns width and height of the composite frame.
103
104 total
105 Return number fo frames
106
107 width
108 Returns width of the composite frame.
109
111 Prima::image-load, <http://www.the-labs.com/GIFMerge/>
112
114 Dmitry Karasik, <dmitry@karasik.eu.org>.
115
116
117
118perl v5.30.0 2019-08-21 Prima::Image::Animate(3)