Warning, file /office/calligra/libs/pigment/KoCompositeColorTransformation.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) 2015 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program 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
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 #ifndef __KO_COMPOSITE_COLOR_TRANSFORMATION_H
0020 #define __KO_COMPOSITE_COLOR_TRANSFORMATION_H
0021 
0022 #include "KoColorTransformation.h"
0023 
0024 #include <QScopedPointer>
0025 
0026 
0027 /**
0028  * A class for storing a composite color transformation. All the
0029  * transformations added with appendTransform() are applied
0030  * sequentially to the process pixels.
0031  *
0032  * \p mode defines how the buffers are used while processing.
0033  *
0034  * When using INPLACE mode all transformations but the first one do
0035  * the conversion in place, that is in \p dst buffer. That is \p dst
0036  * is written at least N - 1 times, where N is the number of embedded
0037  * transformations.
0038  *
0039  * In BUFFERED mode all the transformations are called with distinct
0040  * src and dst buffers, which are created in temporary memory owned by
0041  * KoCompositeColorTransformation. Please note that this mode IS NOT
0042  * IMPLEMENTED YET!
0043  */
0044 class PIGMENTCMS_EXPORT KoCompositeColorTransformation : public KoColorTransformation
0045 {
0046 public:
0047     enum Mode {
0048         INPLACE = 0, /// transform pixels in place (in 'dst' buffer)
0049         BUFFERED /// transform using a temporary buffer (not implemented yet)
0050     };
0051 
0052 public:
0053     explicit KoCompositeColorTransformation(Mode mode);
0054     ~KoCompositeColorTransformation() override;
0055 
0056     void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override;
0057 
0058     /**
0059      * Append a transform to a composite. If \p transform is null,
0060      * nothing happens.
0061      */
0062     void appendTransform(KoColorTransformation *transform);
0063 
0064     /**
0065      * Convenience method that checks if the transformations in \p
0066      * transforms are not null and adds existent ones only. If there
0067      * is only one non-null transform, it is returned directly to
0068      * avoid extra virtual calls added by KoCompositeColorTransformation.
0069      */
0070     static KoColorTransformation* createOptimizedCompositeTransform(const QVector<KoColorTransformation*> transforms);
0071 
0072 private:
0073     struct Private;
0074     const QScopedPointer<Private> m_d;
0075 };
0076 
0077 #endif /* __KO_COMPOSITE_COLOR_TRANSFORMATION_H */