[Qt-interest] Get raw data from QImage
Cole, Derek
dcole at integrity-apps.com
Thu Apr 28 01:33:47 CEST 2011
Hello,
I have populated a QGraphicsPixmapItem with an image using code similar to the following:
QImage *qi = new QImage(imwidth, imheight, QImage::Format_RGB32);
for (int i = 0 ; i < imheight ; i++)
{
for (int j = 0 ; j < imwidth ; j++)
{
qi->setPixel(j,i,qRgb(imageData[i*imwidth+j],imageData[i*imwidth+j],imageData[i*imwidth+j]));
}
}
QPixmap p(QPixmap::fromImage(*qi,Qt::AutoColor));
if(scene.items().contains(item)){
scene.removeItem(item);
item->~QGraphicsItem();
}
item = new ImagePixmapItem(p);
scene.addItem(item);
Now I want to get the data back from one of those QGraphicsItems and I am using some code like this to get the QImage of a particular part of the image:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110427/a1d61091/attachment.html
More information about the Qt-interest-old
mailing list