>  > the only
>  > way I found to do it is to call saveAsPNG and re-open with PIL Image
>  > or wx.Image...
>  > Is there any faster and better way to do it ?
>
>  Yes. FloatCanvas is fully double-buffered, so what is displayed on the
>  screen is stored in an offscreen bitmap:
>
>  Canvas._Buffer
>
>  it's a wx.Bitmap, and you can turn it into a wx.Image with \:
>
>  Canvas._Buffer.ConvertToImage()
>

i originally had a similar problem, in that i wanted the bytes of a
png image of everything i was drawing with floatcanvas, so i do this

I = wx.ImageFromBitmap(Canvas._ForgroundBuffer)
pil = Image.new('RGB', (I.GetWidth(),I.GetHeight())
pil.fromstring(I.GetData())
imageData = StringIO.StringIO()
pil.save(imageData,format='PNG',optimize=True)
return imageData.getvalue()

not sure if it's useful to you, but I hope that helps.
--
Jehiah
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to