The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 Chart::Clicker::Drawing::ColorAllocator;

    my $ca = new Chart::Clicker::Drawing::ColorAllocator({
        colors => (
            new Chart::Clicker::Drawing::Color(1.0, 0, 0, 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.

Class Methods

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.

get

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

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.