« blib/lib/Graphics/Primitive/Paint/Gradient/Linear.pm
↑ Summary
blib/lib/Graphics/Primitive/Paint/Solid.pm »
| 1 | package Graphics::Primitive::Paint::Gradient::Radial; | ||
| 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 'end' => ( | |
| 11 | is => 'rw', | ||
| 12 | isa => 'Geometry::Primitive::Circle', | ||
| 13 | required => 1 | ||
| 14 | ); | ||
| 15 | 1 | has 'start' => ( | |
| 16 | is => 'rw', | ||
| 17 | isa => 'Geometry::Primitive::Circle', | ||
| 18 | required => 1 | ||
| 19 | ); | ||
| 20 | |||
| 21 | 1 | __PACKAGE__->meta->make_immutable; | |
| 22 | |||
| 23 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 1 | 1; | |
| 25 | __END__ | ||
| 26 | =head1 NAME | ||
| 27 | |||
| 28 | Graphics::Primitive::Paint::Gradient::Radial - Radial color blending | ||
| 29 | |||
| 30 | =head1 DESCRIPTION | ||
| 31 | |||
| 32 | Graphics::Primitive::Paint::Gradient::Radial is a color blend between two | ||
| 33 | circles. | ||
| 34 | |||
| 35 | =head1 SYNOPSIS | ||
| 36 | |||
| 37 | use Graphics::Primitive::Paint::Gradient::Radial; | ||
| 38 | |||
| 39 | my $gradient = Graphics::Primitive::Gradient::Radial->new( | ||
| 40 | start => Geometry::Primitive::Circle->new( | ||
| 41 | origin => 0, 0, | ||
| 42 | radius => 5 | ||
| 43 | ), | ||
| 44 | end => Geometry::Primitive::Circle->new( | ||
| 45 | origin => 50, 25, | ||
| 46 | radius => 5 | ||
| 47 | ) | ||
| 48 | ); | ||
| 49 | $gradient->add_stop(0.0, $color1); | ||
| 50 | $gradient->add_stop(1.0, $color2); | ||
| 51 | |||
| 52 | =head1 METHODS | ||
| 53 | |||
| 54 | =head2 Constructor | ||
| 55 | |||
| 56 | =over 4 | ||
| 57 | |||
| 58 | =item I<new> | ||
| 59 | |||
| 60 | Creates a new Graphics::Primitive::Gradient | ||
| 61 | |||
| 62 | =back | ||
| 63 | |||
| 64 | =head2 Instance Methods | ||
| 65 | |||
| 66 | =over 4 | ||
| 67 | |||
| 68 | =item I<add_stop> | ||
| 69 | |||
| 70 | Adds a color stop at the specified position | ||
| 71 | |||
| 72 | =item I<colors> | ||
| 73 | |||
| 74 | Hashref of colors and their stops. The stops are the keys. | ||
| 75 | |||
| 76 | =item I<end> | ||
| 77 | |||
| 78 | The "end" circle. | ||
| 79 | |||
| 80 | =item I<start> | ||
| 81 | |||
| 82 | The "start" circle. | ||
| 83 | |||
| 84 | =item I<stop_count> | ||
| 85 | |||
| 86 | Count of stops added to this Gradient. | ||
| 87 | |||
| 88 | =item I<stops> | ||
| 89 | |||
| 90 | Get the keys of all color stops. | ||
| 91 | |||
| 92 | =back | ||
| 93 | |||
| 94 | =head1 AUTHOR | ||
| 95 | |||
| 96 | Cory Watson <gphat@cpan.org> | ||
| 97 | |||
| 98 | =head1 COPYRIGHT & LICENSE | ||
| 99 | |||
| 100 | Copyright 2008-2010 by Cory G Watson. | ||
| 101 | |||
| 102 | You can redistribute and/or modify this code under the same terms as Perl | ||
| 103 | itself. | ||