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/palette.h"
26#include "graphics/surface.h"
27#include "image/image_decoder.h"
28#include "image/codecs/codec.h"
29
30namespace Common {
31class SeekableReadStream;
32}
33
34namespace Image {
35
50class JPEGDecoder : public ImageDecoder, public Codec {
51public:
54
55 // ImageDecoder API
56 void destroy() override;
58 const Graphics::Surface *getSurface() const override;
59 const Graphics::Palette &getPalette() const override { return _palette; }
60
61 // Codec API
63 void setCodecAccuracy(CodecAccuracy accuracy) override;
65 bool setOutputPixelFormat(const Graphics::PixelFormat &format) override {
66 if (format.isCLUT8())
67 return false;
68 _requestedPixelFormat = format;
69 return true;
70 }
71
72 // Special API for JPEG
80
95 };
96
105 void setOutputColorSpace(ColorSpace outSpace) { _colorSpace = outSpace; }
106
107private:
108 // TODO: Avoid inheriting from multiple superclasses that have identical member functions.
109 using Codec::getPalette;
110 Graphics::Surface _surface;
111 Graphics::Palette _palette;
112 ColorSpace _colorSpace;
113 Graphics::PixelFormat _requestedPixelFormat;
114 CodecAccuracy _accuracy;
115
116 Graphics::PixelFormat getByteOrderRgbPixelFormat() const;
117};
119} // End of namespace Image
120
121#endif
Definition: stream.h:745
Simple class for handling a palette data.
Definition: palette.h:61
Definition: codec.h:57
virtual const byte * getPalette()
Definition: codec.h:104
Definition: image_decoder.h:53
Definition: jpeg.h:50
bool setOutputPixelFormat(const Graphics::PixelFormat &format) override
Definition: jpeg.h:65
const Graphics::Palette & getPalette() const override
Definition: jpeg.h:59
const Graphics::Surface * getSurface() const override
void setOutputColorSpace(ColorSpace outSpace)
Definition: jpeg.h:105
ColorSpace
Definition: jpeg.h:73
@ kColorSpaceRGB
Definition: jpeg.h:79
@ kColorSpaceYUV
Definition: jpeg.h:94
Graphics::PixelFormat getPixelFormat() const override
const Graphics::Surface * decodeFrame(Common::SeekableReadStream &stream) override
bool loadStream(Common::SeekableReadStream &str) override
void destroy() override
void setCodecAccuracy(CodecAccuracy accuracy) override
Definition: algorithm.h:29
Definition: pixelformat.h:138
Definition: surface.h:67