line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::DIUtils::Base; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3994
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
4
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
5
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
335
|
|
7
|
|
|
|
|
|
|
$VERSION = '5.30'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::DIUtils::Base - Base Digital Image Driver for Labyrinth. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Labyrinth::DIUtils::Base; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $hook = Labyrinth::DIUtils::Base->new($file); |
18
|
|
|
|
|
|
|
my $hook = $hook->rotate($degrees); # 0 - 360 |
19
|
|
|
|
|
|
|
my $hook = $hook->reduce($xmax,$ymax); |
20
|
|
|
|
|
|
|
my $hook = $hook->thumb($thumbnail,$square); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Handles the driver software for image manipulation; Do not use |
25
|
|
|
|
|
|
|
this module directly, access via Labyrinth::DIUtils. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This package is a basic package, for use with websites that do not require |
28
|
|
|
|
|
|
|
any image processing. To provide image processing, install one of the drivers |
29
|
|
|
|
|
|
|
available, currently these are: |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item * Labyrinth::DIUtils::GD |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Uses GD graphics library. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item * Labyrinth::DIUtils::ImageMagick |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Uses ImageMagick image library. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=back |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
############################################################################# |
46
|
|
|
|
|
|
|
#Modules/External Subroutines # |
47
|
|
|
|
|
|
|
############################################################################# |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
############################################################################# |
50
|
|
|
|
|
|
|
#Subroutines |
51
|
|
|
|
|
|
|
############################################################################# |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Contructor |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over 4 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item new($file) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The constructor. Passed a single mandatory argument, which is then used as the |
62
|
|
|
|
|
|
|
image file for all image manipulation. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub new { |
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
70
|
0
|
|
|
|
|
|
my $image = shift; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $atts = { |
73
|
|
|
|
|
|
|
'image' => $image, |
74
|
|
|
|
|
|
|
'object' => undef, |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# create the object |
78
|
0
|
|
|
|
|
|
bless $atts, $self; |
79
|
0
|
|
|
|
|
|
return $atts; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Image Manipulation |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over 4 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item rotate($degrees) |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
By default no processing performed. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub rotate { |
94
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
95
|
0
|
|
0
|
|
|
|
my $degs = shift || return; |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
|
return unless($self->{image}); |
98
|
0
|
|
|
|
|
|
return; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item reduce($xmax,$ymax) |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
By default no processing performed. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub reduce { |
108
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
109
|
0
|
|
0
|
|
|
|
my $xmax = shift || 100; |
110
|
0
|
|
0
|
|
|
|
my $ymax = shift || 100; |
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
|
return unless($self->{image}); |
113
|
0
|
|
|
|
|
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item thumb($thumbnail,$square) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
By default no processing performed. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub thumb { |
125
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
126
|
0
|
|
|
|
|
|
my $file = shift; |
127
|
0
|
|
0
|
|
|
|
my $smax = shift || 100; |
128
|
|
|
|
|
|
|
|
129
|
0
|
0
|
|
|
|
|
return unless($self->{image}); |
130
|
0
|
|
|
|
|
|
return; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__END__ |