pngz
easy png io library that converts all images into 8 bit RGBA.
|
#include <png.h>
Go to the source code of this file.
Data Structures | |
struct | pixel |
pixel in RGBA8 format. More... | |
struct | pngz |
easy png structure. More... | |
Typedefs | |
typedef struct pixel | pixel |
pixel in RGBA8 format. | |
typedef struct pngz | pngz |
easy png structure. | |
Functions | |
pixel ** | pngz_alloc_pixels (unsigned rows, unsigned cols) |
allocate a pixel buffer. | |
unsigned char ** | pngz_alloc_bytes (unsigned rows, unsigned cols) |
allocate raw pixel byte buffer. | |
int | pngz_free_pixels (pixel **pixels, unsigned rows) |
safely free pixel buffer. | |
int | pngz_free_bytes (unsigned char **bytes, unsigned rows) |
safely free pixel buffer. | |
int | pngz_free (pngz *z) |
free a pngz structs pixels. | |
int | pngz_pack_pixels (unsigned char **bytes_src, pixel **pixels_dest, unsigned rows, unsigned cols) |
pack pixels with bytes. | |
int | pngz_unpack_pixels (pixel **pixels_src, unsigned char **bytes_dest, unsigned rows, unsigned cols) |
unpack pixels into raw byte ptrs. | |
int | pngz_load (pngz *z) |
load a pngz object into memory | |
int | pngz_load_from (pngz *z, char *path) |
load a pngz from a path directly passed into the call, just indirectly calls the standard pngz_load() | |
int | pngz_save (pngz z) |
write a png back out to file | |
int | pngz_save_as (pngz z, char *path) |
write a png back out to file with a new name | |
void | pngz_print (pngz z) |
print a pngz ztruct contents. | |
void | pngz_print_pixel (pixel p) |
print out a single pixels rgba values in hex. | |
void | pngz_print_indent (pngz z, int indent) |
print a pngz ztruct contents. | |
void | pngz_print_pixel_indent (pixel p, int indent) |
print out a single pixels rgba values. | |
easy png structure.
always contains RGBA8 color (0x0 - 0xFFFFFF). pixel buffer is [height][width] pixels ([rows][cols])
unsigned char ** pngz_alloc_bytes | ( | unsigned | rows, |
unsigned | cols | ||
) |
pixel ** pngz_alloc_pixels | ( | unsigned | rows, |
unsigned | cols | ||
) |
int pngz_free | ( | pngz * | z | ) |
free a pngz structs pixels.
z | pngz* with pixels loaded into memory |
Definition at line 155 of file pngz.c.
References pngz::height, pngz::pixels, and pngz_free_pixels().
int pngz_free_bytes | ( | unsigned char ** | bytes, |
unsigned | rows | ||
) |
int pngz_free_pixels | ( | pixel ** | pixels, |
unsigned | rows | ||
) |
int pngz_load | ( | pngz * | z | ) |
load a pngz object into memory
z | pngz* easy png ptr to load into |
Definition at line 231 of file pngz.c.
References pngz::height, pngz::path, pngz::pixels, pngz_alloc_bytes(), pngz_alloc_pixels(), pngz_free_bytes(), pngz_pack_pixels(), and pngz::width.
int pngz_load_from | ( | pngz * | z, |
char * | path | ||
) |
load a pngz from a path directly passed into the call, just indirectly calls the standard pngz_load()
z | pngz* easy png ptr to load into |
path | char* path to read from |
Definition at line 219 of file pngz.c.
References pngz::path, and pngz_load().
int pngz_pack_pixels | ( | unsigned char ** | bytes_src, |
pixel ** | pixels_dest, | ||
unsigned | rows, | ||
unsigned | cols | ||
) |
void pngz_print | ( | pngz | z | ) |
print a pngz ztruct contents.
z | pngz to print |
Definition at line 403 of file pngz.c.
References pngz::cols, pngz::pixels, and pngz::rows.
void pngz_print_indent | ( | pngz | z, |
int | indent | ||
) |
print a pngz ztruct contents.
z | pngz to print |
indent | int for how much to indent this print |
Definition at line 445 of file pngz.c.
References pngz::height, pngz::pixels, print_indent(), and pngz::width.
void pngz_print_pixel | ( | pixel | p | ) |
void pngz_print_pixel_indent | ( | pixel | p, |
int | indent | ||
) |
int pngz_save | ( | pngz | z | ) |
write a png back out to file
z | pngz* easy png ptr to write to file |
Definition at line 328 of file pngz.c.
References pngz::path, and pngz_save_as().
int pngz_save_as | ( | pngz | z, |
char * | path | ||
) |
write a png back out to file with a new name
path | char* file path to save to |
z | pngz* easy png ptr to write to file |
Definition at line 339 of file pngz.c.
References pngz::height, pngz::pixels, pngz_alloc_bytes(), pngz_free_bytes(), pngz_unpack_pixels(), and pngz::width.
int pngz_unpack_pixels | ( | pixel ** | pixels_src, |
unsigned char ** | bytes_dest, | ||
unsigned | rows, | ||
unsigned | cols | ||
) |