Is there any System.Drawing.Graphics for Windows Phone 8.1?

帅比萌擦擦* 提交于 2019-12-12 02:18:55

问题


I'm trying to create an image generator in a Windows Phone 8.1 application. I want to be able to create an empty bitmap, write some text in it and then add basic content to the bitmap (lines, circles, etc.).

I am using WritableBitmap and I can get the pixels as an integer array. I can modify the array "by hand" but drawing a text for example would be very complicated using this rough method.

WriteableBitmap bmpCreator = new WriteableBitmap(iImgWidthPX, iImgHeightPX);
int[] vPixels = bmpCreator.Pixels;       
// I want to use a drawing layer using vPixels
// Draw text
// Draw lines
// Apply filters
// bmpCreator.SaveJpeg(...); 

In a Windows Forms application I could have used System.Drawing.Graphics. Unfortunately I don't see this available in Windows Phone 8.1?

Basically I'm searching for a "factory" that takes the pixel array as input and exposes basic image processing functions.

So: Is there anything like System.Drawing.Graphics made for Windows Phone? If not, is there an alternative to my problem?

Thank you for your time!


回答1:


I am guessing what you are looking for is Windows.UI.Xaml.Shapes namespace You can draw these onto a canvas, add whatever text you want to add as a label and then render the canvas to a WriteableBitmap (although I am not sure of the last part here).



来源:https://stackoverflow.com/questions/26977886/is-there-any-system-drawing-graphics-for-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!