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
 
QColor convertColorToDisplayColorSpace (KoColor c) const override
 convertColorToDisplayColorSpace
 
QImage convertImageToDisplayColorSpace (const QImage source) const override
 convertImageToDisplayColorSpace
 
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
 
KisHandlePalette handlePaletteForDisplayColorSpace () const override
 handlePaletteForDisplayColorSpace
 
qreal maxVisibleFloatValue (const KoChannelInfo *chaninfo) const override
 
qreal minVisibleFloatValue (const KoChannelInfo *chaninfo) const override
 
QPalette systemPaletteForDisplayColorSpace () const override
 systemPaletteForDisplayColorSpace
 
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 127 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 42 of file KoColorDisplayRendererInterface.cpp.

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

References KoColor::fromQColor().

◆ convertColorToDisplayColorSpace()

QColor KoDumbColorDisplayRenderer::convertColorToDisplayColorSpace ( KoColor color) const
overridevirtual

convertColorToDisplayColorSpace

Parameters
color– base color.
Returns
get a QColor version of the KoColor that is suited for canvas decorations.

Implements KoColorDisplayRendererInterface.

Definition at line 87 of file KoColorDisplayRendererInterface.cpp.

88{
89 return c.toQColor();
90}

References KoColor::toQColor().

◆ convertImageToDisplayColorSpace()

QImage KoDumbColorDisplayRenderer::convertImageToDisplayColorSpace ( const QImage source) const
overridevirtual

convertImageToDisplayColorSpace

Parameters
source– image to convert.
Returns
image converted to be used as a canvas decoration.

Implements KoColorDisplayRendererInterface.

Definition at line 92 of file KoColorDisplayRendererInterface.cpp.

93{
94 return source;
95}
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)

References source().

◆ fromHsv()

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

Implements KoColorDisplayRendererInterface.

Definition at line 49 of file KoColorDisplayRendererInterface.cpp.

50{
51 h = qBound(0, h, 359);
52 s = qBound(0, s, 255);
53 v = qBound(0, v, 255);
54 a = qBound(0, a, 255);
55 QColor qcolor(QColor::fromHsv(h, s, v, a));
56 return KoColor(qcolor, KoColorSpaceRegistry::instance()->rgb8());
57}
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 59 of file KoColorDisplayRendererInterface.cpp.

60{
61 QColor qcolor = toQColor(srcColor);
62 qcolor.getHsv(h, s, v, a);
63}
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 82 of file KoColorDisplayRendererInterface.cpp.

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

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

◆ handlePaletteForDisplayColorSpace()

KisHandlePalette KoDumbColorDisplayRenderer::handlePaletteForDisplayColorSpace ( ) const
overridevirtual

handlePaletteForDisplayColorSpace

Returns
get a version of KisHandlePalette suited for canvas decorations

Implements KoColorDisplayRendererInterface.

Definition at line 97 of file KoColorDisplayRendererInterface.cpp.

98{
99 return KisHandlePalette();
100}

◆ instance()

KoColorDisplayRendererInterface * KoDumbColorDisplayRenderer::instance ( )
static

Definition at line 65 of file KoColorDisplayRendererInterface.cpp.

66{
67 return s_instance;
68}

◆ 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 76 of file KoColorDisplayRendererInterface.cpp.

77{
78 Q_ASSERT(chaninfo);
79 return chaninfo->getUIMax();
80}
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 70 of file KoColorDisplayRendererInterface.cpp.

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

References KoChannelInfo::getUIMin().

◆ systemPaletteForDisplayColorSpace()

QPalette KoDumbColorDisplayRenderer::systemPaletteForDisplayColorSpace ( ) const
overridevirtual

systemPaletteForDisplayColorSpace

Returns
get a version of the system palette that is suited for canvas decorations.

Implements KoColorDisplayRendererInterface.

Definition at line 102 of file KoColorDisplayRendererInterface.cpp.

103{
104 return QPalette();
105}

◆ 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 36 of file KoColorDisplayRendererInterface.cpp.

37{
38 Q_UNUSED(proofToPaintColors);
39 return c.toQColor();
40}
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 28 of file KoColorDisplayRendererInterface.cpp.

29{
30 Q_UNUSED(proofPaintColors); // dumb converter doesn't know a painting color space
31 return srcColorSpace->convertToQImage(data, size.width(), size.height(), 0,
34}
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: