Visual Computing Library
Loading...
Searching...
No Matches
vcl::Image Class Reference

The Image class stores an Image in 4 bytes RGBA format. More...

#include <vclib/space/core/image.h>

Public Member Functions

 Image (const std::string &filename)
 Load an image from a file.
 
 Image (const void *data, uint w, uint h, bool yFlip=false, Color::Format format=Color::Format::ABGR)
 Construct an Image from a raw buffer, which is assumed to be in the given format (default: ABGR).
 
bool isNull () const
 
int height () const
 
int width () const
 
std::size_t sizeInBytes () const
 
Color pixel (uint i, uint j) const
 
const unsigned chardata () const
 
bool load (const std::string &filename)
 
void save (const std::string &filename, uint quality=90) const
 
void mirror (bool horizontal=false, bool vertical=true)
 
void serialize (std::ostream &os) const
 
void deserialize (std::istream &is)
 

Private Attributes

Array2< uint32_tmImg
 

Detailed Description

The Image class stores an Image in 4 bytes RGBA format.

Each pixel is stored as 4 bytes, with the first byte representing RGBA in a uint32_t.

Constructor & Destructor Documentation

◆ Image() [1/2]

vcl::Image::Image ( const std::string &  filename)
inline

Load an image from a file.

Parameters
[in]filenamethe name of the file.

◆ Image() [2/2]

vcl::Image::Image ( const void data,
uint  w,
uint  h,
bool  yFlip = false,
Color::Format  format = Color::Format::ABGR 
)
inline

Construct an Image from a raw buffer, which is assumed to be in the given format (default: ABGR).

Parameters
[in]datathe raw buffer.
[in]wthe width of the image.
[in]hthe height of the image.
[in]yFlipif true, the image is flipped along the y axis.
[in]formatthe format of the buffer, that is the way each pixel (4 bytes) is stored.

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