| 1 | package Graphics::Color::YIQ; | ||||||||||
| 2 | 1 | $Graphics::Color::YIQ::VERSION = '0.31'; | |||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use MooseX::Aliases; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | extends qw(Graphics::Color); | |||||||||
| 7 | |||||||||||
| 8 | # ABSTRACT: YIQ color space | ||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 1 | has 'luminance' => ( | |||||||||
| 12 | is => 'rw', | ||||||||||
| 13 | isa => 'Num', | ||||||||||
| 14 | default => 1, | ||||||||||
| 15 | alias => 'y' | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | 1 | has 'in_phase' => ( | |||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | isa => 'Num', | ||||||||||
| 22 | default => 1, | ||||||||||
| 23 | alias => 'i' | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | 1 | has 'quadrature' => ( | |||||||||
| 28 | is => 'rw', | ||||||||||
| 29 | isa => 'Num', | ||||||||||
| 30 | default => 1, | ||||||||||
| 31 | alias => 'q' | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 1 | has 'name' => ( is => 'rw', isa => 'Str' ); | |||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 39 | 1 | my ($self) = @_; | |||||||||
| 40 | |||||||||||
| 41 | 1 | return sprintf('%s,%s,%s', | |||||||||
| 42 | $self->luminance, $self->in_phase, $self->quadrature | ||||||||||
| 43 | ); | ||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | 1 | ▶ | sub as_array { | ||||||||
|
Subroutine
as_array: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 48 | 1 | my ($self) = @_; | |||||||||
| 49 | |||||||||||
| 50 | 1 | return ($self->luminance, $self->in_phase, $self->quadrature); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 2 | ▶ | sub equal_to { | ||||||||
|
Subroutine
equal_to: called CC=5 SCAR=17.3
Pod
documented
| |||||||||||
| 55 | 2 | my ($self, $other) = @_; | |||||||||
| 56 | |||||||||||
| 57 | 2 | ▶ | return 0 unless defined($other); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | |||||||||||
| 59 | 2 | ▶ | unless($self->luminance == $other->luminance) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | return 0; | |||||||||
| 61 | } | ||||||||||
| 62 | 2 | ▶ | unless($self->in_phase == $other->in_phase) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 1 | return 0; | |||||||||
| 64 | } | ||||||||||
| 65 | 1 | ▶ | unless($self->quadrature == $other->quadrature) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 0 | return 0; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 1 | return 1; | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | |||||||||||
| 73 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 74 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 75 | 1 | 1; | |||||||||
| 76 | |||||||||||
| 77 | __END__ | ||||||||||