Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qpixmapfilter.cpp File Reference
#include <qglobal.h>
#include <QDebug>
#include "qpainter.h"
#include "qpixmap.h"
#include "qpixmapfilter_p.h"
#include "qvarlengtharray.h"
#include "private/qguiapplication_p.h"
#include "private/qpaintengineex_p.h"
#include "private/qpaintengine_raster_p.h"
#include "qmath.h"
#include "private/qmath_p.h"
#include "private/qmemrotate_p.h"
#include "private/qdrawhelper_p.h"
#include <memory>
#include "moc_qpixmapfilter_p.cpp"
+ Include dependency graph for qpixmapfilter.cpp:

Go to the source code of this file.

Classes

class  QPixmapFilterPrivate
 
class  QPixmapConvolutionFilterPrivate
 
class  QPixmapBlurFilterPrivate
 
class  QPixmapColorizeFilterPrivate
 
class  QPixmapDropShadowFilterPrivate
 

Macros

#define Z_MASK   (0xff << zprec)
 
#define ZA_MASK   (0xff << (zprec + aprec))
 
#define AVG(a, b)   ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) )
 
#define AVG16(a, b)   ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) )
 

Functions

static void convolute (QImage *destImage, const QPointF &pos, const QImage &srcImage, const QRectF &srcRect, QPainter::CompositionMode mode, qreal *kernel, int kernelWidth, int kernelHeight)
 
template<int shift>
int qt_static_shift (int value)
 
template<int aprec, int zprec>
void qt_blurinner (uchar *bptr, int &zR, int &zG, int &zB, int &zA, int alpha)
 
template<int aprec, int zprec>
void qt_blurinner_alphaOnly (uchar *bptr, int &z, int alpha)
 
template<int aprec, int zprec, bool alphaOnly>
void qt_blurrow (QImage &im, int line, int alpha)
 
template<int aprec, int zprec, bool alphaOnly>
void expblur (QImage &img, qreal radius, bool improvedQuality=false, int transposed=0)
 
Q_WIDGETS_EXPORT QImage qt_halfScaled (const QImage &source)
 
Q_WIDGETS_EXPORT void qt_blurImage (QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed=0)
 
Q_WIDGETS_EXPORT void qt_blurImage (QImage &blurImage, qreal radius, bool quality, int transposed=0)
 
Q_GUI_EXPORT bool qt_scaleForTransform (const QTransform &transform, qreal *scale)
 
static void grayscale (const QImage &image, QImage &dest, const QRect &rect=QRect())
 

Variables

const qreal radiusScale = qreal(2.5)
 
const int alphaIndex = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3)
 

Macro Definition Documentation

◆ AVG

#define AVG (   a,
  b 
)    ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) )

Definition at line 735 of file qpixmapfilter.cpp.

◆ AVG16

#define AVG16 (   a,
  b 
)    ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) )

Definition at line 736 of file qpixmapfilter.cpp.

◆ Z_MASK

#define Z_MASK   (0xff << zprec)

◆ ZA_MASK

#define ZA_MASK   (0xff << (zprec + aprec))

Function Documentation

◆ convolute()

static void convolute ( QImage destImage,
const QPointF pos,
const QImage srcImage,
const QRectF srcRect,
QPainter::CompositionMode  mode,
qreal kernel,
int  kernelWidth,
int  kernelHeight 
)
static

Definition at line 275 of file qpixmapfilter.cpp.

References QRectF::adjusted(), QRect::bottom(), QImage::bytesPerLine(), cb, QPainter::CompositionMode_Source, QImage::convertToFormat(), QImage::format(), QImage::Format_ARGB32_Premultiplied, QImage::height(), i, QRectF::isNull(), kernel, QRect::left(), QRectF::moveTo(), output, pix, pos, qBound(), QImage::rect(), rect, QRect::right(), QImage::scanLine(), QRectF::toAlignedRect(), QRect::top(), QRect::topLeft(), QImage::width(), QPoint::x(), and QPoint::y().

Referenced by QPixmapConvolutionFilter::draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expblur()

template<int aprec, int zprec, bool alphaOnly>
void expblur ( QImage img,
qreal  radius,
bool  improvedQuality = false,
int  transposed = 0 
)

Definition at line 660 of file qpixmapfilter.cpp.

References QImage::bits(), QImage::bytesPerLine(), e, QImage::Format_ARGB32_Premultiplied, QImage::Format_Grayscale8, QImage::Format_Indexed8, QImage::Format_RGB32, QImage::height(), i, Q_ASSERT, qPow(), qRound(), QImage::setDevicePixelRatio(), and QImage::width().

+ Here is the call graph for this function:

◆ grayscale()

static void grayscale ( const QImage image,
QImage dest,
const QRect rect = QRect() 
)
static

Definition at line 910 of file qpixmapfilter.cpp.

References QImage::bits(), QRect::bottom(), QImage::height(), i, QRect::left(), QRect::moveTo(), qAlpha(), qGray(), qRgba(), QImage::rect(), rect, QRect::right(), QImage::scanLine(), QImage::size(), QRect::top(), and QImage::width().

Referenced by QPixmapColorizeFilter::draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_blurImage() [1/2]

Q_WIDGETS_EXPORT void qt_blurImage ( QImage blurImage,
qreal  radius,
bool  quality,
int  transposed = 0 
)

Definition at line 856 of file qpixmapfilter.cpp.

References QImage::format(), QImage::Format_Grayscale8, and QImage::Format_Indexed8.

+ Here is the call graph for this function:

◆ qt_blurImage() [2/2]

Q_WIDGETS_EXPORT void qt_blurImage ( QPainter p,
QImage blurImage,
qreal  radius,
bool  quality,
bool  alphaOnly,
int  transposed = 0 
)

Definition at line 829 of file qpixmapfilter.cpp.

References QImage::convertToFormat(), QImage::deviceIndependentSize(), QImage::format(), QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, QImage::height(), qt_halfScaled(), QPainter::SmoothPixmapTransform, QSizeF::toSize(), and QImage::width().

Referenced by QPixmapDropShadowFilter::draw(), and QPixmapBlurFilter::draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_blurinner()

template<int aprec, int zprec>
void qt_blurinner ( uchar bptr,
int &  zR,
int &  zG,
int &  zB,
int &  zA,
int  alpha 
)
inline

Definition at line 570 of file qpixmapfilter.cpp.

References QRgb, qt_static_shift(), Z_MASK, and ZA_MASK.

+ Here is the call graph for this function:

◆ qt_blurinner_alphaOnly()

template<int aprec, int zprec>
void qt_blurinner_alphaOnly ( uchar bptr,
int &  z,
int  alpha 
)
inline

Definition at line 603 of file qpixmapfilter.cpp.

◆ qt_blurrow()

template<int aprec, int zprec, bool alphaOnly>
void qt_blurrow ( QImage im,
int  line,
int  alpha 
)
inline

Definition at line 612 of file qpixmapfilter.cpp.

References alphaIndex, QImage::depth(), QImage::format(), QImage::Format_Indexed8, line, QImage::scanLine(), and QImage::width().

+ Here is the call graph for this function:

◆ qt_halfScaled()

Q_WIDGETS_EXPORT QImage qt_halfScaled ( const QImage source)

Definition at line 738 of file qpixmapfilter.cpp.

References AVG, AVG16, QImage::bits(), QImage::bytesPerLine(), QImage::convertToFormat(), QImage::format(), QImage::Format_ARGB32_Premultiplied, QImage::Format_ARGB8565_Premultiplied, QImage::Format_Grayscale8, QImage::Format_Indexed8, QImage::Format_RGB32, QImage::height(), p1, p2, QImage::setDevicePixelRatio(), and QImage::width().

Referenced by qt_blurImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_scaleForTransform()

Q_GUI_EXPORT bool qt_scaleForTransform ( const QTransform transform,
qreal scale 
)

Definition at line 2301 of file qtransform.cpp.

Referenced by cubicTo_clipped().

+ Here is the caller graph for this function:

◆ qt_static_shift()

template<int shift>
int qt_static_shift ( int  value)
inline

Definition at line 559 of file qpixmapfilter.cpp.

References shift().

Referenced by qt_blurinner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ alphaIndex

const int alphaIndex = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3)

Definition at line 600 of file qpixmapfilter.cpp.

Referenced by qt_blurrow().

◆ radiusScale