QPixmap being clipped after rotation
Code:
rotate_image_implace(img, angle); //rotate the img with angle degrees(90, 180, 270 and so on)
graph_pixmap_
->setPixmap
(QPixmap::fromImage(img
));
graph_scene_->setSceneRect(img.rect());
type of graph_pixmap_ is QGraphicsPixmapItem
type of graph_scene_ is QGraphicsScene
type of graph_view_ is QGraphicsView
This may clip the image if their height and width are different, how could I rotate the image without clipping it?
Because the program need to save the image after rotating and mirror(vertical and horizontal), rotation of QGraphicsPixmapItem is not adopted.
Re: QPixmap being clipped after rotation
You cannot rotate an x by y rectangular image without scaling and put it back into the same x by y space except in the limited case of a 180 degree rotation about the image centre. Assuming (because you have not shown us the code that you use to do this rotation) you are rotating about the centre of the x by y image then the rotated image will always fit in a square image sqrt(x*x + y*y) pixels on a side. Alternatively you can compute the minimal size of image you need to place the result in with simple trigonometry.