forked from evegard/pngview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpng.h
68 lines (51 loc) · 1.03 KB
/
png.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* pngview - a standalone PNG viewer
* Copyright 2013 Vegard Edvardsen
*/
#ifndef PNG_H
#define PNG_H
#include <stdint.h>
#include <stdio.h>
#include "zlib.h"
typedef struct chunk_header {
uint32_t length;
char type[4];
} chunk_header_t;
typedef struct chunk {
chunk_header_t header;
char *data;
struct chunk *next_chunk;
} chunk_t;
typedef struct ihdr {
uint32_t width;
uint32_t height;
uint8_t depth;
uint8_t color_type;
uint8_t compression;
uint8_t filter;
uint8_t interlace;
} ihdr_t;
typedef struct png {
char *name;
int width;
int height;
int depth;
int bpp;
int palette;
int color;
int alpha;
char *comp_data;
int comp_data_length;
char *unfiltered_data;
int unfiltered_data_length;
char *data;
int data_length;
chunk_t *first_chunk;
ihdr_t *ihdr;
zlib_t *zlib;
char *palette_data;
} png_t;
png_t *png_read(char *filename);
void png_print_information(png_t *png);
char *png_get_data(png_t *png);
#endif