++ed by:
UKSZA GPHAT PAWAPAWA HORNBURG NGLENN

19 PAUSE users
8 non-PAUSE users.

Cory G Watson

NAME

Chart::Clicker::Drawing::ColorAllocator

DESCRIPTION

Allocates colors for use in the chart. The position in the color allocator corresponds to the series that will be colored.

SYNOPSIS

    use Graphics::Color::RGB;
    use Chart::Clicker::Drawing::ColorAllocator;

    my $ca = Chart::Clicker::Drawing::ColorAllocator->new({
        colors => (
            Graphics::Color::RGB->new(
                red => 1.0, green => 0, blue => 0, alpha => 1.0
            ),
            ...
        )
    });

    my $red = $ca->get(0);

METHODS

Constructor

new

Create a new ColorAllocator. You can optionally pass an arrayref of colors to 'seed' the allocator.

Methods

add_to_colors

Add a color to this allocator.

clear_colors

Clear this allocator's colors

color_count

Get the number of colors in this allocator.

<get_color>

Gets the color at the specified index. Returns undef if that position has no color.

position

Gets the current position.

next

Returns the next color. Each call to next increments the position, so subsequent calls will return different colors.

reset

Resets this allocator back to the beginning.

AUTHOR

Cory 'G' Watson <gphat@cpan.org>

SEE ALSO

perl(1)

LICENSE

You can redistribute and/or modify this code under the same terms as Perl itself.