Krita Source Code Documentation
Loading...
Searching...
No Matches
KoDumbColorDisplayRenderer Class Reference

#include <KoColorDisplayRendererInterface.h>

+ Inheritance diagram for KoDumbColorDisplayRenderer:

Public Member Functions

KoColor approximateFromRenderedQColor (const QColor &c) const override
 
KoColor fromHsv (int h, int s, int v, int a=255) const override
 
void getHsv (const KoColor &srcColor, int *h, int *s, int *v, int *a=0) const override
 
const KoColorSpacegetPaintingColorSpace () const override
 getColorSpace
 
qreal maxVisibleFloatValue (const KoChannelInfo *chaninfo) const override
 
qreal minVisibleFloatValue (const KoChannelInfo *chaninfo) const override
 
QColor toQColor (const KoColor &c, bool proofToPaintColors=false) const override
 
QImage toQImage (const KoColorSpace *srcColorSpace, const quint8 *data, QSize size, bool proofPaintColors=false) const override
 Convert a consecutive block of pixel data to an ARGB32 QImage.
 
- Public Member Functions inherited from KoColorDisplayRendererInterface
 KoColorDisplayRendererInterface ()
 
 ~KoColorDisplayRendererInterface () override
 

Static Public Member Functions

static KoColorDisplayRendererInterfaceinstance ()
 

Additional Inherited Members

- Signals inherited from KoColorDisplayRendererInterface
void displayConfigurationChanged ()
 

Detailed Description

The default conversion class that just calls KoColor::toQColor() conversion implementation which effectively renders the color into sRGB color space.

Definition at line 99 of file KoColorDisplayRendererInterface.h.

Member Function Documentation

◆ approximateFromRenderedQColor()

KoColor KoDumbColorDisplayRenderer::approximateFromRenderedQColor ( const QColor & c) const
overridevirtual

This tries to approximate a rendered QColor into the KoColor of the painting color space. Please note, that in most of the cases the exact reverse transformation does not exist, so the resulting color will be only a rough approximation. Never try to do a round trip like that:

// r will never be equal to c! r = approximateFromRenderedQColor(toQColor(c));

Implements KoColorDisplayRendererInterface.

Definition at line 40 of file KoColorDisplayRendererInterface.cpp.

41{
42 KoColor color;
43 color.fromQColor(c);
44 return color;
45}
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
Definition KoColor.cpp:213

References KoColor::fromQColor().

◆ fromHsv()

KoColor KoDumbColorDisplayRenderer::fromHsv ( int h,
int s,
int v,
int a = 255 ) const
overridevirtual

Implements KoColorDisplayRendererInterface.

Definition at line 47 of file KoColorDisplayRendererInterface.cpp.

48{
49 h = qBound(0, h, 359);
50 s = qBound(0, s, 255);
51 v = qBound(0, v, 255);
52 a = qBound(0, a, 255);
53 QColor qcolor(QColor::fromHsv(h, s, v, a));
54 return KoColor(qcolor, KoColorSpaceRegistry::instance()->rgb8());
55}
qreal v
static KoColorSpaceRegistry * instance()

References KoColorSpaceRegistry::instance(), and v.

◆ getHsv()

void KoDumbColorDisplayRenderer::getHsv ( const KoColor & srcColor,
int * h,
int * s,
int * v,
int * a = 0 ) const
overridevirtual

Implements KoColorDisplayRendererInterface.

Definition at line 57 of file KoColorDisplayRendererInterface.cpp.

58{
59 QColor qcolor = toQColor(srcColor);
60 qcolor.getHsv(h, s, v, a);
61}
QColor toQColor(const KoColor &c, bool proofToPaintColors=false) const override

References toQColor(), and v.

◆ getPaintingColorSpace()

const KoColorSpace * KoDumbColorDisplayRenderer::getPaintingColorSpace ( ) const
overridevirtual

getColorSpace

Returns
the painting color space, this is useful for determining the transform.

Implements KoColorDisplayRendererInterface.

Definition at line 80 of file KoColorDisplayRendererInterface.cpp.

81{
83}
const KoColorSpace * rgb8(const QString &profileName=QString())

References KoColorSpaceRegistry::instance(), and KoColorSpaceRegistry::rgb8().

◆ instance()

KoColorDisplayRendererInterface * KoDumbColorDisplayRenderer::instance ( )
static

Definition at line 63 of file KoColorDisplayRendererInterface.cpp.

64{
65 return s_instance;
66}

◆ maxVisibleFloatValue()

qreal KoDumbColorDisplayRenderer::maxVisibleFloatValue ( const KoChannelInfo * chaninfo) const
overridevirtual
Returns
the maximum value of a floating point channel that can be seen on screen. In normal situation it is 1.0. When the user changes exposure the value varies.

Implements KoColorDisplayRendererInterface.

Definition at line 74 of file KoColorDisplayRendererInterface.cpp.

75{
76 Q_ASSERT(chaninfo);
77 return chaninfo->getUIMax();
78}
double getUIMax(void) const

References KoChannelInfo::getUIMax().

◆ minVisibleFloatValue()

qreal KoDumbColorDisplayRenderer::minVisibleFloatValue ( const KoChannelInfo * chaninfo) const
overridevirtual
Returns
the minimum value of a floating point channel that can be seen on screen

Implements KoColorDisplayRendererInterface.

Definition at line 68 of file KoColorDisplayRendererInterface.cpp.

69{
70 Q_ASSERT(chaninfo);
71 return chaninfo->getUIMin();
72}
double getUIMin(void) const

References KoChannelInfo::getUIMin().

◆ toQColor()

QColor KoDumbColorDisplayRenderer::toQColor ( const KoColor & c,
bool proofToPaintColors = false ) const
overridevirtual

Convert the color c to a custom QColor that will be displayed by the widget on screen. Please note, that the reverse conversion may simply not exist.

Parameters
proofPaintColorsoptionally adjust the color data to painting gamut first

Implements KoColorDisplayRendererInterface.

Definition at line 34 of file KoColorDisplayRendererInterface.cpp.

35{
36 Q_UNUSED(proofToPaintColors);
37 return c.toQColor();
38}
void toQColor(QColor *c) const
a convenience method for the above.
Definition KoColor.cpp:198

References KoColor::toQColor().

◆ toQImage()

QImage KoDumbColorDisplayRenderer::toQImage ( const KoColorSpace * srcColorSpace,
const quint8 * data,
QSize size,
bool proofPaintColors = false ) const
overridevirtual

Convert a consecutive block of pixel data to an ARGB32 QImage.

Parameters
srcColorSpacethe colorspace the pixel data is in
dataa pointer to a byte array with color data; must cover the requested image size
sizedefines the dimensions of the resulting image
proofPaintColorsoptionally adjust the color data to painting gamut first
Returns
a QImage that can be displayed

Implements KoColorDisplayRendererInterface.

Definition at line 26 of file KoColorDisplayRendererInterface.cpp.

27{
28 Q_UNUSED(proofPaintColors); // dumb converter doesn't know a painting color space
29 return srcColorSpace->convertToQImage(data, size.width(), size.height(), 0,
32}
virtual QImage convertToQImage(const quint8 *data, qint32 width, qint32 height, const KoColorProfile *dstProfile, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const
int size(const Forest< T > &forest)
Definition KisForest.h:1232

References KoColorSpace::convertToQImage(), KoColorConversionTransformation::internalConversionFlags(), and KoColorConversionTransformation::internalRenderingIntent().


The documentation for this class was generated from the following files: