ScummVM API documentation
palette_manager.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 ULTIMA8_GFX_PALETTEMANAGER_H
23#define ULTIMA8_GFX_PALETTEMANAGER_H
24
25#include "common/array.h"
26#include "graphics/pixelformat.h"
27#include "ultima/ultima8/gfx/pal_transforms.h"
28
29namespace Common {
30class WriteStream;
31class ReadStream;
32}
33
34namespace Ultima {
35namespace Ultima8 {
36
37class Palette;
38
40public:
41 explicit PaletteManager(const Graphics::PixelFormat &format);
43
44 static PaletteManager *get_instance() {
45 return _paletteManager;
46 }
47
48 enum PalIndex {
49 Pal_Game = 0,
50 Pal_Movie = 1,
51 Pal_Diff = 2, // Crusaders only - difficulty screen??
52 Pal_Misc = 3, // Crusaders only - game menu
53 Pal_Misc2 = 4, // Crusaders only - ??
54 Pal_Star = 5, // Crusaders only - ??
55 Pal_Cred = 6, // Crusader: No regret only (but mentioned in the no remorse exe!)
56 Pal_JPFontStart = 16
57 };
58
59 void load(PalIndex index, Common::ReadStream &rs, Common::ReadStream &xformrs);
60 void load(PalIndex index, Common::ReadStream &rs);
61 Palette *getPalette(PalIndex index);
62 uint getNumPalettes() const { return _palettes.size(); }
63
64 void duplicate(PalIndex src, PalIndex dest);
65
68 void updatedPalette(PalIndex index, int maxindex = 0);
69
71 void transformPalette(PalIndex index, const int16 matrix[12]);
72
74 void untransformPalette(PalIndex index);
75
77 bool getTransformMatrix(int16 matrix[12], PalIndex index);
78
79 // Get a TransformMatrix from a PalTransforms value (-4.11 fixed)
80 static void getTransformMatrix(int16 matrix[12],
81 PalTransforms trans);
82
83 // Create a custom Transform Matrix from RGBA col32. (-4.11 fixed)
84 // Alpha will set how much of original palette to keep. 0 = keep none
85 static void getTransformMatrix(int16 matrix[12], uint32 col32);
86
89
91 void reset();
92
95 bool loadTransforms(Common::ReadStream &rs);
96 void saveTransforms(Common::WriteStream &ws);
97
98private:
100 Graphics::PixelFormat _format;
101
102 static PaletteManager *_paletteManager;
103};
104
105} // End of namespace Ultima8
106} // End of namespace Ultima
107
108#endif
size_type size() const
Definition: array.h:316
Definition: stream.h:385
Definition: stream.h:77
Definition: atari-screen.h:42
Definition: palette.h:36
Definition: palette_manager.h:39
void PixelFormatChanged(const Graphics::PixelFormat &format)
Change the pixel format used by the PaletteManager.
bool getTransformMatrix(int16 matrix[12], PalIndex index)
Get the current TransformMatrix for the given index.
void reset()
Reset the Palette Manager.
void resetTransforms()
Reset all the transforms back to default.
void updatedPalette(PalIndex index, int maxindex=0)
void transformPalette(PalIndex index, const int16 matrix[12])
Apply a transform matrix to a palette (-4.11 fixed)
void untransformPalette(PalIndex index)
reset the transformation matrix of a palette
Definition: algorithm.h:29
Definition: pixelformat.h:138