line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GD::SecurityImage::Styles; |
2
|
4
|
|
|
4
|
|
26
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
147
|
|
3
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
127
|
|
4
|
4
|
|
|
4
|
|
20
|
use vars qw[$VERSION]; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
506
|
|
5
|
4
|
|
|
4
|
|
25
|
use constant ARC_END_DEGREES => 360; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
3600
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '1.72'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub style_default { |
10
|
0
|
|
|
0
|
1
|
|
return shift->_drcommon(' \\ lines will be drawn '); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub style_rect { |
14
|
0
|
|
|
0
|
1
|
|
return shift->_drcommon; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub style_box { |
18
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
19
|
0
|
|
|
|
|
|
my $n = $self->{lines}; |
20
|
0
|
|
|
|
|
|
my $ct = $self->{_COLOR_}{text}; |
21
|
0
|
|
|
|
|
|
my $cl = $self->{_COLOR_}{lines}; |
22
|
0
|
|
|
|
|
|
my $w = $self->{width}; |
23
|
0
|
|
|
|
|
|
my $h = $self->{height}; |
24
|
0
|
|
|
|
|
|
$self->filledRectangle( 0, 0, $w , $h , $ct ); |
25
|
0
|
|
|
|
|
|
$self->filledRectangle( $n, $n, $w - $n - 1, $h - $n - 1, $cl ); |
26
|
0
|
|
|
|
|
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub style_circle { |
30
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
31
|
0
|
|
|
|
|
|
my $cx = $self->{width} / 2; |
32
|
0
|
|
|
|
|
|
my $cy = $self->{height} / 2; |
33
|
0
|
|
|
|
|
|
my $n = $self->{lines}; |
34
|
0
|
|
|
|
|
|
my $cl = $self->{_COLOR_}{lines}; |
35
|
0
|
|
|
|
|
|
my $max = int $self->{width} / $n; |
36
|
0
|
|
|
|
|
|
$max++; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
for my $i ( 1..$n ) { |
39
|
0
|
|
|
|
|
|
my $mi = $max * $i; |
40
|
0
|
|
|
|
|
|
$self->arc( $cx, $cy, $mi, $mi, 0, ARC_END_DEGREES, $cl ); |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub style_ellipse { |
46
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
47
|
0
|
0
|
|
|
|
|
return $self->style_default if $self->{DISABLED}{ellipse}; # GD < 2.07 |
48
|
0
|
|
|
|
|
|
my $cx = $self->{width} / 2; |
49
|
0
|
|
|
|
|
|
my $cy = $self->{height} / 2; |
50
|
0
|
|
|
|
|
|
my $n = $self->{lines}; |
51
|
0
|
|
|
|
|
|
my $cl = $self->{_COLOR_}{lines}; |
52
|
0
|
|
|
|
|
|
my $max = int $self->{width} / $n; |
53
|
0
|
|
|
|
|
|
$max++; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
for my $i ( 1..$n ) { |
56
|
0
|
|
|
|
|
|
my $mi = $max * $i; |
57
|
0
|
|
|
|
|
|
$self->ellipse( $cx, $cy, $mi * 2, $mi, $cl ); |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub style_ec { |
63
|
0
|
|
|
0
|
1
|
|
my($self, @args) = @_; |
64
|
0
|
0
|
|
|
|
|
$self->style_ellipse(@args) if ! $self->{DISABLED}{ellipse}; # GD < 2.07 |
65
|
0
|
|
|
|
|
|
$self->style_circle(@args); |
66
|
0
|
|
|
|
|
|
return; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
1
|
|
sub style_blank {} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _drcommon { |
72
|
0
|
|
|
0
|
|
|
my $self = shift; |
73
|
0
|
|
0
|
|
|
|
my $drawx = shift || 0; |
74
|
0
|
|
|
|
|
|
my $w = $self->{width}; |
75
|
0
|
|
|
|
|
|
my $h = $self->{height}; |
76
|
0
|
|
|
|
|
|
my $max = $self->{lines}; |
77
|
0
|
|
|
|
|
|
my $fx = $w / $max; |
78
|
0
|
|
|
|
|
|
my $fy = $h / $max; |
79
|
0
|
|
|
|
|
|
my $cl = $self->{_COLOR_}{lines}; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my( $ifx ); |
82
|
0
|
|
|
|
|
|
for my $i ( 0..$max ) { |
83
|
0
|
|
|
|
|
|
$ifx = $i * $fx; |
84
|
0
|
|
|
|
|
|
$self->line( $ifx, 0, $ifx , $h, $cl ); # | line |
85
|
0
|
0
|
|
|
|
|
next if not $drawx; |
86
|
0
|
|
|
|
|
|
$self->line( $ifx, 0, $ifx + $fx, $h, $cl ); # \ line |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my( $ify ); |
90
|
0
|
|
|
|
|
|
for my $i ( 1..$max ) { |
91
|
0
|
|
|
|
|
|
$ify = $i * $fy; |
92
|
0
|
|
|
|
|
|
$self->line( 0, $ify, $w, $ify, $cl ); # - line |
93
|
|
|
|
|
|
|
} |
94
|
0
|
|
|
|
|
|
return; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |