C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
VSN::Image Class Reference

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...
 
Imageoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Image() [1/2]

VSN::Image::Image ( std::istream &  in)

Constructor for reading from stream.

Parameters
[in]in- Stream for reading image.

◆ Image() [2/2]

VSN::Image::Image ( const std::string &  path)

Constructor for reading from disk.

Parameters
[in]path- File path.

Member Function Documentation

◆ Init() [1/4]

void VSN::Image::Init ( const std::string &  fileName)

Loads image from file.

Parameters
[in]fileName- File name.

◆ Init() [2/4]

void VSN::Image::Init ( std::istream &  in)

Loads image from stream.

Parameters
[in]in- Stream for reading image.

◆ Init() [3/4]

void VSN::Image::Init ( uint  w,
uint  h,
Format  f,
std::unique_ptr< unsigned char[]>  mem 
)

Initializes Image with parameters.

Parameters
[in]w- Image width.
[in]h- Image height.
[in]f- Image format.
[in]mem- Pointer to array of color info.

◆ Init() [4/4]

void VSN::Image::Init ( uint  w,
uint  h,
Format  f,
const unsigned char *  mem 
)

Initializes Image with parameters.

Parameters
[in]w- Image width.
[in]h- Image height.
[in]f- Image format.
[in]mem- Pointer to array of color info.

◆ SavePNG() [1/2]

void VSN::Image::SavePNG ( std::ostream &  out) const

Saves image in stream in PNG format.

Parameters
[in]out- Reference to PNG stream.

◆ SavePNG() [2/2]

void VSN::Image::SavePNG ( const std::string &  fileName) const

Saves image in stream in PNG format.

Parameters
[in]fileName- File name.

◆ Scale()

Image VSN::Image::Scale ( uint  sw,
uint  sh 
) const

Creates copy of image with other sizes.

Parameters
[in]sw- New width value.
[in]sh- New height value.

◆ SubImage()

Image VSN::Image::SubImage ( uint  x,
uint  y,
uint  w,
uint  h 
)

Returns copied image part.

Parameters
[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.

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