-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswf_png.c
62 lines (48 loc) · 1.13 KB
/
swf_png.c
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
/* This is a test of some PNG capabilities, using a lot of code from
* the util/png2dbl.c file of Ming.
*/
#include <png.h>
#include <zlib.h>
#include "swf_png.h"
#include "swf_error.h"
#define SWF_PNG_SIG_SIZE 8
void
swf_png_get_IHDR(swf_png_data * png, int * error, png_structp png_ptr, png_infop info_ptr)
{
png_uint_32 width=0;
png_uint_32 height=0;
int bits=0;
int colours=0;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bits, &colours, NULL, NULL, NULL);
png->width = width;
png->height = height;
png->bit_depth = bits;
png->color_type = colours;
}
void
swf_png_get_PLTE(swf_png_data * png, int * error, png_structp png_ptr, png_infop info_ptr)
{
int num_palette=0;
png_colorp palette;
palette = png->palette;
png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette);
png->num_palette = num_palette;
png->palette = palette;
}
swf_png_data *
swf_png_make_swf_png(int * error)
{
swf_png_data * self;
if ((self = (swf_png_data *) calloc (1, sizeof (swf_png_data))) == NULL) {
*error = SWF_EMallocFailure;
return NULL;
}
return self;
}
/*
Local Variables:
mode: C
c-basic-offset: 4
tab-width: 4
End:
*/