Krita Source Code Documentation
Loading...
Searching...
No Matches
KoLabColorSpace.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2006 Cyrille Berger <cberger@cberger.net>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7#ifndef KOLABCOLORSPACE_H
8#define KOLABCOLORSPACE_H
9
10#include <QColor>
11
12#include "KoSimpleColorSpace.h"
15
16struct KoLabU16Traits;
17
21class KoLabColorSpace : public KoSimpleColorSpace<KoLabU16Traits>
22{
23
24public:
25
27
28 ~KoLabColorSpace() override;
29
30 static QString colorSpaceId();
31
32 virtual KoColorSpace* clone() const;
33
34 void fromQColor(const QColor& color, quint8 *dst) const override;
35
36 void toQColor(const quint8 *src, QColor *c) const override;
37
38 void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
39 QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
40 void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
41 QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
42 quint8 scaleToU8(const quint8 * srcPixel, qint32 channelIndex) const override;
43 void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const qint32 selectedChannelIndex) const override;
44 void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const QBitArray selectedChannels) const override;
45
46private:
47
48 static const quint32 CHANNEL_L = 0;
49 static const quint32 CHANNEL_A = 1;
50 static const quint32 CHANNEL_B = 2;
51 static const quint32 CHANNEL_ALPHA = 3;
52 static const quint32 MAX_CHANNEL_L = 0xff00;
53 static const quint32 MAX_CHANNEL_AB = 0xffff;
54 static const quint32 CHANNEL_AB_ZERO_OFFSET = 0x8000;
55
56
57};
58
60{
61
62public:
63
66 i18n("L*a*b* (16-bit integer/channel, unmanaged)"),
67 true,
70 }
71
72 KoColorSpace *createColorSpace(const KoColorProfile *) const override {
73 return new KoLabColorSpace();
74 }
75
76};
77
78#endif
qreal v
qreal u
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
KoColorSpace * createColorSpace(const KoColorProfile *) const override
static const quint32 MAX_CHANNEL_L
void toQColor(const quint8 *src, QColor *c) const override
void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const qint32 selectedChannelIndex) const override
static const quint32 CHANNEL_ALPHA
QVector< double > fromHSY(qreal *hue, qreal *sat, qreal *luma) const override
QVector< double > fromYUV(qreal *y, qreal *u, qreal *v) const override
static const quint32 CHANNEL_A
static const quint32 CHANNEL_AB_ZERO_OFFSET
~KoLabColorSpace() override
static const quint32 CHANNEL_L
static const quint32 CHANNEL_B
virtual KoColorSpace * clone() const
void toYUV(const QVector< double > &channelValues, qreal *y, qreal *u, qreal *v) const override
static QString colorSpaceId()
void fromQColor(const QColor &color, quint8 *dst) const override
void toHSY(const QVector< double > &channelValues, qreal *hue, qreal *sat, qreal *luma) const override
static const quint32 MAX_CHANNEL_AB
quint8 scaleToU8(const quint8 *srcPixel, qint32 channelIndex) const override