-
Notifications
You must be signed in to change notification settings - Fork 710
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
Path renders blurry when scaling is >100% #4116
Comments
@GabrielN17 Did you find this issue in Winui3 or System xaml? |
@gegao18 FYI |
It behaves the same with system xaml, WinUI 2.x and WinUI 3 uwp. With WinUI 3 desktop, it's blurry even with 100% scaling. |
If the stroke thickness is 1epx, and you scale to 150%, that would be 1.5epx, so of course would show some blurring? I know there was another issue regarding TextBox borders showing blurring at 100% scale, so WinUI 3.0 rendering may have an issue. But were you expecting the stroke to remain at 1epx with scaling turned on? Is there an API to prevent scaling of elements? |
The scaling makes sense, but there doesn't seem to be a way to make sure the lines are sharp. UseLayoutRounding works for position and dimensions. There could be a similar property for paths and borders. |
Kinda hard to have a 1.5px line not be blurry. Now maybe there should be a Xaml feature to allow for stroke values which are not scaled. So it will remain 1px thick even at 150% - 200% - 400% scaling etc. You can opt out of scaling I think with |
As noted, the following will render blurried (not sharp) :
An obvious reason is that strokes are badly handled. Luckily, there's an easy workaround. Avoid using strokes (
In lieu of drawing a path with a square, then applying a stroke, draw two squares (one within the other), and fill the content with the desired "stroke" color. It will look like a stroked square although it's something else under the hook. Having said that, this workaround is far from perfect. It's a shame this is not addressed automatically. |
Generically scaling up a path at partial pixel percentages is going to incur anti-aliasing. There is no easy solution to this problem and this is not in plan to be addressed at this time. |
Create a simple Path like this:
<Path Data="M 0 0 H 10 V 10 H 0 V 0" StrokeThickness="1" Stroke="Black" Stretch="Fill" Width="10" Height="10" />
It will render blurry when display scaling is larger than 100%.
Some pictures with the UWP caption buttons vs them recreated in XAML:

100%
150%

UseLayoutRounding doesn't fix this, and it seems it's enabled by default.
The text was updated successfully, but these errors were encountered: