Lums
Public Member Functions | List of all members
lm::Image Class Reference

This class represents an image in memory. More...

#include <Image.hpp>

Public Member Functions

LUMS_EXPORTED Image ()
 
 Image (const Image &)=delete
 
LUMS_EXPORTED Image (Image &&rhs)
 
Imageoperator= (const Image &)=delete
 
LUMS_EXPORTED Imageoperator= (Image &&rhs)
 
unsigned int width () const
 
unsigned int height () const
 
unsigned int bufferWidth () const
 
unsigned int bufferHeight () const
 
GLenum format () const
 
const unsigned char * data () const
 
bool loaded () const
 
LUMS_EXPORTED void setPath (const std::string path, bool resource=true)
 
LUMS_EXPORTED void setBuffer (unsigned char *buffer, unsigned int w, unsigned int h, GLenum format)
 
LUMS_EXPORTED void setScale (float scale)
 
LUMS_EXPORTED void load ()
 
LUMS_EXPORTED void unload ()
 
LUMS_EXPORTED ~Image ()
 

Detailed Description

This class represents an image in memory.

Constructor & Destructor Documentation

LUMS_EXPORTED lm::Image::Image ( )

Create an empty Image.

lm::Image::Image ( const Image )
delete

Deleted copy ctor

LUMS_EXPORTED lm::Image::Image ( Image &&  rhs)

Move-copy an Image.

Parameters
rhsThe image to be moved from.
LUMS_EXPORTED lm::Image::~Image ( )

Destructor

Member Function Documentation

unsigned int lm::Image::bufferHeight ( ) const
inline

Get the image buffer height.

Returns
The image buffer height.
unsigned int lm::Image::bufferWidth ( ) const
inline

Get the image buffer width.

Returns
The image buffer width.
const unsigned char* lm::Image::data ( ) const
inline

Get a direct pointer to the buffer

Returns
A pointer to the buffer
GLenum lm::Image::format ( ) const
inline

Get the image format, as an opengl enum. Can be GL_RGB or GL_RGBA

Returns
The image format
unsigned int lm::Image::height ( ) const
inline

Get the image height.

Returns
The image height.
LUMS_EXPORTED void lm::Image::load ( )

Load the image

bool lm::Image::loaded ( ) const
inline

Check wether the image is loaded

Returns
True if the image is loaded, false otherwise
Image& lm::Image::operator= ( const Image )
delete

Deleted assignment operator

LUMS_EXPORTED Image& lm::Image::operator= ( Image &&  rhs)

Move-assign an Image.

Parameters
rhsThe image to be moved from.
LUMS_EXPORTED void lm::Image::setBuffer ( unsigned char *  buffer,
unsigned int  w,
unsigned int  h,
GLenum  format 
)

Set the image buffer

Parameters
bufferThe new buffer
wThe new buffer width
hThe new buffer height
formatThe image format
LUMS_EXPORTED void lm::Image::setPath ( const std::string  path,
bool  resource = true 
)

Set the load path.

Parameters
pathThe load path
resourceIf true, path is relative to the resource path
LUMS_EXPORTED void lm::Image::setScale ( float  scale)

Set the image scale when loaded. Images are interpolated using nearest pixel.

Parameters
scaleThe scale
LUMS_EXPORTED void lm::Image::unload ( )

Unload the image

unsigned int lm::Image::width ( ) const
inline

Get the image width.

Returns
The image width.

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