Windows Phone 8.1是否有任何System.Drawing.Graphics? [英] Is there any System.Drawing.Graphics for Windows Phone 8.1?

查看:53
本文介绍了Windows Phone 8.1是否有任何System.Drawing.Graphics?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在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(...); 

在Windows窗体应用程序中,我可以使用

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆