all repos — mgba @ 95f6a8f8d63001a99b0c6227bfc5f166589857db

mGBA Game Boy Advance Emulator

src/util/png-io.h (view raw)

 1/* Copyright (c) 2013-2014 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef PNG_IO_H
 7#define PNG_IO_H
 8
 9#include "util/common.h"
10
11#ifdef USE_PNG
12
13#include <png.h>
14
15struct VFile;
16
17enum {
18	PNG_HEADER_BYTES = 8
19};
20
21png_structp PNGWriteOpen(struct VFile* source);
22png_infop PNGWriteHeader(png_structp png, unsigned width, unsigned height);
23bool PNGWritePixels(png_structp png, unsigned width, unsigned height, unsigned stride, void* pixels);
24bool PNGWriteCustomChunk(png_structp png, const char* name, size_t size, void* data);
25void PNGWriteClose(png_structp png, png_infop info);
26
27typedef int (*ChunkHandler)(png_structp, png_unknown_chunkp);
28
29bool isPNG(struct VFile* source);
30png_structp PNGReadOpen(struct VFile* source, unsigned offset);
31bool PNGInstallChunkHandler(png_structp png, void* context, ChunkHandler handler, const char* chunkName);
32bool PNGReadHeader(png_structp png, png_infop info);
33bool PNGReadPixels(png_structp png, png_infop info, void* pixels, unsigned width, unsigned height, unsigned stride);
34bool PNGIgnorePixels(png_structp png, png_infop info);
35bool PNGReadFooter(png_structp png, png_infop end);
36void PNGReadClose(png_structp png, png_infop info, png_infop end);
37
38#endif
39
40#endif