PDA

View Full Version : multi pixmap transparency



bluesguy82
9th August 2006, 16:19
I am trying to make a shaped widget. The problem is that I have 3 different images. One scalesWidth when another pixmap gets moved by the mouse. I was trying to use this (http://www.qtcentre.org/forum/p-a-very-difficult-animation-problemcan-qt4-solve-it-post9139/postcount10.html).
I can't get it to work great for one pixmap, but I have been unable to combine the pixmaps to create a single image for masking the whole. any thoughts?

e8johan
9th August 2006, 17:40
You should create a buffer bitmap that you paint the others onto, then use the buffer as a mask.

bluesguy82
21st August 2006, 21:36
I am new to Qt/C++. Could you give me a push in the right direction for the buffered bitmap?

jpn
21st August 2006, 22:13
QPixmap is a paint device like any other. You can construct an empty pixmap of appropriate size and then use QPainter to paint all three pixmaps on the constructed "buffer" pixmap.



QPixmap buffer(width, height);
// not sure, but you might need to fill the "buffer" with a transparent brush here
// ..
QPainter painter(&buffer);
painter.drawPixmap(pixmap1);
..
painter.drawPixmap(pixmap3);
setMask(buffer.mask());