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-17 09:17 PM
I would expect the palette table to be at +0x36, and the raster data at the offset described at +0x0A
What display module is this? What is the colour format?2014-04-17 09:31 PM
offset 18 size = 4 bytes,
the bitmap width in pixels (signed integer) but in code : it's offset 12, or I'm wrong ? xx = *((uint32_t *)&hdr[0x12]); // X pixels (want multiple of 😎 do you mean the LCD ? it's SSD1289, and it's RGB.. I can see from the file the value of offset 12 until 15 are 40 01 00 00 which mean 320...that's correct but from wiki it's saying at offset 18, so it's not right....2014-04-17 09:49 PM
my mistake, 0x12 HEX = 18 DEC....
so I will base on :2014-04-17 09:58 PM
do you mean the LCD ? it's SSD1289, and it's RGB..
Ok, but what's the word format? How are the R,G,B colour bits distributed across the word? The SSD1289 is a controller chip, what's the part# of the display, cite a manual down load for the board you are using.2014-04-17 10:14 PM
I send data from D0-D16....
The RGB will be distributed at D0-D16....is that what you're asking ?2014-04-17 10:52 PM
I send data from D0-D... The RGB will be distributed at D0-D...is that what you're asking ?
FFS I'm trying to understand where the colour bits are within the 16-bit word, is this a hard concept to grasp? I ask for the datasheet for your panel so I can figure it out. I'll make an educated guess at the 5:6:5 format// For the specific BMP, 8-bit per pixel, 24-bit palette
// +0x1C = 8 sourcer32@gmail.com
{
int i, x, y, xx, yy;
uint8_t hdr[0x36];
static uint16_t w[256];
uint32_t off;
UINT bytesread;
res = f_open(&fsrc, ''test.bmp'', FA_READ);
f_read(&fsrc, hdr, sizeof(hdr), &bytesread); // Read header
off = *((uint32_t *)&hdr[0x0A]); // offset to rasters
xx = *((uint32_t *)&hdr[0x12]); // X pixels
yy = *((uint32_t *)&hdr[0x16]); // Y pixels
for(i=0; i<
256
; 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);
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 01:50 AM
I have 2x2 pixel 8 bit bmp,
where is the first byte of the pixel ? offset 0x12 = 2 (width ) offset 0x16 = 2 (height), offset 0x1C = 8 bit ( color of 8 bit ), index color is starting from offset 0x3E = 00 ?2014-04-18 01:53 AM
Ok, please have a look for the datasheet attached...thanks
________________ Attachments : SSD1289.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1AF&d=%2Fa%2F0X0000000bks%2FuWxfwu0qkcAquqQZOG95p3JmEiE_tLIqkOFouzUIUis&asPdf=false2014-04-18 02:13 AM
is it the one you look after ?
2014-04-18 03:17 AM
I tried