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  Graphics::PixelFormat getPixelFormat() const override;
62  bool setOutputPixelFormat(const Graphics::PixelFormat &format) override { _requestedPixelFormat = format; return true; }
63 
64  // Special API for JPEG
65  enum ColorSpace {
72 
86  kColorSpaceYUV
87  };
88 
97  void setOutputColorSpace(ColorSpace outSpace) { _colorSpace = outSpace; }
98 
99 private:
100  Graphics::Surface _surface;
101  ColorSpace _colorSpace;
102  Graphics::PixelFormat _requestedPixelFormat;
103 
104  Graphics::PixelFormat getByteOrderRgbPixelFormat() const;
105 };
107 } // End of namespace Image
108 
109 #endif
Definition: image_decoder.h:52
Definition: surface.h:66
Definition: pixelformat.h:138
ColorSpace
Definition: jpeg.h:65
Definition: stream.h:745
Definition: codec.h:55
void setOutputColorSpace(ColorSpace outSpace)
Definition: jpeg.h:97
Definition: algorithm.h:29
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: jpeg.h:62
Definition: jpeg.h:49
Definition: movie_decoder.h:32