mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +00:00
high api: draw image with antialiasing
This commit is contained in:
parent
0362e8e35f
commit
3aa76886d0
1
bgl.cc
1
bgl.cc
|
@ -350,6 +350,7 @@ namespace
|
||||||
result.fill( 0 ); // Black transparent
|
result.fill( 0 ); // Black transparent
|
||||||
|
|
||||||
QPainter painter( &result );
|
QPainter painter( &result );
|
||||||
|
painter.setRenderHint(QPainter::RenderHint::Antialiasing);
|
||||||
|
|
||||||
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
|
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
|
||||||
img.height() == max ? 0 : ( max - img.height() ) / 2 ),
|
img.height() == max ? 0 : ( max - img.height() ) / 2 ),
|
||||||
|
|
|
@ -257,7 +257,7 @@ bool Class::loadIconFromFile( QString const & _filename, bool isFullName )
|
||||||
result.fill( 0 ); // Black transparent
|
result.fill( 0 ); // Black transparent
|
||||||
|
|
||||||
QPainter painter( &result );
|
QPainter painter( &result );
|
||||||
|
painter.setRenderHint(QPainter::RenderHint::Antialiasing);
|
||||||
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
|
painter.drawImage( QPoint( img.width() == max ? 0 : ( max - img.width() ) / 2,
|
||||||
img.height() == max ? 0 : ( max - img.height() ) / 2 ),
|
img.height() == max ? 0 : ( max - img.height() ) / 2 ),
|
||||||
img );
|
img );
|
||||||
|
|
|
@ -161,7 +161,7 @@ IconButton::IconButton(QWidget *parent)
|
||||||
void IconButton::paintEvent(QPaintEvent *)
|
void IconButton::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
painter.setRenderHint(QPainter::RenderHint::Antialiasing);
|
||||||
QRect pixmapRect = QRect(0, 0, m_pixmap.width(), m_pixmap.height());
|
QRect pixmapRect = QRect(0, 0, m_pixmap.width(), m_pixmap.height());
|
||||||
pixmapRect.moveCenter(rect().center());
|
pixmapRect.moveCenter(rect().center());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue