Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | List of all members
jop::Image Class Reference

#include <Image.hpp>

Public Types

enum  Format { Format::DXT1RGB, Format::DXT1RGBA, Format::DXT3RGBA, Format::DXT5RGBA }
 

Public Member Functions

 Image ()
 Constructor. More...
 
bool load (const std::string &path, const bool allowCompression=true)
 Load from file. More...
 
bool load (const void *ptr, const uint32 size)
 Load the image from memory. More...
 
bool load (const glm::uvec2 &size, const uint32 bytesPerPixel, const unsigned char *pixels)
 Load the image from memory. More...
 
glm::uvec2 getSize () const
 Get the dimensions of the image. More...
 
unsigned int getPixelSize () const
 Get the pixel data size. More...
 
uint32 getPixelDepth () const
 Get image pixel depth. More...
 
const uint8getPixels () const
 Get pixels of this image. More...
 
Format getFormat () const
 Get internal compressed image format. More...
 
unsigned int getMipMapCount () const
 Get the amount of mipmap levels in compressed image. More...
 
bool isCubemap () const
 Check if this image is a cube map. More...
 
bool isCompressed () const
 Check if the image is compressed. More...
 
void flipVertically ()
 Flip image vertically. More...
 
void flipHorizontally ()
 

Detailed Description

Definition at line 36 of file Image.hpp.

Member Enumeration Documentation

enum jop::Image::Format
strong

Compressed image formats

Enumerator
DXT1RGB 
DXT1RGBA 
DXT3RGBA 
DXT5RGBA 

Definition at line 42 of file Image.hpp.

Constructor & Destructor Documentation

jop::Image::Image ( )

Constructor.

Member Function Documentation

void jop::Image::flipHorizontally ( )

brief Flip image horizontally

Doesn't work correctly with compressed images.

void jop::Image::flipVertically ( )

Flip image vertically.

Doesn't work correctly with compressed images.

Format jop::Image::getFormat ( ) const

Get internal compressed image format.

Returns
The compressed image format
See also
isCompressed()
unsigned int jop::Image::getMipMapCount ( ) const

Get the amount of mipmap levels in compressed image.

Returns
The amount of mipmap levels
uint32 jop::Image::getPixelDepth ( ) const

Get image pixel depth.

Returns
Image pixel depth in bytes
const uint8* jop::Image::getPixels ( ) const

Get pixels of this image.

Returns
Pointer to the pixel data
unsigned int jop::Image::getPixelSize ( ) const

Get the pixel data size.

Returns
The pixel data size in bytes
glm::uvec2 jop::Image::getSize ( ) const

Get the dimensions of the image.

Returns
The image dimensions
bool jop::Image::isCompressed ( ) const

Check if the image is compressed.

Returns
True if compressed
bool jop::Image::isCubemap ( ) const

Check if this image is a cube map.

Returns
True if cube map
bool jop::Image::load ( const std::string &  path,
const bool  allowCompression = true 
)

Load from file.

Parameters
pathThe file path
allowCompressionAllow compression?
Returns
True if successful
bool jop::Image::load ( const void *  ptr,
const uint32  size 
)

Load the image from memory.

Parameters
ptrPointer to data
sizeSize of the data
Returns
True if successful
bool jop::Image::load ( const glm::uvec2 &  size,
const uint32  bytesPerPixel,
const unsigned char *  pixels 
)

Load the image from memory.

Parameters
sizeThe size
bytesPerPixelThe byte depth of the image
pixelsPointer to the beginning of the pixel array
Returns
True if successful

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