You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edit I realized the problem only reproduces if I have the Image in a ScrollViewer (i.e. the left margin is always 2px otherwise) and so don't care about this anymore.
The problem is that the left margin actually varies between different runs of the program. The top margin is always 0px. The right and bottom margins change in proportion with the hight and width.
If I translate my rendering with a left offset of 4px. I will get only my clear colour displayed some of the time. Other times I will get a pixel or two of SurfaceImageSource's clear colour 😢.
There is no here of whether or not the offset parameter is being used correctly. It is also true that the documentation for this parameter isn't good in the reference. The Windows.UI.Xaml version only describes it as "Receives the point (x,y) offset of the surface that will be drawn into." where the Microsoft.UI.Xaml version doesn't even document anything.
Looking at the DirectComposition documentation for IDCompositionSurface::BeginDraw and the Windows.UI.Composition ICompositionDrawingSurfaceInterop::BeginDraw provide some extra context for the parameter with the same name. That is, you need to offset your drawing rectangle by the x and y values given in the offset parameter.
Edit I realized the problem only reproduces if I have the
Image
in aScrollViewer
(i.e. the left margin is always 2px otherwise) and so don't care about this anymore.Describe the bug
Tutorial on
SurfaceImageSource
for context.ISurfaceImageSourceNative::BeginDraw
returns a surface that is bigger than thepixelWidth
andpixelHeight
you parse to theSurfaceImageSource
constructor.The problem is that the left margin actually varies between different runs of the program. The top margin is always 0px. The right and bottom margins change in proportion with the hight and width.
If I translate my rendering with a left offset of 4px. I will get only my clear colour displayed some of the time. Other times I will get a pixel or two of
SurfaceImageSource
's clear colour 😢.I can get the actual size from
IDXGISurface::GetDesc
but that doesn't help.Maybe being a pixel or two off is not the end of the world.
Steps to reproduce the bug
NuGet package version
WinUI 3 - Windows App SDK 1.5.4: 1.5.240607001
The text was updated successfully, but these errors were encountered: