ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 {
64  if (format.isCLUT8())
65  return false;
66  _requestedPixelFormat = format;
67  return true;
68  }
69 
70  // Special API for JPEG
71  enum ColorSpace {
78 
92  kColorSpaceYUV
93  };
94 
103  void setOutputColorSpace(ColorSpace outSpace) { _colorSpace = outSpace; }
104 
105 private:
106  Graphics::Surface _surface;
107  ColorSpace _colorSpace;
108  Graphics::PixelFormat _requestedPixelFormat;
109  CodecAccuracy _accuracy;
110 
111  Graphics::PixelFormat getByteOrderRgbPixelFormat() const;
112 };
114 } // End of namespace Image
115 
116 #endif
Definition: image_decoder.h:52
Definition: surface.h:67
Definition: pixelformat.h:138
ColorSpace
Definition: jpeg.h:71
Definition: stream.h:745
bool isCLUT8() const
Definition: pixelformat.h:376
Definition: codec.h:57
void setOutputColorSpace(ColorSpace outSpace)
Definition: jpeg.h:103
Definition: algorithm.h:29
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: jpeg.h:63
Definition: jpeg.h:49
Definition: movie_decoder.h:32