ScummVM API documentation
codec.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_CODEC_H
23 #define IMAGE_CODECS_CODEC_H
24 
25 #include "graphics/surface.h"
26 #include "graphics/pixelformat.h"
27 
28 #include "image/codec-options.h"
29 
30 namespace Common {
31 class SeekableReadStream;
32 }
33 
34 namespace Image {
35 
57 class Codec {
58 public:
59  Codec() {}
60  virtual ~Codec() {}
61 
65  enum DitherType {
68 
71 
73  kDitherTypeQT
74  };
75 
82  virtual const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream) = 0;
83 
88  virtual Graphics::PixelFormat getPixelFormat() const = 0;
89 
94  virtual bool setOutputPixelFormat(const Graphics::PixelFormat &format) { return false; }
95 
99  virtual bool containsPalette() const { return false; }
100 
104  virtual const byte *getPalette() { return 0; }
105 
109  virtual bool hasDirtyPalette() const { return false; }
110 
114  virtual bool canDither(DitherType type) const { return false; }
115 
119  virtual void setDither(DitherType type, const byte *palette) {}
120 
124  virtual void setCodecAccuracy(CodecAccuracy accuracy) {}
125 
129  static byte *createQuickTimeDitherTable(const byte *palette, uint colorCount);
130 };
131 
135 Codec *createBitmapCodec(uint32 tag, uint32 streamTag, int width, int height, int bitsPerPixel);
136 
140 Codec *createQuickTimeCodec(uint32 tag, int width, int height, int bitsPerPixel);
141 
142 } // End of namespace Image
143 
144 #endif
Definition: surface.h:67
virtual bool setOutputPixelFormat(const Graphics::PixelFormat &format)
Definition: codec.h:94
Definition: pixelformat.h:138
virtual bool canDither(DitherType type) const
Definition: codec.h:114
virtual void setCodecAccuracy(CodecAccuracy accuracy)
Definition: codec.h:124
Definition: stream.h:745
Definition: codec.h:57
virtual bool containsPalette() const
Definition: codec.h:99
Definition: codec.h:67
Definition: algorithm.h:29
virtual bool hasDirtyPalette() const
Definition: codec.h:109
virtual const byte * getPalette()
Definition: codec.h:104
virtual void setDither(DitherType type, const byte *palette)
Definition: codec.h:119
DitherType
Definition: codec.h:65
Definition: movie_decoder.h:32
Definition: codec.h:70