// x, y0, and y1 must be in bounds (0-localWidth/Height), y1 > y0 void SmartMatrix::drawHardwareVLine(uint8_t x, uint8_t y0, uint8_t y1, const rgb24& color) { int i; for (i = y0; i <= y1; i++) { copyRgb24(currentDrawBufferPtr[i][x], color); } }
// x0, x1, and y must be in bounds (0-localWidth/Height), x1 > x0 void SmartMatrix::drawHardwareHLine(uint8_t x0, uint8_t x1, uint8_t y, const rgb24& color) { int i; for (i = x0; i <= x1; i++) { copyRgb24(currentDrawBufferPtr[y][i], color); } }
void SmartMatrix::drawPixel(int16_t x, int16_t y, const rgb24& color) { int16_t hwx, hwy; // check for out of bounds coordinates if (x < 0 || y < 0 || x >= screenConfig.localWidth || y >= screenConfig.localHeight) return; // map pixel into hardware buffer before writing if (screenConfig.rotation == rotation0) { hwx = x; hwy = y; } else if (screenConfig.rotation == rotation180) { hwx = (DRAWING_WIDTH - 1) - x; hwy = (DRAWING_HEIGHT - 1) - y; } else if (screenConfig.rotation == rotation90) { hwx = (DRAWING_WIDTH - 1) - y; hwy = x; } else { /* if (screenConfig.rotation == rotation270)*/ hwx = y; hwy = (DRAWING_HEIGHT - 1) - x; } convertToHardwareXY(hwx, hwy, &hwx, &hwy); copyRgb24(currentDrawBufferPtr[hwy][hwx], color); }
// x, y0, and y1 must be in bounds (0-localWidth/Height), y1 > y0 void SmartMatrix::drawHardwareVLine(uint8_t x, uint8_t y0, uint8_t y1, const rgb24& color) { int16_t i, hwx, hwy; for (i = y0; i <= y1; i++) { convertToHardwareXY(x, i, &hwx, &hwy); copyRgb24(currentDrawBufferPtr[hwy][hwx], color); } }
// x0, x1, and y must be in bounds (0-localWidth/Height), x1 > x0 void SmartMatrix::drawHardwareHLine(uint8_t x0, uint8_t x1, uint8_t y, const rgb24& color) { int16_t i, hwx, hwy; for (i = x0; i <= x1; i++) { convertToHardwareXY(i, y, &hwx, &hwy); copyRgb24(currentDrawBufferPtr[hwy][hwx], color); } }
// coordinates based on screen position, which is between 0-localWidth/localHeight void SmartMatrix::getPixel(uint8_t x, uint8_t y, rgb24 *xyPixel) { copyRgb24(*xyPixel, currentRefreshBufferPtr[y][x]); }
void SmartMatrix::setScrollColor(rgb24 newColor) { copyRgb24(&textcolor, &newColor); }