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