OSDN Git Service

new file: PTMP.TXT
[proj16/16.git] / src / test2.c
1 #include <stdio.h>\r
2 #include "src\lib\modex16.h"\r
3 #include "src\lib\planar.h"\r
4 #include "src\lib\bitmap.h"\r
5 \r
6 word far* clock= (word far*) 0x046C; /* 18.2hz clock */\r
7 \r
8 void main() {\r
9     bitmap_t bmp;\r
10     planar_buf_t *p;\r
11     word size;\r
12     int i;\r
13     int plane;\r
14     int x,y;\r
15     //byte color;\r
16 \r
17     /* get the size we want */\r
18     /*printf("Width: ");\r
19     scanf("%d", &bmp.width);\r
20     printf("Height: ");\r
21     scanf("%d", &bmp.height);\r
22     printf("Color: ");\r
23     scanf("%x", &color);*/\r
24 \r
25     /* allocate the bmp and fill it with 42 */\r
26     /*size = bmp.width * bmp.height;\r
27     bmp.data = malloc(size);\r
28     for(i=0; i<size; i++) {\r
29         bmp.data[i] = color;\r
30     }*/\r
31
32         bmp = bitmapLoadPcx("ptmp.pcx");
33 \r
34     /* create the planar buffer */\r
35     p = planar_buf_from_bitmap(&bmp);\r
36 \r
37     /* print out the contents of each plane */\r
38     for(plane=0; plane < 4; plane++) {\r
39         i=0;\r
40         printf("Plane %d\n", plane);\r
41         for(y=0; y < p->height; y++) {\r
42             for(x=0; x < p->pwidth; x++) {\r
43                 printf("%02X ", (int) p->plane[plane][i++]);\r
44             }\r
45             printf("\n");\r
46         }\r
47     }\r
48 }\r