libfacade 1.1
A library for manipulating PNG images with payloads.
|
A span of data representing the underlying bits or bytes of a pixel. More...
#include <png.hpp>
Public Member Functions | |
PixelSpan () | |
PixelSpan (const PixelSpan &other) | |
Pixel | operator[] (std::size_t index) const |
Syntactic sugar to get a facade::png::Pixel variant out of this span. | |
const std::uint8_t * | data () const |
Return the underlying raw byte data representing this pixel span. | |
std::size_t | data_size () const |
Return the size of this pixel span. | |
Pixel | get (std::size_t index=0) const |
Retrieve a facade::png::Pixel variant of the underlying pixel type at the given index. | |
void | set (const Pixel &pixel, std::size_t index=0) |
Set a given facade::png::Pixel variant at the given offset. | |
Static Public Attributes | |
static const std::size_t | Samples = (8 / PixelType::Bits) + static_cast<int>(PixelType::Bits > 8) |
The amount of samples possibly contained within this pixel span. | |
A span of data representing the underlying bits or bytes of a pixel.
This class is the binary bridge which allows us to access pixel data that is less than 8 bits in size. It relies on a union of a byte and a byte array to contain as low as 1-bit pixels (with 8 samples) and as large as 64-bit pixels (with 1 sample). This design is necessary to properly type pixel data as it exists within raw PNG image data, allowing us to essentially create objects such as vectors of pixels, which then become a facade::png::ScanlineBase.
PixelType | The base pixel type to use for this span of pixel data. |
|
inline |
|
inline |
|
inline |
Return the underlying raw byte data representing this pixel span.
|
inline |
Return the size of this pixel span.
|
inline |
Retrieve a facade::png::Pixel variant of the underlying pixel type at the given index.
index | The index of the sample in the pixel to retrieve. 0 for anything over or equal to 8-bit, anything less than facade::png::PixelSpan::Samples for less than 8-bit. |
facade::exception::OutOfBounds |
|
inline |
Syntactic sugar to get a facade::png::Pixel variant out of this span.
index | The index of the sample to retrieve. |
|
inline |
Set a given facade::png::Pixel variant at the given offset.
pixel | The pixel variant to write to the pixel span. |
index | The index of the sample to set. For pixels greater than or equal to 8-bits, this should be 0. For pixels less than 8-bits, this can be anything less than facade::png::PixelSpan::Samples. |
std::uint8_t facade::png::PixelSpan< PixelType >::bits |
std::uint8_t facade::png::PixelSpan< PixelType >::bytes[PixelType::Bits/8] |
|
static |
The amount of samples possibly contained within this pixel span.
Pixels that are greater than or equal to 8 bits are considered 1 sample.