|
| Image () |
|
| Image (const void *ptr, std::size_t size, bool validate=true) |
|
| Image (const std::vector< std::uint8_t > &data, bool validate=true) |
|
| Image (const std::string &filename, bool validate=true) |
|
| Image (const Image &other) |
|
Image & | operator= (const Image &other) |
| Syntatic sugar for assigning to an image object.
|
|
Scanline & | operator[] (std::size_t index) |
| Syntactic sugar for getting a scanline from the loaded image.
|
|
const Scanline & | operator[] (std::size_t index) const |
| Syntactic sugar for getting a const scanline from the loaded image.
|
|
bool | has_chunk (const std::string &tag) const |
| Check for the presence of a given chunk tag.
|
|
std::vector< ChunkVec > | get_chunks (const std::string &tag) const |
| Get the chunk data for the corresponding tag.
|
|
void | add_chunk (const ChunkVec &chunk) |
| Add a given chunk to the underlying image.
|
|
bool | has_trailing_data () const |
| Return whether or not this PNG image has trailing data.
|
|
std::vector< std::uint8_t > & | get_trailing_data () |
| Get the trailing data in the image.
|
|
const std::vector< std::uint8_t > & | get_trailing_data () const |
| Get the const trailing data in the image.
|
|
void | set_trailing_data (const std::vector< std::uint8_t > &data) |
| Set the trailing data of the PNG image.
|
|
void | clear_trailing_data () |
| Clear the trailing data in the PNG image.
|
|
void | parse (const void *ptr, std::size_t size, bool validate=true) |
| Parse a given data buffer into its individual chunks for further processing.
|
|
void | parse (const std::vector< std::uint8_t > &data, bool validate=true) |
| Parse a given data vector for a PNG image.
|
|
void | parse (const std::string &filename, bool validate=true) |
| Read a file and parse it as a PNG file.
|
|
void | load () |
| Load the image data from the IDAT chunks.
|
|
Scanline & | scanline (std::size_t index) |
| Get the scanline at the given y index.
|
|
const Scanline & | scanline (std::size_t index) const |
| Get the const scanline at the given y index.
|
|
bool | has_header () const |
| Check if this PNG image has a header present.
|
|
Header & | header () |
| Get the header present in the PNG image.
|
|
const Header & | header () const |
| Get the const header present in the PNG image.
|
|
Header & | new_header () |
| Create and return a new blank header in the PNG image.
|
|
std::size_t | width () const |
| Get the width, in pixels, of this image.
|
|
std::size_t | height () const |
| Get the height, in pixels, of this image.
|
|
bool | has_image_data () const |
| Return if the image has any IDAT chunks present.
|
|
bool | is_loaded () const |
| Check if the image data has been extracted from the IDAT chunks.
|
|
void | decompress () |
| Decompress the IDAT chunks in the image.
|
|
void | compress (std::optional< std::size_t > chunk_size=8192, int level=-1) |
| Compress the image data into IDAT chunks.
|
|
void | reconstruct () |
| Reconstruct the filtered image data into their raw, unfiltered form.
|
|
void | filter () |
| Filter the image data to prepare it for compression.
|
|
std::vector< std::uint8_t > | to_file () const |
| Convert this object into an image buffer fit for saving to a .png file.
|
|
void | save (const std::string &filename) const |
| Call facade::png::Image::to_file and save that file to disk.
|
|
bool | has_text () const |
| Return whether or not the image contains a tEXt chunk.
|
|
Text & | add_text (const std::string &keyword, const std::string &text) |
| Add a text chunk to the PNG image.
|
|
void | remove_text (const Text &text) |
| Remove the given tEXt section from the image.
|
|
void | remove_text (const std::string &keyword, const std::string &text) |
| Remove a tEXt section by keyword and text.
|
|
std::vector< Text > | get_text (const std::string &keyword) const |
| Get the tEXt sections with the following keyword.
|
|
bool | has_ztext () const |
| Return whether or not the image contains a zTXt chunk.
|
|
ZText & | add_ztext (const std::string &keyword, const std::string &text) |
| Add a zTXt chunk to the PNG image.
|
|
void | remove_ztext (const ZText &ztext) |
| Remove the given zTXt section from the image.
|
|
void | remove_ztext (const std::string &keyword, const std::string &text) |
| Remove a zTXt section by keyword and text.
|
|
std::vector< ZText > | get_ztext (const std::string &keyword) const |
| Get the zTXt sections with the following keyword.
|
|
A class for loading and manipulating PNG images.
Here is an example of how to use this class object in particular:
int main(int argc, char *argv[])
{
image.
parse(
"../test/art.png");
{
{
pixel.
red().set_value(0xFF - *pixel.
red());
pixel.
blue().set_value(0xFF - *pixel.
blue());
image[y].set_pixel(pixel, x);
}
}
image.
save(
"art.inverted.png");
return 0;
}
An RGB pixel with alpha channel.
Definition: png.hpp:607
A class for loading and manipulating PNG images.
Definition: png.hpp:1305
void filter()
Filter the image data to prepare it for compression.
Definition: png.cpp:1305
void compress(std::optional< std::size_t > chunk_size=8192, int level=-1)
Compress the image data into IDAT chunks.
Definition: png.cpp:1143
void save(const std::string &filename) const
Call facade::png::Image::to_file and save that file to disk.
Definition: png.cpp:1488
Header & header()
Get the header present in the PNG image.
Definition: png.cpp:999
void decompress()
Decompress the IDAT chunks in the image.
Definition: png.cpp:1038
void parse(const void *ptr, std::size_t size, bool validate=true)
Parse a given data buffer into its individual chunks for further processing.
Definition: png.cpp:935
void reconstruct()
Reconstruct the filtered image data into their raw, unfiltered form.
Definition: png.cpp:1172
Sample & blue()
Retrieve a reference to the blue channel.
Definition: png.hpp:511
Sample & red()
Retrieve a reference to the red channel.
Definition: png.hpp:497
Sample & green()
Retrieve a reference to the green channel.
Definition: png.hpp:504
std::variant< GrayscalePixel1Bit, GrayscalePixel2Bit, GrayscalePixel4Bit, GrayscalePixel8Bit, GrayscalePixel16Bit, TrueColorPixel8Bit, TrueColorPixel16Bit, PalettePixel1Bit, PalettePixel2Bit, PalettePixel4Bit, PalettePixel8Bit, AlphaGrayscalePixel8Bit, AlphaGrayscalePixel16Bit, AlphaTrueColorPixel8Bit, AlphaTrueColorPixel16Bit > Pixel
The variant type corresponding to all known pixel types for PNG images.
Definition: png.hpp:674
Definition: exception.hpp:14