Zero in the alpha channel makes a pixel totally transparent, and 1.0 (255 when expressed as 8 bit int) makes it totally opaque.
I gather you want a partly transparent top image to be drawn over the bottom image.
// both images are opaque because JPEG has no alpha channel
p.
drawImage(QPoint(0,
0), bot
);
// drawn as-isp.setOpacity(0.2);
p.
drawImage(QPoint(0,
0), top
);
// drawn at 20% opacityp.end();
QImage top("top.jpg");
QImage bot("bottom.jpg");
// both images are opaque because JPEG has no alpha channel
QPixmap combined(bot.size());
QPainter p(&combined);
p.drawImage(QPoint(0, 0), bot); // drawn as-is
p.setOpacity(0.2);
p.drawImage(QPoint(0, 0), top); // drawn at 20% opacity
p.end();
To copy to clipboard, switch view to plain text mode
Bookmarks