MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / drawLine

Method drawLine

src/DisplayManager.cpp:2570–2593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2568}
2569
2570void DisplayManager_::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint32_t color)
2571{
2572 int16_t dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
2573 int16_t dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
2574 int16_t err = dx + dy, e2;
2575
2576 while (true)
2577 {
2578 matrix->drawPixel(x0, y0, color);
2579 if (x0 == x1 && y0 == y1)
2580 break;
2581 e2 = 2 * err;
2582 if (e2 >= dy)
2583 {
2584 err += dy;
2585 x0 += sx;
2586 }
2587 if (e2 <= dx)
2588 {
2589 err += dx;
2590 y0 += sy;
2591 }
2592 }
2593}
2594
2595void DisplayManager_::drawRGBBitmap(int16_t x, int16_t y, const uint32_t *bitmap, int16_t w, int16_t h)
2596{

Callers 4

NotifyOverlayFunction · 0.80
TimeAppFunction · 0.80
DateAppFunction · 0.80
ShowCustomAppFunction · 0.80

Calls 1

drawPixelMethod · 0.80

Tested by

no test coverage detected