|
pngz
easy png io library that converts all images into 8 bit RGBA.
|
#include <png.h>#include <stdint.h>

Go to the source code of this file.
Data Structures | |
| struct | PNGZ_Pixel |
| pixel in RGBA8 format. More... | |
| struct | PNGZ_Image |
| easy png based image structure. More... | |
Typedefs | |
| typedef struct PNGZ_Pixel | PNGZ_Pixel |
| pixel in RGBA8 format. | |
| typedef struct PNGZ_Image | PNGZ_Image |
| easy png based image structure. | |
Functions | |
| int | PNGZ_AllocPixels (PNGZ_Pixel ***pixels_ptr, const unsigned rows, const unsigned cols) |
| allocate a pixel buffer. | |
| int | PNGZ_AllocBytes (uint8_t ***bytes_ptr, const unsigned rows, const unsigned cols) |
| allocate raw pixel byte buffer. | |
| int | PNGZ_FreePixels (PNGZ_Pixel **pixels, const unsigned rows) |
| safely free pixel buffer. | |
| int | PNGZ_FreeBytes (uint8_t **bytes, const unsigned rows) |
| safely free pixel buffer. | |
| int | PNGZ_Free (PNGZ_Image *z) |
| free a pngz structs pixels. | |
| int | PNGZ_BytesToPixels (uint8_t **bytes_src, PNGZ_Pixel **pixels_dest, const unsigned rows, const unsigned cols) |
| pack bytes into pixels. | |
| int | PNGZ_PixelsToBytes (PNGZ_Pixel **pixels_src, uint8_t **bytes_dest, const unsigned rows, const unsigned cols) |
| unpack pixels into raw byte ptrs. | |
| int | PNGZ_Load (PNGZ_Image *z) |
| load a pngz object into memory | |
| int | PNGZ_LoadFrom (PNGZ_Image *z, const char *path) |
| load a pngz from a path directly passed into the call, just a wrapper for standard pngz_load() | |
| int | PNGZ_Save (const PNGZ_Image z) |
| write a png back out to file, wrapper for pngz_save_as() | |
| int | PNGZ_SaveAs (const PNGZ_Image z, const char *path) |
| write a png back out to file with a new name | |
| int | PNGZ_Copy (const PNGZ_Image z_src, PNGZ_Image *z_dest) |
| copies the pixel data from one pngz to another. | |
| int | PNGZ_PrintImage (const PNGZ_Image z) |
| print a pngz ztruct contents. | |
| int | PNGZ_PrintPixel (const PNGZ_Pixel p) |
| print out a single pixels rgba values in hex. | |
| int | PNGZ_PrintImageIndent (const PNGZ_Image z, const int indent) |
| print a pngz ztruct contents. | |
| int | PNGZ_PrintPixelIndent (const PNGZ_Pixel p, const int indent) |
| typedef struct PNGZ_Image PNGZ_Image |
easy png based image structure.
always contains RGBA8 color (0x0 - 0xFFFFFF). pixel buffer is [height][width] pixels ([rows][cols])
| typedef struct PNGZ_Pixel PNGZ_Pixel |
pixel in RGBA8 format.
| int PNGZ_AllocBytes | ( | uint8_t *** | bytes_ptr, |
| const unsigned | rows, | ||
| const unsigned | cols ) |
| int PNGZ_AllocPixels | ( | PNGZ_Pixel *** | pixels_ptr, |
| const unsigned | rows, | ||
| const unsigned | cols ) |
| int PNGZ_BytesToPixels | ( | uint8_t ** | bytes_src, |
| PNGZ_Pixel ** | pixels_dest, | ||
| const unsigned | rows, | ||
| const unsigned | cols ) |
pack bytes into pixels.
| bytes_src | unpacked pixel byte source |
| pixels_dest | packed pixel destination |
| rows | rows of pixels (Y) |
| cols | cols of pixels (X) (IN PIXELS NOT BYTES) |
Definition at line 183 of file pngz.c.
References PNGZ_Pixel::a, PNGZ_Pixel::b, PNGZ_Pixel::g, and PNGZ_Pixel::r.
| int PNGZ_Copy | ( | const PNGZ_Image | z_src, |
| PNGZ_Image * | z_dest ) |
copies the pixel data from one pngz to another.
| z_src | source pixel buffer, passed by val |
| z_dest | destination pixel buffer, passed by ptr |
Definition at line 257 of file pngz.c.
References PNGZ_Image::height, PNGZ_Image::pixels, and PNGZ_Image::width.
| int PNGZ_Free | ( | PNGZ_Image * | z | ) |
free a pngz structs pixels.
| z | pngz* with pixels loaded into memory |
Definition at line 168 of file pngz.c.
References PNGZ_Image::height, PNGZ_Image::pixels, and PNGZ_FreePixels().

| int PNGZ_FreeBytes | ( | uint8_t ** | bytes, |
| const unsigned | rows ) |
| int PNGZ_FreePixels | ( | PNGZ_Pixel ** | pixels, |
| const unsigned | rows ) |
| int PNGZ_Load | ( | PNGZ_Image * | z | ) |
load a pngz object into memory
| z | pngz* easy png ptr to load into |
Definition at line 296 of file pngz.c.
References PNGZ_Image::height, PNGZ_Image::path, PNGZ_Image::pixels, PNGZ_AllocBytes(), PNGZ_AllocPixels(), PNGZ_BytesToPixels(), PNGZ_FreeBytes(), and PNGZ_Image::width.

| int PNGZ_LoadFrom | ( | PNGZ_Image * | z, |
| const char * | path ) |
load a pngz from a path directly passed into the call, just a wrapper for standard pngz_load()
| z | pngz* easy png ptr to load into |
| path | char* path to read from |
Definition at line 285 of file pngz.c.
References PNGZ_Image::path, and PNGZ_Load().

| int PNGZ_PixelsToBytes | ( | PNGZ_Pixel ** | pixels_src, |
| uint8_t ** | bytes_dest, | ||
| const unsigned | rows, | ||
| const unsigned | cols ) |
unpack pixels into raw byte ptrs.
expects adequate space, rows by cols in the pixel buffer and rows by cols * 4 in the byte buffer
| pixels_src | packed pixel source |
| bytes_dest | unpacked byte destination |
| rows | rows of pixels |
| cols | cols of pixels (IN PIXELS NOT BYTES) |
Definition at line 223 of file pngz.c.
References PNGZ_Pixel::r.
| int PNGZ_PrintImage | ( | const PNGZ_Image | z | ) |
print a pngz ztruct contents.
| z | pngz to print |
Definition at line 456 of file pngz.c.
References PNGZ_Image::height, PNGZ_Image::pixels, and PNGZ_Image::width.
| int PNGZ_PrintImageIndent | ( | const PNGZ_Image | z, |
| const int | indent ) |
print a pngz ztruct contents.
| z | pngz to print |
| indent | int for how much to indent this print |
Definition at line 499 of file pngz.c.
References PNGZ_Image::height, PNGZ_Image::pixels, and PNGZ_Image::width.
| int PNGZ_PrintPixel | ( | const PNGZ_Pixel | p | ) |
print out a single pixels rgba values in hex.
| p | unsigned char* to the pixel to print |
Definition at line 475 of file pngz.c.
References PNGZ_Pixel::a, PNGZ_Pixel::g, and PNGZ_Pixel::r.
| int PNGZ_PrintPixelIndent | ( | const PNGZ_Pixel | p, |
| const int | indent ) |
| int PNGZ_Save | ( | const PNGZ_Image | z | ) |
write a png back out to file, wrapper for pngz_save_as()
| z | pngz* easy png ptr to write to file |
Definition at line 386 of file pngz.c.
References PNGZ_Image::path, and PNGZ_SaveAs().

| int PNGZ_SaveAs | ( | const PNGZ_Image | z, |
| const 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 397 of file pngz.c.
References PNGZ_Image::height, PNGZ_Image::pixels, PNGZ_AllocBytes(), PNGZ_FreeBytes(), PNGZ_PixelsToBytes(), and PNGZ_Image::width.
