我通过覆盖单独的UiElement的onRender方法并使用绘图行程直接绘制基元来绘制WPF窗口中的相当复杂的“图像”(通常需要刷新并有许多绘制基元)。

我的问题是,幕后究竟发生了什么?据我所知,这不是使用保留模式(如果我将形状放入控制),这将是这种情况。我问这个问题,因为我急于像这样画画实际上只是在后面使用GDI +,带来了自己的问题(例如,用GDI +绘制的印刷东西已经花费了我们的时间和精力)。

是否有任何良好的资源(除了明显的MSDN资源,似乎没有启发我的呢?

或者我完全错了一切?

谢谢你朝着正确的方向指向我的任何答案。 [编辑:拼写]

有帮助吗?

解决方案

You are still using retained mode, you're just not using high level objects (no animating objects, etc..), but instead simple points, lines, etc..

I've dug into the sources of DrawingContext and from what I can tell, it seems to be pushing all those DrawXYZ commands into a queue using some low-level wizardry (the queue itself consists of arbitrarily sized structs, each denoting a certain command).

WPF then processes this queue on another thread, denoted the rendering thread in this question. I haven't verified this, but I'm guessing that WPF uses the StreamingContext for all its drawing.

Furthermore, WPF is using DirectX for rendering, as can be seen by this bogpost, which takes a better look at what WPF actually does.

I hope this clarifies things for you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top