DecodedImage

Fields

std::vector< unsigned char > pixels
unsigned int width
unsigned int height
int channels

Detailed Description

class DecodedImage

Decoded in-memory image. Owns the pixel buffer via std::vector.

Public Functions

DecodedImage() = default

Default constructor — empty image.

DecodedImage(unsigned char const *png_data, size_t png_size)

Construct by decoding a PNG blob from memory. On failure, pixels is empty and dimensions are zero.

Parameters:
  • png_data – Pointer to the PNG file bytes.
  • png_size – Number of bytes in png_data.
~DecodedImage() = default
inline bool IsValid() const
Returns:true if the image was decoded successfully.
DecodedImage(DecodedImage const&) = delete
DecodedImage &operator=(DecodedImage const&) = delete
DecodedImage(DecodedImage&&) = default
DecodedImage &operator=(DecodedImage&&) = default

Public Members

std::vector<unsigned char> pixels

Pixel data. Empty on failure.

unsigned int width = 0

Image width in pixels.

unsigned int height = 0

Image height in pixels.

int channels = 0

Bytes per pixel: 1 = grayscale, 3 = RGB, 4 = RGBA.