File indexing completed on 2024-05-19 04:27:23

0001 /*
0002  *  SPDX-FileCopyrightText: 2005 Boudewijn Rempt <boud@valdyas.org>
0003  * SPDX-FileCopyrightText: 2021 L. E. Segovia <amy@amyspark.me> *
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  */
0007 
0008 #ifndef _KOCOLORSPACE_P_H_
0009 #define _KOCOLORSPACE_P_H_
0010 
0011 #include "KoColorSpace.h"
0012 #include "KoColorSpaceEngine.h"
0013 #include "KoColorConversionTransformation.h"
0014 #include <QPair>
0015 #include <QThreadStorage>
0016 #include <QPolygonF>
0017 
0018 struct Q_DECL_HIDDEN KoColorSpace::Private {
0019     /**
0020      * Returns the thread-local conversion cache. If it doesn't exist
0021      * yet, it is created. If it is currently too small, it is resized.
0022      */
0023     struct ThreadLocalCache {
0024         QVector<quint8> * get(quint32 size)
0025         {
0026             QVector<quint8> * ba = 0;
0027             if (!m_cache.hasLocalData()) {
0028                 ba = new QVector<quint8>(size, '0');
0029                 m_cache.setLocalData(ba);
0030             } else {
0031                 ba = m_cache.localData();
0032                 if ((quint8)ba->size() < size)
0033                     ba->resize(size);
0034             }
0035             return ba;
0036         }
0037     private:
0038         QThreadStorage<QVector<quint8>*> m_cache;
0039     };
0040 
0041 
0042     QString id;
0043     quint32 idNumber;
0044     QString name;
0045     QHash<QString, KoCompositeOp*> compositeOps;
0046     QList<KoChannelInfo *> channels;
0047     KoMixColorsOp* mixColorsOp;
0048     KoConvolutionOp* convolutionOp;
0049     QHash<QString, QMap<DitherType, KisDitherOp*>> ditherOps;
0050 
0051     mutable ThreadLocalCache conversionCache;
0052     mutable ThreadLocalCache channelFlagsApplicationCache;
0053 
0054     mutable KoColorConversionTransformation* transfoToRGBA16;
0055     mutable KoColorConversionTransformation* transfoFromRGBA16;
0056     mutable KoColorConversionTransformation* transfoToLABA16;
0057     mutable KoColorConversionTransformation* transfoFromLABA16;
0058     
0059     QPolygonF gamutXYY;
0060     QPolygonF TRCXYY;
0061     QVector <qreal> colorants;
0062     QVector <qreal> lumaCoefficients;
0063 
0064     KoColorSpaceEngine *iccEngine;
0065 
0066     Deletability deletability;
0067 };
0068 
0069 #endif