PaletteManager.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2006 The Pentagram Team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef PALETTEMANAGER_H
00020 #define PALETTEMANAGER_H
00021 
00022 #include "Palette.h"
00023 #include <vector>
00024 
00025 class IDataSource;
00026 class RenderSurface;
00027 
00028 class PaletteManager
00029 {
00030 public:
00031         explicit PaletteManager(RenderSurface* rs);
00032         ~PaletteManager();
00033 
00034         static PaletteManager* get_instance() { return palettemanager; }
00035 
00036         enum PalIndex {
00037                 Pal_Game = 0,
00038                 Pal_Movie = 1,
00039                 Pal_JPFontStart = 16
00040         };
00041 
00042         void load(PalIndex index, IDataSource& ds, IDataSource &xformds);
00043         void load(PalIndex index, IDataSource& ds);
00044         Pentagram::Palette* getPalette(PalIndex index);
00045 
00046         void duplicate(PalIndex src, PalIndex dest);
00047 
00049         void updatedFont(PalIndex index);
00050 
00052         void transformPalette(PalIndex index, sint16 matrix[12]);
00053 
00055         void untransformPalette(PalIndex index);
00056 
00057         // Get a TransformMatrix from a PalTransforms value (-4.11 fixed)
00058         static void getTransformMatrix(sint16 matrix[12],
00059                                                                    Pentagram::PalTransforms trans);
00060 
00061         // Create a custom Transform Matrix from RGBA col32. (-4.11 fixed)
00062         // Alpha will set how much of original palette to keep. 0 = keep none
00063         static void getTransformMatrix(sint16 matrix[12], uint32 col32);        
00064 
00066         void RenderSurfaceChanged(RenderSurface* rs);
00067 
00069         void reset();
00070 
00072         void resetTransforms();
00073 
00074 private:
00075         std::vector<Pentagram::Palette*> palettes;
00076         RenderSurface *rendersurface;
00077 
00078         static PaletteManager* palettemanager;
00079 };
00080 
00081 #endif

Generated on Fri Jul 27 22:27:28 2007 for pentagram by  doxygen 1.4.7