Is there any System.Drawing.Graphics for Windows P

2019-09-06 16: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条回答
贼婆χ
2楼-- · 2019-09-06 17:02

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

查看更多
登录 后发表回答