|
Krita Source Code Documentation
|
The KisConvolutionPainter class applies a convolution kernel to a paint device. More...
#include <kis_convolution_painter.h>
Inheritance diagram for KisConvolutionPainter:Public Types | |
| enum | EnginePreference { NONE , SPATIAL , FFTW } |
Public Types inherited from KisPainter | |
| enum | FillStyle { FillStyleNone , FillStyleForegroundColor , FillStyleBackgroundColor , FillStylePattern , FillStyleGenerator } |
| This enum contains the styles with which we can fill things like polygons and ellipses. More... | |
| enum | StrokeStyle { StrokeStyleNone , StrokeStyleBrush } |
| The style of the brush stroke around polygons and so. More... | |
Public Member Functions | |
| void | applyMatrix (const KisConvolutionKernelSP kernel, const KisPaintDeviceSP src, QPoint srcPos, QPoint dstPos, QSize areaSize, KisConvolutionBorderOp borderOp=BORDER_REPEAT) |
| KisConvolutionPainter () | |
| KisConvolutionPainter (KisPaintDeviceSP device) | |
| KisConvolutionPainter (KisPaintDeviceSP device, EnginePreference enginePreference) | |
| KisConvolutionPainter (KisPaintDeviceSP device, KisSelectionSP selection) | |
| bool | needsTransaction (const KisConvolutionKernelSP kernel) const |
| void | setEnginePreference (EnginePreference value) |
Public Member Functions inherited from KisPainter | |
| void | addDirtyRect (const QRect &r) |
| void | addDirtyRects (const QVector< QRect > &rects) |
| bool | antiAliasPolygonFill () |
| Return whether a polygon's filled area should be anti-aliased or not. | |
| void | applyDevice (const QRect &applyRect, const KisRenderedDab &dab, KisRandomAccessorSP dstIt, const KoColorSpace *srcColorSpace, KoCompositeOp::ParameterInfo &localParamInfo) |
| void | applyDeviceWithSelection (const QRect &applyRect, const KisRenderedDab &dab, KisRandomAccessorSP dstIt, KisRandomConstAccessorSP maskIt, const KoColorSpace *srcColorSpace, KoCompositeOp::ParameterInfo &localParamInfo) |
| const KoColor & | backgroundColor () const |
| Returns the current background color. | |
| void | begin (KisPaintDeviceSP device) |
| void | begin (KisPaintDeviceSP device, KisSelectionSP selection) |
| void | beginTransaction (const KUndo2MagicString &transactionName=KUndo2MagicString(), int timedID=-1) |
| Begin an undoable paint operation. | |
| void | bitBlt (const QPoint &pos, const KisPaintDeviceSP srcDev, const QRect &srcRect) |
| void | bitBlt (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight) |
| void | bitBltOldData (const QPoint &pos, const KisPaintDeviceSP srcDev, const QRect &srcRect) |
| void | bitBltOldData (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight) |
| void | bitBltWithFixedSelection (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 selX, qint32 selY, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight) |
| void | bitBltWithFixedSelection (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 srcWidth, qint32 srcHeight) |
| void | bltFixed (const QPoint &pos, const KisFixedPaintDeviceSP srcDev, const QRect &srcRect) |
| void | bltFixed (const QRect &rc, const QList< KisRenderedDab > allSrcDevices) |
| void | bltFixed (qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight) |
| void | bltFixedWithFixedSelection (qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 selX, qint32 selY, qint32 srcX, qint32 srcY, quint32 srcWidth, quint32 srcHeight) |
| void | bltFixedWithFixedSelection (qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, quint32 srcWidth, quint32 srcHeight) |
| const QVector< QPair< QPointF, QPointF > > | calculateAllMirroredPoints (const QPair< QPointF, QPointF > &pair) |
| const QVector< QPointF > | calculateAllMirroredPoints (const QPointF &pos) |
| const QVector< QRect > | calculateAllMirroredRects (const QRect &rc) |
| template<class T > | |
| QVector< T > | calculateMirroredObjects (const T &object) |
| QBitArray | channelFlags () |
| const KoCompositeOp * | compositeOp (const KoColorSpace *srcCS) |
| QString | compositeOpId () |
| Returns the current composite op Id. | |
| void | copyMirrorInformationFrom (const KisPainter *other) |
| void | deleteTransaction () |
| KisPaintDeviceSP | device () |
| const KisPaintDeviceSP | device () const |
| Returns the current paint device. | |
| void | drawDDALine (const QPointF &start, const QPointF &end) |
| void | drawLine (const QPointF &start, const QPointF &end) |
| void | drawLine (const QPointF &start, const QPointF &end, qreal width, bool antialias) |
| void | drawPainterPath (const QPainterPath &path, const QPen &pen) |
| void | drawPainterPath (const QPainterPath &path, const QPen &pen, const QRect &requestedRect) |
| void | drawThickLine (const QPointF &start, const QPointF &end, int startWidth, int endWidth) |
| void | drawWobblyLine (const QPointF &start, const QPointF &end) |
| void | drawWuLine (const QPointF &start, const QPointF &end) |
| void | end () |
| KUndo2Command * | endAndTakeTransaction () |
| void | endTransaction (KisPostExecutionUndoAdapter *undoAdapter) |
| void | endTransaction (KisUndoAdapter *undoAdapter) |
| Finish the undoable paint operation. | |
| void | fill (qint32 x, qint32 y, qint32 width, qint32 height, const KoColor &color) |
| void | fillPainterPath (const QPainterPath &path) |
| void | fillPainterPath (const QPainterPath &path, const QRect &requestedRect) |
| void | fillPainterPathImpl (const QPainterPath &path, const QRect &requestedRect) |
| FillStyle | fillStyle () const |
| Returns the current fill style. | |
| qreal | flow () const |
| const KisFilterConfigurationSP | generator () const |
| void | getBezierCurvePoints (const QPointF &pos1, const QPointF &control1, const QPointF &control2, const QPointF &pos2, vQPointF &points) const |
| const KoAbstractGradientSP | gradient () const |
| bool | hasDirtyRegion () const |
| bool | hasHorizontalMirroring () const |
| bool | hasMirroring () const |
| bool | hasVerticalMirroring () const |
| bool | isOpacityUnit () const |
| KisPainter () | |
| Construct painter without a device. | |
| KisPainter (KisPaintDeviceSP device) | |
| Construct a painter, and begin painting on the device. | |
| KisPainter (KisPaintDeviceSP device, KisSelectionSP selection) | |
| Construct a painter, and begin painting on the device. All actions will be masked by the given selection. | |
| void | mirrorDab (Qt::Orientation direction, KisRenderedDab *dab, bool skipMirrorPixels=false) const |
| void | mirrorRect (Qt::Orientation direction, QRect *rc) const |
| qreal | opacityF () const |
| Returns the opacity that is used in painting. | |
| void | paintAt (const KisPaintInformation &pos, KisDistanceInformation *savedDist) |
| void | paintBezierCurve (const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) |
| const KoColor & | paintColor () const |
| Returns the color that will be used to paint with. | |
| void | paintEllipse (const qreal x, const qreal y, const qreal w, const qreal h) |
| void | paintEllipse (const QRectF &rect) |
| void | paintLine (const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) |
| KisPaintOp * | paintOp () const |
| void | paintPainterPath (const QPainterPath &path) |
| void | paintPolygon (const vQPointF &points) |
| void | paintPolyline (const QVector< QPointF > &points, int index=0, int numPoints=-1) |
| void | paintRect (const qreal x, const qreal y, const qreal w, const qreal h) |
| void | paintRect (const QRectF &rect) |
| const KoPatternSP | pattern () const |
| Returns the currently set pattern. | |
| QTransform | patternTransform () |
| get the current transform on the pattern. | |
| KisPaintOpPresetSP | preset () const |
| Return the paintop preset. | |
| Private (KisPainter *_q) | |
| Private (KisPainter *_q, const KoColorSpace *cs) | |
| void | putTransaction (KisTransaction *transaction) |
| continue a transaction started somewhere else | |
| void | renderDabWithMirroringNonIncremental (QRect rc, KisPaintDeviceSP dab) |
| void | renderMirrorMask (QRect rc, KisFixedPaintDeviceSP dab) |
| void | renderMirrorMask (QRect rc, KisFixedPaintDeviceSP dab, KisFixedPaintDeviceSP mask) |
| void | renderMirrorMask (QRect rc, KisPaintDeviceSP dab) |
| void | renderMirrorMask (QRect rc, KisPaintDeviceSP dab, int sx, int sy, KisFixedPaintDeviceSP mask) |
| void | renderMirrorMaskSafe (QRect rc, KisFixedPaintDeviceSP dab, bool preserveDab) |
| void | renderMirrorMaskSafe (QRect rc, KisFixedPaintDeviceSP dab, KisFixedPaintDeviceSP mask, bool preserveDab) |
| void | renderMirrorMaskSafe (QRect rc, KisPaintDeviceSP dab, int sx, int sy, KisFixedPaintDeviceSP mask, bool preserveMask) |
| void | revertTransaction () |
| Cancel all the changes made by the painter. | |
| KisRunnableStrokeJobsInterface * | runnableStrokeJobsInterface () const |
| KisSelectionSP | selection () |
| void | setAntiAliasPolygonFill (bool antiAliasPolygonFill) |
| Set whether a polygon's filled area should be anti-aliased or not. The default is true. | |
| void | setAverageOpacity (qreal averageOpacity) |
| void | setBackgroundColor (const KoColor &color) |
| void | setChannelFlags (QBitArray channelFlags) |
| void | setColorConversionFlags (KoColorConversionTransformation::ConversionFlags conversionFlags) |
| void | setCompositeOpId (const KoCompositeOp *op) |
| void | setCompositeOpId (const QString &op) |
| Set the composite op for this painter by string. | |
| void | setFillStyle (FillStyle fillStyle) |
| Set the current style with which to fill. | |
| void | setFlow (qreal flow) |
| void | setGenerator (KisFilterConfigurationSP generator) |
| Set the current generator (a generator can be used to fill an area. | |
| void | setGradient (const KoAbstractGradientSP gradient) |
| void | setMaskImageSize (qint32 width, qint32 height) |
| void | setMirrorInformation (const QPointF &axesCenter, bool mirrorHorizontally, bool mirrorVertically) |
| void | setOpacityF (qreal opacity) |
| void | setOpacityToUnit () |
| void | setOpacityU8 (quint8 opacity) |
| Set the opacity which is used in painting (like filling polygons) | |
| void | setOpacityUpdateAverage (qreal opacity) |
| void | setPaintColor (const KoColor &color) |
| void | setPaintOpPreset (KisPaintOpPresetSP preset, KisNodeSP node, KisImageSP image) |
| void | setPattern (const KoPatternSP pattern) |
| Set the current pattern. | |
| void | setPatternTransform (QTransform transform) |
| Set the transform on the pattern. | |
| void | setProgress (KoUpdater *progressUpdater) |
| void | setRenderingIntent (KoColorConversionTransformation::Intent intent) |
| void | setRunnableStrokeJobsInterface (KisRunnableStrokeJobsInterface *interface) |
| void | setSelection (KisSelectionSP selection) |
| void | setStrokeStyle (StrokeStyle strokeStyle) |
| Set the current brush stroke style. | |
| StrokeStyle | strokeStyle () const |
| Returns the current brush stroke style. | |
| QVector< QRect > | takeDirtyRegion () |
| KisTransaction * | takeTransaction () |
| take transaction out of the reach of KisPainter | |
| bool | tryReduceSourceRect (const KisPaintDevice *srcDev, QRect *srcRect, qint32 *srcX, qint32 *srcY, qint32 *srcWidth, qint32 *srcHeight, qint32 *dstX, qint32 *dstY) |
| virtual | ~KisPainter () |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Static Public Member Functions | |
| static bool | supportsFFTW () |
Static Public Member Functions inherited from KisPainter | |
| static qreal | blendAverageOpacity (qreal opacity, qreal averageOpacity) |
| static bool | checkDeviceHasTransparency (KisPaintDeviceSP dev) |
| static KisPaintDeviceSP | convertToAlphaAsAlpha (KisPaintDeviceSP src) |
| static KisPaintDeviceSP | convertToAlphaAsGray (KisPaintDeviceSP src) |
| static KisPaintDeviceSP | convertToAlphaAsPureAlpha (KisPaintDeviceSP src) |
| static void | copyAreaOptimized (const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect) |
| static void | copyAreaOptimized (const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect, KisSelectionSP selection) |
| static void | copyAreaOptimizedOldData (const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect) |
Private Member Functions | |
| template<class factory > | |
| KisConvolutionWorker< factory > * | createWorker (const KisConvolutionKernelSP kernel, KisPainter *painter, KoUpdater *progress) |
| bool | useFFTImplementation (const KisConvolutionKernelSP kernel) const |
Private Attributes | |
| EnginePreference | m_enginePreference |
Friends | |
| class | KisConvolutionPainterTest |
The KisConvolutionPainter class applies a convolution kernel to a paint device.
Note: https://bugs.kde.org/show_bug.cgi?id=220310 shows that there's something here that we need to fix...
Definition at line 29 of file kis_convolution_painter.h.
| Enumerator | |
|---|---|
| NONE | |
| SPATIAL | |
| FFTW | |
Definition at line 38 of file kis_convolution_painter.h.
| KisConvolutionPainter::KisConvolutionPainter | ( | ) |
Definition at line 97 of file kis_convolution_painter.cc.
| KisConvolutionPainter::KisConvolutionPainter | ( | KisPaintDeviceSP | device | ) |
Definition at line 103 of file kis_convolution_painter.cc.
| KisConvolutionPainter::KisConvolutionPainter | ( | KisPaintDeviceSP | device, |
| KisSelectionSP | selection ) |
Definition at line 109 of file kis_convolution_painter.cc.
| KisConvolutionPainter::KisConvolutionPainter | ( | KisPaintDeviceSP | device, |
| EnginePreference | enginePreference ) |
Definition at line 115 of file kis_convolution_painter.cc.
| void KisConvolutionPainter::applyMatrix | ( | const KisConvolutionKernelSP | kernel, |
| const KisPaintDeviceSP | src, | ||
| QPoint | srcPos, | ||
| QPoint | dstPos, | ||
| QSize | areaSize, | ||
| KisConvolutionBorderOp | borderOp = BORDER_REPEAT ) |
Convolve all channels in src using the specified kernel; there is only one kernel for all channels possible.
WARNING: The painter will read more pixels than you pass in areaSize. The actual processing area will be: QRect(x - kernel.width() / 2, y - kernel.height() / 2, w + 2 * (kernel.width() / 2), h + 2 * (kernel.height() / 2))
The border op decides what to do with pixels too close to the edge of the rect as defined above.
The channels flag determines which set out of color channels, alpha channels. channels we convolve.
Note that we do not (currently) support different kernels for different channels or channel types.
If you want to convolve a subset of the channels in a pixel, set those channels with KisPainter::setChannelFlags();
Force BORDER_IGNORE op for the wraparound mode, because the paint device has its own special iterators, which do everything for us.
We don't use defaultBounds->topLevelWrapRect(), because the main purpose of this wrapping is "getting expected results when applying to the layer". If a mask is bigger than the image, then it should be wrapped around the mask instead.
FIXME: Implementation can return empty destination device on faults and has no way to report this. This will cause a crash on sequential convolutions inside iterators.
o implementation should do it's work or assert otherwise (or report the issue somehow) o check other cases of the switch for the vulnerability
Definition at line 126 of file kis_convolution_painter.cc.
References BORDER_IGNORE, BORDER_REPEAT, bounds, KisConvolutionWorker< _IteratorFactory_ >::execute(), KIS_SAFE_ASSERT_RECOVER, and KisPainter::progressUpdater.
|
private |
Definition at line 66 of file kis_convolution_painter.cc.
References useFFTImplementation().
| bool KisConvolutionPainter::needsTransaction | ( | const KisConvolutionKernelSP | kernel | ) | const |
The caller should ask if the painter needs an explicit transaction iff the source and destination devices coincide. Otherwise, the transaction is just not needed.
Definition at line 183 of file kis_convolution_painter.cc.
References useFFTImplementation().
| void KisConvolutionPainter::setEnginePreference | ( | EnginePreference | value | ) |
Definition at line 121 of file kis_convolution_painter.cc.
References m_enginePreference, and value().
|
static |
Definition at line 87 of file kis_convolution_painter.cc.
|
private |
Definition at line 46 of file kis_convolution_painter.cc.
References FFTW, KisConvolutionKernel::height(), m_enginePreference, NONE, and KisConvolutionKernel::width().
|
friend |
Definition at line 84 of file kis_convolution_painter.h.
|
private |
Definition at line 97 of file kis_convolution_painter.h.