ScummVM API documentation
jpeg.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_JPEG_H
23 #define IMAGE_JPEG_H
24 
25 #include "graphics/surface.h"
26 #include "image/image_decoder.h"
27 #include "image/codecs/codec.h"
28 
29 namespace Common {
30 class SeekableReadStream;
31 }
32 
33 namespace Image {
34 
49 class JPEGDecoder : public ImageDecoder, public Codec {
50 public:
51  JPEGDecoder();
52  ~JPEGDecoder();
53 
54  // ImageDecoder API
55  void destroy() override;
56  bool loadStream(Common::SeekableReadStream &str) override;
57  const Graphics::Surface *getSurface() const override;
58 
59  // Codec API
60  const Graphics::Surface *decodeFrame(Common::SeekableReadStream &stream) override;
61  void setCodecAccuracy(CodecAccuracy accuracy) override;
62  Graphics::PixelFormat getPixelFormat() const override;
63  bool setOutputPixelFormat(const Graphics::PixelFormat &format) override { _requestedPixelFormat = format; return true; }
64 
65  // Special API for JPEG
66  enum ColorSpace {
73 
87  kColorSpaceYUV
88  };
89 
98  void setOutputColorSpace(ColorSpace outSpace) { _colorSpace = outSpace; }
99 
100 private:
101  Graphics::Surface _surface;
102  ColorSpace _colorSpace;
103  Graphics::PixelFormat _requestedPixelFormat;
104  CodecAccuracy _accuracy;
105 
106  Graphics::PixelFormat getByteOrderRgbPixelFormat() const;
107 };
109 } // End of namespace Image
110 
111 #endif
Definition: image_decoder.h:52
Definition: surface.h:67
Definition: pixelformat.h:138
ColorSpace
Definition: jpeg.h:66
Definition: stream.h:745
Definition: codec.h:57
void setOutputColorSpace(ColorSpace outSpace)
Definition: jpeg.h:98
Definition: algorithm.h:29
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: jpeg.h:63
Definition: jpeg.h:49
Definition: movie_decoder.h:32