-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
StyleBox fake AA improvements (make anti aliasing size a float property) #51442
StyleBox fake AA improvements (make anti aliasing size a float property) #51442
Conversation
I tested this on my default project theme PR rework. Here are the results: https://imgsli.com/NjQ5MTA/3/5 It's definitely an upgrade over what we have currently, and it should still work nicely on rotated StyleBoxes. Nice work 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a great way to solve this issue! Thanks for looking into this.
There's just one regression I've found, it's that if you have a border with rounded corners and don't fill the inside part, the inside edges of the border are not anti-asliased anymore.
(it's also visible inside the corners without the rotation)
Apart from that, everything looks better and there's more flexibility to adjust AA, so it seems all good! It would be probably worth porting to 3.x as well, since the current state is not great and this PR's compatibility breaking is not that bad (it might just require re-adjusting AA size in some cases).
88b7ca6
to
e27bfb3
Compare
e27bfb3
to
db2460f
Compare
@Calinou @pouleyKetchoupp Thanks for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Thanks! |
This doesn't seem trivial to cherry-pick so it might warrant a dedicated PR if it's wanted in |
By allowing decimal values for StyleBoxFlat's anti_aliasing_size property the user has more control over it while the crispness of the fake AA can be slightly increased as seen in this screenshot (partly fixes #35279):
Although it is by far from perfect, I think this is still an improvement to the StyleBox resource and could be enough for using rounded corners in #51159 (@Calinou What do you think?). This change can be combined with the addition of an enum for different fake AA techniques as suggested by Calinou in #35279 (comment).
Changes:
Changed the anti-aliasing size to be a float property and set the new default value to 0.625 (determined through testing)
Adjusted slightly how the anti-aliasing gradient ring is calculated when a border is drawn to partly solve the problems mentioned in StyleBoxFlat aliasing looks blurry (regression between 3.2beta5 and 3.2beta6) #35279. As shown in these screenshots, the extent of the border fake AA gradient ring matches the extent when just the infill is drawn.
CURRENT MASTER:
THIS PR:
Corrected some comments and variable names to fit the Godot codestyle (camelCase variables and COMMENTS FULLY IN CAPS)
I would suggest that you try it out yourself and compile this PR to see it in action since resized screenshots can't properly depict how it looks in the end. Feedback is always appreciated :)