![]() |
![]()
| ![]() |
![]()
NAMEPrima::Image::Animate - animate gif,webp,png filesDESCRIPTIONThe module provides high-level access to GIF, APNG, and WebP animation sequences.SYNOPSISuse Prima qw(Application Image::Animate); my $x = Prima::Image::Animate->load($ARGV[0]); die $@ unless $x; my ( $X, $Y) = ( 0, 100); my $want_background = 1; # 0 for eventual transparency my $background = $::application-> get_image( $X, $Y, $x-> size); $::application-> begin_paint; while ( my $info = $x-> next) { my $frame = $background-> dup; $frame-> begin_paint; $x-> draw_background( $frame, 0, 0) if $want_background; $x-> draw( $frame, 0, 0); $::application-> put_image( $X, $Y, $frame); $::application-> sync; select(undef, undef, undef, $info-> {delay}); } $::application-> put_image( $X, $Y, $g); new $CLASS, %OPTIONSCreates an empty animation container. If $OPTIONS{images} is given, it is expected to be an array of images, best if loaded from gif files with "loadExtras" and "iconUnmask" parameters set ( see Prima::image-load for details).detect_animation $HASHChecks "{extras} hash" obtained from a image loaded with "loadExtras" flag set, to detect whether the image is an animation, and if loading all of its frame is supported by the module. Returns file format name on success, undef otherwise.load $SOURCE, %OPTIONSLoads GIF or WebP animation sequence from file or stream $SOURCE. Options are the same as understood by "Prima::Image::load", and are passed down to it.add $IMAGEAppends an image frame to the container.bgColorReturn the background color specified by the sequence as the preferred background color to use when there is no specific background to superimpose the animation to.currentReturn index of the current framedraw $CANVAS, $X, $YDraws the current composite frame on $CANVAS at the given coordinates.draw_background $CANVAS, $X, $YFills the background on $CANVAS at the given coordinates if file provides that. Returns whether the canvas was tainted or not.heightReturns height of the composite frame.iconCreates and returns an icon object off the current composite frame.imageCreates and returns an image object off the current composite frame. The transparent pixels on the image are replaced with the preferred background color.is_stoppedReturns true if the animation sequence was stopped, false otherwise. If the sequence was stopped, the only way to restart it is to call "reset".lengthReturns total animation length (without repeats) in seconds.loopCount [ INTEGER ]Sets and returns number of loops left, undef for indefinite.nextAdvances one animation frame. The step triggers changes to the internally kept icon image that create effect of transparency, if needed. The method returns a hash, where the following fields are initialized:
resetResets the animation sequence. This call is necessary either when image sequence was altered, or when sequence display restart is needed.sizeReturns width and height of the composite frame.totalReturn number fo frameswidthReturns width of the composite frame.SEE ALSOPrima::image-loadAUTHORDmitry Karasik, <dmitry@karasik.eu.org>.
|