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