ScummVM API documentation
Image::JPEGDecoder Class Reference
Inheritance diagram for Image::JPEGDecoder:
Image::ImageDecoder Image::Codec Titanic::CJPEGDecode

Public Types

enum  ColorSpace { kColorSpaceRGB, kColorSpaceYUV }
 
- Public Types inherited from Image::Codec
enum  DitherType { kDitherTypeUnknown, kDitherTypeVFW, kDitherTypeQT }
 

Public Member Functions

void destroy () override
 
bool loadStream (Common::SeekableReadStream &str) override
 
const Graphics::SurfacegetSurface () const override
 
const Graphics::SurfacedecodeFrame (Common::SeekableReadStream &stream) override
 
void setCodecAccuracy (CodecAccuracy accuracy) override
 
Graphics::PixelFormat getPixelFormat () const override
 
bool setOutputPixelFormat (const Graphics::PixelFormat &format) override
 
void setOutputColorSpace (ColorSpace outSpace)
 
- Public Member Functions inherited from Image::ImageDecoder
virtual const byte * getPalette () const
 
virtual bool hasPalette () const
 
virtual uint16 getPaletteColorCount () const
 
virtual bool hasTransparentColor () const
 
virtual uint32 getTransparentColor () const
 
- Public Member Functions inherited from Image::Codec
virtual bool containsPalette () const
 
virtual const byte * getPalette ()
 
virtual bool hasDirtyPalette () const
 
virtual bool canDither (DitherType type) const
 
virtual void setDither (DitherType type, const byte *palette)
 

Additional Inherited Members

- Static Public Member Functions inherited from Image::Codec
static byte * createQuickTimeDitherTable (const byte *palette, uint colorCount)
 

Member Enumeration Documentation

◆ ColorSpace

Enumerator
kColorSpaceRGB 

Output RGB data in the pixel format specified using setOutputPixelFormat.

This is the default output.

kColorSpaceYUV 

Output (interleaved) YUV data.

Be aware that some images cannot be output in YUV mode. These are (non-standard) JPEG images which are in RGB colorspace.

The resulting Surface will have a PixelFormat with 3 bytes per pixel and the remaining entries are completely zeroed. This works around the fact that PixelFormat can only describe RGB formats.

You should only use this when you are really aware of what you are doing!

Member Function Documentation

◆ destroy()

void Image::JPEGDecoder::destroy ( )
overridevirtual

Destroy this decoder's surface and palette.

This should be called by a loadStream() implementation as well as by the destructor.

Implements Image::ImageDecoder.

◆ loadStream()

bool Image::JPEGDecoder::loadStream ( Common::SeekableReadStream stream)
overridevirtual

Load an image from the specified stream.

loadStream() should implicitly call destroy() to free the memory of the last loadStream() call.

Parameters
streamInput stream.
Returns
Whether loading the file succeeded.
See also
getSurface
getPalette

Implements Image::ImageDecoder.

◆ getSurface()

const Graphics::Surface* Image::JPEGDecoder::getSurface ( ) const
overridevirtual

Get the decoded surface.

This surface is owned by this ImageDecoder and remains valid until destroy() or loadStream() is called, or until the destructor of this ImageDecoder is called.

Returns
The decoded surface, or 0 if no surface is present.

Implements Image::ImageDecoder.

◆ decodeFrame()

const Graphics::Surface* Image::JPEGDecoder::decodeFrame ( Common::SeekableReadStream stream)
overridevirtual

Decode the frame for the given data and return a pointer to a surface containing the decoded frame.

Returns
a pointer to the decoded frame

Implements Image::Codec.

◆ setCodecAccuracy()

void Image::JPEGDecoder::setCodecAccuracy ( CodecAccuracy  accuracy)
overridevirtual

Set the decoding accuracy of the codec, if supported

Reimplemented from Image::Codec.

◆ getPixelFormat()

Graphics::PixelFormat Image::JPEGDecoder::getPixelFormat ( ) const
overridevirtual

Get the format that the surface returned from decodeImage() will be in.

Implements Image::Codec.

◆ setOutputPixelFormat()

bool Image::JPEGDecoder::setOutputPixelFormat ( const Graphics::PixelFormat format)
inlineoverridevirtual

Select the preferred format to use, for codecs where this is faster than converting the image afterwards. Returns true if supported, and false otherwise.

Reimplemented from Image::Codec.

◆ setOutputColorSpace()

void Image::JPEGDecoder::setOutputColorSpace ( ColorSpace  outSpace)
inline

Request the output color space. This can be used to obtain raw YUV data from the JPEG file. But this might not work for all files!

The decoder itself defaults to RGB.

Parameters
outSpaceThe color space to output.

The documentation for this class was generated from the following file: