Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smooth arc function #587

Closed
oldmud0 opened this issue Jul 5, 2024 · 6 comments
Closed

Add smooth arc function #587

oldmud0 opened this issue Jul 5, 2024 · 6 comments
Labels
enhancement New feature or request stale Inactive issues

Comments

@oldmud0
Copy link

oldmud0 commented Jul 5, 2024

Carefully written requests are more likely to be given priority.
丁寧に記述された要望は優先して対応される可能性が高くなります。

Is your feature request related to a problem? Please describe.
Compared to TFT_eSPI, LGFX lacks smooth arc functions. (In TFT_eSPI, this is the TFT_eSPI::drawSmoothArc function). This would also be a great feature to have, considering that LGFX already has smooth lines, smooth circles, and smooth round rects.

Describe the solution you'd like
Add the smooth parameter to fill_arc_helper, fillEllipseArc, and drawEllipseArc to support new drawSmoothArc and fillSmoothArc functions, and implement the antialiasing code.

Describe alternatives you've considered
I've looked at the TFT_eSPI code and considered copying it, but the arc functions don't line up exactly the same from what I can see.

Additional context
Screenshot showing a normal call to LGFX_Base::fillArc from the SDL2 runtime.
image

I'd use LVGL, but currently this is not an avenue for me due to time constraints and platform issues.

@oldmud0 oldmud0 added the enhancement New feature or request label Jul 5, 2024
@tobozo
Copy link
Collaborator

tobozo commented Jul 8, 2024

hi, thanks for your suggestion 👍

apparently drawSmoothArc() function exists in TFT_eSPI, since LGFX already implements the necessary functions drawSpot() and drawWedgeLine(), it should not be a problem to import it and make it work with all lgfx color types.

also the DrawLineThickness.ino example will need to be extended with that new function.

I'll update this thread with the progress.

@tobozo
Copy link
Collaborator

tobozo commented Jul 8, 2024

I was a bit shocked by the brute force used in drawArc() to find the edges 🤔

also I forgot fill_arc_helper() takes two radiuses and has a totally different approach from bodmer's drawArc() so it's not as simple as using the existing functions

@oldmud0 anything you can suggest to help implement smoothness in fill_arc_helper() will be welcome

@tonbor
Copy link

tonbor commented Jul 14, 2024

Any progress?

@tobozo
Copy link
Collaborator

tobozo commented Jul 15, 2024

yes: fill_arc_helper() can't have smoothness added without performance loss as the function is already optimized for fastest rendering, and adding any conditional block for antialiased edges will compromise that

LGFX's arc helper primitives are based on ellipse (e.g. a circle is an ellipse with two equal radiuses), so there are two paths to get this done:

  1. Use fill_arc_helper() as a base to create fill_smooth_arc_helper(): the hard part is to implement alpha for the edges in a two-radiuses context while keeping the ellipse based logic
  2. Integrate Bodmer's drawSmoothArc() and its primitives: very slow, and someone will eventually ask for an ellipse version of the function

I don't have the time and skills to do either points, but I can provide support and help for anything related to a proper integration in LovyanGFX.

Copy link

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.

@github-actions github-actions bot added the stale Inactive issues label Aug 14, 2024
Copy link

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale Inactive issues
Projects
None yet
Development

No branches or pull requests

3 participants