22 comments on “Drawing / Inking API in WinRT (C#) – I

  1. Pingback: Windows 8 Developer Links – 2012-07-27Dan Rigby | Dan Rigby

  2. Pingback: Drawing / Inking API in WinRT (C#) – I

  3. Hi

    First of all, thanks for the article!
    Second, I have a little problem with the ink manager.
    I need to write the ink canvas to a WriteableBitmap in my app, and normally I would do this in Silverlight without much effort, using “var bmp = new WriteableBitmap(my_InkPresenter,null)”
    Only this constructor doesn’t exist in .NET.
    So I tried saving the strokes to a memory stream through the InkManager.SaveAsync(..) method, then using the stream to create the WriteableBitmap. But this only saves the strokes and not the whole ink canvas. And I really need to get the position of the strokes on the canvas.

    Any ideas that can help?
    Thanks!

    • Hey Peter,

      I will add the second part of the series tonight which is about loading and saving the strokes as/from image file.

      Hope it will help you…

    • I just noticed… The saveasync method should work without any problems… When you are passing stokes to the inkmanager, the positions of the strokes are relative to the canvas itself since the pointer events are captured from the canvas. So even if it is saving the strokes only, it is as good as the WriteableBitmap(inkpresenter, null).

      Could you explain a bit more what the problem is with the stoke positions?

      • I’d like to have a “capture” of the canvas, with all the transparent parts as well as the strokes. However, it’s like the SaveAsync method “crops out” the transparent parts, since it’s only really saving the strokes.
        Also, did you find any other method for rendering than Bezier? Bezier can go out of control if the user draws points close together (ie drawing the same line thrice before rendering).

        I have to say I miss the InkPresenter class!!

      • yeap I was just testing it my self…You are absolutely right the bounding rectangle from the ink manager basically shows what is wrong with the saving… (i.e. Canvas.ActualWidth = InkManager.BoundingRectangle.Left + InkManager.BoundingRectangle.Width + InkManager.BoundingRectangle.Right)

  4. I’d like to have a “capture” of the canvas, with all the transparent parts as well as the strokes. However, it’s like the SaveAsync method “crops out” the transparent parts, since it’s only really saving the strokes.
    Also, did you find any other method for rendering than Bezier? Bezier can go out of control if the user draws points close together (ie drawing the same line thrice before rendering).

    I have to say I miss the InkPresenter class!!

  5. Pingback: Drawing / Inking API in WinRT (C#) – I | azkafaiz.com

  6. Pingback: Drawing / Inking API in WinRT (C#) – II | Can Bilgin

  7. Hi Can,

    Is these a way to undo the last Stroke using InkManager?? There is no way for us to remove Strokes in code from whatever I have seen. Any ideas??

  8. Guys, I am unable to merge Both background image and storkes of inkmanager into single image.
    Is it possible to do that?

  9. Pingback: Drawing / Inking API in WinRT (C#) – I | Can Bilgin | Ra Puke Moana

  10. hi, Can, is there any example of touch input?
    i install my application in windows tablet, and when i try to draw something in canvas, the screen keeps moving …

  11. Pingback: Drawing / Inking API in WinRT (C#) – III | Can Bilgin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s