summaryrefslogtreecommitdiffstats
path: root/lib/gui/picopng.h
blob: a17dd14b0c9ec7bffc5f2f49f9b327e7c43dafbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef _PICOPNG_H
#define _PICOPNG_H

typedef struct {
	uint32_t *data;
	size_t size;
	size_t allocsize;
} vector32_t;

typedef struct {
	uint8_t *data;
	size_t size;
	size_t allocsize;
} vector8_t;

typedef struct {
	uint32_t width, height;
	uint32_t colorType, bitDepth;
	uint32_t compressionMethod, filterMethod, interlaceMethod;
	uint32_t key_r, key_g, key_b;
	bool key_defined; // is a transparent color key given?
	vector8_t *palette;
	vector8_t *image;
} PNG_info_t;

PNG_info_t *PNG_decode(const uint8_t *in, uint32_t size);
void png_alloc_free_all(void);

unsigned picopng_zlib_decompress(unsigned char* out, size_t outsize,
				 const unsigned char* in, size_t insize);

extern int PNG_error;

#endif