[Feature] TilesBrush Surface can be DPI Aware #4632
michael-hawker
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the problem this feature would solve
If you create a
TilesBrushwith a URI to an image that are context aware, then it only loads the normal scaled image instead of the one for the specific DPI of your monitor.This is because
SurfaceLoader.LoadImageAsyncthat is used is using the underlyingCanvasBitmap.LoadAsyncmethod from Win2D on theuriwhich bypasses the UWP contextual loading system. Therefore, the developer can't provide up-res textures for larger DPI monitors in order to keep the design aesthetic the same for a tiled background in the app.Describe the solution
I believe there are a few improvements we can make here to help with this:
ResourceContextthat can retrieve the context aware resource based on a uri (also see theToAppxUrihelpers too, as this slightly inverse), we may want a coupleResourceCandidatewhich can be used to get a stream or storageFile from.SurfaceLoaderwhendpiModeis aDisplayDpi*setting to use theResourceContextinstead for an ms-appx uriTo Investigate Also: May open another issue, but want to investigate adding an attached property for image, which can hook into the
MapChangedevent and automatically reload an image on context change (scale, theme, etc...) - not sure if that would work for aRequestedThemechange like we do on a sample-page with an app or only the system level change.Describe alternatives you've considered
After exposing
Horizontal/VerticalAlignmentRatioon theCompositionSurfaceBrushforTilesBrushin my testing, that alone was not sufficient with any other settings to get this scenario to work as expected.Additional context & Screenshots
Current at 150 DPI:

At 100 DPI and expected result for both:

Beta Was this translation helpful? Give feedback.
All reactions