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 SNATCHER_PALETTE_H
23#define SNATCHER_PALETTE_H
24
25#include "common/platform.h"
26#include "graphics/pixelformat.h"
27#include "snatcher/graphics.h"
28
29class PaletteManager;
30
31namespace Common {
32class SeekableWriteStream;
33class SeekableReadStream;
34}
35
36namespace Graphics {
37struct PixelFormat;
38}
39
40namespace Snatcher {
41
42class Palette {
43public:
45 virtual ~Palette();
46
47 const uint8 *getSystemPalette() const { return _sysPalette; }
48 void block();
49 void unblock();
50
51 virtual bool enqueueEvent(ResourcePointer &res) { return true; }
52 virtual void processEventQueue() {}
53 virtual void clearEvents() {}
54 virtual void setDefaults(int mode) {}
55 virtual void update();
56 virtual void hINTCallback(void*) {}
57
58 virtual void selectPalettes(uint32) {}
59 virtual void getPresetColor(int pal, int index, uint8 &r, uint8 &g, uint8 &b) const {}
60 virtual void setColor(int index, uint8 r, uint8 g, uint8 b) {}
61 virtual void getColor(int index, uint8 &r, uint8 &g, uint8 &b) const {}
62 virtual void adjustColor(int index, int8 r, int8 g, int8 b) {}
63
64 virtual void loadState(Common::SeekableReadStream *in) {}
65 virtual void saveState(Common::SeekableWriteStream *out) {};
66 virtual void postLoadProcess() {}
67
68protected:
69 virtual void updateSystemPalette() = 0;
70
71 uint8 *_sysPalette = nullptr;
72 bool _blocked = false;
73 int _refreshAfterLoad = 0;
74 const Graphics::PixelFormat _pixelFormat = Graphics::PixelFormat();
75 PaletteManager *_palMan = nullptr;
76 GraphicsEngine::GfxState &_gfxState;
77
78private:
79 static Palette *createSegaPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state);
80
81public:
82 static Palette *create(const Graphics::PixelFormat *pxf, PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state);
83};
84
85} // End of namespace Snatcher
86
87#endif // SNATCHER_PALETTE_H
Definition: stream.h:745
Definition: stream.h:351
Definition: paletteman.h:47
Definition: palette.h:42
Definition: resource.h:52
Platform
Definition: platform.h:93
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: pixelformat.h:138
Definition: graphics.h:163