The small3d library
Classes | Public Member Functions | Static Public Attributes | List of all members
small3d::Image Class Reference

An image, loaded from a .png file, which can be used for generating textures. More...

#include <Image.hpp>

Public Member Functions

 Image (const std::string &fileLocation="")
 File-reading constructor. More...
 
 Image (std::vector< char > &data)
 Memory-based constructor. More...
 
 ~Image ()=default
 Destructor.
 
void toColour (Vec4 colour)
 Convert to a coloured 10 x 10 pixel image. More...
 
unsigned long getWidth () const
 Get the image width. More...
 
unsigned long getHeight () const
 Get the image height. More...
 
unsigned long getByteSize () const
 Get the size of the image, in bytes. More...
 
const uint8_t * getData () const
 Get the image data. More...
 
template<class Archive >
void serialize (Archive &archive)
 

Static Public Attributes

static const std::string NOTRGBA = "Image format not recognised. Only RGB / RGBA png images are supported."
 String saying that the colour encoding of the image being read is not RGB/RGBA.
 

Detailed Description

An image, loaded from a .png file, which can be used for generating textures.

Constructor & Destructor Documentation

◆ Image() [1/2]

small3d::Image::Image ( const std::string &  fileLocation = "")
explicit

File-reading constructor.

Parameters
fileLocationLocation of the png image file

◆ Image() [2/2]

small3d::Image::Image ( std::vector< char > &  data)
explicit

Memory-based constructor.

Parameters
dataPNG bytes already read into memory

Member Function Documentation

◆ getByteSize()

unsigned long small3d::Image::getByteSize ( ) const

Get the size of the image, in bytes.

Returns
Size of the image, in bytes

◆ getData()

const uint8_t * small3d::Image::getData ( ) const

Get the image data.

Returns
The image data

◆ getHeight()

unsigned long small3d::Image::getHeight ( ) const

Get the image height.

Returns
The image height

◆ getWidth()

unsigned long small3d::Image::getWidth ( ) const

Get the image width.

Returns
The image width

◆ toColour()

void small3d::Image::toColour ( Vec4  colour)

Convert to a coloured 10 x 10 pixel image.

Parameters
colourThe colour of the image

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