2014-04-11 02:21 AM
Guys,
Does anyone of you have experience on decoding bmp ? I want to display bmp file to my LCD... Any clues ? thanks #i-have-a-clue2014-04-18 06:28 PM
2014-04-18 07:06 PM
I don't understand, it's already working on your side ? do I miss some registers on my init ?
I used your LCD init, still the same result....it's not from the init...2014-04-18 07:08 PM
I used the same init you have, still the same result,
Do I miss something in my LCD bitmap function ? thanks2014-04-18 07:26 PM
wild guess
pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3); giving me a greenish mix with blueish....2014-04-18 07:34 PM
I fixed it,
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header I missed sizeof(hdr) supposed to be sizeof(hdr_256),f_read(&fsrc, hdr_256, sizeof(hdr), &bytesread); // Read header Thanks a lot for helping me out, for example I want to use 16K colors, I just change the 256 loop ? It works now
2014-04-18 07:58 PM
for 16K color will be like this ? please correct me if I'm wrong, thanks
//16K color bmp
res = f_open(&fsrc, ''test9.bmp'', FA_READ);
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header
off = *((uint32_t *)&hdr_256[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr_256[0x12]); // X pixels
yy = *((uint32_t *)&hdr_256[0x16]); // Y pixels
for(i=0; i<
16384
; i++) // Build palette conversion (+0x46 count?)
{
uint32_t pal;
f_read(&fsrc, &pal, 4, &bytesread); // Read palette B G R
// RRRRRRRRGGGGGGGGBBBBBBBB 8:8:8
// BBBBBGGGGGGRRRRR 5:6:5
//pal = ((pal & 0x00FC00) >> 5) | ((pal & 0xF80000) >> 19) | ((pal & 0x0000F8) <<
8
);
pal = ((pal & 0xF80000) >> 8) | ((pal & 0x00FC00) >> 5) | ((pal & 0x0000F8) >> 3);
//pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3);
w[i] = (uint16_t)pal;
}
f_lseek(&fsrc, off); // Seek to the data
for(y=0; y<yy; y++)
{
for(x=0; x<xx; x++)
{
uint8_t b;
f_read(&fsrc, &b, 1, &bytesread); // Read byte
LCD_SetPoint(y, x, w[b]); // Colour Map
} // x
} // y
f_close(&fsrc);
2014-04-18 07:59 PM
for example I want to use 16M colors, I just change the 256 loop ?
The high colour depth files don't need the palette tables, each pixel is described individually, and you'd need to transform into the 5:6:5 64K colour space of the display, or whatever it is capable of.2014-04-18 08:02 PM
for 16K color will be like this ? please correct me if I'm wrong, thanks
//16K color bmp
res = f_open(&fsrc, ''test9.bmp'', FA_READ);
f_read(&fsrc, hdr_256, sizeof(hdr_256), &bytesread); // Read header
off = *((uint32_t *)&hdr_256[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr_256[0x12]); // X pixels
yy = *((uint32_t *)&hdr_256[0x16]); // Y pixels
for(i=0; i<
16384
; i++) // Build palette conversion (+0x46 count?)
{
uint32_t pal;
f_read(&fsrc, &pal, 4, &bytesread); // Read palette B G R
// RRRRRRRRGGGGGGGGBBBBBBBB 8:8:8
// BBBBBGGGGGGRRRRR 5:6:5
//pal = ((pal & 0x00FC00) >> 5) | ((pal & 0xF80000) >> 19) | ((pal & 0x0000F8) <<
8
);
pal = ((pal & 0xF80000) >> 8) | ((pal & 0x00FC00) >> 5) | ((pal & 0x0000F8) >> 3);
//pal = ((pal & 0x1F0000) >> 8) | ((pal & 0x007E00) >> 5) | ((pal & 0x0000F8) >> 3);
w[i] = (uint16_t)pal;
}
f_lseek(&fsrc, off); // Seek to the data
for(y=0; y<yy; y++)
{
for(x=0; x<xx; x++)
{
uint8_t b;
f_read(&fsrc, &b, 1, &bytesread); // Read byte
LCD_SetPoint(y, x, w[b]); // Colour Map
} // x
} // y
f_close(&fsrc);
2014-04-18 08:11 PM
do you have example for it ? thanks
2014-04-18 08:14 PM
for 16K color will be like this ? please correct me if I'm wrong, thanks
16K? Don't you mean 24-bit 16M? There isn't a palette table, you go directly to the pixel data, and then you have to convert that to the colour space of your display.