1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-24 14:42:53 +02:00

* Added TomahawkUtils::tinted(QPixmap, QColor).

This commit is contained in:
Christian Muehlhaeuser
2014-09-02 05:29:28 +02:00
parent 199759cf26
commit 1006d1aa1d
2 changed files with 16 additions and 0 deletions

View File

@@ -947,6 +947,21 @@ squareCenterPixmap( const QPixmap& sourceImage )
}
QPixmap
tinted( const QPixmap& p, const QColor& tint )
{
QImage resultImage( p.size(), QImage::Format_ARGB32_Premultiplied );
QPainter painter( &resultImage );
painter.drawPixmap( 0, 0, p );
painter.setCompositionMode( QPainter::CompositionMode_Screen );
painter.fillRect( resultImage.rect(), tint );
painter.end();
resultImage.setAlphaChannel( p.toImage().alphaChannel() );
return QPixmap::fromImage( resultImage );
}
QImage
blurred( const QImage& image, const QRect& rect, int radius, bool alphaOnly, bool blackWhite )
{

View File

@@ -76,6 +76,7 @@ namespace TomahawkUtils
DLLEXPORT QPixmap addDropShadow( const QPixmap& sourceImage, const QSize& targetSize );
DLLEXPORT QPixmap squareCenterPixmap( const QPixmap& sourceImage );
DLLEXPORT QPixmap tinted( const QPixmap& pixmap, const QColor& tint );
DLLEXPORT QImage blurred( const QImage& image, const QRect& rect, int radius, bool alphaOnly = false, bool blackWhite = false );
DLLEXPORT void drawCompositedPopup( QWidget* widget, const QPainterPath& outline, const QColor& lineColor, const QBrush& backgroundBrush, qreal opacity );