Windows Phone 8.1是否有任何System.Drawing.Graphics? [英] Is there any System.Drawing.Graphics for Windows Phone 8.1?
问题描述
我正在尝试在Windows Phone 8.1应用程序中创建图像生成器.我希望能够创建一个空的位图,在其中写入一些文本,然后向该位图添加基本内容(线,圆等).
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.).
我正在使用 WritableBitmap ,我可以将像素作为整数数组获取.我可以手动"修改数组,但是使用这种 rough方法,例如绘制文本会非常复杂.
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.
所以:是否有为Windows Phone制作的类似System.Drawing.Graphics的东西?如果没有,我的问题是否有替代方法?
So: Is there anything like System.Drawing.Graphics made for Windows Phone? If not, is there an alternative to my problem?
谢谢您的时间!
推荐答案
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).
这篇关于Windows Phone 8.1是否有任何System.Drawing.Graphics?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!