[Qt-interest] Getting color-distorted images when I add to a scene
Cole, Derek
dcole at integrity-apps.com
Tue Feb 1 17:51:11 CET 2011
Hello,
I have the following code:
processedData = yd->decompose();
QImage *qi = new QImage(imwidth, imheight, QImage::Format_RGB888);
for (int h = 0; h<imheight; h++){
memcpy(qi->scanLine(h), processedData[h], imwidth*3);
}
QList<QGraphicsItem *> itemList = scene.items();
while(!itemList.isEmpty()){
scene.removeItem(itemList.last());
itemList.removeLast();
}
QPixmap p(QPixmap::fromImage(*qi,Qt::AutoColor));
item = new ImagePixmapItem(p);
scene.addItem(item);
ui->graphicsView->setScene(&scene);
ui->graphicsView->show();
connect(item,SIGNAL(eventReceived(QGraphicsSceneHoverEvent*)),SLOT(on_eventReceived(QGraphicsSceneHoverEvent*)));
proj = new RigorousProjection(reader);
delete qi;
processedData is my RGB888 data coming from my class function. I have another similar method that gives me a different set of processedData. However, if I call one function right afte the other, my scene gets an image in it that has the coloring all messed up. For instance, if I run the first algorithm, I get an image who looks primarily green (correct), i run the second, and I get the different image, but the colors are like in a neon green instead of what they are supposed to. I put in that code to try to remove all QGraphicsItems from the scene, but it did not correct the issue. Any thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110201/2a4bc165/attachment.html
More information about the Qt-interest-old
mailing list