U8G2 drawXBMP incorrect bitmap drawing

Hi :wave:

I have a problem with bitmap rendering. For some reason the bitmap is being rendered as two halves facing each other. The original bitmap is supposed to look like a lambda in a circle (Half-Life logo). I have tried several bitmap converters with the same result.

Code:

U8G2_SSD1309_128X64_NONAME0_F_HW_I2C display(U8G2_R0, 23, 22, 21);

// Display init...

#define lambdaWidth 16
#define lambdaHeight 16
const static unsigned char lambda[] U8X8_PROGMEM = {
    0x03, 0xE0, 0x0F, 0xF0, 0x1C, 0x38, 0x33,
    0x0C, 0x63, 0x86, 0x61, 0x86, 0x41, 0x82,
    0x41, 0xC3, 0x43, 0xC3, 0x42, 0x63, 0x66,
    0x76, 0x64, 0x26, 0x30, 0x0C, 0x1C, 0x18,
    0x0F, 0xF0, 0x03, 0xC0};

// Other code...

display.drawXBMP(0, 30, lambdaWidth, lambdaHeight, lambda);
1 Like

as i see, you should to swap the halves

You have a regular bitmap i.e. MSB on the left.
XBMP format draws LSB first. i.e. left hand pixel.

U8g2 has methods for regular BMP bitmaps and for XBMP format monochrome bitmaps.

Copy the logo from PROGMEM to SRAM memory. Then use the BMP method.

David.

1 Like

Thanks a lot!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.