blip  0.1
ImageDecoder Class Referenceabstract

An abstract base class for image decoders. More...

#include <ImageDecoder.hpp>

Inheritance diagram for ImageDecoder:

Public Member Functions

 ImageDecoder (ccxx::DataReader *reader)
 Construct a new ImageDecoder that will read an image from the given DataReader. More...
 
virtual ~ImageDecoder ()
 Destructor. More...
 
void decodeMetadata ()
 Decode the metadata for the image. More...
 
void decodeImage (Pixmap *pixmap)
 Decode the image itself. More...
 
Size getSize () const
 Get the size of the image, in pixels. More...
 

Protected Member Functions

virtual void readMetadata (ccxx::DataReader *reader)=0
 This method must be implemented to perform the image metadata decoding. More...
 
virtual void readPixmap (ccxx::DataReader *reader, Pixmap *pixmap)=0
 This method must be implemented to perform the image data decoding. More...
 
void setSize (const Size &size)
 This method should be called from readMetadata() to store the image size, once it has been determined. More...
 

Detailed Description

An abstract base class for image decoders.

An ImageDecoder decodes an image from a DataReader into a Pixmap. Thus it can be used to read images from files, from memory buffers, or from Android assets.

The steps to decode an image are as follows:

Author
Mark Lindner

Constructor & Destructor Documentation

◆ ImageDecoder()

ImageDecoder ( ccxx::DataReader *  reader)

Construct a new ImageDecoder that will read an image from the given DataReader.

◆ ~ImageDecoder()

~ImageDecoder ( )
virtual

Destructor.

Member Function Documentation

◆ decodeImage()

void decodeImage ( Pixmap pixmap)

Decode the image itself.

This method must be called after decodeMetadata().

Parameters
pixmapThe Pixmap in which to store the image data.
Exceptions
IOExceptionIf an I/O error occurs, or if the supplied Pixmap is too small to accommodate the image.

◆ decodeMetadata()

void decodeMetadata ( )

Decode the metadata for the image.

This method must be called before decodeImage().

Exceptions
IOExceptionIf an I/O error occurs.

◆ getSize()

Size getSize ( ) const
inline

Get the size of the image, in pixels.

This method will return a size of 0x0 if decodeMetadata() has not yet been called.

◆ readMetadata()

virtual void readMetadata ( ccxx::DataReader *  reader)
protectedpure virtual

This method must be implemented to perform the image metadata decoding.

Exceptions
IOExceptionIf an I/O error occurs.

Implemented in PNGImageDecoder.

◆ readPixmap()

virtual void readPixmap ( ccxx::DataReader *  reader,
Pixmap pixmap 
)
protectedpure virtual

This method must be implemented to perform the image data decoding.

Parameters
readerThe DataReader that the image is being read from.
pixmapThe Pixmap to store the image into.
Exceptions
IOExceptionIf an I/O error occurs.

Implemented in PNGImageDecoder.

◆ setSize()

void setSize ( const Size size)
inlineprotected

This method should be called from readMetadata() to store the image size, once it has been determined.


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