| 494 |
theseven |
1 |
//
|
|
|
2 |
//
|
|
|
3 |
// Copyright 2011 TheSeven
|
|
|
4 |
//
|
|
|
5 |
//
|
|
|
6 |
// This file is part of emCORE.
|
|
|
7 |
//
|
|
|
8 |
// emCORE is free software: you can redistribute it and/or
|
|
|
9 |
// modify it under the terms of the GNU General Public License as
|
|
|
10 |
// published by the Free Software Foundation, either version 2 of the
|
|
|
11 |
// License, or (at your option) any later version.
|
|
|
12 |
//
|
|
|
13 |
// emCORE is distributed in the hope that it will be useful,
|
|
|
14 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
15 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
16 |
// See the GNU General Public License for more details.
|
|
|
17 |
//
|
|
|
18 |
// You should have received a copy of the GNU General Public License along
|
|
|
19 |
// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20 |
//
|
|
|
21 |
//
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
#ifndef __PNG_H__
|
|
|
25 |
#define __PNG_H__
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
#include "emcorelib.h"
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
struct png_rgb
|
|
|
32 |
{
|
|
|
33 |
uint8_t r;
|
|
|
34 |
uint8_t g;
|
|
|
35 |
uint8_t b;
|
|
|
36 |
} __attribute__((packed));
|
|
|
37 |
|
|
|
38 |
struct png_rgba
|
|
|
39 |
{
|
|
|
40 |
uint8_t r;
|
|
|
41 |
uint8_t g;
|
|
|
42 |
uint8_t b;
|
|
|
43 |
uint8_t a;
|
|
|
44 |
} __attribute__((packed));
|
|
|
45 |
|
|
|
46 |
struct png_info
|
|
|
47 |
{
|
|
|
48 |
uint32_t width;
|
|
|
49 |
uint32_t height;
|
|
|
50 |
uint8_t depth;
|
|
|
51 |
uint8_t colortype;
|
|
|
52 |
uint8_t comprtype;
|
|
|
53 |
uint8_t filtertype;
|
|
|
54 |
const struct png_rgb* palette;
|
|
|
55 |
const uint8_t* palalpha;
|
|
|
56 |
uint32_t palalphacnt;
|
|
|
57 |
const void* idat;
|
|
|
58 |
size_t idatlen;
|
|
|
59 |
uint16_t key[3];
|
|
|
60 |
struct png_rgb bg;
|
|
|
61 |
uint8_t keyvalid;
|
|
|
62 |
uint8_t channels;
|
|
|
63 |
} __attribute__((packed));
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
struct png_info* png_open(const void* data, size_t size);
|
|
|
67 |
uint32_t png_get_width(struct png_info* info);
|
|
|
68 |
uint32_t png_get_height(struct png_info* info);
|
|
|
69 |
void png_set_background(struct png_info* info, uint32_t color);
|
|
|
70 |
struct png_rgba* png_decode_rgba(struct png_info* info);
|
|
|
71 |
struct png_rgb* png_decode_rgb(struct png_info* info);
|
|
|
72 |
void png_destroy(struct png_info* info);
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
#endif
|