NoQuiteFeynman
30th July 2013, 14:54
Hello
I wonder if you can assist. I'm running Qt Creator 2.7.0 based on Qt 5.0.2 using a Windows 7 Enterprise Intel Core 2 Duo E7200.
I'm a complete Newbie so please forgive my somewhat trivial query.
My aim is to superpose two .jpg images into a QPixmap.
However, I have followed others' suggestions (on this board) for an identical problem, and using their suggestions, I have tried the following code:
//.................................................. .................................................. ................................
// LOAD IMAGE
if (!fileName.isEmpty()) {
QImage image(fileName);
if (image.isNull()) {
QMessageBox::information(this, tr("Mammogram Viewer"),
tr("Cannot load %1.").arg(fileName));
return;
}
//.................................................. .................................................. ................................
QImage BottomMammogram(fileName);
BottomMammogram= BottomMammogram.convertToFormat(QImage::Format_ARG B32);
image.fill(qRgba(0,0,0,0));
QImage TopMammogram("C:/TopMammogram");
TopMammogram= TopMammogram.convertToFormat(QImage::Format_ARGB32 );
image.fill(qRgba(0,0,0,0));
painter1 = new QPainter;
img = new QPixmap(500, 500);
painter1->begin(img);
painter1->fillRect(img->rect(), Qt::transparent);
painter1->drawImage(0, 0, BottomMammogram); // puts BottomMammogram image into img
painter1->drawImage(50, 50, TopMammogram); // puts TopMammogram image into img
painter1->end();
imageLabel->setPixmap(*img);
imageLabel->show();
I have had no success with the above code, since the top Picture is completely opaque.
Any help would be gratefully appreciated.
Thank you in advance.
NotQuiteFeynman
I wonder if you can assist. I'm running Qt Creator 2.7.0 based on Qt 5.0.2 using a Windows 7 Enterprise Intel Core 2 Duo E7200.
I'm a complete Newbie so please forgive my somewhat trivial query.
My aim is to superpose two .jpg images into a QPixmap.
However, I have followed others' suggestions (on this board) for an identical problem, and using their suggestions, I have tried the following code:
//.................................................. .................................................. ................................
// LOAD IMAGE
if (!fileName.isEmpty()) {
QImage image(fileName);
if (image.isNull()) {
QMessageBox::information(this, tr("Mammogram Viewer"),
tr("Cannot load %1.").arg(fileName));
return;
}
//.................................................. .................................................. ................................
QImage BottomMammogram(fileName);
BottomMammogram= BottomMammogram.convertToFormat(QImage::Format_ARG B32);
image.fill(qRgba(0,0,0,0));
QImage TopMammogram("C:/TopMammogram");
TopMammogram= TopMammogram.convertToFormat(QImage::Format_ARGB32 );
image.fill(qRgba(0,0,0,0));
painter1 = new QPainter;
img = new QPixmap(500, 500);
painter1->begin(img);
painter1->fillRect(img->rect(), Qt::transparent);
painter1->drawImage(0, 0, BottomMammogram); // puts BottomMammogram image into img
painter1->drawImage(50, 50, TopMammogram); // puts TopMammogram image into img
painter1->end();
imageLabel->setPixmap(*img);
imageLabel->show();
I have had no success with the above code, since the top Picture is completely opaque.
Any help would be gratefully appreciated.
Thank you in advance.
NotQuiteFeynman