2

我在缩放和转换时遇到问题QGraphicsPixmapItem。我创建了图形编辑器,我在其中使用QGraphicsItem初始大小 100,100,之后我通过setTransform()方法调整和旋转它。

之后,我将存储此转换并将其用于我的另一个名为 player 的应用程序,在该应用程序中,我使用这些转换并在其上显示图像和视频,QgraphicsPixmapItem如果我设置缩放和setTransform图像清晰度的方法,我现在将用于显示图像其清晰度被破坏.

即使我缩放和转换它是否可以保持清晰。我使用的图像是 2560x1440 像素。任何帮助将不胜感激。

代码是:

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);
4

1 回答 1

2

您可以使用setTransformationMode函数来设置像素图项的转换模式。默认值为 Qt::FastTransformation。您应该将变换模式设置Qt::SmoothTransformation为启用双线性过滤,从而在缩放时产生更好的质量:

pixitem->setTransformationMode(Qt::SmoothTransformation);
于 2015-05-06T06:46:09.703 回答