QPixmapColorizeFilter Class

The QPixmapColorizeFilter class provides colorizing filtering for pixmaps. More...

Header: #include <QPixmapColorizeFilter>
Inherits: QPixmapFilter

Public Functions

QPixmapColorizeFilter(QObject *parent = nullptr)
virtual ~QPixmapColorizeFilter()
QColor color() const
void setColor(const QColor &color)
void setStrength(qreal strength)
qreal strength() const

Reimplemented Public Functions

virtual void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const override

Detailed Description

\since4.5 \ingroup painting

A colorize filter gives the pixmap a tint of its color(). The filter first grayscales the pixmap and then converts those to colorized values using QPainter::CompositionMode_Screen with the chosen color. The alpha-channel is not changed.

Example:

 QPixmapColorizeFilter *myFilter = new QPixmapColorFilter;
 myFilter->setColor(QColor(128, 0, 0));
 myFilter->draw(painter, QPoint(0, 0), originalPixmap);

\internal

See also QPainter::CompositionMode.

Member Function Documentation

QPixmapColorizeFilter::QPixmapColorizeFilter(QObject *parent = nullptr)

Constructs an pixmap colorize filter.

Default color value for colorizing is QColor(0, 0, 192).

\internal

[virtual noexcept] QPixmapColorizeFilter::~QPixmapColorizeFilter()

\internal

QColor QPixmapColorizeFilter::color() const

Gets the color of the colorize filter.

\internal

See also setColor().

[override virtual] void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const

\internal

void QPixmapColorizeFilter::setColor(const QColor &color)

Sets the color of the colorize filter to the color specified.

\internal

See also color().

void QPixmapColorizeFilter::setStrength(qreal strength)

Sets the strength of the colorize filter to strength.

\internal

See also strength().

qreal QPixmapColorizeFilter::strength() const

Gets the strength of the colorize filter, 1.0 means full colorized while 0.0 equals to no filtering at all.

\internal

See also setStrength().