Object analogue to HTML5's canvas. Drawing shapes, editing pixels RRS feed

  • Question

  • What is equivalent in Windows modern apps to Canvas in HTML5?

    I know that there is something named Canvas in Windows too, but as I see in the examples it is more vector like thing (like SVG in HTML). I'm going to make simple drawing app like Paint.

    What I need is something that will let me get particular pixel of canvas, edit it etc, and finally save it to the file. What should I use?

    Sunday, November 9, 2014 4:11 PM


  • Windows.UI.xaml doesn't have an in-box raster graphics library beyond the WriteableBitmap. You can directly manipulate the pixels in the WriteableBitmap, but there are no high level constructs such as lines and shapes.

    There are several options:

    • Build the shapes with vector graphics (Windows.UI.XAML.Shapes) and use RenderTargetBitmap to convert o a bitmap.
    • Interop with Direct2D
    • Implement your own drawing primitives on the WriteableBitmap's PixelBuffer
    • Use a third party library (such a WriteableBitmapEx) which already implements these techniques


    • Marked as answer by Stefan54 Monday, November 10, 2014 6:35 AM
    Sunday, November 9, 2014 5:56 PM