** Function name: drawRoundRect ** Description: Draw a rounded corner rectangle outline ***************************************************************************************/ Draw a rounded rectangle
| 2637 | ***************************************************************************************/ |
| 2638 | // Draw a rounded rectangle |
| 2639 | void TFT_eSPI::drawRoundRect(int32_t x, int32_t y, int32_t w, int32_t h, int32_t r, uint32_t color) |
| 2640 | { |
| 2641 | //begin_tft_write(); // Sprite class can use this function, avoiding begin_tft_write() |
| 2642 | inTransaction = true; |
| 2643 | |
| 2644 | // smarter version |
| 2645 | drawFastHLine(x + r , y , w - r - r, color); // Top |
| 2646 | drawFastHLine(x + r , y + h - 1, w - r - r, color); // Bottom |
| 2647 | drawFastVLine(x , y + r , h - r - r, color); // Left |
| 2648 | drawFastVLine(x + w - 1, y + r , h - r - r, color); // Right |
| 2649 | // draw four corners |
| 2650 | drawCircleHelper(x + r , y + r , r, 1, color); |
| 2651 | drawCircleHelper(x + w - r - 1, y + r , r, 2, color); |
| 2652 | drawCircleHelper(x + w - r - 1, y + h - r - 1, r, 4, color); |
| 2653 | drawCircleHelper(x + r , y + h - r - 1, r, 8, color); |
| 2654 | |
| 2655 | inTransaction = lockTransaction; |
| 2656 | end_tft_write(); // Does nothing if Sprite class uses this function |
| 2657 | } |
| 2658 | |
| 2659 | |
| 2660 | /*************************************************************************************** |