All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::CompressedImage Class Reference

A compressed image. Currently supports DXT format. More...

#include <Luminous/Image.hpp>

Public Member Functions

void clear ()
 Clears the image data and release any allocated memory.
 
PixelFormat::Compression compression () const
 Returns the compression used.
 
void * data () const
 Returns a pointer to the raw image data.
 
int datasize () const
 Returns the size of the image data in bytes. More...
 
int height () const
 Returns the height of the image.
 
bool loadImage (QFile &file, const ImageInfo &info, int size)
 Loads image data from the given file handle. More...
 
bool read (const QString &filename, int level=0)
 Reads an image from a file. More...
 
float readAlpha (Nimble::Vector2i pos) const
 Returns the alpha in the given pixel position.
 
int width () const
 Returns the widget of the image.
 

Protected Attributes

PixelFormat::Compression m_compression
 Used compression.
 
Nimble::Vector2i m_size
 Size of the image in pixels.
 

Detailed Description

A compressed image. Currently supports DXT format.

Member Function Documentation

int Luminous::CompressedImage::datasize ( ) const

Returns the size of the image data in bytes.

Returns
image data size in bytes
bool Luminous::CompressedImage::loadImage ( QFile &  file,
const ImageInfo info,
int  size 
)

Loads image data from the given file handle.

Parameters
filefile to read from
infoimage info
sizebytes to read
Returns
true if the reading succeeded, false otherwise
bool Luminous::CompressedImage::read ( const QString &  filename,
int  level = 0 
)

Reads an image from a file.

Parameters
filenamefilename to load
levelmipmap level to load
Returns
true if succeed, false on error