hello wxGurus,
I am author of Magic Garden (http://magicgarden.sf.net).
I use Python and wxPython in my project.
I use following code for saving PNG files:
dc = wx.ClientDC(panel)
w,h = dc.GetSize()
memory = wx.MemoryDC( )
bitmap = wx.EmptyBitmap( w, h )
memory.SelectObject( bitmap )
memory.Blit( 0, 0, w, h, dc, 0, 0)
memory.SelectObject( wx.NullBitmap)
filename="renders/render_"+str(self.render_counter)+".png";
bitmap.SaveFile( filename, wx.BITMAP_TYPE_PNG)
For some reason, it works incorrectly.
If you start Magic Garden and then:
- load example plant (any)
- go to the genotypes page
- click “render”
You will notice, that rendered panel looks OK, but when you open stored PNG file (in renders/ subdirectory) you will notice trash on bottom and right margins.
I think that for some reason this Blit copies smaller array than expected.
So instead w * h rectangle I got something like (w-2)*(h-2) rectangle.
I tried to modify code, tried different sizes of panel and memory buffer, but can’t find good solution and don’t really understand what is wrong.
Could you give me an example of code which saves panel into PNG file?
Or better - could you try find bug in my code?
···
–
Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net