5 # Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
7 # ------------------------------------------------------------------------------
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 # ------------------------------------------------------------------------------
25 # Please feel free to send questions, suggestions or improvements to:
31 # NB: there is no palette destructor because most of the time the
32 # palette will be owned by a surface, so any palettes you create
33 # with new, won't be destroyed until the program ends!
40 # NB: there is no palette destructor because most of the time the
41 # palette will be owned by a surface, so any palettes you create
42 # with new, won't be destroyed until the program ends!
46 my $class = ref($proto) || $proto;
51 $self = \$image->palette();
53 $self = \SDL::NewPalette(256);
55 croak SDL::GetError() unless $$self;
62 return SDL::PaletteNColors($$self);
70 $r = shift; $g = shift; $b = shift;
71 return SDL::PaletteColors($$self,$index,$r,$g,$b);
73 return SDL::PaletteColors($$self,$index);
84 SDL::PaletteColors($$self,$index),$c);
87 SDL::PaletteColors($$self,$index));
98 SDL::PaletteColors($$self,$index),$c);
101 SDL::PaletteColors($$self,$index));
112 SDL::PaletteColors($$self,$index),$c);
115 SDL::PaletteColors($$self,$index));
127 SDL::Palette - a perl extension
131 L<SDL::Palette> provides an interface to the SDL_Palette structures,
132 and can be used to set the color values of an existing palette's indexes.
136 =head2 blue ( index, [value] )
138 Fetches and sets the blue component of the color at index.
140 =head2 green ( index, [value] )
142 Fetches and sets the green component of the color at index.
144 =head2 red ( index, [value] )
146 Fetches and sets the red component of the color at index.
148 =head2 color ( index, [ r, g, b ] )
150 Fetches and sets the RGB, returns an SDL_Color *.
154 Returns the size of the palette.
162 L<perl> L<SDL::Color> L<SDL::Surface>