src/util/png-io.h (view raw)
1#ifndef PNG_IO_H
2#define PNG_IO_H
3
4#include "common.h"
5
6#include <png.h>
7
8struct VFile;
9
10enum {
11 PNG_HEADER_BYTES = 8
12};
13
14png_structp PNGWriteOpen(struct VFile* source);
15png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height);
16bool PNGWritePixels(png_structp png, unsigned width, unsigned height, unsigned stride, void* pixels);
17bool PNGWriteCustomChunk(png_structp png, const char* name, size_t size, void* data);
18void PNGWriteClose(png_structp png, png_infop info);
19
20typedef int (*ChunkHandler)(png_structp, png_unknown_chunkp);
21
22bool isPNG(struct VFile* source);
23png_structp PNGReadOpen(struct VFile* source, unsigned offset);
24bool PNGInstallChunkHandler(png_structp png, void* context, ChunkHandler handler, const char* chunkName);
25bool PNGReadHeader(png_structp png, png_infop info);
26bool PNGIgnorePixels(png_structp png, png_infop info);
27bool PNGReadFooter(png_structp png, png_infop end);
28void PNGReadClose(png_structp png, png_infop info, png_infop end);
29
30#endif