当前位置:网站首页>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
边栏推荐
- 領域驅動模型DDD(三)——使用Saga管理事務
- TSlint注释忽略错误和RESTful理解
- Graphics. Fromimage reports an error "graphics object cannot be created from an image that has an indexed pixel..."
- Traversal array, object parent-child communication props / $emit
- String class understanding - final is immutable
- Uniapp hot update with progress bar
- Implementation of resnet-34 CNN with kears
- Understand the relationship between promise async await
- On the use of constant pointer and pointer constant -- exercise (record)
- Low code and no code considerations
猜你喜欢
Low code and no code considerations
弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器
Five key technologies to improve the devsecops framework
what is wifi6?
2021-10-08
Three 之 three.js (webgl)旋转属性函数的简单整理,以及基于此实现绕轴旋转的简单案例
Top 25 Devops tools in 2021 (Part 2)
Laravel database
The title bar will be pushed to coincide with the status bar
Fast application fuzzy search
随机推荐
egg中的cors和proxy(づ ̄3 ̄)づ╭~踩坑填坑的过程~ToT~
Data bus realizes the communication between brother components
d.ts---更详细的知识还是需要看官网的介绍(声明文件章节)
Use pagoda + Xdebug + vscode to debug code remotely
弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器
[triangle Yang Hui triangle printing odd even cycle JS for break cycle]
Implementation of resnet-34 CNN with kears
WTL self drawn control library (cqscheckcomboxbox)
CPT 104_TTL 09
egg的static的前缀是可以修改惹,靴靴
史上最强egg框架的error处理机制
Five key technologies to improve the devsecops framework
[untitled] Notepad content writing area
Three of three JS (webgl) simple sorting of rotation attribute function, and a simple case of rotating around the axis based on this
Three 之 three.js (webgl)模型的删除/场景的清空/内存的释放 的简单整理
Study notes: unity customsrp-13-colorgrading
2021-10-25
String class understanding - final is immutable
Arithmetic and logical operations
Output string in reverse order