You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 detailsdefdraw_circle(xpos0, ypos0, rad, col=1):
x=rad-1y=0dx=1dy=1err=dx- (rad<<1)
whilex>=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)
iferr<=0:
y+=1err+=dydy+=2iferr>0:
x-=1dx+=2err+=dx- (rad<<1)
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: