libfacade 1.1
A library for manipulating PNG images with payloads.
|
The base scanline class containing a row of facade::png::PixelSpan of the given pixel type. More...
#include <png.hpp>
Public Types | |
using | Span = PixelSpan< PixelType > |
The pixel span this scanline holds. | |
Public Member Functions | |
ScanlineBase () | |
ScanlineBase (std::uint8_t filter_type, std::size_t width) | |
ScanlineBase (std::uint8_t filter_type, std::vector< Span > pixel_data) | |
ScanlineBase (const ScanlineBase &other) | |
Pixel | operator[] (std::size_t index) const |
Syntactic sugar for getting a facade::png::Pixel variant. | |
std::uint8_t | filter_type () const |
Get the filter type of this scanline. | |
void | set_filter_type (std::uint8_t filter_type) |
Set the filter type of this scanline. | |
__attribute__((used)) const std std::size_t | pixel_span () const |
Return a const reference to the underlying pixel data array. | |
std::size_t | pixel_width () const |
Return the size, in samples, of the given scanline. | |
Span & | get_span (std::size_t index) |
Get the facade::png::PixelSpan reference at the given index. | |
const Span & | get_span (std::size_t index) const |
Get the const facade::png::PixelSpan reference at the given index. | |
void | set_span (const Span &span, std::size_t index) |
Set the facade::png::PixelSpan object at the given index. | |
Pixel | get_pixel (std::size_t index) const |
Get the pixel at the given index. | |
void | set_pixel (const Pixel &pixel, std::size_t index) |
Set the pixel at the given index. | |
std::vector< std::uint8_t > | to_raw () const |
Convert this scanline to raw byte form. | |
ScanlineBase | reconstruct (std::optional< ScanlineBase > previous) const |
Reconstruct the scanline based on its filter value. | |
ScanlineBase | filter (std::optional< ScanlineBase > previous) const |
Calculate all filters and determine the best compressed filter among them. | |
ScanlineBase | filter (FilterType filter_type, std::optional< ScanlineBase > previous) const |
Calculate the given filter type on this scanline. | |
Static Public Member Functions | |
static ScanlineBase | read_line (const std::vector< std::uint8_t > &raw_data, std::size_t offset, std::size_t width) |
Create a scanline object from raw data at the given data offset. | |
static std::vector< ScanlineBase > | from_raw (const Header &header, const std::vector< std::uint8_t > &raw_data) |
Collect a vector of scanlines from the given raw data. | |
The base scanline class containing a row of facade::png::PixelSpan of the given pixel type.
PixelType | The pixel type this scanline holds. |
using facade::png::ScanlineBase< PixelType >::Span = PixelSpan<PixelType> |
The pixel span this scanline holds.
|
inline |
|
inline |
|
inline |
|
inline |
ScanlineBase facade::png::ScanlineBase< PixelType >::filter | ( | FilterType | filter_type, |
std::optional< ScanlineBase< PixelType > > | previous | ||
) | const |
Calculate the given filter type on this scanline.
filter_type | The facade::png::FilterType to assign on the scanline. |
previous | The previous scanline that is sometimes necessary for filtering. Typically the previous scanline if y > 0. |
ScanlineBase facade::png::ScanlineBase< PixelType >::filter | ( | std::optional< ScanlineBase< PixelType > > | previous | ) | const |
Calculate all filters and determine the best compressed filter among them.
previous | The previous scanline, if any. This is sometimes necessary for reconstruction procedures. |
std::uint8_t ScanlineBase::filter_type |
Get the filter type of this scanline.
|
static |
Collect a vector of scanlines from the given raw data.
header | The header of the given image to collect scanlines from. |
raw_data | The raw pixel data from the uncompressed IDAT chunks. |
Pixel ScanlineBase::get_pixel | ( | std::size_t | index | ) | const |
Get the pixel at the given index.
Index, in this case, is bound by the value returned by facade::png::Header::width.
facade::exception::OutOfBounds |
Span & facade::png::ScanlineBase< PixelType >::get_span | ( | std::size_t | index | ) |
Get the facade::png::PixelSpan reference at the given index.
Index, in this case, is bound by facade::png::ScanlineBase::pixel_span.
facade::exception::OutOfBounds |
const ScanlineBase< PixelType >::Span & ScanlineBase::get_span | ( | std::size_t | index | ) | const |
Get the const facade::png::PixelSpan reference at the given index.
Index, in this case, is bound by facade::png::ScanlineBase::pixel_span.
facade::exception::OutOfBounds |
Pixel ScanlineBase::operator[] | ( | std::size_t | index | ) | const |
Syntactic sugar for getting a facade::png::Pixel variant.
__attribute__((used)) const std std::size_t facade::png::ScanlineBase< PixelType >::pixel_span | ( | ) | const |
Return a const reference to the underlying pixel data array.
Return the size, in terms of pixel span objects, of the underlying scanline.
std::size_t facade::png::ScanlineBase< PixelType >::pixel_width | ( | ) | const |
Return the size, in samples, of the given scanline.
|
static |
Create a scanline object from raw data at the given data offset.
raw_data | The raw data byte vector to read from. |
offset | The offset to begin reading the scanline. |
width | The width of the scanline. |
facade::exception::OutOfBounds |
ScanlineBase< PixelType > ScanlineBase::reconstruct | ( | std::optional< ScanlineBase< PixelType > > | previous | ) | const |
Reconstruct the scanline based on its filter value.
This essentially performs the inverse of what the facade::png::ScanlineBase::filter functions do.
previous | The previous scanline, if any. This is sometimes necessary for reconstruction procedures. |
void ScanlineBase::set_filter_type | ( | std::uint8_t | filter_type | ) |
Set the filter type of this scanline.
void ScanlineBase::set_pixel | ( | const Pixel & | pixel, |
std::size_t | index | ||
) |
Set the pixel at the given index.
Index, in this case, is bound by the value returned by facade::png::Header::width.
facade::exception::OutOfBounds |
void ScanlineBase::set_span | ( | const Span & | span, |
std::size_t | index | ||
) |
Set the facade::png::PixelSpan object at the given index.
Index, in this case, is bound by facade::png::ScanlineBase::pixel_span.
span | The pixel span to set. |
index | The index of the span to set it to. |
facade::exception::OutOfBounds |
std::vector< std::uint8_t > ScanlineBase::to_raw |
Convert this scanline to raw byte form.