PDA

View Full Version : How to flip QImage



lni
9th March 2009, 16:40
Hi,

I have a QImage, I need to flip vertically or horizontally or both depending on situation, but I got lost in the QTransform. I can use scanLine and flip myself, but I think QImage::transformed should do the job.

Can someone please tell me how?

Thanks

JimDaniel
9th March 2009, 16:45
I'm not sure the correct way to use it, but I've done this before:



QImage myImage("c:/myimage.png");
QTransform myTransform;
myTransform.rotate(180);
myImage = myImage.transformed(myTransform);

jpn
9th March 2009, 16:45
There is a simpler way, QImage::mirrored(). :)

wysota
9th March 2009, 17:03
Which is equivalent to QImage::scaled() with -1 parameter in the axis opposite to the one you want to mirror along.

lni
9th March 2009, 17:28
Thanks all!! Great features!