Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt - QImage is there a method to paste Qimage into another Qimage?

Tags:

qt

qimage

I am looking for a way to simply paste some Qimage into bigger one, starting with some given (x,y). Now, I am copying pixel by pixel all Qimage.

like image 337
John X Avatar asked Aug 30 '10 16:08

John X


1 Answers

QImage srcImage = QImage(100, 100);
QImage destImage = QImage(200, 200);
QPoint destPos = QPoint(25, 25);  // The location to draw the source image within the dest

srcImage.fill(Qt::red);
destImage.fill(Qt::white);

QPainter painter(&destImage);
painter.drawImage(destPos, srcImage);
painter.end();
like image 179
PhotoMonkee Avatar answered Sep 27 '22 19:09

PhotoMonkee