Closed NoobTracker closed 4 years ago
Maybe fillCircle()
is plagues by the same issues @DaveSprague fixed in #197 for drawCircle()
.
No, I had another problem. And I fixed it. I changed
void OLEDDisplay::fillCircle(int16_t x0, int16_t y0, int16_t radius) {
int16_t x = 0, y = radius;
int16_t dp = 1 - radius;
do {
if (dp < 0)
dp = dp + (x++) * 2 + 3;
else
dp = dp + (x++) * 2 - (y--) * 2 + 5;
drawHorizontalLine(x0 - x, y0 - y, 2*x);
drawHorizontalLine(x0 - x, y0 + y, 2*x);
drawHorizontalLine(x0 - y, y0 - x, 2*y);
drawHorizontalLine(x0 - y, y0 + x, 2*y);
} while (x < y);
drawHorizontalLine(x0 - radius, y0, 2 * radius);
}
to
void OLEDDisplay::fillCircle(int16_t x0, int16_t y0, int16_t radius) {
int16_t x = 0, y = radius;
int16_t dp = 1 - radius;
do {
if (dp < 0)
dp = dp + (x++) * 2 + 3;
else
dp = dp + (x++) * 2 - (y--) * 2 + 5;
drawHorizontalLine(x0 - x, y0 - y, 2*x + 1);
drawHorizontalLine(x0 - x, y0 + y, 2*x + 1);
drawHorizontalLine(x0 - y, y0 - x, 2*y + 1);
drawHorizontalLine(x0 - y, y0 + x, 2*y + 1);
} while (x < y);
drawHorizontalLine(x0 - radius, y0, (2 * radius) + 1);
drawVerticalLine(x0, y0 - radius, 2 * radius);
}
I'm not sure, but I think that the problem was caused by horizontalLine(). I guess this should be implemented in a future bugfix. Now it looks much better.
Hopefully this will be fixed in an update soon, because I want to use this lib in a game and don't want to tell the people "Please delete line x to y and insert this:". I would also like to see fillCircleQuads(). Otherwise it's a great lib.
By far the quickest way to get issues resolved is through pull requests.
I haven't figured out how these pull requests work. I'm new to GitHub and my english is not the best.
Fear not - there's a first time for everything, we've all been there 😄 Finding your way around GitHub and knowing how to create PRs is a powerful tool in your developer toolbox. And very satisfactory, too!
Can I encourage you maybe start with this video https://youtu.be/For9VtrQx58 or our own guidelines?
That's really interesting! Thank you!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello!
I have a problem with fillCircle(). It looks like the circles are a pixel higher then wide. I don't have problems with drawCircle(). My code:
You can see the result in the attached image.