Bitmap/MemoryDC weirdness

Hello,

I have this case where I create some wx.Bitmaps from wx.EmptyBitmaps
by drawing inside a wx.MemoryDC with a wx.GCDC for nice, antialiased
drawing.
These images are used to be drawn on another wx.MemoryDC.
If I use the bitmaps directly, the only thing that gets drawn on the
last MemoryDC are the bitmaps themselves. All the other drawings are
not represented. The background is GRAY.
If I do a:
bitmap.ConvertToImage().ConvertToBitmap()
everything draws up as it should.

Any idea what I might be doing wrong?

···

--
There is NO FATE, we are the creators.
blog: http://damoc.ro/

Peter Damoc wrote:

Hello,

I have this case where I create some wx.Bitmaps from wx.EmptyBitmaps
by drawing inside a wx.MemoryDC with a wx.GCDC for nice, antialiased
drawing.
These images are used to be drawn on another wx.MemoryDC.
If I use the bitmaps directly, the only thing that gets drawn on the
last MemoryDC are the bitmaps themselves. All the other drawings are
not represented. The background is GRAY.
If I do a:
bitmap.ConvertToImage().ConvertToBitmap()
everything draws up as it should.

Any idea what I might be doing wrong?

Not sure. Can you make a sample app that shows this problem?

···

--
Robin Dunn
Software Craftsman

I don't think so. I've tried for some cases and the bugs just don't show.

One thing I discovered. I used
mdc.SelectObject(wx.NullBitmap)
before using the bitmaps because I felt that this way the bitmap will
have nothing to do with the MemoryDC anymore.
commenting that line "removed" the bug.
I don't know if it helps but... maybe it provides a clue.

Peter

···

On Tue, Sep 1, 2009 at 7:49 PM, Robin Dunn<robin@alldunn.com> wrote:

Not sure. Can you make a sample app that shows this problem?

--
There is NO FATE, we are the creators.
blog: http://damoc.ro/

Peter Damoc wrote:

I don't think so. I've tried for some cases and the bugs just don't show.

One thing I discovered. I used
mdc.SelectObject(wx.NullBitmap)
before using the bitmaps because I felt that this way the bitmap will
have nothing to do with the MemoryDC anymore.

That is what should be done. DrawBitmap on Windows, for example, uses a temporary memory dc to do a Blit(), and a single bitmap can not be selected into more than one Dc at a time.

commenting that line "removed" the bug.
I don't know if it helps but... maybe it provides a clue.

Unfortunately it just makes me scratch my head even more...

···

--
Robin Dunn
Software Craftsman