当前位置:网站首页>QT drawpixmap and DrawImage blur problem
QT drawpixmap and DrawImage blur problem
2022-04-23 05:27:00 【Oriental forgetfulness】
drawPixmap and drawImage When the picture is displayed , If the picture has zoom , There will be ambiguity , For example, a 100x100
The picture of is displayed to 30x30 Region , At this time, there will be blur . as follows :
Actual picture :
This problem is the pixel distortion caused by the display of large images into small images .
When we're in 1080 A clear picture is displayed on the screen 2k Blurred images may also appear on the screen , The reason is also the distortion of scaling pixels caused by large images being displayed as small images or larger images .
resolvent : According to the size to be displayed , Our code scales it in advance , Prevent it from scaling automatically .
QPainter p(this);
p.setPen(QColor(208,208,208));
p.setBrush(Qt::white);
p.setRenderHint(QPainter::Antialiasing);
QPainterPath path;
path.addEllipse(this->rect());
p.setClipPath(path);
p.drawEllipse(this->rect());
qreal pixelRatio = p.device()->devicePixelRatioF(); // Get the resolution ratio of different displays , Prevent image distortion at different resolutions
m_logopix = m_logopix.scaled(QSize(width() * pixelRatio, height() *pixelRatio)
, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);// Zoom the picture to the display size at the current resolution ,SmoothTransformation Smoothing .
p.drawPixmap(this->rect(),m_logopix);
The effect after treatment is as follows :
版权声明
本文为[Oriental forgetfulness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220543307494.html
边栏推荐
- d.ts---更详细的知识还是需要看官网的介绍(声明文件章节)
- 史上最强egg框架的error处理机制
- selenium預先加載cookie的必要性
- [no title] Click the classification jump page to display the details
- Uncle wolf is looking for a translator -- Plato -- ongoing translation
- Uniapp wechat sharing
- Solve the problem of JS calculation accuracy
- Executable program execution process
- Phlli in a VM node
- Box collapse and margin collapse
猜你喜欢
Excel 2016 cannot open the file for the first time. Sometimes it is blank and sometimes it is very slow. You have to open it for the second time
弘玑|数字化时代下,HR如何进行自我变革和组织变革?
Excel 2016 打开文件第一次打不开,有时空白,有时很慢要打开第二次才行
Domain driven model DDD (III) -- using saga to manage transactions
2021-11-01
Laravel routing job
C#测试调用PaddleSharp模块识别图片文字
Kanban Quick Start Guide
Blender programmed terrain production
2021-10-25
随机推荐
Study notes: unity customsrp-11-post processing --- bloom
Use of ES6 array
The main difference between pointer and reference
Understand the relationship between promise async await
What are the reasons for the failure of digital transformation?
史上最强egg框架的error处理机制
Self incrementing sequence creation of MySQL
[untitled]
Escape characters \ splicing of data formats
Why can't V-IF and V-for be used together
JS array common methods
Laravel [view]
d. TS --- for more detailed knowledge, please refer to the introduction on the official website (chapter of declaration document)
Phlli in a VM node
Multi process model in egg -- egg document Porter
Laravel implements the Holy Grail model with template inheritance
狼叔来找翻译人员了--plato--持续翻译中.....
The 2021 IT industry project management survey report was released!
egg的static的前缀是可以修改惹,靴靴
The prefix of static of egg can be modified, including boots