24 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!

    Like

    • 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?

      Like

      • 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!!

        Like

      • 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)

        Like

  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!!

    Like

  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??

    Like

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

    Like

  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 …

    Like

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

  12. Hello! Thanks a lot for this article and sample. Is it possible to disable the Ink on the Canvas? It is never disabled here! And is it possible to zoom into the canvas without interfering with the Ink Pointer Entered events?

    Like

    • Disabling ink is as simple as not feeding the pointer move events to the InkManager, you can maybe add a flag in there somewhere to check if it is disabled currently or not and add Bezier curves accordingly and push the pointer moved events to the InkManager (i.e. I am referring to the line CurrentManager.ProcessPointerUpdate(pt); )

      As for the zoom, it might complicate things a little. There is no easy way. You would need to the deal with gestures on the app level and distribute the events to the controls (i.e. it wouldn’t work as it is done in the example attaching to the events on the canvas control)

      Like

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