none
Universal app 如何创建图片,然后在图片上绘制文本和图片 RRS feed

  • 问题

  • 现在正在做为wp8.1和windows8.1 Universal app,程序功能需要创建图片,在图片上绘制其他图像和文本,并保存下来。我以前是做winform程序,使用GDI+进行的绘图。以前的方法都不能用了,希望有人能指点一下如何创建图片和绘制。最好能提供示例代码。谢谢。
    2014年9月3日 3:30

答案

  • 感谢回复。我从英文论坛上获取到了解答:

    Windows.UI.Xaml doesn't contain any high level raster graphics classes, but it has strong vector graphics support, and you can interop with Direct2D.

    You have several options:

    1. You can use vector graphics to place your Image and TextBlocks in a Grid or Canvas and then use RenderTargetBitmap to render the combined image into a bitmap and save it out.
    2. You can use a WriteableBitmap and directly modify the PixelBuffer. You can use 3rd party toolkits such as WriteableBitmapEx for shape support.
    3. You can interop with Direct2D and DirectWrite to create a bitmap image.

    For simple image and text composition I would generally choose the first. For more complicated graphics needs I'd choose the third.

    • 已标记为答案 废除 2014年9月3日 7:06
    2014年9月3日 7:03

全部回复

  • 是指这样的东东么  
    2014年9月3日 6:27
  • 感谢回复。我从英文论坛上获取到了解答:

    Windows.UI.Xaml doesn't contain any high level raster graphics classes, but it has strong vector graphics support, and you can interop with Direct2D.

    You have several options:

    1. You can use vector graphics to place your Image and TextBlocks in a Grid or Canvas and then use RenderTargetBitmap to render the combined image into a bitmap and save it out.
    2. You can use a WriteableBitmap and directly modify the PixelBuffer. You can use 3rd party toolkits such as WriteableBitmapEx for shape support.
    3. You can interop with Direct2D and DirectWrite to create a bitmap image.

    For simple image and text composition I would generally choose the first. For more complicated graphics needs I'd choose the third.

    • 已标记为答案 废除 2014年9月3日 7:06
    2014年9月3日 7:03