QPainter to draw custom-size image

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_42237844/article/details/102740404

QPainter to draw pictures using drawPixmap interfaces, qt offers two rendering mode, the interface is as follows:

1. First, the incoming draw points, left corner of the picture is the anchor point, how to draw big picture, if you need to modify the image size, the scale can be QPixmap method for image to zoom, but the scale method use, picture resolution will be reduced.

2. The second, pass a rectangle, this method of drawing out of the picture size is set by the size of the rectangle, the image will be scaled to the size of QPixmap QRect within the scope of re-rendering, picture resolution will not change much.

The second approach is recommended to draw

Guess you like

Origin blog.csdn.net/qq_42237844/article/details/102740404