Commit 155f7ac19f7521b5febb0b43ab15b67f80804296
1 parent
4daa2ca3
Some BMP recognition
Showing
1 changed file
with
45 additions
and
0 deletions
Show diff stats
@@ -44,6 +44,51 @@ main () { | @@ -44,6 +44,51 @@ main () { | ||
44 | printf("?\n"); | 44 | printf("?\n"); |
45 | pmap = XCreatePixmap(dis, win, width, height, DefaultDepth(dis, DefaultScreen(dis))); | 45 | pmap = XCreatePixmap(dis, win, width, height, DefaultDepth(dis, DefaultScreen(dis))); |
46 | 46 | ||
47 | + | ||
48 | + FILE* home = NULL; | ||
49 | + char buffer[4]; | ||
50 | + home = fopen("home.bmp", "r"); | ||
51 | + if(home == NULL) | ||
52 | + return 0; | ||
53 | + | ||
54 | + fseek(home, 0x0A, SEEK_SET); | ||
55 | + buffer[0] = getc(home); | ||
56 | + buffer[1] = getc(home); | ||
57 | + buffer[2] = getc(home); | ||
58 | + buffer[3] = getc(home); | ||
59 | + printf("Pixel array offset %02x %02x %02x %02x\n", buffer[0], buffer[1], buffer[2], buffer[3]); | ||
60 | + | ||
61 | + fseek(home, 0x12, SEEK_SET); | ||
62 | + buffer[0] = getc(home); | ||
63 | + buffer[1] = getc(home); | ||
64 | + buffer[2] = getc(home); | ||
65 | + buffer[3] = getc(home); | ||
66 | + printf("Width %02x %02x %02x %02x\n", buffer[0], buffer[1], buffer[2], buffer[3]); | ||
67 | + | ||
68 | + //fseek(home, 0x12, SEEK_SET); | ||
69 | + buffer[0] = getc(home); | ||
70 | + buffer[1] = getc(home); | ||
71 | + buffer[2] = getc(home); | ||
72 | + buffer[3] = getc(home); | ||
73 | + printf("Height %02x %02x %02x %02x\n", buffer[0], buffer[1], buffer[2], buffer[3]); | ||
74 | + | ||
75 | + fseek(home, 0x1C, SEEK_SET); | ||
76 | + buffer[0] = getc(home); | ||
77 | + buffer[1] = getc(home); | ||
78 | + printf("Bits Per Pixel %02x %02x\n", buffer[0], buffer[1]); | ||
79 | + | ||
80 | + if(buffer[1] != 0 || buffer[0] != 0x18) | ||
81 | + { | ||
82 | + printf("Could not read BMP\n"); | ||
83 | + return 1; | ||
84 | + } | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | ||
89 | + while(1); | ||
90 | + | ||
91 | + | ||
47 | /* look for events forever... */ | 92 | /* look for events forever... */ |
48 | while(1) { | 93 | while(1) { |
49 | /* get the next event and stuff it into our event variable. | 94 | /* get the next event and stuff it into our event variable. |