PDA

View Full Version : How can I extract raw data from a QPixmap?



ricardo
13th September 2009, 13:51
Hi dudes!

After doing a sprite sheet creator, I'd like to convert it from PNG (actually a QPixmap on memory) to PVR (a propietary iPhone compressed format).

Creating a PVR texture with PVRLib requires evidently I pass it a pointer to my image, using raw format. It is similar to glTexImage2D and its "const GLvoid *pixels" parameter.

My question is how can I extract a raw image or pointer from a QPixmap? Or should I convert this QPixmap to QImage or QPicture....?
After reading docs I don't see anything, or maybe I'm blind :)

Thanks a lot for your help.

ricardo
16th September 2009, 01:36
Anyone?

Please...

aamer4yu
16th September 2009, 06:13
Am not sure but may be QImage::bits might be of some use to you

scascio
16th September 2009, 09:31
yes that's it.

Since QPixmap is dedicated to display , QImage is for pixel access and it can be uses as a wrapper of some buffer when using the constructor that takes char* in argument.

Be aware of QBitmap copies, in passing or returning arguments when manipulating data.