[Interest] building a retina QPixmap from a non-retina QImage
Paul Miller
paul at fxtech.com
Fri Apr 4 00:02:40 CEST 2014
I'm algorithmically building a QImage at double resolution, and I want
to build a retina-capable QPixmap from it.
Say for instance I want to make a retina-capable image at 100x100
logical pixels. So I create a QImage at 200x200, draw some stuff into,
then I want to convert it to a QPixmap at 100x100 with a
devicePixelRatio of 2.
Doing this...
QImage image(200, 200, ...)
// draw into image
image.setDevicePixelRatio(2.0f);
QPixmap pixmap = QPixmap::fromImage(image);
...doesn't seem to yield the proper image.
Is that all that is necessary, or did I miss a step?
More information about the Interest
mailing list