// reads pixel from drawing buffer, not refresh buffer const rgb24 SmartMatrix::readPixel(int16_t x, int16_t y) const { int hwx, hwy; // check for out of bounds coordinates if (x < 0 || y < 0 || x >= screenConfig.localWidth || y >= screenConfig.localHeight) return (rgb24)rgb24(0, 0, 0); // map pixel into hardware buffer before writing if (screenConfig.rotation == rotation0) { hwx = x; hwy = y; } else if (screenConfig.rotation == rotation180) { hwx = (MATRIX_WIDTH - 1) - x; hwy = (MATRIX_HEIGHT - 1) - y; } else if (screenConfig.rotation == rotation90) { hwx = (MATRIX_WIDTH - 1) - y; hwy = x; } else { /* if (screenConfig.rotation == rotation270)*/ hwx = y; hwy = (MATRIX_HEIGHT - 1) - x; } return currentDrawBufferPtr[hwy][hwx]; }
void RGB(void) { rgb24(cntx, c_cntx); }