void Adafruit_SSD1306::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { boolean bSwap = false; switch(rotation) { case 0: // 0 degree rotation, do nothing break; case 1: // 90 degree rotation, swap x & y for rotation, then invert x bSwap = true; swap(x, y); x = WIDTH - x - 1; break; case 2: // 180 degree rotation, invert x and y - then shift y around for height. x = WIDTH - x - 1; y = HEIGHT - y - 1; x -= (w-1); break; case 3: // 270 degree rotation, swap x & y for rotation, then invert y and adjust y for w (not to become h) bSwap = true; swap(x, y); y = HEIGHT - y - 1; y -= (w-1); break; } if(bSwap) { drawFastVLineInternal(x, y, w, color); } else { drawFastHLineInternal(x, y, w, color); } }
/******************************************************************************* * Function Name : * Description : * Input : *******************************************************************************/ void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { uint8_t bSwap = DISABLE; switch(rotation) { case 0: break; case 1: // 90 degree rotation, swap x & y for rotation, then invert x and adjust x for h (now to become w) bSwap = ENABLE; swap(x, y); x = WIDTH - x - 1; x -= (h-1); break; case 2: // 180 degree rotation, invert x and y - then shift y around for height. x = WIDTH - x - 1; y = HEIGHT - y - 1; y -= (h-1); break; case 3: // 270 degree rotation, swap x & y for rotation, then invert y bSwap = ENABLE; swap(x, y); y = HEIGHT - y - 1; break; } if(bSwap) { drawFastHLineInternal(x, y, h, color); } else { drawFastVLineInternal(x, y, h, color); } }
void ESP_SSD1306::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { bool bSwap = false; switch(rotation) { case 0: break; case 1: // 90 degree rotation, swap x & y for rotation, then invert x and adjust x for h (to become w) bSwap = true; adagfxswap(x, y); x = WIDTH - x - 1; x -= (h-1); break; case 2: // 180 degree rotation, invert x and y - then shift y around for height. x = WIDTH - x - 1; y = HEIGHT - y - 1; y -= (h-1); break; case 3: // 270 degree rotation, swap x & y for rotation, then invert y bSwap = true; adagfxswap(x, y); y = HEIGHT - y - 1; break; } if(bSwap) { drawFastHLineInternal(x, y, h, color); } else { drawFastVLineInternal(x, y, h, color); } }