Skip to content

Conversation

@Vinci10
Copy link
Contributor

@Vinci10 Vinci10 commented Jul 4, 2025

Description:

(Based on #5830)
Fixed an issue where rounded edge was not rendered correctly.

Before

edge_smoothness_before

After

edge_smoothness_after

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great looking improvement thanks so much.

Unfortunately it has broken the ability to draw thin borders on rectangles...

See ere how the file save dialog input in fyne_demo has a significantly wider outline:
Screenshot 2025-07-04 at 17 20 37
Screenshot 2025-07-04 at 17 20 16

@coveralls
Copy link

coveralls commented Jul 4, 2025

Coverage Status

coverage: 62.38% (-0.01%) from 62.392%
when pulling 86418bf on Vinci10:rectangle_edge_smoothness_fix
into c23b700 on fyne-io:develop.

@Vinci10
Copy link
Contributor Author

Vinci10 commented Jul 4, 2025

Good point. Fortunately, if there is added border then sharp edge is not visible, what about changing edge_softness to 0 when border is added ? edge_softness has already been added as a shader parameter

IMO significantly wider outline looks better but I understand that someone may want to draw thin border

@andydotxyz
Copy link
Member

Good point. Fortunately, if there is added border then sharp edge is not visible, what about changing edge_softness to 0 when border is added ? edge_softness has already been added as a shader parameter

I'm not certain of the details but if the edge is only used when it is fill to background then that sounds like a fine approach.

@Vinci10
Copy link
Contributor Author

Vinci10 commented Jul 4, 2025

Maybe we should add edge_softness as a new rectangle parameter to allow user to change it? High edge_softness value may create something looking like drop shadow

@andydotxyz
Copy link
Member

Maybe we should add edge_softness as a new rectangle parameter to allow user to change it? High edge_softness value may create something looking like drop shadow

No.

The Fyne API is a semantic API - the parameters do what they mean. Something called "EdgeSoftness" that can create a shadow-like effect makes no sense IMHO.

@andydotxyz
Copy link
Member

This is looking excellent now thanks.
Unfortunately a tidy in how shaders are loaded ("embed" package) is blocking this now.
Could you re-base on latest develop and we can get this merged?

Thanks!

@Vinci10
Copy link
Contributor Author

Vinci10 commented Jul 8, 2025

I updated the PR with a different implementation of the stroke and fill colors via smoothstep to make the thin border look smooth for rounded corners . Please check if it works as expected. Thanks.

@Vinci10 Vinci10 marked this pull request as ready for review July 9, 2025 20:21
@Vinci10 Vinci10 requested a review from andydotxyz July 9, 2025 20:25
@andydotxyz
Copy link
Member

I updated the PR with a different implementation of the stroke and fill colors via smoothstep to make the thin border look smooth for rounded corners . Please check if it works as expected. Thanks.

Thanks so much for going back and looking at it again :)

@andydotxyz
Copy link
Member

Thanks - this version looks cool.
The comment style is pretty weird though - if it's needed try to limit it to the content.

@Vinci10
Copy link
Contributor Author

Vinci10 commented Jul 11, 2025

I removed that comment. I think it is not needed. I tested the code only on WSL Ubuntu 20.04. I am not able to perform tests on other platforms and I am not sure about performance impact. Could you please verify correctness of this new code ? Thanks.

@Vinci10 Vinci10 requested a review from andydotxyz July 11, 2025 10:33
@Vinci10
Copy link
Contributor Author

Vinci10 commented Jul 21, 2025

I had to update PR because I found out that edges were cropped so I expanded frame without changing rectangle size

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks so much for pulling this together, loving the smoothness

@andydotxyz andydotxyz merged commit 2706f78 into fyne-io:develop Jul 25, 2025
21 of 24 checks passed
@andydotxyz
Copy link
Member

Congratulations on landing your first Fyne PR and thanks so much!

@Vinci10 Vinci10 deleted the rectangle_edge_smoothness_fix branch August 1, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants