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

0001 /*
0002  *  SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #ifndef _KO_FALL_BACK_COLOR_TRANSFORMATION_H_
0008 #define _KO_FALL_BACK_COLOR_TRANSFORMATION_H_
0009 
0010 #include "KoColorTransformation.h"
0011 
0012 #include "kritapigment_export.h"
0013 
0014 class KoColorSpace;
0015 class KoColorConversionTransformation;
0016 
0017 /**
0018  * Use this color transformation to encapsulate another KoColorTransformation
0019  * and perform a color conversion before and after using that KoColorTransformation.
0020  */
0021 class KRITAPIGMENT_EXPORT KoFallBackColorTransformation : public KoColorTransformation
0022 {
0023 public:
0024     /**
0025      * Create a fall back color transformation using the given two color
0026      * spaces. This constructor will initialize his own color conversion
0027      * objects.
0028      *
0029      * The created object takes owner ship of the transormation and will
0030      * take charge of deleting it.
0031      *
0032      * @param cs color space of the source and destination pixels
0033      * @param fallBackCS color space use natively by the color transformation
0034      * @param transfo the color transformation (working in the fallback color space)
0035      */
0036     KoFallBackColorTransformation(const KoColorSpace* _cs, const KoColorSpace* _fallBackCS, KoColorTransformation* _transfo);
0037     /**
0038      * Creates a fall back color transformation using the two transformations
0039      * given as parameters. The created object take ownership of the
0040      * conversion and the color transformations and will be in charge of
0041      * deleting them.
0042      *
0043      * @param csToFallBack transformation from the color space to the fallback
0044      * @param fallBackToCs transformation from the fallback to the color space
0045      * @param transfo the color transformation (working in the fallback color space)
0046      */
0047     KoFallBackColorTransformation(KoColorConversionTransformation* _csToFallBack, KoColorConversionTransformation* _fallBackToCs, KoColorTransformation* _transfo);
0048     ~KoFallBackColorTransformation() override;
0049     void transform(const quint8 *src, quint8 *dst, qint32 nPixels) const override;
0050     QList<QString> parameters() const override;
0051     int parameterId(const QString& name) const override;
0052     void setParameter(int id, const QVariant& parameter) override;
0053 private:
0054     struct Private;
0055     Private* const d;
0056 };
0057 
0058 #endif