[Cairo] another set of Python bindings

Maarten Breddels dmon at xs4all.nl
Thu Sep 11 12:30:18 PDT 2003


> On Thu, Sep 11, 2003 at 07:30:51PM +0200, Maarten Breddels wrote:
> >I don't mind giving up my project if you feel you can give 
> maintain it
> >and think it does everything(or more) my binding does. I 
> don't support
> >fonts in my binding, and only tried it out on Windows. But linux/unix
> >shouldn't be a problem thanks to SWIG. I hope I have some time this
> >weekend(just started at university) to check out your binding.
> 
> One thing that caught my attention about your project, 
> Maarten, was that
> you had success using it with wxPython.  I am interested in 
> using cairo
> in my wxPython project as soon as I can.  How hard would it be to make
> that work in James's version?

I guess not too hard, as long as you can get to the raw color data.
The problem I had, was that I needed to convert from BGRA to RGB data.
I added a function to the pycairo binding for it. As you can see in the
example below.

-- begin code
def OnPaint(self, event):
	cairo.write32BGRAto24RGB(self.imageData, self.image24, WIDTH,
HEIGHT)
	self.image.SetData(self.image24)
	
	dc = wx.PaintDC(self)
	bitmap = self.image.ConvertToBitmap()
	dc.DrawBitmap(bitmap, 0, 0, False)
-- end code

Btw, are you using windows or linux or ... ?
I have a win32 installer executable ready for Python2.3

Maarten





More information about the cairo mailing list