|
StuBS
|
Portable Network Graphics file format. More...
#include <utils/png.h>
Classes | |
| struct | huffman_tree |
Public Types | |
| enum | error { PNG_EOK = 0 , PNG_ENOMEM = 1 , PNG_ENOTFOUND = 2 , PNG_ENOTPNG = 3 , PNG_EMALFORMED = 4 , PNG_EUNSUPPORTED = 5 , PNG_EUNINTERLACED = 6 , PNG_EUNFORMAT = 7 , PNG_EPARAM = 8 , PNG_EIOERROR = 9 } |
| enum | format { BADFORMAT , RGB8 , RGB16 , RGBA8 , RGBA16 , LUMINANCE1 , LUMINANCE2 , LUMINANCE4 , LUMINANCE8 , LUMINANCE_ALPHA1 , LUMINANCE_ALPHA2 , LUMINANCE_ALPHA4 , LUMINANCE_ALPHA8 } |
Public Member Functions | |
| PNG (const unsigned char *buffer, unsigned long size) | |
| Load PNG image from memory. | |
| PNG (const char *path) | |
| Load PNG image from file system. | |
| ~PNG () | |
| Free memory reserved for PNG image. | |
| unsigned | get_width () const |
| Width of image (pixels) | |
| unsigned | get_height () const |
| Height of image (pixels) | |
| unsigned | get_bpp () const |
| Bits per pixel. | |
| unsigned | get_bitdepth () const |
| Depth of color (bits pro color channel) | |
| unsigned | get_components () const |
| Number of components per pixel. | |
| unsigned | get_pixelsize () const |
| Number of bytes per pixel. | |
| enum format | get_format () const |
| Retrieve the format. | |
| const unsigned char * | get_buffer () |
| Image buffer address. | |
| unsigned | get_size () |
| Size of image buffer. | |
Protected Member Functions | |
| enum error | header () |
| Extract header (image attributes) | |
| enum error | decode () |
| Decode whole image. | |
Protected Attributes | |
| enum error | error |
| unsigned | error_line |
Private Types | |
| enum | color { COLOR_LUM = 0 , COLOR_RGB = 2 , COLOR_LUMA = 4 , COLOR_RGBA = 6 } |
| enum | { STATE_ERROR = -1 , STATE_DECODED = 0 , STATE_HEADER = 1 , STATE_NEW = 2 } |
Private Member Functions | |
| void | free_source () |
| void | huffman_tree_create_lengths (struct huffman_tree *tree, const unsigned *bitlen) |
| unsigned | huffman_decode_symbol (const unsigned char *in, unsigned long *bp, const struct huffman_tree *codetree, unsigned long inlength) |
| void | get_tree_inflate_dynamic (struct huffman_tree *codetree, struct huffman_tree *codetreeD, struct huffman_tree *codelengthcodetree, const unsigned char *in, unsigned long *bp, unsigned long inlength) |
| void | inflate_huffman (unsigned char *out, unsigned long outsize, const unsigned char *in, unsigned long *bp, unsigned long *pos, unsigned long inlength, unsigned btype) |
| void | inflate_uncompressed (unsigned char *out, unsigned long outsize, const unsigned char *in, unsigned long *bp, unsigned long *pos, unsigned long inlength) |
| enum error | uz_inflate_data (unsigned char *out, unsigned long outsize, const unsigned char *in, unsigned long insize, unsigned long inpos) |
| enum error | uz_inflate (unsigned char *out, unsigned long outsize, const unsigned char *in, unsigned long insize) |
| void | unfilter_scanline (unsigned char *recon, const unsigned char *scanline, const unsigned char *precon, unsigned long bytewidth, unsigned char filterType, unsigned long length) |
| void | unfilter (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, unsigned bpp) |
| void | post_process_scanlines (unsigned char *out, unsigned char *in, const PNG *info_png) |
| enum format | determine_format () |
Static Private Member Functions | |
| static void | huffman_tree_init (struct huffman_tree *tree, unsigned *buffer, unsigned numcodes, unsigned maxbitlen) |
| static void | remove_padding_bits (unsigned char *out, const unsigned char *in, unsigned long olinebits, unsigned long ilinebits, unsigned h) |
Private Attributes | ||
| unsigned | width = 0 | |
| unsigned | height = 0 | |
| enum color | color_type | |
| unsigned | color_depth | |
| enum format | format = BADFORMAT | |
| unsigned char * | buffer = nullptr | |
| unsigned long | size = 0 | |
| enum PNG:: { ... } | state | |
| struct { | ||
| const unsigned char * | buffer | |
| unsigned long | size | |
| char | owning | |
| } | source | |
Portable Network Graphics file format.
!
| struct PNG::huffman_tree |
| enum PNG::error |
| enum PNG::format |
|
private |
| PNG::PNG | ( | const unsigned char * | buffer, |
| unsigned long | size | ||
| ) |
Load PNG image from memory.
| buffer | pointer to memory buffer |
| size | size of memory buffer |
|
explicit |
Load PNG image from file system.
| path | path to file |
| PNG::~PNG | ( | ) |
Free memory reserved for PNG image.
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
protected |
Extract header (image attributes)
|
protected |
Decode whole image.
|
inline |
Width of image (pixels)
|
inline |
Height of image (pixels)
|
inline |
Bits per pixel.
|
inline |
Depth of color (bits pro color channel)
|
inline |
Number of components per pixel.
|
inline |
Number of bytes per pixel.
|
inline |
Retrieve the format.
|
inline |
Image buffer address.
|
inline |
Size of image buffer.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| enum { ... } PNG::state |
| struct { ... } PNG::source |
|
protected |
|
protected |