4 //
\83p
\83f
\83B
\83\93\83O
\82Ì
\8aÖ
\8cW
\82Å
\82±
\82ñ
\82È
\82±
\82Æ
\82É
\82È
\82Á
\82Ä
\82é
\r
5 typedef struct DATA_FORMAT_BMP_FILE_HEADER {
\r
10 uchar offset_to_data[4];
\r
11 } DATA_Format_BMP_FileHeader;
\r
14 typedef struct DATA_FORMAT_BMP_CORE_HEADER {
\r
20 } DATA_Format_BMP_CoreHeader;
\r
23 typedef struct DATA_FORMAT_BMP_INFO_HEADER {
\r
29 uint compression_type; //0:no compression, 1:RLE8 2:RLE4 3:bit field
\r
30 uint image_data_size;
\r
31 uint pixel_per_meter_x;
\r
32 uint pixel_per_meter_y;
\r
33 uint colors_in_palette;
\r
34 uint index_of_important_color;
\r
35 } DATA_Format_BMP_InformationHeader;
\r
37 typedef struct DATA_FORMAT_BMP_RGB24 {
\r
41 } DATA_Format_BMP_RGB24;
\r
43 uint Format_BMP_DrawPicture(void *vram, uint xsize, uint x, uint y, uint pxsize, uint pysize, void *bmp)
\r
46 DATA_Format_BMP_FileHeader *fheader;
\r
47 DATA_Format_BMP_InformationHeader *infoheader;
\r
49 DATA_Format_BMP_RGB24 *rgb24;
\r
52 uint offset_to_data, filesize;
\r
54 fheader = (DATA_Format_BMP_FileHeader *)bmp;
\r
56 if(fheader->sign[0] != 'B' || fheader->sign[1] != 'M'){
\r
57 Drawing_Put_String(vram, xsize, x, y, 0x000000, "BMP:Unknown File Format.");
\r
61 read32 = (uint *)(&fheader->filesize[0]);
\r
63 read32 = (uint *)(&fheader->offset_to_data[0]);
\r
64 offset_to_data = *read32;
\r
66 //snprintf(s, sizeof(s), "size:%d offset:%d", filesize, offset_to_data);
\r
67 //Drawing_Put_String(vram, xsize, x, y, 0x000000, s);
\r
69 read32 = (uint *)(bmp + 0x0e);
\r
72 Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "BMP Core Header.(not implemented.)");
\r
74 } else if(*read32 == 40){
\r
75 //Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "BMP INFO Header.");
\r
76 infoheader = (DATA_Format_BMP_InformationHeader *)(bmp + 0x0e);
\r
77 if(infoheader->ysize > 0){
\r
78 //Drawing_Put_String(vram, xsize, x, y + 16 * 2, 0x000000, "Bottom Up.");
\r
80 Drawing_Put_String(vram, xsize, x, y + 16 * 2, 0x000000, "Top Down (not implemented).");
\r
84 if(infoheader->compression_type == 0){
\r
85 //Drawing_Put_String(vram, xsize, x, y + 16 * 3, 0x000000, "No compression.");
\r
87 Drawing_Put_String(vram, xsize, x, y + 16 * 3, 0x000000, "Compressed (not implemented).");
\r
91 if(infoheader->bpp == 24){
\r
92 //Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, "24 bpp.");
\r
94 snprintf(s, sizeof(s), "%d bpp(not implemented).", infoheader->bpp);
\r
95 Drawing_Put_String(vram, xsize, x, y + 16 * 4, 0x000000, s);
\r
99 //snprintf(s, sizeof(s), "xsize:%d ysize:%d", infoheader->xsize, infoheader->ysize);
\r
100 //Drawing_Put_String(vram, xsize, x, y + 16 * 5, 0x000000, s);
\r
102 rgb24 = (DATA_Format_BMP_RGB24 *)(bmp + offset_to_data);
\r
104 for(iy = infoheader->ysize; iy > 0; iy--){
\r
105 for(ix = 0; ix < infoheader->xsize; ix++){
\r
106 Drawing_Draw_Point(vram, xsize, x + ix, y + iy - 1, rgb24->r << 16 | rgb24->g << 8 | rgb24->b);
\r
107 rgb24 = (DATA_Format_BMP_RGB24 *)((uint)rgb24 + 3);
\r
109 rgb24 = (DATA_Format_BMP_RGB24 *)((uint)rgb24 + ((infoheader->xsize + 3) & ~3) - infoheader->xsize);
\r
112 Drawing_Put_String(vram, xsize, x, y + 16 * 1, 0x000000, "Unknown BMP Header.");
\r