[PyKDE] Python C extension to manipulate QImage

Phil Thompson phil at riverbankcomputing.co.uk
Fri May 23 21:05:00 BST 2003


On Friday 23 May 2003 7:42 pm, Maxwell Sayles wrote:
> Hi,
> 	In C, I can load an image using QImage and then access its bits using
> img.bits().  the bits() method is not, however, supported in PyQt.  Is
> there a way I can either get the QImage pointer in my C extension?  or get
> access to the value returned by bits() in python, which I can then pass on
> to my C extension?

I could implement bits() (and scanLine(), jumpTable() and colorTable()) to 
return void*. You then have the choice of passing the Python object to your 
extension and calling sipConvertToVoidPtr() to extract the address, or using 
the Python int() on the object to convert it to an integer before passing to 
your extension.

Phil




More information about the PyQt mailing list