Hi all,

>From the PyQt docs on QImage :

        uchar *bits();

        The return value is a sip.voidptr object which is only useful if passed to
        another Python module.

I'm using the following (swig-ed) to get the bits of the QImage as a
python raw string so I can manipulate it later using PIL or using it as a
texture in PyOpenGL. Where data_ptr, n = qimage.bits(), qimage.numBytes()

        PyObject *pointer_to_pystring(long data_ptr, int n)
        {
            return PyString_FromStringAndSize(data_ptr, n);
        }

This works for me(TM) but I wonder if this should be added/included in
PyQt by default. Probably under a different name to avoid surprises,
something like "bits_pystr()" or so.

Of course, you may say, if we do this for bits() we should do it for all
the other funcs returning sip.voidptr ...

Any commments/flames on this?

Best regards.

--roberto



_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to