QT4如何模糊QPixmap图像? [英] QT4 How to blur QPixmap image?

查看:1116
本文介绍了QT4如何模糊QPixmap图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



<$>

QT4如何模糊QPixmap图像?

<$> p $ p> 模糊(象素图);
painter.Blur();
painter.Blur(rect);

最好的方法是什么?

解决方案

1st)声明外部QT例程:

  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

第二种)使用:

  extern QImage srcImg; //源图像
QPixmap pxDst(srcImg.size()); //模糊目标
pxDst.fill(Qt :: transparent );
{
QPainter画家(& pxDst);
qt_blurImage(& painter,srcImg,2,true,false); //模糊半径:2px
}


QT4 How to blur QPixmap image?

I am looking for something like one of the following:

Blur(pixmap); 
painter.Blur(); 
painter.Blur(rect);

What is the best way to do this?

解决方案

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
  }

这篇关于QT4如何模糊QPixmap图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆