Domanda

Sto dipingendo una "immagine" piuttosto complessa (che spesso deve essere rinfrescata e ha molti primitivi di disegno) in una finestra del WPF sovrascrivendo il metodo onRender di un uelinement separato e utilizzando il DrawingContext per disegnare direttamente i primitivi. .

La mia domanda è, cosa succede esattamente dietro le quinte?Per quanto ho capito che questo non sta usando la modalità mantenuta (che sarebbe il caso se stavi posizionando forme nel controllo).Sto facendo la domanda perché sono ansioso che disegnando come questo, in realtà, userà in realtà il GDI + nella parte posteriore che porta con i propri problemi (ad esempio la stampa di roba disegnata con GDI + ci è già costata tempo e sforzo).

Ci sono buone risorse (oltre alle ovvie risorse MSDN che non sembravano essere in grado di illuminarmi?

o ho avuto tutto completamente sbagliato?

Grazie per tutte le risposte che mi indicano nella giusta direzione. [modifica: ortografia]

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top