Krita Source Code Documentation
Loading...
Searching...
No Matches
KisDisplayColorConverter::Private::DisplayRenderer Class Reference
+ Inheritance diagram for KisDisplayColorConverter::Private::DisplayRenderer:

Public Member Functions

KoColor approximateFromRenderedQColor (const QColor &c) const override
 
 DisplayRenderer (KisDisplayColorConverter *displayColorConverter, KoCanvasResourceProvider *resourceManager)
 
KoColor fromHsv (int h, int s, int v, int a) const override
 
void getHsv (const KoColor &srcColor, int *h, int *s, int *v, int *a) 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
 

Private Attributes

KisDisplayColorConverterm_displayColorConverter
 
QPointer< KoCanvasResourceProviderm_resourceManager
 

Additional Inherited Members

- Signals inherited from KoColorDisplayRendererInterface
void displayConfigurationChanged ()
 

Detailed Description

Definition at line 171 of file kis_display_color_converter.cpp.

Constructor & Destructor Documentation

◆ DisplayRenderer()

KisDisplayColorConverter::Private::DisplayRenderer::DisplayRenderer ( KisDisplayColorConverter * displayColorConverter,
KoCanvasResourceProvider * resourceManager )
inline

Definition at line 173 of file kis_display_color_converter.cpp.

174 : m_displayColorConverter(displayColorConverter),
176 {
177 displayColorConverter->connect(displayColorConverter, SIGNAL(displayConfigurationChanged()),
178 this, SIGNAL(displayConfigurationChanged()), Qt::UniqueConnection);
179 }

Member Function Documentation

◆ approximateFromRenderedQColor()

KoColor KisDisplayColorConverter::Private::DisplayRenderer::approximateFromRenderedQColor ( const QColor & c) const
inlineoverridevirtual

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 190 of file kis_display_color_converter.cpp.

190 {
192 }
KoColor approximateFromRenderedQColor(const QColor &c) const

◆ fromHsv()

KoColor KisDisplayColorConverter::Private::DisplayRenderer::fromHsv ( int h,
int s,
int v,
int a ) const
inlineoverridevirtual

Implements KoColorDisplayRendererInterface.

Definition at line 194 of file kis_display_color_converter.cpp.

194 {
195 return m_displayColorConverter->fromHsv(h, s, v, a);
196 }
qreal v
KoColor fromHsv(int h, int s, int v, int a=255) const

References v.

◆ getHsv()

void KisDisplayColorConverter::Private::DisplayRenderer::getHsv ( const KoColor & srcColor,
int * h,
int * s,
int * v,
int * a ) const
inlineoverridevirtual

Implements KoColorDisplayRendererInterface.

Definition at line 198 of file kis_display_color_converter.cpp.

198 {
199 m_displayColorConverter->getHsv(srcColor, h, s, v, a);
200 }
void getHsv(const KoColor &srcColor, int *h, int *s, int *v, int *a=0) const

References v.

◆ getPaintingColorSpace()

const KoColorSpace * KisDisplayColorConverter::Private::DisplayRenderer::getPaintingColorSpace ( ) const
inlineoverridevirtual

getColorSpace

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

Implements KoColorDisplayRendererInterface.

Definition at line 218 of file kis_display_color_converter.cpp.

218 {
220 }
const KoColorSpace * paintingColorSpace() const

◆ maxVisibleFloatValue()

qreal KisDisplayColorConverter::Private::DisplayRenderer::maxVisibleFloatValue ( const KoChannelInfo * chaninfo) const
inlineoverridevirtual
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 206 of file kis_display_color_converter.cpp.

206 {
207 qreal maxValue = chaninfo->getUIMax();
208
209 if (m_resourceManager) {
210 qreal exposure = m_resourceManager->resource(KoCanvasResource::HdrExposure).value<qreal>();
211 // not sure if *= is what we want
212 maxValue *= std::pow(2.0, -exposure);
213 }
214
215 return maxValue;
216 }
double getUIMax(void) const

References KoChannelInfo::getUIMax(), and KoCanvasResource::HdrExposure.

◆ minVisibleFloatValue()

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

Implements KoColorDisplayRendererInterface.

Definition at line 202 of file kis_display_color_converter.cpp.

202 {
203 return chaninfo->getUIMin();
204 }
double getUIMin(void) const

References KoChannelInfo::getUIMin().

◆ toQColor()

QColor KisDisplayColorConverter::Private::DisplayRenderer::toQColor ( const KoColor & c,
bool proofToPaintColors = false ) const
inlineoverridevirtual

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 186 of file kis_display_color_converter.cpp.

186 {
187 return m_displayColorConverter->toQColor(c, proofToPaintColors);
188 }
QColor toQColor(const KoColor &c, bool proofToPaintColors=false) const

◆ toQImage()

QImage KisDisplayColorConverter::Private::DisplayRenderer::toQImage ( const KoColorSpace * srcColorSpace,
const quint8 * data,
QSize size,
bool proofPaintColors = false ) const
inlineoverridevirtual

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 181 of file kis_display_color_converter.cpp.

181 {
182 QImage result = m_displayColorConverter->toQImage(srcColorSpace, data, size, proofPaintColors);
183 return result;
184 }
QImage toQImage(KisPaintDeviceSP srcDevice, bool proofPaintColors=false) const

Member Data Documentation

◆ m_displayColorConverter

KisDisplayColorConverter* KisDisplayColorConverter::Private::DisplayRenderer::m_displayColorConverter
private

Definition at line 223 of file kis_display_color_converter.cpp.

◆ m_resourceManager

QPointer<KoCanvasResourceProvider> KisDisplayColorConverter::Private::DisplayRenderer::m_resourceManager
private

Definition at line 224 of file kis_display_color_converter.cpp.


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