I have a few questions about drawing. The project I am working on I
did not write the drawing code it uses now, but I have to try an
update it, and I dont always understand why it does something one way
or another so I figured I would ask a few questions so I can better
understand how to use a DC (or GCDC) in general.
A little info about my project
1) It draws to a scrolled window
2) It has several "layers", basically just containers for diff types
of drawing that keep track of all the objects they are responsible for
(Images, lines, text etc.)
3) Every time an object is redrawn it creates a new DC, draws it then
deletes the DC
4) It uses a mix of ClientDC and MemoryDC (I have not figured out yet
why it uses one over the other in places)
So my questions
1) Would it be better to make a Canvas wide DC that each "layer" uses
when it wants to draw and not delete the DC or is it better to create,
draw, then delete like it does now?
2) How is the new Graphics Device better / worse then using ClientDC
and MemoryDC?
and you might want to check out wx.lib.floatcanvas for an involved example.
-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
Ok I have a another Drawing question now that I have started writing
some code. I have my code to a point that it draws some stuff works
well on windows, but fails to draw the 4 circles on Linux, but does
not output any errors to the console. So I was wondering if I am doing
something wrong or ?
Ok I have a another Drawing question now that I have started writing
some code. I have my code to a point that it draws some stuff works
well on windows, but fails to draw the 4 circles on Linux, but does
not output any errors to the console. So I was wondering if I am doing
something wrong or ?
There is still a couple holes in the GraphicsContext implementation on Linux, one of those is drawing bitmaps.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Ok I have a another Drawing question now that I have started writing
some code. I have my code to a point that it draws some stuff works
well on windows, but fails to draw the 4 circles on Linux, but does
not output any errors to the console. So I was wondering if I am doing
something wrong or ?
FWIW, it crashes on OS-X
Also, this is too much code for me to quickly figure out, but it looks like you could have saved yourself a lot of time by using wx.lib.floatcanvas, or better yet, the newest version at:
That version has a "Group" object that is pretty much like a layer.
-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
I looked at FloatCanvas, but decided against it because it required
more external installs (numpy) for my end users, plus it, as far as I
could tell, does not support Alpha blending which I need for the
Circle and Fog layers.
As for it crashing on OS-X I bet thats due to the same reason it does
not work on Linux (Double Buffering does not yet work with
GraphicsContext on those platforms)
···
On 2/15/07, Christopher Barker <Chris.Barker@noaa.gov> wrote:
FWIW, it crashes on OS-X
Also, this is too much code for me to quickly figure out, but it looks
like you could have saved yourself a lot of time by using
wx.lib.floatcanvas, or better yet, the newest version at:
Ok, well I made an even more simplistic example which just draws a
circle onto the panel (No buffer not other junk) and it still fails to
draw the circle on Linux
For the record: both OS X and Gtk are natively double buffered and
implementing your own buffering on these platforms is a waste of time
at best.
···
On 2/15/07, Dj Gilcrease <digitalxero@gmail.com> wrote:
I looked at FloatCanvas, but decided against it because it required
more external installs (numpy) for my end users, plus it, as far as I
could tell, does not support Alpha blending which I need for the
Circle and Fog layers.
As for it crashing on OS-X I bet thats due to the same reason it does
not work on Linux (Double Buffering does not yet work with
GraphicsContext on those platforms)
I use GraphicsContext on linux without a problem. Try use it directly
instead of creating a GCDC.
···
On 2/15/07, Dj Gilcrease <digitalxero@gmail.com> wrote:
On 2/15/07, Robin Dunn <robin@alldunn.com> wrote:
> There is still a couple holes in the GraphicsContext implementation on
> Linux, one of those is drawing bitmaps.
Ok, well I made an even more simplistic example which just draws a
circle onto the panel (No buffer not other junk) and it still fails to
draw the circle on Linux
Ok I have a another Drawing question now that I have started writing
some code. I have my code to a point that it draws some stuff works
well on windows, but fails to draw the 4 circles on Linux, but does
not output any errors to the console. So I was wondering if I am doing
something wrong or ?
FWIW, it crashes on OS-X
Yes, I know about this too. It used to work so it is a regression...
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
There is still a couple holes in the GraphicsContext implementation on
Linux, one of those is drawing bitmaps.
Ok, well I made an even more simplistic example which just draws a
circle onto the panel (No buffer not other junk) and it still fails to
draw the circle on Linux
Looks like another hole. Hopefully we'll get the Cairo backend for wxGraphicsContext up to scratch soon. BTW, if you drop down to the wx.GraphicsContext/wx.GraphicsPath API instead of wx.GCDC then drawing/filling circle paths works ok.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Looks like another hole. Hopefully we'll get the Cairo backend for
wxGraphicsContext up to scratch soon. BTW, if you drop down to the
wx.GraphicsContext/wx.GraphicsPath API instead of wx.GCDC then
drawing/filling circle paths works ok.