-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Fix jagged background for labels and widgets #2205
Fix jagged background for labels and widgets #2205
Conversation
…of-missing-anti-aliasing
…ti-aliasing' of github.com:Mapsui/Mapsui into 2204-backfill-of-labels-is-jagged-because-of-missing-anti-aliasing
…of-missing-anti-aliasing
…of-missing-anti-aliasing
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.
Good improvement.
Are there maybe more SkPaint Colors that need antialising?
@@ -298,7 +296,7 @@ private static void DrawBackground(LabelStyle style, SKRect rect, SKCanvas targe | |||
if (color.HasValue) | |||
{ | |||
var rounding = style.CornerRounding; | |||
using var backgroundPaint = new SKPaint { Color = color.Value }; | |||
using var backgroundPaint = new SKPaint { Color = color.Value, IsAntialias = true }; |
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.
Good fix, first I didn't see the jagged background, but after I figured out how to compre the images (with the swipe feature, it is clearly an improvement.
Looking through the Code I saw in the PerformanceWidgetRenderer no antialiasing on the Background.
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.
I noticed the degradation on the corner radius and the PerformanceWidgetRenderer does not use the corner radius, so I did not change it, but I am not sure if would make a difference even with a regular square.
That said, higher quality does have a cost and sometimes quite noticeable. In de past I have often chosen a faster way of rendering. For instance when rendering a lot of svg point symbols you may not always want the fastest solution. Perhaps quality should even be configurable for individual layers.
Likely. But I think not every draw method benefits from it, and there is a performance penalty we may not always want to take. For instance, for drawing bitmaps there is the FilterQuality and we use FilterQuality.Low, while there is also High and Medium. For my purpose (some years ago) High was too slow. Btw, if you do not set the FilterQuality the default None is used, which is significantly worse than Low. |
Yes, I thought about a configurable option could be helpful. I didn't see the problem because I have a 4K Monitor so Rounded Corners are smooth even without AntiAliasing and Smartphones have high Resolution too so you don't see much of a difference. But the Performance could be noticable. Maybe the MapControl could have two Properties Antialiasing and FilterQuality with Antialiasing set to true and FilterQuality set to FilterQuality.Low. Or maybe this can be set with Properties on the Renderer. |
Is this nothing, that should be configurable for each layer or widget and not globally? |
@charlenni @inforithmics I created an issue to discuss this #2213 |
No description provided.