In a win8 app,how to get a drawingsession from a canvascontrol (win2d),or ,how to draw image on canvascontrol out of the function:canvasControl_Draw.
相关问题
- How can I simulate a DeviceLost event with Win2D?
- Access denied while saving image in UWP.Access is
- Win2D library: CanvasImageBrush paints using the C
- UWP: Compute text height in a RichTextBlock gives
- How to pull missile images on top of the lines?
相关文章
- How can I simulate a DeviceLost event with Win2D?
- Access denied while saving image in UWP.Access is
- UWP:在RichTextBlock计算文本高度给出了怪异的结果(UWP: Compute text
- Win2D library: CanvasImageBrush paints using the C
- UWP: Compute text height in a RichTextBlock gives
- How to pull missile images on top of the lines?
- Support more than one color input in my Pixel Shad
- Is Win2D yet available in C++/WinRt?
You cannot - this is a key part of policy provided by CanvasControl.
This ensures that:
the drawingsession is created and closed at the appropriate time
drawing isn't attempted before resources have been created
handling device lost errors are handled
If you want to force a redraw you can use CanvasControl.Invalidate().
Alternatively, you may find that you want to render to an offscreen CanvasRenderTarget (that you can call CreateDrawingSession). Then use DrawImage in your CanvasControl_Draw to draw the render target to the control.
If your goal is just to render to an image, you can do this without being in the CanvasControl.Draw method. Here is some code from one of my apps that renders to an image and saves it to a file (PageRenderer is my class that does the rendering):