All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::ImageCodec Class Referenceabstract

The base class for different image codecs. More...

#include <Luminous/ImageCodec.hpp>

Inheritance diagram for Luminous::ImageCodec:
Luminous::ImageCodecDDS

Public Member Functions

virtual bool canRead (QFile &file)=0
 Can this codec read the given file? The method should examine the file contents and return true if this codec can read it. More...
 
virtual QString extensions () const =0
 Get the extensions associated with this codec in a string separated by spaces. More...
 
virtual QString name () const =0
 Return name of the codec. More...
 
virtual bool ping (ImageInfo &info, QFile &file)=0
 Pinging an image just reads the width, height, and pixel format from a file. More...
 
virtual bool read (Image &image, QFile &file)=0
 Read the image data from the given file. More...
 
virtual bool read (CompressedImage &image, QFile &file, int level=0)
 Read compressed image data from the given file. More...
 
virtual bool write (const Image &image, QFile &file)=0
 Store the given Image into a file. More...
 

Detailed Description

The base class for different image codecs.

Derive your own codec from this and override the three methods.

Member Function Documentation

virtual bool Luminous::ImageCodec::canRead ( QFile &  file)
pure virtual

Can this codec read the given file? The method should examine the file contents and return true if this codec can read it.

The function must not change the current position in the file.

Parameters
filefile to examine
Returns
true if the codec can read the image data stored in the file, false if it can't

Implemented in Luminous::ImageCodecDDS.

virtual QString Luminous::ImageCodec::extensions ( ) const
pure virtual

Get the extensions associated with this codec in a string separated by spaces.

Returns
extensions separated by spaces (eg. "jpeg jpg")

Implemented in Luminous::ImageCodecDDS.

virtual QString Luminous::ImageCodec::name ( ) const
pure virtual

Return name of the codec.

Returns
name of the codec

Implemented in Luminous::ImageCodecDDS.

virtual bool Luminous::ImageCodec::ping ( ImageInfo info,
QFile &  file 
)
pure virtual

Pinging an image just reads the width, height, and pixel format from a file.

Parameters
infoImageInfo struct to store the read info to
filefile to read from
Returns
true if the reading succeeded, false otherwise

Implemented in Luminous::ImageCodecDDS.

virtual bool Luminous::ImageCodec::read ( Image image,
QFile &  file 
)
pure virtual

Read the image data from the given file.

Parameters
imageImage to store the data into
filefile to read the data from
Returns
true if the file was decoded successfully, false otherwise

Implemented in Luminous::ImageCodecDDS.

virtual bool Luminous::ImageCodec::read ( CompressedImage image,
QFile &  file,
int  level = 0 
)
inlinevirtual

Read compressed image data from the given file.

Parameters
imageimage to read to
filefile to read from
levelmipmap level to read
Returns
true if the file was decoded successfully, false otherwise

Reimplemented in Luminous::ImageCodecDDS.

virtual bool Luminous::ImageCodec::write ( const Image image,
QFile &  file 
)
pure virtual

Store the given Image into a file.

Parameters
imageImage to store
filefile to write to
Returns
true if the encoding was successful, false otherwise

Implemented in Luminous::ImageCodecDDS.