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!
35 package SDL::Game::Palette;
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));