Aether
SDL2 based UI Framework for NX
|
Represents an object containing the raw pixel data for an image/texture as an array, along with required metadata such as width and height. More...
#include <ImageData.hpp>
Public Member Functions | |
ImageData () | |
The number of channels in the image (usually 3 or 4) More... | |
ImageData (const std::vector< uint8_t > &data, const size_t width, const size_t height, const uint8_t channels) | |
Constructs a new ImageData object from the given raw bytes. More... | |
ImageData (const std::vector< Colour > &pixels, const size_t width, const size_t height, const uint8_t channels) | |
Constructs a new ImageData object from the given raw bytes. More... | |
bool | valid () const |
Returns whether the associated image is considered 'valid' (i.e. has some pixel data). More... | |
size_t | width () const |
Returns the width of the stored image in pixels. More... | |
size_t | height () const |
Returns the height of the stored image in pixels. More... | |
uint8_t | channels () const |
Returns the number of channels used within the stored image. This will usually return 3 (RGB) or 4 (RGBA). More... | |
Colour * | colourAt (const size_t x, const size_t y) const |
Returns a pointer to the colour of a pixel at the given coordinate. More... | |
std::vector< uint8_t > | toByteVector () const |
Returns the stored image as a vector of bytes (i.e. one byte per channel). e.g. For an RGB image: [r0, g0, b0, r1, g1, b1, etc...]. More... | |
std::vector< Colour > | toColourVector () const |
Returns the stored image as a vector of colours. More... | |
Represents an object containing the raw pixel data for an image/texture as an array, along with required metadata such as width and height.
Aether::ImageData::ImageData | ( | ) |
The number of channels in the image (usually 3 or 4)
Constructs a new (invalid) ImageData object.
Aether::ImageData::ImageData | ( | const std::vector< uint8_t > & | data, |
const size_t | width, | ||
const size_t | height, | ||
const uint8_t | channels | ||
) |
Constructs a new ImageData object from the given raw bytes.
data | Vector of bytes containing pixels in RGB(A) format. |
width | Width of image in pixels |
height | Height of image in pixels |
channels | Number of channels forming the image. |
Aether::ImageData::ImageData | ( | const std::vector< Colour > & | pixels, |
const size_t | width, | ||
const size_t | height, | ||
const uint8_t | channels | ||
) |
Constructs a new ImageData object from the given raw bytes.
pixels | Vector of pixels. |
width | Width of image in pixels |
height | Height of image in pixels |
channels | Number of channels forming the image. |
uint8_t Aether::ImageData::channels | ( | ) | const |
Returns the number of channels used within the stored image. This will usually return 3 (RGB) or 4 (RGBA).
Colour* Aether::ImageData::colourAt | ( | const size_t | x, |
const size_t | y | ||
) | const |
Returns a pointer to the colour of a pixel at the given coordinate.
x | x-coordinate of pixel |
y | y-coordinate of pixel |
size_t Aether::ImageData::height | ( | ) | const |
Returns the height of the stored image in pixels.
std::vector<uint8_t> Aether::ImageData::toByteVector | ( | ) | const |
Returns the stored image as a vector of bytes (i.e. one byte per channel). e.g. For an RGB image: [r0, g0, b0, r1, g1, b1, etc...].
std::vector<Colour> Aether::ImageData::toColourVector | ( | ) | const |
Returns the stored image as a vector of colours.
bool Aether::ImageData::valid | ( | ) | const |
Returns whether the associated image is considered 'valid' (i.e. has some pixel data).
size_t Aether::ImageData::width | ( | ) | const |
Returns the width of the stored image in pixels.