File indexing completed on 2024-05-12 15:59:35
0001 /* 0002 * SPDX-FileCopyrightText: 2006 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef _KO_COLOR_TRANSFORMATION_H_ 0008 #define _KO_COLOR_TRANSFORMATION_H_ 0009 0010 #include <QHash> 0011 0012 #include "kritapigment_export.h" 0013 0014 class QVariant; 0015 class QString; 0016 0017 0018 /** 0019 * This is the base class of all color transform that takes n pixels in input 0020 * and n pixels in output. 0021 * 0022 * They are created by color spaces. 0023 * 0024 * For instance: 0025 * @code 0026 * KoColorSpace* cs = KoColorSpaceRegistry::rgb8(); 0027 * quint8 pixelsSrc[ nbpixels * cs->pixelSize() ]; 0028 * quint8 pixelsDst[ nbpixels * cs->pixelSize() ]; 0029 * KoColorTransformation* transfo = cs->createInvertTransformation(); 0030 * transfo->transform( pixelsSrc, pixelsDst, nbpixels ); 0031 * @endcode 0032 */ 0033 class KRITAPIGMENT_EXPORT KoColorTransformation 0034 { 0035 public: 0036 virtual ~KoColorTransformation(); 0037 /** 0038 * This function apply the transformation on a given number of pixels. 0039 * 0040 * @param src a pointer to the source pixels 0041 * @param dst a pointer to the destination pixels 0042 * @param nPixels the number of pixels 0043 * 0044 * This function may or may not be thread safe. You need to create one 0045 * KoColorTransformation per thread. 0046 */ 0047 virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const = 0; 0048 0049 /** 0050 * @return the list of parameters 0051 */ 0052 virtual QList<QString> parameters() const; 0053 /** 0054 * Get the parameter id for a parameter name 0055 */ 0056 virtual int parameterId(const QString& name) const; 0057 0058 void setParameters(const QHash<QString, QVariant> & parameters); 0059 /** 0060 * Update one parameter of a cached transformation object. 0061 * 0062 */ 0063 virtual void setParameter(int id, const QVariant& parameter); 0064 0065 /// @return true 0066 virtual bool isValid() const { return true; } 0067 }; 0068 0069 #endif