Hi, I'm trying to draw a high resolution image when device pixel ratio is set 
to 2x (to display nicely on a 4K monitor).It works fine if I draw a pixmap 
directly on a painter:
int pixelRatio = 2;QPixmap myImage = ...;auto pxm = myImage.scaled(imgDiameter 
* pixelRatio, imgDiameter * pixelRatio, Qt::IgnoreAspectRatio, 
Qt::SmoothTransformation);pxm.setDevicePixelRatio(pixelRatio);painter->drawPixmap(QPoint(xPos,
 yPos), pxm);
However since I need images to be drawn on top of irregular shapes I use the 
brush:int pixelRatio = 2;QPixmap myImage = ...;auto oldBrush = 
painter->brush();auto pxm = myImage.scaled(imgDiameter * pixelRatio, 
imgDiameter * pixelRatio, Qt::IgnoreAspectRatio, 
Qt::SmoothTransformation);pxm.setDevicePixelRatio(pixelRatio);QBrush 
brush(pxm);painter->setPen(Qt::NoPen);painter->setBrush(brush);painter->setBrushOrigin(xPos,
 yPos);painter->drawEllipse(xPos, yPos, imgDiameter, 
imgDiameter);painter->setBrush(oldBrush);
When the brush is getting filled it appears that it doesn't adhere to pixmap's 
devicePixelRatio, so the pixmap inside the shape is twice as big.
Is there something wrong with what I'm doing?
Thanks,Pavlo
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to