wxGraphicsContext and printing

Hello !

I’ve made a canvas using wxGraphicsContext and I need to print drawing I make with my canvas

How can I do it??
wxPrinterDC don’t work with wxGraphicsContext

Seb

Sébastien Ramage wrote:

Hello !

I've made a canvas using wxGraphicsContext and I need to print drawing I make with my canvas

How can I do it??
wxPrinterDC don't work with wxGraphicsContext

wxGraphicsContext is still new and doesn't have printer support yet. The best that can be done currently is to render the context to a bitmap using a wx.MemoryDC and then print the bitmap using the normal print framework

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

yes it can be a good alternative
can you give me a example of the use of wx.MemoryDC ? because I’ve tried to render into a memoryDC and then blit it on the printerdc but it didn’t work

thank you

Seb

···

2007/6/7, Robin Dunn robin@alldunn.com:

Sébastien Ramage wrote:

Hello !

I’ve made a canvas using wxGraphicsContext and I need to print drawing I
make with my canvas

How can I do it??
wxPrinterDC don’t work with wxGraphicsContext

wxGraphicsContext is still new and doesn’t have printer support yet.
The best that can be done currently is to render the context to a bitmap
using a wx.MemoryDC and then print the bitmap using the normal print

framework


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org

Sébastien Ramage wrote:

yes it can be a good alternative
can you give me a example of the use of wx.MemoryDC ? because I've tried to render into a memoryDC and then blit it on the printerdc but it didn't work

You can try using DrawBitmap instead of blitting. Maybe something like this:

  bmp = wx.EmptyBitmap(width, height)
  dc = wx.MemoryDC(bmp)
  self.DoDrawing(dc)
  del dc

  printerDC.DrawBitmap(bmp, 0,0)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

thanks you, it works !

I have do this :

bmp = wx.EmptyBitmap(width, height)
dc = wx.MemoryDC(bmp)
dc.SelectObject(bmp)
self.DoDrawing(dc)

printerDC.DrawBitmap(bmp, 0,0)

Seb

···

2007/6/8, Robin Dunn robin@alldunn.com:

Sébastien Ramage wrote:

yes it can be a good alternative
can you give me a example of the use of wx.MemoryDC ? because I’ve tried
to render into a memoryDC and then blit it on the printerdc but it

didn’t work

You can try using DrawBitmap instead of blitting. Maybe something like
this:

    bmp = wx.EmptyBitmap(width, height)
    dc = wx.MemoryDC(bmp)
    self.DoDrawing

(dc)
del dc

    printerDC.DrawBitmap(bmp, 0,0)


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org