Closed kucint closed 6 months ago
Following code should draw a rectangle of size 10x6
new Rectangle() .Width(10) .Height(6) .StrokeThickness(1) .Stroke(Colors.Black)
but it draws a rectangle of size 13x8 (anti-aliased inner rectangle has size 11x6)
This is original screenshot:
This is the same screenshot zoomed in Paint:
The code should draw a rectangle of size 10x6
STEPS TO REPRODUCE
MINIMAL REPRO PROJECT
{ "msbuild-sdks": { "Uno.Sdk": "5.1.104", "Microsoft.Build.NoTargets": "3.7.56" } }
Nuget Package (s):
<Project ToolsVersion="15.0"> <ItemGroup> <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" /> <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" /> <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231219000" /> <PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" /> <PackageVersion Include="Uno.Extensions.Core.WinUI" Version="4.0.0" /> <PackageVersion Include="Uno.Extensions.Hosting" Version="4.0.0" /> <PackageVersion Include="Uno.Extensions.Hosting.WinUI" Version="4.0.0" /> <PackageVersion Include="Uno.Extensions.Logging.WinUI" Version="4.0.0" /> <PackageVersion Include="Uno.Extensions.Reactive" Version="4.0.0" /> <PackageVersion Include="Uno.Extensions.Reactive.WinUI" Version="4.0.0" /> <PackageVersion Include="Uno.Toolkit.WinUI" Version="5.1.7" /> <PackageVersion Include="Uno.Resizetizer" Version="1.4.0" /> <PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="$(UnoVersion)" /> <PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" /> <PackageVersion Include="Uno.WinUI" Version="$(UnoVersion)" /> <PackageVersion Include="Uno.WinUI.Lottie" Version="$(UnoVersion)" /> <PackageVersion Include="Uno.WinUI.Markup" Version="5.1.5" /> <PackageVersion Include="Uno.Extensions.Markup.Generators" Version="5.1.5" /> <PackageVersion Include="Uno.Toolkit.WinUI.Markup" Version="5.1.3" /> <PackageVersion Include="Uno.Extensions.Reactive.WinUI.Markup" Version="4.0.0" /> <PackageVersion Include="Uno.Themes.WinUI.Markup" Version="4.1.1" /> <PackageVersion Include="Uno.WinUI.DevServer" Version="$(UnoVersion)" /> </ItemGroup> </Project>
Affected platform(s):
Visual Studio:
Relevant plugins:
checked only on windows. Other platforms - behavior unknown.
Maybe there is DPI scaling?
oh gosh! you are perfectly right! this is due to dpi scaling... Thanks for the hint!
Current behavior
Following code should draw a rectangle of size 10x6
but it draws a rectangle of size 13x8 (anti-aliased inner rectangle has size 11x6)
This is original screenshot:
This is the same screenshot zoomed in Paint:
Expected behavior
The code should draw a rectangle of size 10x6
How to reproduce it (as minimally and precisely as possible)
STEPS TO REPRODUCE
MINIMAL REPRO PROJECT
Environment
Nuget Package (s):
Affected platform(s):
Visual Studio:
Relevant plugins:
Anything else we need to know?
checked only on windows. Other platforms - behavior unknown.