ScummVM API documentation
palette.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef LURE_PALETTE_H
23 #define LURE_PALETTE_H
24 
25 #include "lure/luredefs.h"
26 #include "lure/disk.h"
27 #include "lure/memory.h"
28 
29 namespace Lure {
30 
31 enum PaletteSource {DEFAULT, RGB, RGB64, EGA};
32 
33 class Palette {
34 private:
35  MemoryBlock *_palette;
36  uint16 _numEntries;
37 
38  void convertRgb64Palette(const byte *srcPalette, uint16 srcNumEntries);
39  void convertEGAPalette(const byte *srcPalette);
40 public:
41  Palette();
42  Palette(uint16 srcNumEntries, const byte *srcData, PaletteSource paletteSource);
43  Palette(Palette &src);
44  Palette(uint16 resourceId, PaletteSource paletteSource = DEFAULT);
45  ~Palette();
46 
47  uint8 *data() { return _palette->data(); }
48  MemoryBlock *palette() { return _palette; }
49  uint16 numEntries() { return _palette->size() / 4; }
50  void setEntry(uint8 index, uint32 value);
51  uint32 getEntry(uint8 index);
52  void copyFrom(Palette *src);
53 };
54 
56 private:
57  Palette **_palettes;
58  uint8 _numPalettes;
59 public:
60  PaletteCollection(uint16 resourceId);
62 
63  uint8 numPalettes() { return _numPalettes; }
64  Palette &getPalette(uint8 paletteNum);
65 };
66 
67 } // end of namspace Lure
68 
69 #endif
Definition: palette.h:33
Definition: palette.h:55
Definition: animseq.h:27
Definition: memory.h:31