2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-02-11 12:54:56 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2006-02-11 12:54:56 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-07-23 15:32:14 +00:00
|
|
|
#ifndef LURE_PALETTE_H
|
|
|
|
#define LURE_PALETTE_H
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
#include "lure/luredefs.h"
|
|
|
|
#include "lure/disk.h"
|
|
|
|
#include "lure/memory.h"
|
|
|
|
|
|
|
|
namespace Lure {
|
|
|
|
|
2007-12-31 05:58:22 +00:00
|
|
|
enum PaletteSource {DEFAULT, RGB, RGB64, EGA};
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
class Palette {
|
|
|
|
private:
|
|
|
|
MemoryBlock *_palette;
|
|
|
|
uint16 _numEntries;
|
|
|
|
|
2007-12-31 05:58:22 +00:00
|
|
|
void convertRgb64Palette(const byte *srcPalette, uint16 srcNumEntries);
|
|
|
|
void convertEGAPalette(const byte *srcPalette);
|
2006-02-11 12:54:56 +00:00
|
|
|
public:
|
|
|
|
Palette();
|
2008-01-02 11:14:42 +00:00
|
|
|
Palette(uint16 srcNumEntries, const byte *srcData, PaletteSource paletteSource);
|
2006-02-11 12:54:56 +00:00
|
|
|
Palette(Palette &src);
|
2007-12-31 05:58:22 +00:00
|
|
|
Palette(uint16 resourceId, PaletteSource paletteSource = DEFAULT);
|
2008-05-28 23:28:11 +00:00
|
|
|
~Palette();
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
uint8 *data() { return _palette->data(); }
|
|
|
|
MemoryBlock *palette() { return _palette; }
|
|
|
|
uint16 numEntries() { return _palette->size() / 4; }
|
|
|
|
void setEntry(uint8 index, uint32 value);
|
|
|
|
uint32 getEntry(uint8 index);
|
2008-01-27 19:47:41 +00:00
|
|
|
void copyFrom(Palette *src);
|
2006-02-11 12:54:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class PaletteCollection {
|
|
|
|
private:
|
|
|
|
Palette **_palettes;
|
|
|
|
uint8 _numPalettes;
|
|
|
|
public:
|
|
|
|
PaletteCollection(uint16 resourceId);
|
|
|
|
~PaletteCollection();
|
|
|
|
|
|
|
|
uint8 numPalettes() { return _numPalettes; }
|
|
|
|
Palette &getPalette(uint8 paletteNum);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namspace Lure
|
|
|
|
|
|
|
|
#endif
|