Warning, file /office/calligra/libs/pigment/KoColorTransformation.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef _KO_COLOR_TRANSFORMATION_H_
0021 #define _KO_COLOR_TRANSFORMATION_H_
0022 
0023 #include <QHash>
0024 
0025 #include "pigment_export.h"
0026 
0027 class QVariant;
0028 class QString;
0029 
0030 
0031 /**
0032  * This is the base class of all color transform that takes n pixels in input
0033  * and n pixels in output.
0034  *
0035  * They are created by color spaces.
0036  *
0037  * For instance:
0038  * @code
0039  * KoColorSpace* cs = KoColorSpaceRegistry::rgb8();
0040  * quint8 pixelsSrc[ nbpixels * cs->pixelSize() ];
0041  * quint8 pixelsDst[ nbpixels * cs->pixelSize() ];
0042  * KoColorTransformation* transfo = cs->createInvertTransformation();
0043  * transfo->transform( pixelsSrc, pixelsDst, nbpixels );
0044  * @endcode
0045  */
0046 class PIGMENTCMS_EXPORT KoColorTransformation
0047 {
0048 public:
0049     virtual ~KoColorTransformation();
0050     /**
0051      * This function apply the transformation on a given number of pixels.
0052      *
0053      * @param src a pointer to the source pixels
0054      * @param dst a pointer to the destination pixels
0055      * @param nPixels the number of pixels
0056      *
0057      * This function may or may not be thread safe. You need to create one
0058      * KoColorTransformation per thread.
0059      */
0060     virtual void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const = 0;
0061 
0062     /**
0063      * @return the list of parameters
0064      */
0065     virtual QList<QString> parameters() const;
0066     /**
0067      * Get the parameter id for a parameter name
0068      */
0069     virtual int parameterId(const QString& name) const;
0070 
0071     void setParameters(const QHash<QString, QVariant> & parameters);
0072     /**
0073      * Update one parameter of a cached transformation object.
0074      *
0075      */
0076     virtual void setParameter(int id, const QVariant& parameter);
0077 
0078     /// @return true
0079     virtual bool isValid() const { return true; }
0080 };
0081 
0082 #endif