another GC question/problem. I am working on the render-to-surface system for fc2. I do it like shown here, attached is also the modified "GraphicsContext" demo which exhibits the behaviour I describe below (don't let the weird graphics confuse you, only the empty part at the bottom of the image is of interest).
# create a bigger bitmap and render to it
bitmap2 = wx.EmptyBitmap( 800, 800 )
dc.SelectObject( bitmap2 )
# ... draw into gc here ...
# blit to screen
paint_dc.Blit(0, 0, 800, 800, dc, 0, 0)
As long as bitmap2 is smaller than bitmap everything works just fine. But when bitmap2 is bigger than bitmap the lower portion of bitmap2 remains empty.
Is this a bug somewhere (maybe some clipping region not updated/graphics context doesn't notice the underlying bitmap of the memory dc has changed) or is this a fundamential limitation? It's pretty crucial for the render-to-surface feature that I can render to a different bitmap than my main framebuffer. I cannot easily create two (or lots more) GCs, because the drawing uses cached graphics pathes and such. Plus I expect multiple gcs to be a bit too heavyweight.
another GC question/problem. I am working on the render-to-surface system for fc2. I do it like shown here, attached is also the modified "GraphicsContext" demo which exhibits the behaviour I describe below (don't let the weird graphics confuse you, only the empty part at the bottom of the image is of interest).
# create a bigger bitmap and render to it
bitmap2 = wx.EmptyBitmap( 800, 800 )
dc.SelectObject( bitmap2 )
# ... draw into gc here ...
# blit to screen
paint_dc.Blit(0, 0, 800, 800, dc, 0, 0)
As long as bitmap2 is smaller than bitmap everything works just fine. But when bitmap2 is bigger than bitmap the lower portion of bitmap2 remains empty.
Is this a bug somewhere (maybe some clipping region not updated/graphics context doesn't notice the underlying bitmap of the memory dc has changed) or is this a fundamential limitation?
My guess is that changing the properties of the DC (by selecting a new and differently sized bitmap into it) after the GC has been created is confusing GDI+.
It's pretty crucial for the render-to-surface feature that I can render to a different bitmap than my main framebuffer. I cannot easily create two (or lots more) GCs, because the drawing uses cached graphics pathes and such.
The paths and other classes are independent of the GC so AFAIK there is no need to always use the same GC with them. You should be able to create new GCs as you need them and use the saved paths, matrices and etc. with them.
Plus I expect multiple gcs to be a bit too heavyweight.
Maybe, but probably not as much as you think.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
It's pretty crucial for the render-to-surface feature that I can render to a different bitmap than my main framebuffer. I cannot easily create two (or lots more) GCs, because the drawing uses cached graphics pathes and such.
The paths and other classes are independent of the GC so AFAIK there is no need to always use the same GC with them. You should be able to create new GCs as you need them and use the saved paths, matrices and etc. with them.
Ahh ok. I was assuming that objects created with a specific gc are local to it. I'll just try creating multiple GCs then and see how it goes.
Plus I expect multiple gcs to be a bit too heavyweight.
It works. My assumption was a bit silly. I didn't recall that the various wxGraphicsContext::Create* methods point to the wxGraphicsRenderer::Create* methods and since there is only one wxGraphicsRenderer instance all GCs share the path objects and thus it works.
Thanks for your help Robin!
-Matthias
···
Am 09.08.2008, 11:05 Uhr, schrieb Nitro <nitro@dr-code.org>:
It's pretty crucial for the render-to-surface feature that I can render to a different bitmap than my main framebuffer. I cannot easily create two (or lots more) GCs, because the drawing uses cached graphics pathes and such.
The paths and other classes are independent of the GC so AFAIK there is no need to always use the same GC with them. You should be able to create new GCs as you need them and use the saved paths, matrices and etc. with them.
Ahh ok. I was assuming that objects created with a specific gc are local to it. I'll just try creating multiple GCs then and see how it goes.