@@ -626,6 +626,69 @@ void Adafruit_GFX::fillCircleHelper(int16_t x0, int16_t y0, int16_t r,
626626 }
627627}
628628
629+ /* *************************************************************************/
630+ /* !
631+ @brief Quarter-circle drawer with fill.
632+ @param x0 Center-point x coordinate
633+ @param y0 Center-point y coordinate
634+ @param r Radius of circle
635+ @param corners Mask bits 0x1, 0x2, 0x4, and 0x8 to indicate which quarters
636+ of the circle to fill: 0x1 = top-left, 0x2 = top-right,
637+ 0x4 = bottom-right, 0x8 = bottom-left
638+ @param color 16-bit 5-6-5 Color to fill with
639+ */
640+ /* *************************************************************************/
641+ void Adafruit_GFX::fillCircleHelper (int16_t x0, int16_t y0, int16_t r,
642+ uint8_t corners, uint16_t color) {
643+
644+ int16_t f = 1 - r;
645+ int16_t ddF_x = 1 ;
646+ int16_t ddF_y = -2 * r;
647+ int16_t x = 0 ;
648+ int16_t y = r;
649+ int16_t px = x;
650+ int16_t py = y;
651+
652+ if (corners & (0x2 | 0x1 ))
653+ writeFastVLine (x0, y0 - r, r + 1 , color);
654+ if (corners & (0x8 | 0x4 ))
655+ writeFastVLine (x0, y0, r + 1 , color);
656+
657+ while (x < y) {
658+ if (f >= 0 ) {
659+ y--;
660+ ddF_y += 2 ;
661+ f += ddF_y;
662+ }
663+ x++;
664+ ddF_x += 2 ;
665+ f += ddF_x;
666+
667+ if (x < (y + 1 )) {
668+ if (corners & 0x4 )
669+ writeFastVLine (x0 + x, y0, y, color);
670+ if (corners & 0x2 )
671+ writeFastVLine (x0 + x, y0 - y, y, color);
672+ if (corners & 0x8 )
673+ writeFastVLine (x0 - x, y0, y, color);
674+ if (corners & 0x1 )
675+ writeFastVLine (x0 - x, y0 - y, y, color);
676+ }
677+ if (y != py) {
678+ if (corners & 0x4 )
679+ writeFastVLine (x0 + py, y0, px, color);
680+ if (corners & 0x2 )
681+ writeFastVLine (x0 + py, y0 - px, px, color);
682+ if (corners & 0x8 )
683+ writeFastVLine (x0 - py, y0, px, color);
684+ if (corners & 0x1 )
685+ writeFastVLine (x0 - py, y0 - px, px, color);
686+ py = y;
687+ }
688+ px = x;
689+ }
690+ }
691+
629692/* *************************************************************************/
630693/* !
631694 @brief Draw a rectangle with no fill color
0 commit comments