1st) declare external QT routine:
QT_BEGIN_NAMESPACE
extern Q_WIDGETS_EXPORT void qt_blurImage( QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0 );
QT_END_NAMESPACE
2nd) Use:
extern QImage srcImg;//source image
QPixmap pxDst( srcImg.size() );//blurred destination
pxDst.fill( Qt::transparent );
{
QPainter painter( &pxDst );
qt_blurImage( &painter, srcImg, 2, true, false );//blur radius: 2px
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…