Reputation: 330972
So if I have a WPF window, would moving another window over the WPF window cause the WPF window to do thousands of redraws like Windows Forms?
I am wondering the effects of using vectors in this case, as opposed to everything being bitmap-based like Window Forms.
Upvotes: 3
Views: 1042
Reputation: 48066
You can take a peek at the WPF architecture to get an idea of how it's set up.
To answer your specific question: WPF uses a retained mode drawing system. In particular, that means that any redrawing necessary (which may be necessary) is handled behind the scenes without your intervention.
By contrast, GDI uses immediate mode; i.e. you essentially write pixels directly and if -for any reason- those pixels need refreshing, you need to re-render.
WPF doesn't necessarily actually cache everything - that depends on the OS and memory availability amongst other things. However, if it does need to re-render, it'll use the scene graph you last provided to do so; it's transparent to the programmer. Also, even though it "uses" DirectX, that basically just means it's doing a best-effort case to use hardware support insofar available and implemented for that feature. Not all graphics cards nor all WPF features are fully accelerated. This question concerns telling the different rending modes apart and the consequence that entails.
Upvotes: 6
Reputation: 564413
WPF's rendering is handled completely differently than Windows Forms. It's using DirectX to render itself, so the rendering tends to have quite a bit less problems of this nature than Windows Forms.
(This does, however, cause some of its own issues - in particular, it has a higher requirement for the graphics card to get decent performance...)
Upvotes: 1