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 ULTIMA8_GRAPHICS_PALETTE_H
23 #define ULTIMA8_GRAPHICS_PALETTE_H
24 
25 #include "graphics/palette.h"
26 #include "ultima/ultima8/graphics/pal_transforms.h"
27 
28 namespace Common {
29 class ReadStream;
30 }
31 
32 namespace Ultima {
33 namespace Ultima8 {
34 
35 class Palette: public Graphics::Palette {
36 public:
37  Palette() : Graphics::Palette(256) {}
38 
39  void load(Common::ReadStream &rs, Common::ReadStream &xformrs);
40  void load(Common::ReadStream &rs);
41 
42  // Transform a single set of rgb values based on the current matrix.
43  // Not designed for speed - just useful for one-offs.
44  void transformRGB(int &r, int &g, int &b) const;
45 
46  // Untransformed pixel format palette map
47  uint32 _native_untransformed[256];
48 
49  // Transformed pixel format palette map
50  uint32 _native[256];
51 
52  // Untransformed XFORM ARGB palette map
53  uint32 _xform_untransformed[256];
54 
55  // Transformed XFORM ARGB palette map
56  uint32 _xform[256];
57 
58  // Colour transformation matrix (for fades, hue shifts)
59  // Applied by the RenderSurface (fixed -4.11)
60  // R = R*matrix[0] + G*matrix[1] + B*matrix[2] + matrix[3];
61  // G = R*matrix[4] + G*matrix[5] + B*matrix[6] + matrix[7];
62  // B = R*matrix[8] + G*matrix[9] + B*matrix[10] + matrix[11];
63  // A = A;
64  int16 _matrix[12];
65 
66  // The current palette transform
67  PalTransforms _transform;
68 };
69 
70 } // End of namespace Ultima8
71 } // End of namespace Ultima
72 
73 #endif
Definition: detection.h:27
Definition: algorithm.h:29
Definition: stream.h:385
Simple class for handling a palette data.
Definition: palette.h:45
Definition: palette.h:35