I need to mirror a image. I have that part accomplished, but the original image goes away in my image area when this function is called. I saved the original image and using QPainter drew the original then the mirrored, thinking both images would be composited. I'm still only getting the mirrored image. I want both the mirrored and the original image on my one image area. Here's what I have so far.
QImage* Original= mImage; //original image
QImage reflection = mImage->mirrored(true,false);//mirror the original image
QPainter painter(mImage);
painter.CompositionMode_DestinationOver;
painter.drawImage(0, 0, *mImage);
painter.drawImage(0, 0, reflection);
painter.end();
QPainter::CompositionMode_DestinationOver
The alpha of the destination is used to blend it on top of the source pixels.
If your image doesn't have an alpha channel you won't see any difference.
Besides, you have other issues in your code.
painter.end();
is unnecessarypainter.setCompositionMode();
QPainter painter(mImage);
painter.setCompositionMode(QPainter::CompositionMode_DestinationOver);
painter.drawImage(0, 0, reflection);