PDA

View Full Version : how to rotate an image...



sh123
15th January 2009, 13:10
I want to know how to rotate an image.I have searched the forum but could find what i want.please help.

xenofanes
15th January 2009, 15:13
You can use QGraphicsPixmapItem. QGraphicsItem has rotate(angle) method.
This piece of code can be usefull.


QGraphicsScene *scene = new QGraphicsScene();
QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(QPixmap("image.bmp"));
scene->addItem(pixmapItem);
...
pixmapItem->rotate(15);


And read the qassistant for further need...

caduel
15th January 2009, 15:59
vague question... vague answer...

you can create a QMatrix (or a QTransform) for your rotation angle and then rotate your image (assuming you have a QImage) with QImage::transformed()

HTH