Thanks Robin,
So I see, I create a MemoryDC and SelectObject a bitmap onto it. Then
when I blit the panel DC onto the MemoryDC, the bitmap becomes a
bitmap 'picture' of the panel DC. So I can then scale this bitmap
which scales by panel picture, and then blit that onto the printer DC.
So as I see it, the bitmap object I originally created remains a
pointer to a location in memory, the SelectObject function associates
that pointer with the MemoryDC, and the Blit function copies data into
the same location that the bitmap points to in memory. Or maybe I'm a
little off.
Whew. A little bit of voodoo here, this is where wxPython shows its C roots.
Heres what I did if anyone else is interested. It works just fine,it
just temporarily uses an awful lot of memory:
def OnPrintPage(self, pgno):
dc = self.GetDC()
dc.StartDoc("Start")
dc.StartPage()
printerWidth, printerHeight = dc.GetSizeTuple()
panelDC = wx.WindowDC(self.panel1)
panelWidth, panelHeight = panelDC.GetSizeTuple()
bm = wx.EmptyBitmap(panelWidth, panelHeight)
temp_dc = wx.MemoryDC()
temp_dc.SelectObject(bm)
temp_dc.Blit(wx.Point(0,0), wx.Size(panelWidth, panelHeight),
panelDC, wx.Point(0,0))
image = wx.ImageFromBitmap(bm)
image.Rescale(printerWidth, printerHeight)
bm2 = wx.BitmapFromImage(image)
dc.DrawBitmap(bm2, wx.Point(0,0))
dc.EndPage()
dc.EndDoc()