0

I want to save the image with InkCanvas stroke in a single image as like the below image. enter image description here

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

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

Thanks

Santhiya
  • 191
  • 2
  • 14

1 Answers1

1

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

According to the "XAML visuals and RenderTargetBitmap capture capabilities" of RenderTargetBitmap 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).

So that the content of InkCanvas may not be captureable. And it seems like there is no APIs can directly capture a InkCanvas with an image attached.

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

You should be able to use 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 this thread. If you have any issues when you using the Win2D package you may open new threads.

Sunteen Wu
  • 10,509
  • 1
  • 10
  • 21
  • I have tried the Win2D CanvasDevice. But I have a doubt, how to save an image which I mentioned. If I use the RenderBitmap image path are disappeared, then how can I get the rendered image? I am confused please help me... i tried this https://stackoverflow.com/questions/37179815/displaying-a-background-image-on-a-uwp-ink-canvas. – Santhiya Oct 24 '17 at 13:13
  • @Santhiya I have a completed sample in [this thread](https://stackoverflow.com/questions/43390816/uwp-how-can-i-attach-an-image-to-an-inkcanvas/43446268#43446268), there is a save button. If you still cannot resolve out tell me I will upload a demo to you. – Sunteen Wu Oct 26 '17 at 03:03
  • Thanks.. I tried it is working but the ink path position changed. – Santhiya Oct 26 '17 at 06:45
  • @Santhiya, that just a sample for implementing it, details you can do it by yourself. The position you may control by define the image size. The `InkCanvas` size may also have influences on it. If you still cannot resolve out by yourself, you may open a new thread with the reproduced project. – Sunteen Wu Oct 26 '17 at 08:36