Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions

QPixmapConvolutionFilter Class Reference
[
QtGui module]

The QPixmapConvolutionFilter class provides convolution filtering for pixmaps. More...

 #include <QPixmapConvolutionFilter>

Inherits QPixmapFilter.

This class was introduced in Qt 4.5.

Public Functions


Detailed Description

The QPixmapConvolutionFilter class provides convolution filtering for pixmaps.

QPixmapConvolutionFilter implements a convolution pixmap filter, which is applied when draw() is called. A convolution filter lets you distort an image by setting the values of a matrix of qreal values called its kernel. The matrix's values are usually between -1.0 and 1.0.

Example:

 QPixmapConvolutionFilter *myFilter = new QPixmapConvolutionFilter;
 qreal kernel[] = {
      0.0,-1.0, 0.0,
     -1.0, 5.0,-1.0,
      0.0,-1.0, 0.0
     };
 myFilter->setConvolutionKernel(kernel, 3, 3);
 myFilter->draw(painter, QPoint(0, 0), originalPixmap);

See also Pixmap Filters Example, QPixmapColorizeFilter, and QPixmapDropShadowFilter.


Member Function Documentation

QPixmapConvolutionFilter::QPixmapConvolutionFilter ()

Constructs a pixmap convolution filter.

By default there is no convolution kernel.

QPixmapConvolutionFilter::~QPixmapConvolutionFilter ()

Destructor of pixmap convolution filter.

void QPixmapConvolutionFilter::setConvolutionKernel ( const qreal * kernel, int rows, int columns )

Sets convolution kernel with the given number of rows and columns. Values from kernel are copied to internal data structure.

To preserve the intensity of the pixmap, the sum of all the values in the convolution kernel should add up to 1.0. A sum greater than 1.0 produces a lighter result and a sum less than 1.0 produces a darker and transparent result.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.5.0-rc1