Color.pm

filter: Statementstmt 95.2% 20 / 21 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 2 / 2 totaltotal 87.5% 28 / 32 SCAR 13.9
CC
4
Cov
88%
derive
4.1
equal_to
2.0
BEGIN
1.0
CRAP 4.0
« Color/YUV.pm ↑ Summary Color/Types.pm »
1 package Graphics::Color;
2 8 $Graphics::Color::VERSION = '0.30';
3 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 with qw(MooseX::Clone Graphics::Color::Equal MooseX::Storage::Deferred);
7  
8 # ABSTRACT: Device and library agnostic color spaces.
9  
10  
11 sub derive {
12 6 ▶ my ($self, $args) = @_;
Subroutine derive: called CC=4 SCAR=14.1
Pod documented
13  
14 6 ▶ return unless ref($args) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args eq "HASH" 0 6 6
15 6 my $new = $self->clone;
16 6 foreach my $key (keys %{ $args }) {
17 6 ▶ $new->$key($args->{$key}) if($new->can($key));
Branch: 1 branch
BranchTrueFalseTotal
if $new->can($key) 6 0 6
18 }
19 6 return $new;
20 }
21  
22  
23 sub equal_to {
24 0 ▶ die("Override me!");
Subroutine equal_to: not called CC=1 SCAR=6.9
Pod documented
25 }
26  
27 8 __PACKAGE__->meta->make_immutable;
28  
29 8 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 8 1;
31  
32 __END__
33  
34 =pod
35  
36 =head1 NAME
37  
38 Graphics::Color - Device and library agnostic color spaces.
39  
40 =head1 VERSION
41  
42 version 0.30
43  
44 =head1 SYNOPSIS
45  
46 my $color = Graphics::Color::RGB->new(
47 red => .5, green => .5, blue => .5, alpha => .5
48 );
49 say $color->as_string;
50  
51 =head1 DESCRIPTION
52  
53 Graphics color is a device and library agnostic system for creating and
54 manipulating colors in various color spaces.
55  
56 =head1 DISCLAIMER
57  
58 I'm not an art student or a wizard of arcane color knowledge. I'm a normal
59 programmer with a penchant for things graphical. Hence this module is likely
60 incomplete in some places. Patches are encouraged. I've intentions of adding
61 more color spaces as well as conversion routines (where applicable).
62  
63 =head1 COLOR TYPES
64  
65 The following color types are supported.
66  
67 L<CMYK|Graphics::Color::CMYK>
68  
69 L<HSL|Graphics::Color::HSL>
70  
71 L<HSV|Graphics::Color::HSV>
72  
73 L<RGB|Graphics::Color::RGB>
74  
75 L<YIQ|Graphics::Color::YIQ>
76  
77 L<YUV|Graphics::Color::YUV>
78  
79 =head1 METHODS
80  
81 =head2 derive
82  
83 Clone this color but allow one of more of it's attributes to change by passing
84 in a hashref of options:
85  
86 my $new = $color->derive({ attr => $newvalue });
87  
88 The returned color will be identical to the cloned one, save the attributes
89 specified.
90  
91 =head2 equal_to
92  
93 Compares this color to the provided one. Returns 1 if true, else 0;
94  
95 =head2 not_equal_to
96  
97 The opposite of equal_to.
98  
99 =head1 AUTHOR
100  
101 Cory G Watson <gphat@cpan.org>
102  
103 =head1 COPYRIGHT AND LICENSE
104  
105 This software is copyright (c) 2014 by Cold Hard Code, LLC.
106  
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109  
110 =cut
« Color/YUV.pm ↑ Summary Color/Types.pm »