line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::DIUtils; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4219
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
4
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
6
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
85
|
|
7
|
|
|
|
|
|
|
$VERSION = '5.30'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::DIUtils - Digital Image Utilities for Labyrinth |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Labyrinth::DIUtils; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Labyrinth::DIUtils::Tool('GD'); # switch to GD |
18
|
|
|
|
|
|
|
Labyrinth::DIUtils::Tool('ImageMagick'); # switch to ImageMagick |
19
|
|
|
|
|
|
|
my $tool = Labyrinth::DIUtils::Tool; # returns current tool setting |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $hook = Labyrinth::DIUtils->new($file); |
22
|
|
|
|
|
|
|
my $hook = $hook->rotate($degrees); # 0 - 360 |
23
|
|
|
|
|
|
|
my $hook = $hook->reduce($xmax,$ymax); |
24
|
|
|
|
|
|
|
my $hook = $hook->thumb($thumbnail,$square); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Handles the driver software for image manipulation; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
############################################################################# |
33
|
|
|
|
|
|
|
#Modules/External Subroutines # |
34
|
|
|
|
|
|
|
############################################################################# |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
2
|
|
61
|
use Labyrinth::Globals; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use Labyrinth::Writer; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
############################################################################# |
40
|
|
|
|
|
|
|
#Variables |
41
|
|
|
|
|
|
|
############################################################################# |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $tool = 'Base'; # defaults to no processing |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
############################################################################# |
46
|
|
|
|
|
|
|
#Subroutines |
47
|
|
|
|
|
|
|
############################################################################# |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 FUNCTIONS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=over 4 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item Tool |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Configuration function to determine which image package to load. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=back |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub Tool { |
62
|
|
|
|
|
|
|
@_ ? $tool = shift : $tool; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 Contructor |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item new() |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Constructs the interface between Labyrinth and the image package. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub new { |
78
|
|
|
|
|
|
|
my $self = shift; |
79
|
|
|
|
|
|
|
my $file = shift; |
80
|
|
|
|
|
|
|
my $hook; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
if(!defined $file) { |
83
|
|
|
|
|
|
|
Croak("No image file specified to $self->new()."); |
84
|
|
|
|
|
|
|
} elsif(!defined $tool) { |
85
|
|
|
|
|
|
|
Croak("No image tool specified for $self."); |
86
|
|
|
|
|
|
|
} else { |
87
|
|
|
|
|
|
|
my $class = "Labyrinth::DIUtils::$tool"; |
88
|
|
|
|
|
|
|
eval { |
89
|
|
|
|
|
|
|
eval "require $class"; |
90
|
|
|
|
|
|
|
$hook = $class->new($file); |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
if($@ || !$hook) { |
93
|
|
|
|
|
|
|
Croak("Invalid image tool [$tool] specified for $self. [$@]"); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
return $hook; # a cheat, but does the job :) |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |