| 1 | use Renard::Incunabula::Common::Setup; | ||
| 2 | package Intertangle::Taffeta::Color::RGBFloat; | ||
| 3 | # ABSTRACT: A floating point RGB colour | ||
| 4 | $Intertangle::Taffeta::Color::RGBFloat::VERSION = '0.001'; | ||
| 5 | use Mu; | ||
| 6 | use Intertangle::Taffeta::Types qw(RGBFloatComponentValue); | ||
| 7 | |||
| 8 | extends qw(Intertangle::Taffeta::Color); | ||
| 9 | |||
| 10 | has r_float => ( is => 'ro', isa => RGBFloatComponentValue ); | ||
| 11 | |||
| 12 | has g_float => ( is => 'ro', isa => RGBFloatComponentValue ); | ||
| 13 | |||
| 14 | has b_float => ( is => 'ro', isa => RGBFloatComponentValue ); | ||
| 15 | |||
| 16 | method rgb_float_triple() { | ||
| 17 | ($self->r_float, $self->g_float, $self->b_float); | ||
| 18 | } | ||
| 19 | |||
| 20 | method svg_value() { | ||
| 21 | sprintf("rgb(%f%%, %f%%, %f%%)", | ||
| 22 | $self->r_float * 100, | ||
| 23 | $self->g_float * 100, | ||
| 24 | $self->b_float * 100, | ||
| 25 | ); | ||
| 26 | } | ||
| 27 | |||
| 28 | 1; | ||
| 29 | |||
| 30 | __END__ |