Simple++
Powerfull and lightning fast C++ Library
|
#include <Texture.h>
Public Member Functions | |
Texture (typename Format format=Format::RGB) | |
Empty constructor, create an image unallocated of size (0:0) More... | |
Texture (const Math::Vec2< Size > &size, typename Format format=Format::RGB) | |
Constructor to create an not initialized image of specified size. More... | |
Texture (const WString &filePath) | |
create a new image using a path to a file (only support official file format) More... | |
Texture (std::fstream *fileStream) | |
create a new Texture using a file stream to read. More... | |
Texture (const Texture< T > &image) | |
copy constructor More... | |
Texture (const T *dataBuffer, const Math::Vec2< Size > &size, typename LoadingFormat loadingFormat=LoadingFormat::RGB, bool invertY=false) | |
create a Texture from a image data More... | |
Texture (Texture< T > &&image) | |
move constructor More... | |
~Texture () | |
const Math::Vec2< Size > & | getSize (typename Vector< _Image< T >>::Size i=0) const |
get the actual size (width:height) of the image More... | |
unsigned int | getWidth (typename Vector< _Image< T >>::Size i=0) const |
get the actual width of the image More... | |
unsigned int | getHeight (typename Vector< _Image< T >>::Size i=0) const |
get the actual height of the image More... | |
void | setDatas (const T *data, const Math::Vec2< Size > &size, typename LoadingFormat loadingFormat=LoadingFormat::RGB, bool invertY=false) |
set the data from an another data buffer. More... | |
void | clear (const Math::Vec2< Size > &size) |
reset this image with a new size. More... | |
void | clear (const Math::Vec2< Size > &size, typename Format format) |
reset this image with a new size and a new format More... | |
_Image< T > * | getMipmap (typename Vector< _Image< T >>::Size i=0) |
get a mipmap from this texture More... | |
_Image< T > * | operator[] (typename Vector< _Image< T >>::Size i) |
get a mipmap from this texture More... | |
void | generateMipmaps () |
generate the mipmap from the actual lod 0 More... | |
const T * | getDatas (typename Vector< _Image< T >>::Size i=0) const |
get the data buffer of this image More... | |
T * | getDatas (typename Vector< _Image< T >>::Size i=0) |
get the data buffer of this image More... | |
const T * | getPixel (typename Vector< _Image< T >>::Size i, unsigned int x, unsigned int y) const |
get a pixel from this texture More... | |
void | setPixel (typename Vector< _Image< T >>::Size i, unsigned int x, unsigned int y, const T *p) |
set a pixel inside this image More... | |
Texture< T > & | operator= (const Texture< T > &image) |
copy operator More... | |
Texture< T > & | operator= (Texture< T > &&image) |
move operator More... | |
bool | read (std::fstream *fileStream) |
read from a file stream More... | |
bool | write (std::fstream *fileStream) const |
write this object as binary into a file stream More... | |
Format | getFormat () const |
get the format of this image More... | |
Vector< _Image< T > * >::Size | getNumMipmaps () const |
get the number of mipmap of this texture More... | |
Public Member Functions inherited from BasicSimpleIO | |
bool | read (std::fstream *fileStream) |
read from a file stream More... | |
bool | write (std::fstream *fileStream) const |
write this object as binary into a file stream More... | |
Protected Types | |
enum | ctor { null } |
Protected Member Functions | |
Texture (ctor) | |
bool | _read (std::fstream *fileStream) |
void | _unload () |
Protected Attributes | |
Vector< _Image< T > * > | datas |
|
protected |
Graphic::Texture< T >::Texture | ( | typename Format | format = Format::RGB | ) |
Empty constructor, create an image unallocated of size (0:0)
format | of the image |
Graphic::Texture< T >::Texture | ( | const Math::Vec2< Size > & | size, |
typename Format | format = Format::RGB |
||
) |
Constructor to create an not initialized image of specified size.
size | size of the image to create. |
format | of the image |
Graphic::Texture< T >::Texture | ( | const WString & | filePath | ) |
create a new image using a path to a file (only support official file format)
Graphic::Texture< T >::Texture | ( | std::fstream * | fileStream | ) |
create a new Texture using a file stream to read.
fileStream | file stream to read. |
Graphic::Texture< T >::Texture | ( | const Texture< T > & | image | ) |
copy constructor
Graphic::Texture< T >::Texture | ( | const T * | dataBuffer, |
const Math::Vec2< Size > & | size, | ||
typename LoadingFormat | loadingFormat = LoadingFormat::RGB , |
||
bool | invertY = false |
||
) |
create a Texture from a image data
dataBuffer | buffer of the image to copy. |
size | size of the image to copy. |
format | of the image |
invertY | if the image has to be flipped vertically or not. |
Graphic::Texture< T >::Texture | ( | Texture< T > && | image | ) |
move constructor
Graphic::Texture< T >::~Texture | ( | ) |
|
protected |
|
protected |
|
protected |
void Graphic::Texture< T >::clear | ( | const Math::Vec2< Size > & | size | ) |
reset this image with a new size.
size | new size |
void Graphic::Texture< T >::clear | ( | const Math::Vec2< Size > & | size, |
typename Format | format | ||
) |
reset this image with a new size and a new format
size | new size |
format | new format of the image |
void Graphic::Texture< T >::generateMipmaps | ( | ) |
generate the mipmap from the actual lod 0
const T * Graphic::Texture< T >::getDatas | ( | typename Vector< _Image< T >>::Size | i = 0 | ) | const |
get the data buffer of this image
i | number of mipmap (0 = original image) |
T * Graphic::Texture< T >::getDatas | ( | typename Vector< _Image< T >>::Size | i = 0 | ) |
get the data buffer of this image
i | number of mipmap (0 = original image) |
Format Graphic::Texture< T >::getFormat | ( | ) | const |
get the format of this image
unsigned int Graphic::Texture< T >::getHeight | ( | typename Vector< _Image< T >>::Size | i = 0 | ) | const |
get the actual height of the image
i | num of the mipmap |
_Image< T > * Graphic::Texture< T >::getMipmap | ( | typename Vector< _Image< T >>::Size | i = 0 | ) |
get a mipmap from this texture
i | mipmap number (0 mean original size) |
Vector< _Image< T > * >::Size Graphic::Texture< T >::getNumMipmaps | ( | ) | const |
get the number of mipmap of this texture
const T * Graphic::Texture< T >::getPixel | ( | typename Vector< _Image< T >>::Size | i, |
unsigned int | x, | ||
unsigned int | y | ||
) | const |
get a pixel from this texture
i | mipmap level |
x | x coordinate of the pixel |
y | y coordinate of the pixel |
const Math::Vec2< Size > & Graphic::Texture< T >::getSize | ( | typename Vector< _Image< T >>::Size | i = 0 | ) | const |
get the actual size (width:height) of the image
i | num of the mipmap |
unsigned int Graphic::Texture< T >::getWidth | ( | typename Vector< _Image< T >>::Size | i = 0 | ) | const |
get the actual width of the image
i | num of the mipmap |
Texture< T > & Graphic::Texture< T >::operator= | ( | const Texture< T > & | image | ) |
copy operator
image | Image to copy |
Texture< T > & Graphic::Texture< T >::operator= | ( | Texture< T > && | image | ) |
move operator
image | Image to move from |
_Image< T > * Graphic::Texture< T >::operator[] | ( | typename Vector< _Image< T >>::Size | i | ) |
get a mipmap from this texture
i | mipmap number (0 mean the original size) |
bool Graphic::Texture< T >::read | ( | std::fstream * | fileStream | ) |
read from a file stream
fileStream | stream used to read load this object |
void Graphic::Texture< T >::setDatas | ( | const T * | data, |
const Math::Vec2< Size > & | size, | ||
typename LoadingFormat | loadingFormat = LoadingFormat::RGB , |
||
bool | invertY = false |
||
) |
set the data from an another data buffer.
data | Data buffer to copy |
size | size of the new image |
invertY | if the image has to be flipped vertically or not. |
void Graphic::Texture< T >::setPixel | ( | typename Vector< _Image< T >>::Size | i, |
unsigned int | x, | ||
unsigned int | y, | ||
const T * | p | ||
) |
set a pixel inside this image
i | mipmap level |
x | x coordinate of the pixel |
y | y coordinate of the pixel |
p | The pixel to set. |
bool Graphic::Texture< T >::write | ( | std::fstream * | fileStream | ) | const |
write this object as binary into a file stream
fileStream | stream used to write this object |
|
protected |