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!
38 # NB: there is no palette destructor because most of the time the
39 # palette will be owned by a surface, so any palettes you create
40 # with new, won't be destroyed until the program ends!
44 my $class = ref($proto) || $proto;
49 $self = \$image->palette();
51 $self = \SDL::NewPalette(256);
53 die SDL::GetError() unless $$self;
60 return SDL::PaletteNColors($$self);
68 $r = shift; $g = shift; $b = shift;
69 return SDL::PaletteColors($$self,$index,$r,$g,$b);
71 return SDL::PaletteColors($$self,$index);
82 SDL::PaletteColors($$self,$index),$c);
85 SDL::PaletteColors($$self,$index));
96 SDL::PaletteColors($$self,$index),$c);
99 SDL::PaletteColors($$self,$index));
110 SDL::PaletteColors($$self,$index),$c);
113 SDL::PaletteColors($$self,$index));
125 SDL::Palette - a perl extension
129 L<SDL::Palette> provides an interface to the SDL_Palette structures,
130 and can be used to set the color values of an existing palette's indexes.
134 =head2 blue ( index, [value] )
136 Fetches and sets the blue component of the color at index.
138 =head2 green ( index, [value] )
140 Fetches and sets the green component of the color at index.
142 =head2 red ( index, [value] )
144 Fetches and sets the red component of the color at index.
146 =head2 color ( index, [ r, g, b ] )
148 Fetches and sets the RGB, returns an SDL_Color *.
152 Returns the size of the palette.
160 L<perl> L<SDL::Color> L<SDL::Surface>