Please consider adding the ability to draw a circle and/or ellipse.
An existing Adafruit example -- Adafruit_CircuitPython_SSD1306 -- implements a draw_circle function that works for my case in the meantime.
# Helper function to draw a circle from a given position with a given radius
# This is an implementation of the midpoint circle algorithm,
# see https://en.wikipedia.org/wiki/Midpoint_circle_algorithm#C_example for details
def draw_circle(xpos0, ypos0, rad, col=1):
x = rad - 1
y = 0
dx = 1
dy = 1
err = dx - (rad << 1)
while x >= y:
oled.pixel(xpos0 + x, ypos0 + y, col)
oled.pixel(xpos0 + y, ypos0 + x, col)
oled.pixel(xpos0 - y, ypos0 + x, col)
oled.pixel(xpos0 - x, ypos0 + y, col)
oled.pixel(xpos0 - x, ypos0 - y, col)
oled.pixel(xpos0 - y, ypos0 - x, col)
oled.pixel(xpos0 + y, ypos0 - x, col)
oled.pixel(xpos0 + x, ypos0 - y, col)
if err <= 0:
y += 1
err += dy
dy += 2
if err > 0:
x -= 1
dx += 2
err += dx - (rad << 1)
Please consider adding the ability to draw a circle and/or ellipse.
An existing Adafruit example -- Adafruit_CircuitPython_SSD1306 -- implements a
draw_circle
function that works for my case in the meantime.