It is all for convenience. That one line in the example replaces about 4 lines it would take to do it without a wx.BufferedPaintDC. In fact, all of the buffered dc classes are entirely for convenience. You can do everything they do yourself with just a bitmap, a MemoryDC and a ClientDC or PaintDC.
[1] Although it is becoming a better practice to avoid using wx.ClientDC and just call Refresh instead, and do all your painting from the EVT_PAINT handler. This is because with the newer CoreGraphics API on OS X "out of order repaints" is much more expensive of an operation. It's possible that other platforms may move in this direction as well.
I had a pretty good discussion with Stephan about this a while back, and at the time, I think you pretty much needed to call Update() after the Refresh(), to make sure it got to the screen sooner than later. In this case, doesn't it do "out of order repaints" anyway?
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
[1] Although it is becoming a better practice to avoid using wx.ClientDC and just call Refresh instead, and do all your painting from the EVT_PAINT handler. This is because with the newer CoreGraphics API on OS X "out of order repaints" is much more expensive of an operation. It's possible that other platforms may move in this direction as well.
I had a pretty good discussion with Stephan about this a while back, and at the time, I think you pretty much needed to call Update() after the Refresh(), to make sure it got to the screen sooner than later. In this case, doesn't it do "out of order repaints" anyway?
No, as I understand it using Refresh/Update just reprioritizes the normal order so the paint event happens now, but it still goes through the normal procedure to actually do the drawing to the screen. On the other hand, using a wxClientDC causes the drawing to happen at an unexpected time in the normal procedure and so some things need to be suspended in order for that to happen. (Or something like that, I'm pulling this from some old rusty memory banks...) With wxDC using the old QuickDraw API it was possible to do that, but with CoreGraphics it is not.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
No, as I understand it using Refresh/Update just reprioritizes the normal order so the paint event happens now, but it still goes through the normal procedure to actually do the drawing to the screen. On the other hand, using a wxClientDC causes the drawing to happen at an unexpected time in the normal procedure and so some things need to be suspended in order for that to happen. (Or something like that, I'm pulling this from some old rusty memory banks...) With wxDC using the old QuickDraw API it was possible to do that, but with CoreGraphics it is not.
Ah -- OK, When I get a chance, I'll see what happens if I remove wxCleintDC calls from FloatCanvas -- I need to fix a bug with my kludged alpha drawing on OS-X anyway -- if I have problems, you'll hear about them!
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception