« blib/lib/Graphics/Primitive/Paint/Gradient.pm
↑ Summary
blib/lib/Graphics/Primitive/Paint/Gradient/Radial.pm »
| 1 | package Graphics::Primitive::Paint::Gradient::Linear; | ||
| 2 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use Moose::Util::TypeConstraints; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use MooseX::Storage; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | extends 'Graphics::Primitive::Paint::Gradient'; | |
| 7 | |||
| 8 | 1 | with Storage (format => 'JSON', io => 'File'); | |
| 9 | |||
| 10 | 1 | has line => ( | |
| 11 | isa => 'Geometry::Primitive::Line', | ||
| 12 | is => 'rw', | ||
| 13 | ); | ||
| 14 | |||
| 15 | 1 | __PACKAGE__->meta->make_immutable; | |
| 16 | |||
| 17 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 1 | 1; | |
| 19 | __END__ | ||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | Graphics::Primitive::Paint::Gradient::Linear - Linear color blending | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | Graphics::Primitive::Paint::Gradient::Linear is a gradient along a line. | ||
| 27 | |||
| 28 | =head1 SYNOPSIS | ||
| 29 | |||
| 30 | use Graphics::Primitive::Paint::Gradient::Linear; | ||
| 31 | |||
| 32 | my $gradient = Graphics::Primitive::Gradient::Linear->new( | ||
| 33 | line => Geometry::Primitive::Line->new( | ||
| 34 | start => Graphics::Primitive::Point->new(x => 0, y => 0), | ||
| 35 | end => Graphics::Primitive::Point->new(x => 0, y => 10), | ||
| 36 | ) | ||
| 37 | ); | ||
| 38 | $gradient->add_stop(0.0, $color1); | ||
| 39 | $gradient->add_stop(1.0, $color2); | ||
| 40 | |||
| 41 | =head1 METHODS | ||
| 42 | |||
| 43 | =head2 Constructor | ||
| 44 | |||
| 45 | =over 4 | ||
| 46 | |||
| 47 | =item I<new> | ||
| 48 | |||
| 49 | Creates a new Graphics::Primitive::Gradient | ||
| 50 | |||
| 51 | =back | ||
| 52 | |||
| 53 | =head2 Instance Methods | ||
| 54 | |||
| 55 | =over 4 | ||
| 56 | |||
| 57 | =item I<add_stop> | ||
| 58 | |||
| 59 | Adds a color stop at the specified position | ||
| 60 | |||
| 61 | =item I<colors> | ||
| 62 | |||
| 63 | Hashref of colors and their stops. The stops are the keys. | ||
| 64 | |||
| 65 | =item I<line> | ||
| 66 | |||
| 67 | The line along which the gradient should run. | ||
| 68 | |||
| 69 | =item I<stop_count> | ||
| 70 | |||
| 71 | Count of stops added to this Gradient. | ||
| 72 | |||
| 73 | =item I<stops> | ||
| 74 | |||
| 75 | Get the keys of all color stops. | ||
| 76 | |||
| 77 | =back | ||
| 78 | |||
| 79 | =head1 AUTHOR | ||
| 80 | |||
| 81 | Cory Watson <gphat@cpan.org> | ||
| 82 | |||
| 83 | =head1 COPYRIGHT & LICENSE | ||
| 84 | |||
| 85 | Copyright 2008-2010 by Cory G Watson. | ||
| 86 | |||
| 87 | You can redistribute and/or modify this code under the same terms as Perl | ||
| 88 | itself. | ||