| 1 | use 5.14.0; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use CairoX::Sweet::Standard; | ||
| 5 | |||
| 6 | # PODNAME: CairoX::Sweet::Color | ||
| 7 | |||
| 8 | class CairoX::Sweet::Color using Moose { | ||
| 9 | |||
| 10 | our $VERSION = '0.0108'; # VERSION | ||
| 11 | |||
| 12 | foreach my $color (qw/red green blue/) { | ||
| 13 | has $color => ( | ||
| 14 | is => 'ro', | ||
| 15 | isa => NumUpToOne, | ||
| 16 | required => 1, | ||
| 17 | ); | ||
| 18 | } | ||
| 19 | has opacity => ( | ||
| 20 | is => 'ro', | ||
| 21 | default => 1, | ||
| 22 | isa => NumUpToOne, | ||
| 23 | ); | ||
| 24 | |||
| 25 | method color { | ||
| 26 | return ($self->red, $self->green, $self->blue); | ||
| 27 | } | ||
| 28 | method color_with_opacity { | ||
| 29 | return ($self->red, $self->green, $self->blue, $self->opacity); | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | 1; | ||
| 34 | |||
| 35 | __END__ | ||
| 36 | |||
| 37 | =pod | ||
| 38 | |||
| 39 | =encoding UTF-8 | ||
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | CairoX::Sweet::Color | ||
| 44 | |||
| 45 | =head1 VERSION | ||
| 46 | |||
| 47 | Version 0.0108, released 2015-03-21. | ||
| 48 | |||
| 49 | =head1 SOURCE | ||
| 50 | |||
| 51 | L<https://github.com/Csson/p5-CairoX-Sweet> | ||
| 52 | |||
| 53 | =head1 HOMEPAGE | ||
| 54 | |||
| 55 | L<https://metacpan.org/release/CairoX-Sweet> | ||
| 56 | |||
| 57 | =head1 AUTHOR | ||
| 58 | |||
| 59 | Erik Carlsson <info@code301.com> | ||
| 60 | |||
| 61 | =head1 COPYRIGHT AND LICENSE | ||
| 62 | |||
| 63 | This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. | ||
| 64 | |||
| 65 | This is free software; you can redistribute it and/or modify it under | ||
| 66 | the same terms as the Perl 5 programming language system itself. | ||
| 67 | |||
| 68 | =cut |