microsoft / Win2D

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.
http://microsoft.github.io/Win2D
Other
1.8k stars 284 forks source link

Look of InkStrokes drawn to CanvasRenderTarget look different depending on Windows UI scale #180

Closed Trasteby closed 8 years ago

Trasteby commented 8 years ago

When drawing on a standard InkCanvas, the ink looks the same regardless of Windows UI scaling settings (it looks the same on 100% versus say 125%). When drawing ink on a CanvasRenderTarget, however, the scaling settings change the look of the ink stroke. It looks like it does antialiasing differently on different UI scale settings.

These two images show how the same ink stroke is rendered on 100% UI scale versus 175% UI scale. On a standard InkCanvas, they both look like the 100%-version.

100 The 100% version

175 The 175% version

just to be clear, the UI scale settings I'm talking about are the ones you see if you go to Start Menu -> Settings -> System -> Display -> "Change the size of text, apps and other items". I'm running Windows 10.

damyanp commented 8 years ago

Is it possible that you're creating your CanvasRenderTarget with the DPI explicitly set to 96? You can query the Dpi property on the render target to confirm this.

In the case that the UI is scaled 175% I expect the DPI should be 168.

If you construct the CanvasRenderTarget passing it something that implements ICanvasResourceCreatorWithDpi (for example, a CanvasControl or CanvasAnimatedControl) then the CanvasRenderTarget can pick up the dpi from the control, which ultimately picks the dpi up from the environment.