-->

缩放和转换Qgraphicspixmapitem(Scaled and transform Qgra

2019-10-23 00:45发布

我有一个问题,而缩放和转换QGraphicsPixmapItem 。 我已经创建,其中我使用图形编辑器QGraphicsItem初始大小100100和后,我调整大小和通过转动它setTransform()方法。

在那之后,我存储这个变换和使用这些我在我使用的变换和展示它的图像和视频的另一个应用程序调用播放器,我使用QgraphicsPixmapItem现在显示的图像,如果我设置缩放和setTransform方法,以图像的清晰度被宠坏了。

是否有可能保持清晰,因为它是就算我缩放和转换我使用的后援图像是2560×1440像素。 任何帮助将不胜感激。

该代码是:

QGraphicsPixmapItem *pixitem = new QGraphicsPixmapItem;
pixitem->setFlags(QGraphicsItem::ItemIsMovable);
pixitem->setPos(50,50);
QTransform trans;
trans.setMatrix(4.20399,2.9286,0,-3.86601,0.761397,0,33.1015,-134.5,1);
pixitem->setPixmap(QPixmap("abc.jpg").scaled(100,100));
pixitem->setTransform(trans);
pixitem->setShapeMode(QGraphicsPixmapItem::MaskShape);
scene->addItem(pixitem);

Answer 1:

您可以使用setTransformationMode函数来设置图片项目的改造模式。 默认值是Qt::FastTransformation 。 你应该设置的转换模式Qt::SmoothTransformation使双线性过滤缩放时这会导致更好的质量:

pixitem->setTransformationMode(Qt::SmoothTransformation);


文章来源: Scaled and transform Qgraphicspixmapitem