File indexing completed on 2024-05-12 15:59:36

0001 /*
0002  *  SPDX-FileCopyrightText: 2005 Boudewijn Rempt <boud@valdyas.org>
0003  *  SPDX-FileCopyrightText: 2006-2007 Cyrille Berger <cberger@cberger.net>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  */
0007 #ifndef KO_CONVOLUTION_OP_H
0008 #define KO_CONVOLUTION_OP_H
0009 
0010 /**
0011  * Base class of a convolution operation. A convolution operation is
0012  * defined by sum(colors[i] * kernelValues[i]) / factor + offset). The
0013  * most well known convolution is the gaussian blur.
0014  *
0015  * You access the KoConvolutionOp of a colorspace by calling
0016  * KoColorSpace::convolutionOp.
0017  */
0018 class KoConvolutionOp
0019 {
0020 public:
0021     virtual ~KoConvolutionOp() { }
0022     /**
0023      * Convolve the colors.
0024      *
0025      * @param colors a pointer toward the source pixels
0026      * @param kernelValues the coefficient of the source pixels
0027      * @param dst the destination pixel
0028      * @param factor usually the factor is equal to the sum of kernelValues
0029      * @param offset the offset which is added to the result, useful
0030      *        when the sum of kernelValues is equal to 0
0031      * @param nColors the number of pixels in the colors array
0032      * @param channelFlags determines which channels are affected in pixel order
0033      *
0034      * This function is thread-safe.
0035      *
0036      */
0037     virtual void convolveColors(const quint8* const* colors, const qreal* kernelValues, quint8 *dst, qreal factor, qreal offset, qint32 nColors, const QBitArray & channelFlags) const = 0;
0038 };
0039 
0040 #endif