line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GD::Image::AnimatedGif; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
33223
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
1
|
|
|
1
|
|
488
|
use GD; # gdlib v 2.0.33 or later required |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub GD::Image::animated_gif { |
10
|
|
|
|
|
|
|
my ($im,$lp,$ft,$fc,$sp,$x,$y,$ar,$cd) = @_; |
11
|
|
|
|
|
|
|
$lp = $lp ? 0 : 1; |
12
|
|
|
|
|
|
|
my @addargs = (0,0,0,$sp,1); |
13
|
|
|
|
|
|
|
my $prev = $im; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$cd = sub { shift->string($ft,$x,$y,shift,$fc); } if ref $cd ne 'CODE'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $gifdata = $im->gifanimbegin(1,$lp); |
18
|
|
|
|
|
|
|
for(@{ $ar }) { |
19
|
|
|
|
|
|
|
my $frame = GD::Image->new($im->getBounds); |
20
|
|
|
|
|
|
|
$cd->($frame,$_); |
21
|
|
|
|
|
|
|
$gifdata .= $frame->gifanimadd(@addargs,$prev); |
22
|
|
|
|
|
|
|
$prev = $frame; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
$gifdata .= $im->gifanimend; |
25
|
|
|
|
|
|
|
return $gifdata; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub GD::Image::animated_gif_easy { |
29
|
|
|
|
|
|
|
my $img = shift; |
30
|
|
|
|
|
|
|
my $lup = shift || 0; |
31
|
|
|
|
|
|
|
$img->transparent($img->colorAllocate(255,255,255)) if shift; |
32
|
|
|
|
|
|
|
return $img->animated_gif($lup,GD::Font->Small(),$img->colorAllocate(0,0,0),42,4,2,shift,shift); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |