win2d

How can I simulate a DeviceLost event with Win2D?

醉酒当歌 提交于 2019-12-03 13:49:30
问题 I have a CanvasControl in a UWP app and I've noticed when I leave my Surface alone for a while and it goes to sleep automatically, the CanvasControl no longer works after resuming. The previously drawn bitmap is now blank. I tried to simulate Suspend/Resume in Visual Studio 2015, but that doesn't seem to cause a problem. It resumes fine. I have a feeling it has to do with the CanvasDevice.DeviceLost event, and although I manage that with the CanvasControl.CreateResources event, I can't find a

How can I simulate a DeviceLost event with Win2D?

北战南征 提交于 2019-12-03 04:51:10
I have a CanvasControl in a UWP app and I've noticed when I leave my Surface alone for a while and it goes to sleep automatically, the CanvasControl no longer works after resuming. The previously drawn bitmap is now blank. I tried to simulate Suspend/Resume in Visual Studio 2015, but that doesn't seem to cause a problem. It resumes fine. I have a feeling it has to do with the CanvasDevice.DeviceLost event, and although I manage that with the CanvasControl.CreateResources event, I can't find a way to easily test it. I tried the following: // This throws an exception. Not allowed to do this.

Access denied while saving image in UWP.Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

巧了我就是萌 提交于 2019-12-02 01:46:56
I am working on universal windows app on Windows 10 SDK to draw rectangle on faces recognized in the image. I am using Win2D to edit the pictures and draw rectangle on it. I am able to read files from the Pictures library but when I try to save the image after editing it gives the following error: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) The following is the method I used to draw rectangle on the image: private async void DrawRect() { CanvasDevice device = CanvasDevice.GetSharedDevice(); CanvasBitmap bitmap = null; CanvasRenderTarget offscreen = null; Windows