Currently I am using Bresenham's circle drawing algorithm, which draws circles fine, however I would like a relatively fast and efficient way to draw a circle with a specified thickness (since Bresenham's method only draws a single pixel thickness). I realise that I could simply draw multiple circles with different radii, but I believe this would be very inefficient (and efficiency is important because this will be running on an Arduino where every microsecond is precious). I am currently using the following code:
void circle(byte xc, byte yc, int radius, Colour colour) {
int x = -radius, y = 0, err = 2 - 2 * radius;
while(x < 0) {
setPixel(xc - x, yc + y, colour);
setPixel(xc - y, yc - x, colour);
setPixel(xc + x, yc - y, colour);
setPixel(xc + y, yc + x, colour);
radius = err;
if(radius <= y) {
err += ++y * 2 + 1;
}
if(radius > x || err > y) {
err += ++x * 2 + 1;
}
}
}
How could I modify this to allow for specification of the circle's thickness? PS I don't want to use any external libraries, please!