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 TOLTECS_PALETTE_H
23 #define TOLTECS_PALETTE_H
24 
25 #include "common/array.h"
26 #include "common/system.h"
27 
28 #include "toltecs/toltecs.h"
29 
30 namespace Toltecs {
31 
32 //#define ROT(index) (((index << 4) & 0xF0) | ((index >> 4) & 0x0F))
33 //#define ROT(index) (index)
34 
35 class Palette {
36 public:
38  ~Palette();
39 
40  void setFullPalette(byte *palette);
41  void getFullPalette(byte *palette);
42  void setDeltaPalette(byte *palette, byte mask, int8 deltaValue, int16 count, int16 startIndex);
43 
44  void loadAddPalette(uint resIndex, byte startIndex);
45  void loadAddPaletteFrom(byte *source, byte startIndex, byte count);
46 
47  void addFragment(uint resIndex, int16 id);
48  uint16 findFragment(int16 id);
49  void clearFragments();
50 
51  byte getMatchingColor(byte r, byte g, byte b);
52  void buildColorTransTable(byte limit, int8 deltaValue, byte mask);
53  byte getColorTransPixel(byte pixel) const { return _colorTransTable[pixel]; }
54 
55  byte *getMainPalette() { return _mainPalette; }
56  byte *getAnimPalette() { return _animPalette; }
57 
58  void saveState(Common::WriteStream *out);
59  void loadState(Common::ReadStream *in);
60 
61 protected:
62 
63  struct PaletteFragment {
64  int16 id;
65  byte index, count;
66  };
67 
69 
70  ToltecsEngine *_vm;
71 
72  byte _mainPalette[768];
73  byte _animPalette[768];
74  byte _colorTransTable[256];
75 
76  PaletteFragmentArray _fragments;
77  byte _fragmentIndex;
78 
79 };
80 
81 } // End of namespace Toltecs
82 
83 #endif /* TOLTECS_PALETTE_H */
Definition: animation.h:28
Definition: stream.h:77
Definition: palette.h:35
Definition: toltecs.h:94
Definition: palette.h:63
Definition: stream.h:385