none
Convertir stroke (InkCanvas) en imagen para compartir. RRS feed

All replies

  • Hello,

    Win2D provide a method for you to draw ink to a image:

    http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_CanvasDrawingSession_DrawInk.htm

    After you draw the session you can then use CanvasRenderTarget and it's saveasync method to save your current things to a image file. 

    http://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_CanvasBitmap_SaveAsync_4.htm

    This is to save it to a image file. However it will not keep your strokes, if you need to share the strokes, you still need to save your strokes to a file based on the official save file doc. That is to say, in your scenario, you may need to save both a image file and a strokes file, and then share both of them. Or if you are also the receiver, you can put the convert to image method in the logic of your receiver, then you will be able to read the storkes from the sender, and then prase the storke file as a image file.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 21, 2019 1:49 AM
    Moderator
  • Hello:

    I want to do is convert the stroke of the InkCanvas to image for share As Attachment



    • Edited by Javier Ra Thursday, March 21, 2019 2:04 PM more information
    Thursday, March 21, 2019 7:31 AM
  • Hello,

    You can save the image first then treat the image as a file when you want to share it. This is the first part. The second part is the share option, can you be specific about what you want to share? If you want to share data between apps, then check here https://docs.microsoft.com/en-us/windows/uwp/app-to-app/share-data

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 22, 2019 2:40 AM
    Moderator
  • Hello: 

    I want to do this

    Friday, March 22, 2019 10:07 AM
  • @Javier Ra,

    Yep that is the ShareUI here:

    https://docs.microsoft.com/en-us/windows/uwp/app-to-app/share-data#launch-the-share-ui

    The UI code is simple, just:

    DataTransferManager.ShowShareUI();

    What you need is still get ready for the content before you want to share.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 25, 2019 7:15 AM
    Moderator
  • Hello:

    So this OnDeferredImageRequestedHandler connect DataPackage, but this would be bitmap and not PNG, I want PNG as a file to share.

    Monday, March 25, 2019 8:40 PM
  • @Javier,

    Actually the following method https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.datatransfer.datapackage.setdata#Windows_ApplicationModel_DataTransfer_DataPackage_SetData_System_String_System_Object_ also support custom format only if your receiver understand the format ID you passed. So png should be OK. Have you tested it yet?

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 26, 2019 8:08 AM
    Moderator
  • Hi:

    As I can make the stroke of L inkCanvas is convirta in Png Image.

    Although I've been watching the documentation

    Tuesday, March 26, 2019 1:26 PM
  • Hello,

    I have the following advice for you:

    1.  I strongly recommend that you can create a support ticket and we actually have the Spanish support which can make the communication much better. You will undersand every better if you can use your own language. 

    2. I'm not so sure whether you mean you want to know whether you can convert your stokes to a png image. But please notice that my first post is about how you can save your ink strokes as a image. And we highly recommend that when you share your image, you can directly share a file instead. While you are sharing the file, you can easily do the convertion from your receiver side. That's actually a better idea.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 27, 2019 2:33 AM
    Moderator
  • Hello.
    When drawing stroke in the inkCanvas, when I go to share add me for example to the mail 0Kb therefore the stroke should become Png or JPG image.
    Wednesday, March 27, 2019 2:28 PM
  • Hello:

    I want to convert this image

    Wednesday, March 27, 2019 2:37 PM
  • @Javier Ra,

    So as we've discussed before, you can save your strokes as a image first. Then choose to share the image file as the file. For how to share the image file, see here for demo code:https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/ShareSource/cs/ShareImage.xaml.cs

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 2, 2019 9:00 AM
    Moderator