[wxPython-users] graphics class definitions
Christopher Barker
Chris.Barker at noaa.gov
Thu Dec 27 13:29:18 PST 2007
Karl Kobata wrote:
> Will someone explain if the DC subclasses stores data as bmp or vector
> graphics?
not a simple answer....
> It seems that wx.MemoryDC specifically says graphics are stored it bitmap
> form, but the others do not. So does this mean, wx.ClientDC, wx.PaintDC,
> wx.PrinterDC, wx.ScreenDC, wx.WindowDC, and wx.GraphicsContext store
> graphics in vector format?
No, it means that they don't store the graphics at all. They are
renderers -- they render both vector and bitmap graphics to various
devices in various ways. A wx.MemoryDC renders to a wx.Bitmap object
(which then can store the result as a bitmap), the wx.clientDC,
wx.PaintDC, wx.ScreenDC all render to the screen, and don't store
anything themselves. The wx.PrinterDC renders to the printer device, and
doesn't store anything.
a wx.GraphicsContext is a similar concept -- it is a rendering interface
that can render to various different things. It is similar to a DC,
except that it is newer and more sophisticated. It's a bit harder to
use, can have poorer performance, but give additional capabilities,
notably real alpha blending and anti-aliasing.
See:
http://wiki.wxpython.org/RecipesImagesAndGraphics?highlight=%28graphics%29
for some background.
-Chris
PS: FloatCanvas stores drawings as vector data and handles zooming, etc
for you. It does its actual rendering with DCs, though it can optionally
use GraphicsContext.
--
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
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list