如何保存 InkCanvas 笔画和图像?

How to save the InkCanvas stroke and image?

我想将带有 InkCanvas 描边的图像保存在单个图像中,如下图所示。

当我使用 RenderTargetBitmap 时,墨水笔划消失了,路径也没有保存。

如何在不使用 CanvasDevice 的情况下将图像和墨迹保存在单个图像中?

谢谢

When I am using the RenderTargetBitmap the ink stroke disappeared and the path not saved.

根据RenderTargetBitmap的"XAML visuals and RenderTargetBitmap capture capabilities" class:

Content that can't be captured will appear as blank in the captured image, but other content in the same visual tree can still be captured and will render (the presence of content that can't be captured won't invalidate the entire capture of that XAML composition).

因此 InkCanvas 的内容可能无法捕获。而且似乎没有API可以直接捕获带有图像的InkCanvas。

How to save the image and ink stroke in a single image without using the CanvasDevice?

您应该可以使用 Win2D. I'm confused that why you don't want to use CanvasDevice, with Win2D to implement your feature is the recommend way to do this, I do recommend you to use that. For a code sample please reference 。如果您在使用 Win2D 包时遇到任何问题,可以开新帖。