MCPcopy Create free account
hub / github.com/PricelessToolkit/MailBoxGuard / drawCircle

Method drawCircle

Code/Arduino_libraries/SSD1306/OLEDDisplay.cpp:221–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221void OLEDDisplay::drawCircle(int16_t x0, int16_t y0, int16_t radius) {
222 int16_t x = 0, y = radius;
223 int16_t dp = 1 - radius;
224 do {
225 if (dp < 0)
226 dp = dp + (x++) * 2 + 3;
227 else
228 dp = dp + (x++) * 2 - (y--) * 2 + 5;
229
230 setPixel(x0 + x, y0 + y); //For the 8 octants
231 setPixel(x0 - x, y0 + y);
232 setPixel(x0 + x, y0 - y);
233 setPixel(x0 - x, y0 - y);
234 setPixel(x0 + y, y0 + x);
235 setPixel(x0 - y, y0 + x);
236 setPixel(x0 + y, y0 - x);
237 setPixel(x0 - y, y0 - x);
238
239 } while (x < y);
240
241 setPixel(x0 + radius, y0);
242 setPixel(x0, y0 + radius);
243 setPixel(x0 - radius, y0);
244 setPixel(x0, y0 - radius);
245}
246
247void OLEDDisplay::drawCircleQuads(int16_t x0, int16_t y0, int16_t radius, uint8_t quads) {
248 int16_t x = 0, y = radius;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected