ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qtrle.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_QTRLE_H
23 #define IMAGE_CODECS_QTRLE_H
24 
25 #include "graphics/pixelformat.h"
26 #include "graphics/palette.h"
27 #include "image/codecs/codec.h"
28 
29 namespace Image {
30 
36 class QTRLEDecoder : public Codec {
37 public:
38  QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel);
39  ~QTRLEDecoder() override;
40 
42  Graphics::PixelFormat getPixelFormat() const override;
43 
44  bool containsPalette() const override { return _ditherPalette != 0; }
45  const byte *getPalette() override { _dirtyPalette = false; return _ditherPalette.data(); }
46  bool hasDirtyPalette() const override { return _dirtyPalette; }
47  bool canDither(DitherType type) const override;
48  void setDither(DitherType type, const byte *palette) override;
49 
50 private:
51  byte _bitsPerPixel;
52  Graphics::Surface *_surface;
53  uint16 _width, _height;
54  uint32 _paddedWidth;
55  Graphics::Palette _ditherPalette;
56  bool _dirtyPalette;
57  byte *_colorMap;
58 
59  void createSurface();
60 
61  void decode1(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange);
62  void decode2_4(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange, byte bpp);
63  void decode8(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange);
64  void decode16(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange);
65  void decode24(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange);
66  void dither24(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange);
67  void decode32(Common::SeekableReadStream &stream, uint32 rowPtr, uint32 linesToChange);
68 };
69 
70 } // End of namespace Image
71 
72 #endif
Definition: surface.h:67
Definition: pixelformat.h:138
bool hasDirtyPalette() const override
Definition: qtrle.h:46
Definition: stream.h:745
void setDither(DitherType type, const byte *palette) override
Definition: codec.h:57
const byte * getPalette() override
Definition: qtrle.h:45
Graphics::PixelFormat getPixelFormat() const override
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
bool canDither(DitherType type) const override
Definition: qtrle.h:36
Simple class for handling a palette data.
Definition: palette.h:51
DitherType
Definition: codec.h:65
Definition: movie_decoder.h:32
bool containsPalette() const override
Definition: qtrle.h:44