-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestgifloader.c
57 lines (44 loc) · 1.02 KB
/
testgifloader.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
#include <stdio.h>
#include <errno.h>
#include "gifloader.h"
int main(int argc,char* argv[])
{
int i;
int j;
GIFLOADER *gfl;
GifColorType *colors;
if(!(gfl = gifloader_open("spritecloseupsingle.gif",16,16))) {
perror("Can't open gif");
return 1;
}
if(!(colors = gifloader_fetch_sprite(gfl,0,4))) {
fprintf(stderr,"gifloader can't fetch colors.\n");
return 1;
}
printf("Here's sprite 0\n\n");
for(j=0;j<16;j++) {
for(i=0;i<16;i++) {
printf("0x%02x%02x%02x ",
colors[16*j+i].Red,
colors[16*j+i].Green,
colors[16*j+i].Blue);
}
printf("\n");
}
gifloader_free_sprite(colors);
if(!(colors = gifloader_fetch_sprite(gfl,1,4))) {
fprintf(stderr,"gifloader can't fetch colors.\n");
return 1;
}
printf("\nHere's sprite 1\n\n");
for(j=0;j<16;j++) {
for(i=0;i<16;i++) {
printf("0x%02x%02x%02x ",
colors[16*j+i].Red,
colors[16*j+i].Green,
colors[16*j+i].Blue);
}
printf("\n");
}
gifloader_free_sprite(colors);
}