Krita Source Code Documentation
Loading...
Searching...
No Matches
LabU8ColorSpace.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006 Cyrille Berger <cberger@cberger.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef LabU8ColorSpace_H_
8#define LabU8ColorSpace_H_
9
10#include "LcmsColorSpace.h"
12
13#define TYPE_LABA_8 (COLORSPACE_SH(PT_Lab) | CHANNELS_SH(3) | BYTES_SH(1) | EXTRA_SH(1))
14
15struct KoLabU8Traits;
16
17class LabU8ColorSpace : public LcmsColorSpace<KoLabU8Traits>
18{
19public:
20 LabU8ColorSpace(const QString &name, KoColorProfile *p);
21 bool willDegrade(ColorSpaceIndependence independence) const override;
22
23 static QString colorSpaceId()
24 {
25 return QStringLiteral("LABAU8");
26 }
27
28 KoID colorModelId() const override
29 {
30 return LABAColorModelID;
31 }
32
33 KoID colorDepthId() const override
34 {
36 }
37
38 virtual KoColorSpace* clone() const;
39 void colorToXML(const quint8* pixel, QDomDocument& doc, QDomElement& colorElt) const override;
40 void colorFromXML(quint8* pixel, const QDomElement& elt) const override;
41 void toHSY(const QVector<double> &channelValues, qreal *hue, qreal *sat, qreal *luma) const override;
42 QVector <double> fromHSY(qreal *hue, qreal *sat, qreal *luma) const override;
43 void toYUV(const QVector<double> &channelValues, qreal *y, qreal *u, qreal *v) const override;
44 QVector <double> fromYUV(qreal *y, qreal *u, qreal *v) const override;
45 quint8 scaleToU8(const quint8 * srcPixel, qint32 channelIndex) const override;
46 void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const qint32 selectedChannelIndex) const override;
47 void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const QBitArray selectedChannels) const override;
48};
49
51{
52public:
54
55 bool userVisible() const override
56 {
57 return true;
58 }
59
60 QString id() const override
61 {
63 }
64
65 QString name() const override
66 {
67 return QString("%1 (%2)").arg(LABAColorModelID.name()).arg(Integer8BitsColorDepthID.name());
68 }
69
70 KoID colorModelId() const override
71 {
72 return LABAColorModelID;
73 }
74
75 KoID colorDepthId() const override
76 {
78 }
79
80 int referenceDepth() const override
81 {
82 return 8;
83 }
84
86 {
87 return new LabU8ColorSpace(name(), p->clone());
88 }
89
90 QString defaultProfile() const override
91 {
92 return "Lab identity built-in";
93 }
94};
95
96#endif
const Params2D p
qreal v
qreal u
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
ColorSpaceIndependence
#define TYPE_LABA_8
Definition KoID.h:30
QString name() const
Definition KoID.cpp:68
QString id() const override
KoID colorModelId() const override
KoID colorDepthId() const override
int referenceDepth() const override
QString defaultProfile() const override
KoColorSpace * createColorSpace(const KoColorProfile *p) const override
bool userVisible() const override
QString name() const override
quint8 scaleToU8(const quint8 *srcPixel, qint32 channelIndex) const override
QVector< double > fromHSY(qreal *hue, qreal *sat, qreal *luma) const override
void toYUV(const QVector< double > &channelValues, qreal *y, qreal *u, qreal *v) const override
static QString colorSpaceId()
bool willDegrade(ColorSpaceIndependence independence) const override
QVector< double > fromYUV(qreal *y, qreal *u, qreal *v) const override
void convertChannelToVisualRepresentation(const quint8 *src, quint8 *dst, quint32 nPixels, const qint32 selectedChannelIndex) const override
void colorToXML(const quint8 *pixel, QDomDocument &doc, QDomElement &colorElt) const override
void toHSY(const QVector< double > &channelValues, qreal *hue, qreal *sat, qreal *luma) const override
KoID colorDepthId() const override
void colorFromXML(quint8 *pixel, const QDomElement &elt) const override
KoID colorModelId() const override
virtual KoColorSpace * clone() const
LabU8ColorSpace(const QString &name, KoColorProfile *p)