Draw a black rect (OLED) SOLVED

My goal is to draw a black rect with a white outline on top of a bunch of other stuff. Is this possible?

The code for the OneBitGraphicsDisplayImpl in display.h suggest this is not possible:

void DrawRect(uint_fast8_t x1,
                uint_fast8_t y1,
                uint_fast8_t x2,
                uint_fast8_t y2,
                bool         on,
                bool         fill = false) override
{
    if(fill)
    {
        for(uint_fast8_t x = x1; x <= x2; x++)
        {
            for(uint_fast8_t y = y1; y <= y2; y++)
            {
                ((ChildType*)(this))->ChildType::DrawPixel(x, y, on);
            }
        }
    }
    else
    {
        ((ChildType*)(this))->ChildType::DrawLine(x1, y1, x2, y1, on);
        ((ChildType*)(this))->ChildType::DrawLine(x2, y1, x2, y2, on);
        ((ChildType*)(this))->ChildType::DrawLine(x2, y2, x1, y2, on);
        ((ChildType*)(this))->ChildType::DrawLine(x1, y2, x1, y1, on);
    }
}

If so, this seems to be kind of a big omission…

Ok call me stupid, I didn’t realize the parameter on + fill fills it black.

1 Like