シーンの後ろのOnRender作業でDrawingContextを使って描画する方法は?

StackOverflow https://stackoverflow.com/questions/9519504

  •  14-11-2019
  •  | 
  •  

質問

別のUIElementのOnRenderメソッドをオーバーライドし、DrawingContextを使用してプリミティブを直接描画するために、WPFウィンドウには、かなり複雑な「イメージ」(さまざまな描画プリミティブを持つ必要があり、多くの描画プリミティブを持っています)をペイントしています。

私の質問は、シーンの後ろに正確に起こるものですか?私が理解している限り、これは保持モードを使用していません(私がコントロールに形を置いている場合は事実です)。私はこのような絵が実際にそれ自身の問題をもたらす背中の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