Search code examples
drawingwindows-phone-8pixel

Windows Phone 8 - Draw single pixel


What drawing methods can I use in the Win 8 Phone SDK to manually draw single pixels on the screen, like in a drawing app?

It doesn't matter if its c#, c++ or something else.


Solution

  • Use WritableBitmap.Pixels collection to manipulate pixels directly and display them on the screen by setting Image.SetSource(myWriteableBItmap).

    Since WriteableBitmap is a bit sparse, you should pick up WriteableBitmapEx that adds lots of 2D rendering functions to WriteableBitmap. See more at @ http://writeablebitmapex.codeplex.com

    For on-screen drawing you should consider using InkPresenter as it's much more suited to handle those usecases @ http://www.nickharris.net/2010/03/silverlight-for-mobile-on-windows-phone-7-inkpresenter-fun/