在WPF绘制像素像素、WPF

2023-09-02 11:56:15 作者:□兜兜里没钱钱ゞ

怎么会在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两个建议。 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.

 
精彩推荐
图片推荐