C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
Image class provides tolls for loading/saving different image formats. More...
#include <vsn_image.h>
Public Member Functions | |
Image () | |
Default constructor. | |
Image (Image &&image) | |
Move constructor. | |
Image (const Image &image) | |
Copy constructor. | |
Image (uint width, uint height, Format format, unsigned char *data) | |
Constructor with parameters. | |
Image (std::istream &in) | |
Constructor for reading from stream. More... | |
Image (const std::string &path) | |
Constructor for reading from disk. More... | |
Image & | operator= (const Image &) |
Copy constructor. | |
~Image () | |
Destructor. | |
bool | IsCompressed () const |
Returns flag of compressed image. | |
uint | GetWidth () const |
Returns image width. | |
uint | GetHeight () const |
Returns image height. | |
Format | GetFormat () const |
Returns image format. | |
unsigned char * | GetBits () const |
Returns pointer to data that can be null. | |
bool | IsValid () const |
Checks if image contains data. | |
void | Init (const std::string &fileName) |
Loads image from file. More... | |
void | Init (std::istream &in) |
Loads image from stream. More... | |
void | Init (uint w, uint h, Format f, std::unique_ptr< unsigned char[]> mem) |
Initializes Image with parameters. More... | |
void | Init (uint w, uint h, Format f, const unsigned char *mem) |
Initializes Image with parameters. More... | |
void | Init (const Image &other) |
Initializes Image with parameters of another image. | |
void | SavePNG (std::ostream &out) const |
Saves image in stream in PNG format. More... | |
void | SavePNG (const std::string &fileName) const |
Saves image in stream in PNG format. More... | |
void | Clear () |
Deletes image data. | |
Image | Scale (uint sw, uint sh) const |
Creates copy of image with other sizes. More... | |
Image | SubImage (uint x, uint y, uint w, uint h) |
Returns copied image part. More... | |
Image class provides tolls for loading/saving different image formats.
Image class often contains uncompressed data of an image and is one of the objects that can be uploaded to a texture. As a rule, Image object is used to load a texture, when it's necessary to perform an additional processing of an image before its loading or when you want to split the existing texture. Image has a set of useful functions and also gives an opportunity of direct access to pixels of image bit map.
VSN::Image::Image | ( | std::istream & | in | ) |
Constructor for reading from stream.
[in] | in | - Stream for reading image. |
VSN::Image::Image | ( | const std::string & | path | ) |
Constructor for reading from disk.
[in] | path | - File path. |
void VSN::Image::Init | ( | const std::string & | fileName | ) |
Loads image from file.
[in] | fileName | - File name. |
void VSN::Image::Init | ( | std::istream & | in | ) |
Loads image from stream.
[in] | in | - Stream for reading image. |
void VSN::Image::Init | ( | uint | w, |
uint | h, | ||
Format | f, | ||
std::unique_ptr< unsigned char[]> | mem | ||
) |
void VSN::Image::Init | ( | uint | w, |
uint | h, | ||
Format | f, | ||
const unsigned char * | mem | ||
) |
void VSN::Image::SavePNG | ( | std::ostream & | out | ) | const |
Saves image in stream in PNG format.
[in] | out | - Reference to PNG stream. |
void VSN::Image::SavePNG | ( | const std::string & | fileName | ) | const |
Saves image in stream in PNG format.
[in] | fileName | - File name. |
Image VSN::Image::Scale | ( | uint | sw, |
uint | sh | ||
) | const |
Creates copy of image with other sizes.
[in] | sw | - New width value. |
[in] | sh | - New height value. |
Image VSN::Image::SubImage | ( | uint | x, |
uint | y, | ||
uint | w, | ||
uint | h | ||
) |
Returns copied image part.
[in] | x | - Position of the left side of new image concerning the left side of initial one. |
[in] | y | - Position of the bottom side of new image concerning the bottom side of initial one. |
[in] | w | - New image width. |
[in] | h | - New image height. |