ScummVM API documentation
cdtoons.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 IMAGE_CODECS_CDTOONS_H
23#define IMAGE_CODECS_CDTOONS_H
24
25#include "image/codecs/codec.h"
26
27#include "common/array.h"
28#include "common/hashmap.h"
29#include "common/rect.h"
30#include "graphics/palette.h"
31
32namespace Image {
33
35 uint16 typeFlags;
36 uint32 size;
37 uint16 startFrame;
38 uint16 endFrame;
39 byte *data;
40};
41
47class CDToonsDecoder : public Codec {
48public:
49 CDToonsDecoder(uint16 width, uint16 height);
50 ~CDToonsDecoder() override;
51
54 bool containsPalette() const override { return true; }
55 const byte *getPalette() override { _dirtyPalette = false; return _palette.data(); }
56 bool hasDirtyPalette() const override { return _dirtyPalette; }
57
58private:
59 struct CDToonsAction {
60 uint16 blockId;
61 Common::Rect rect;
62 };
63
64 Graphics::Surface *_surface;
65 Graphics::Surface *_backingSurface;
66 bool _backingSurfaceValid;
67 Graphics::Palette _palette;
68 bool _dirtyPalette;
69 uint16 _currentPaletteId;
70
72
73 void renderActions(const Common::Array<CDToonsAction> &actions, uint begin, uint end, Graphics::Surface &surface, const Common::Rect *clipRect);
74 void renderBlock(Graphics::Surface &surface, byte *data, uint size, int x, int y, uint width, uint height, const Common::Rect *clipRect = nullptr);
75 void setPalette(byte *data);
76};
77
78} // End of namespace Image
79
80#endif
Definition: array.h:52
Definition: hashmap.h:85
Definition: stream.h:745
Simple class for handling a palette data.
Definition: palette.h:61
Definition: cdtoons.h:47
Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
bool containsPalette() const override
Definition: cdtoons.h:54
bool hasDirtyPalette() const override
Definition: cdtoons.h:56
const byte * getPalette() override
Definition: cdtoons.h:55
Graphics::PixelFormat getPixelFormat() const override
Definition: cdtoons.h:53
Definition: codec.h:57
Definition: rect.h:536
Definition: pixelformat.h:138
static constexpr PixelFormat createFormatCLUT8()
Definition: pixelformat.h:184
Definition: surface.h:67
Definition: cdtoons.h:34