1Prima::Image::Animate(3U)ser Contributed Perl DocumentatiPornima::Image::Animate(3)
2
3
4

NAME

6       Prima::Image::Animate - animate gif,webp,png files
7

DESCRIPTION

9       The module provides high-level access to GIF, APNG, and WebP animation
10       sequences.
11

SYNOPSIS

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   detect_animation $HASH
41       Checks "{extras} hash" obtained from a image loaded with "loadExtras"
42       flag set, to detect whether the image is an animation, and if loading
43       all of its frame is supported by the module. Returns file format name
44       on success, undef otherwise.
45
46   load $SOURCE, %OPTIONS
47       Loads GIF or WebP animation sequence from file or stream $SOURCE.
48       Options are the same as understood by "Prima::Image::load", and are
49       passed down to it.
50
51   add $IMAGE
52       Appends an image frame to the container.
53
54   bgColor
55       Return the background color specified by the sequence as the preferred
56       background color to use when there is no specific background to
57       superimpose the animation to.
58
59   current
60       Return index of the current frame
61
62   draw $CANVAS, $X, $Y
63       Draws the current composite frame on $CANVAS at the given coordinates.
64
65   draw_background $CANVAS, $X, $Y
66       Fills the background on $CANVAS at the given coordinates if file
67       provides that.  Returns whether the canvas was tainted or not.
68
69   height
70       Returns height of the composite frame.
71
72   icon
73       Creates and returns an icon object off the current composite frame.
74
75   image
76       Creates and returns an image object off the current composite frame.
77       The transparent pixels on the image are replaced with the preferred
78       background color.
79
80   is_stopped
81       Returns true if the animation sequence was stopped, false otherwise.
82       If the sequence was stopped, the only way to restart it is to call
83       "reset".
84
85   length
86       Returns total animation length (without repeats) in seconds.
87
88   loopCount [ INTEGER ]
89       Sets and returns number of loops left, undef for indefinite.
90
91   next
92       Advances one animation frame. The step triggers changes to the
93       internally kept icon image that create effect of transparency, if
94       needed.  The method returns a hash, where the following fields are
95       initialized:
96
97       left, bottom, right, top
98           Coordinates of the changed area since the last frame was updated.
99
100       delay
101           Time in seconds how long the frame is expected to be displayed.
102
103   reset
104       Resets the animation sequence. This call is necessary either when image
105       sequence was altered, or when sequence display restart is needed.
106
107   size
108       Returns width and height of the composite frame.
109
110   total
111       Return number fo frames
112
113   width
114       Returns width of the composite frame.
115

SEE ALSO

117       Prima::image-load
118

AUTHOR

120       Dmitry Karasik, <dmitry@karasik.eu.org>.
121
122
123
124perl v5.36.0                      2023-03-20          Prima::Image::Animate(3)
Impressum