在WPF绘制像素 [英] Drawing Pixels in WPF

查看:550
本文介绍了在WPF绘制像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

怎么会在WPF管理逐像素渲染(比如说,对于光线追踪)?我最初的猜测是创建一个BitmapImage的,修改缓冲区,并显示在Image控件中,但我无法弄清楚如何创建(create方法需要非托管内存块)

how would I manage pixel-by-pixel rendering in WPF (like, say, for a raytracer)? My initial guess was to create a BitmapImage, modify the buffer, and display that in an Image control, but I couldn't figure out how to create one (the create method requires a block of unmanaged memory)

推荐答案

我极力推荐的的的previous两个建议。 <一href="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap(VS.85).aspx">The WriteableBitmap的类提供了你需要假设你使用的是3.5 SP1。在SP1之前存在,除非你采取一些严重的弄虚作假是没有真正好的答案在WPF这个问题。

I highly recommend against the previous two suggestions. The WriteableBitmap class provides what you need assuming you are using 3.5 SP1. Before SP1 there's no really good answer to this question in WPF unless you resort to some serious trickery.

这篇关于在WPF绘制像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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