ScummVM API documentation
dither.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_DITHER_H
23 #define IMAGE_CODECS_DITHER_H
24 
25 #include "image/codecs/codec.h"
26 
27 #include "common/types.h"
28 #include "graphics/palette.h"
29 
30 namespace Image {
31 
32 class DitherCodec : public Codec {
33 public:
34  DitherCodec(Codec *codec, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
35  virtual ~DitherCodec() override;
36 
38 
39  Graphics::PixelFormat getPixelFormat() const override;
40  bool setOutputPixelFormat(const Graphics::PixelFormat &format) override;
41  bool containsPalette() const override;
42  const byte *getPalette() override;
43  bool hasDirtyPalette() const override;
44  bool canDither(DitherType type) const override;
45  void setDither(DitherType type, const byte *palette) override;
46  void setCodecAccuracy(CodecAccuracy accuracy) override;
47 
51  void setPalette(const byte *palette) { _srcPalette = palette; }
52 
56  static byte *createQuickTimeDitherTable(const byte *palette, uint colorCount);
57 
58 private:
59  DisposeAfterUse::Flag _disposeAfterUse;
60  Codec *_codec;
61  const byte *_srcPalette;
62 
63  Graphics::Surface *_ditherFrame;
64  Graphics::Palette _forcedDitherPalette;
65  byte *_ditherTable;
66  bool _dirtyPalette;
67 };
68 
69 } // End of namespace Image
70 
71 #endif
Definition: surface.h:67
bool containsPalette() const override
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
bool hasDirtyPalette() const override
Definition: pixelformat.h:138
Graphics::PixelFormat getPixelFormat() const override
static byte * createQuickTimeDitherTable(const byte *palette, uint colorCount)
bool canDither(DitherType type) const override
Definition: stream.h:745
Definition: codec.h:57
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
void setPalette(const byte *palette)
Definition: dither.h:51
void setCodecAccuracy(CodecAccuracy accuracy) override
void setDither(DitherType type, const byte *palette) override
Definition: dither.h:32
const byte * getPalette() override
Simple class for handling a palette data.
Definition: palette.h:55
DitherType
Definition: codec.h:65
Definition: movie_decoder.h:32