当前位置:网站首页>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
边栏推荐
- Membarrier (personal learning and understanding)
- 史上最强egg框架的error处理机制
- Phlli in a VM node
- (十一)vscode代码格式化配置
- Redis in node -- ioredis
- Interpretation of common SQL statements
- 2021-09-27
- How to realize adaptive layout
- Click the Add button - a box appears (similar to adding learning experience - undergraduate - Graduate)
- 日志简介和构建web应用
猜你喜欢

phphphphphphphp

Camera imaging + homography transformation + camera calibration + stereo correction

On the use of constant pointer and pointer constant -- exercise (record)

2021-10-08

Three 之 three.js (webgl)旋转属性函数的简单整理,以及基于此实现绕轴旋转的简单案例

弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器

Fast application fuzzy search
![[the background color changes after clicking a line]](/img/3a/709d47fd3a370d86569fb9b560b403.png)
[the background color changes after clicking a line]

uni使用的一些坑

Uncle wolf is looking for a translator -- Plato -- ongoing translation
随机推荐
CPT 104_TTL 09
弘玑|数字化时代下,HR如何进行自我变革和组织变革?
Edit, cancel, pull up menu
Uncle wolf is looking for a translator -- Plato -- ongoing translation
(11) Vscode code formatting configuration
日志简介和构建web应用
Use of uniapp native plug-ins
Uniapp hot update with progress bar
Getting started with varnish
Error handling mechanism of the strongest egg framework in history
Wbpack configuring production development environment
selenium预先加载cookie的必要性
Watch depth monitoring mode
C#测试调用PaddleSharp模块识别图片文字
Low code and no code considerations
WTL self drawn control library (cqscheckcomboxbox)
Fast application fuzzy search
Basic knowledge of redis
Double click The jar package cannot run the solution
(十一)vscode代码格式化配置