Skip to content

Bitmaps of certain heights don't draw correctly at non-zero y values #17

@mikelowe983

Description

@mikelowe983

When using bitmaps of certain sizes, the oled.bitmap function will not draw the bitmap correctly.

See the below example bitmap:

/*
    SQ_Symbol [8, 9]

                     
             12345678
            .--------.
        0x01|********|
        0x02|*      *|
        0x04|*      *|
        0x08|*      *|
        0x10|*      *|
        0x20|*      *|
        0x40|*      *|
        0x80|*      *|
        0x01|********|   
            '--------'
*/

const int SQ_Symbol_Height = 9;
const int SQ_Symbol_Width = 8;
const uint8_t SQ_Symbol[] = {0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01};

Calling oled.bitmap with a 0 for the y0 argument draws the bitmap as expected:

    oled.bitmap(0, 0, (uint8_t *)SQ_Symbol, SQ_Symbol_Width, SQ_Symbol_Height);

output:

********
*      *   
*      *
*      *
*      *
*      *
*      *
*      *
********

However, if I pass a non-zero value for y0, the bitmap does not draw correctly:

    oled.bitmap(0, 1, (uint8_t *)SQ_Symbol, SQ_Symbol_Width, SQ_Symbol_Height);

output:

********
*      *   
*      *
*      *
*      *
*      *
*      *
*      *

The bottom row is not drawn. This also occurs for bitmaps that have heights of 10, 11, 12, etc.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions