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

NAME

Allegro::Palette - Allegro Palette object

SYNOPSIS

   use Allegro;

   $al = Allegro->new() or die;
   $d  = $al->Display(width => 640, height => 480)
      or die $al->error;

   $bmp = $d->Bitmap(file => 'test.pcx') or die;

   $d->palette($bmp->palette);
   $d->blit($bmp);
   sleep;

DESCRIPTION

The Palette object holds a set of color entries for 8-bit color modes. Palettes can be loaded from datafiles or bitmap files.

To access a Palette object from a Bitmap object, use Bitmap's palette method. Palettes can also be loaded like any other datafile object. To set a palette see the palette method of Allegro::Display.

METHODS

new

Creates a new Palette object. Does not take any parameters.

   $pal = $al->Palette();
set - sets a palette entry

Sets the specified index to a certain color.

   $pal->set($index, $red, $green, $blue);
index

Index to set. Valid values are 0-255.

red, green, blue

Red/Green/Blue values for this index. Valid values are 0-255.

get - retrieve a palette entry

Returns a list containing the red, green, and blue values for the specified index.

   ($r, $g, $b) = $pal->get($index);

AUTHOR

Colin O'Leary <colino@cpan.org>

COPYRIGHT

Copyright 2003 by Colin O'Leary. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The Allegro library is copyright its authors, and is giftware. See http://alleg.sf.net for more information.

SEE ALSO

Allegro - Base Allegro routines
Allegro::Bitmap - Allegro Bitmap object
Allegro::Datafile - Allegro Datafile object
Allegro::Display - Allegro Display object