SpatiumLib
|
Templated image container. More...
#include <Image.h>
Public Member Functions | |
Image () | |
Constructor Constructs an image with a single pixel to ensure function pixel() can always return a reference to a value. More... | |
Image (size_t width, size_t height) | |
Constructor. More... | |
Image (const Image &other) | |
Copy constructor. Deep copy. More... | |
Image (Image &&other) | |
Move constructor. More... | |
Image & | operator= (const Image &other) |
Copy assignment operator Deep copy. More... | |
Image | operator= (Image &&other) |
Move assignment operator. More... | |
~Image ()=default | |
Destructor. More... | |
bool | operator== (const Image &other) const |
Compare operator. Is equal. More... | |
bool | operator!= (const Image &other) const |
Compare operator. Is unequal. More... | |
size_t | width () const |
Image width in pixels. More... | |
size_t | height () const |
Image height in pixels. More... | |
size_t | channelCount () const |
Channel count of pixel values. More... | |
std::array< T, N > * | imageDataPtr () const |
Pointer to image data. More... | |
void | resize (size_t newWidth, size_t newHeight) |
Resize image. This allocates new memory without copying pixel values. More... | |
void | clear () |
Clear the image data (Set to zero) More... | |
std::array< T, N > | pixel (size_t x, size_t y, bool checkBounds=true) const |
Access pixel by value. More... | |
std::array< T, N > & | pixel (size_t x, size_t y, bool checkBounds=true) |
Access pixel by reference. More... | |
Protected Attributes | |
size_t | m_width |
Image width in pixels. More... | |
size_t | m_height |
Image height in pixels. More... | |
std::unique_ptr< std::array< T, N >[]> | m_imageData |
Pointer to image data. More... | |
Templated image container.
An image has no knowledge about color. The minimum image size is 1x1 pixel.
|
inline |
Constructor Constructs an image with a single pixel to ensure function pixel() can always return a reference to a value.
std::bad_alloc | on bad allocation |
|
inline |
|
inline |
Copy constructor. Deep copy.
std::bad_alloc | on bad allocation |
|
inline |
Move constructor.
std::bad_alloc | on bad allocation |
|
default |
Destructor.
|
inline |
Channel count of pixel values.
|
inline |
Clear the image data (Set to zero)
|
inline |
Image height in pixels.
|
inline |
Pointer to image data.
|
inline |
Compare operator. Is unequal.
[in] | other | Other image |
|
inline |
Copy assignment operator Deep copy.
std::bad_alloc | on bad allocation |
|
inline |
Move assignment operator.
|
inline |
Compare operator. Is equal.
[in] | other | Other image |
|
inline |
Access pixel by value.
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | checkBounds | Check bounds (default = true). If the coordinates |
|
inline |
Access pixel by reference.
[in] | x | X coordinate |
[in] | y | Y coordinate |
|
inline |
|
inline |
Image width in pixels.
|
protected |
Image height in pixels.
|
protected |
Pointer to image data.
|
protected |
Image width in pixels.