libfacade 1.1
A library for manipulating PNG images with payloads.
|
A sample of data for a given pixel. More...
#include <png.hpp>
Public Types | |
using | Base = _Base |
The base type used by this sample. | |
Public Member Functions | |
Sample () | |
Sample (Base value) | |
Sample (const Sample &other) | |
Base | operator* () const |
Syntactic sugar to get the value of this sample. | |
Sample & | operator= (Base value) |
Syntactic sugar to assign the value of this sample. | |
Base | value () const |
Get the value retained by this sample. | |
void | set_value (Base value) |
Assign the given value to this sample. | |
Static Public Attributes | |
static const std::size_t | Bits = _Bits |
The size, in bits, of this sample. | |
static const std::size_t | Max = (1 << Bits) - 1 |
The maximum value that can be used with this sample. | |
A sample of data for a given pixel.
A sample is a unit of bits representing a given pixel value (e.g., a color channel). It can be a variety of sizes:
As a result, it can be two different types:
To make typing easier, a series of typedefs are created to declare what type of sample you want.
_Base | The base type that contains the sample value. Can be std::uint8_t or std::uint16_t. |
_Bits | The size, in bits, of the desired sample. Can be 1, 2, 4, 8 or 16. |
using facade::png::Sample< _Base, _Bits >::Base = _Base |
The base type used by this sample.
|
inline |
|
inline |
|
inline |
|
inline |
Syntactic sugar to get the value of this sample.
|
inline |
Syntactic sugar to assign the value of this sample.
|
inline |
Assign the given value to this sample.
Throws an exception if the value provided is too large for the given sample size.
value | The value to assign to the sample. |
facade::exception::IntegerOverflow |
|
inline |
Get the value retained by this sample.
|
static |
The size, in bits, of this sample.
|
static |
The maximum value that can be used with this sample.