Labyrinth/DIUtils/Base.pm

filter: Statementstmt 36.6% 11 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 42.8% 3 / 7 Podpod 100% 4 / 4 totaltotal 30.5% 18 / 59 SCAR 35.6
CC
8
Cov
25%
reduce
20.0
rotate
12.0
thumb
12.0
CRAP 35.0
« Labyrinth/Writer/Parser/TT.pm ↑ Summary Labyrinth/Constraints.pm »
1 package Labyrinth::DIUtils::Base;
2  
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 $VERSION = '5.31';
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 ▶ my $self = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
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 ▶ my $self = shift;
Subroutine rotate: not called CC=3 SCAR=24.8
Pod documented
95 0 ▶ my $degs = shift || return;
Condition0%0/2
shift() || (return)
l!l
00
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
96  
97 0 ▶ return unless($self->{image});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"image"} 0 0 0
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 ▶ my $self = shift;
Subroutine reduce: not called CC=4 SCAR=30.0
Pod documented
109 0 ▶ my $xmax = shift || 100;
Condition0%0/2
shift() || 100
l!l
00
MC/DC0%0/1
shift() || 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
110 0 ▶ my $ymax = shift || 100;
Condition0%0/2
shift() || 100
l!l
00
MC/DC0%0/1
shift() || 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
111  
112 0 ▶ return unless($self->{image});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"image"} 0 0 0
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 ▶ my $self = shift;
Subroutine thumb: not called CC=3 SCAR=24.8
Pod documented
126 0 my $file = shift;
127 0 ▶ my $smax = shift || 100;
Condition0%0/2
shift() || 100
l!l
00
MC/DC0%0/1
shift() || 100
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
128  
129 0 ▶ return unless($self->{image});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"image"} 0 0 0
130 0 return;
131 }
132  
133 4 1;
134  
135 __END__
136  
137 =head1 SEE ALSO
138  
139 Labyrinth::DIUtils
140  
141 =head1 AUTHOR
142  
143 Barbie, <barbie@missbarbell.co.uk> for
144 Miss Barbell Productions, L<http://www.missbarbell.co.uk/>
145  
146 =head1 COPYRIGHT & LICENSE
147  
148 Copyright (C) 2002-2015 Barbie for Miss Barbell Productions
149 All Rights Reserved.
150  
151 This module is free software; you can redistribute it and/or
152 modify it under the Artistic License 2.0.
153  
154 =cut
« Labyrinth/Writer/Parser/TT.pm ↑ Summary Labyrinth/Constraints.pm »