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
 
QColor convertColorToDisplayColorSpace (KoColor c) const override
 convertColorToDisplayColorSpace
 
QImage convertImageToDisplayColorSpace (const QImage source) const override
 convertImageToDisplayColorSpace
 
 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
 
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
 

Private Attributes

KisDisplayColorConverterm_displayColorConverter
 
QPointer< KoCanvasResourceProviderm_resourceManager
 

Additional Inherited Members

- Signals inherited from KoColorDisplayRendererInterface
void displayConfigurationChanged ()
 

Detailed Description

Definition at line 179 of file kis_display_color_converter.cpp.

Constructor & Destructor Documentation

◆ DisplayRenderer()

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

Definition at line 181 of file kis_display_color_converter.cpp.

182 : m_displayColorConverter(displayColorConverter),
184 {
185 displayColorConverter->connect(displayColorConverter, SIGNAL(displayConfigurationChanged()),
186 this, SIGNAL(displayConfigurationChanged()), Qt::UniqueConnection);
187 }

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

198 {
200 }
KoColor approximateFromRenderedQColor(const QColor &c) const

◆ convertColorToDisplayColorSpace()

QColor KisDisplayColorConverter::Private::DisplayRenderer::convertColorToDisplayColorSpace ( KoColor color) const
inlineoverridevirtual

convertColorToDisplayColorSpace

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

Implements KoColorDisplayRendererInterface.

Definition at line 230 of file kis_display_color_converter.cpp.

230 {
232 }
QColor convertColorToDisplayColorSpace(const KoColor color, bool applyOcio=false) const
convertColorToDisplayColorSpace This applies displayfiltering to the given KoColor,...

◆ convertImageToDisplayColorSpace()

QImage KisDisplayColorConverter::Private::DisplayRenderer::convertImageToDisplayColorSpace ( const QImage source) const
inlineoverridevirtual

convertImageToDisplayColorSpace

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

Implements KoColorDisplayRendererInterface.

Definition at line 234 of file kis_display_color_converter.cpp.

234 {
235 // Limited to 8bit sRGB for now...
237 srcDevice->convertFromQImage(source, KoColorSpaceRegistry::instance()->p709SRGBProfile(), 0, 0);
238 QImage destination = m_displayColorConverter->convertImageToDisplayColorSpace(srcDevice);
239 destination.setDevicePixelRatio(source.devicePixelRatio());
240 return destination;
241 }
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
QImage convertImageToDisplayColorSpace(KisPaintDeviceSP srcDevice, QRect source=QRect(), bool applyOcio=false) const
convertImageToDisplayColorSpace Same as convertColorToDisplayColorSpace, but then for a KisPaintDevic...
void convertFromQImage(const QImage &image, const KoColorProfile *profile, qint32 offsetX=0, qint32 offsetY=0)
static KoColorSpaceRegistry * instance()

References KisPaintDevice::convertFromQImage(), KoColorSpaceRegistry::instance(), and source().

◆ fromHsv()

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

Implements KoColorDisplayRendererInterface.

Definition at line 202 of file kis_display_color_converter.cpp.

202 {
203 return m_displayColorConverter->fromHsv(h, s, v, a);
204 }
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 206 of file kis_display_color_converter.cpp.

206 {
207 m_displayColorConverter->getHsv(srcColor, h, s, v, a);
208 }
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 226 of file kis_display_color_converter.cpp.

226 {
228 }
const KoColorSpace * paintingColorSpace() const

◆ handlePaletteForDisplayColorSpace()

KisHandlePalette KisDisplayColorConverter::Private::DisplayRenderer::handlePaletteForDisplayColorSpace ( ) const
inlineoverridevirtual

handlePaletteForDisplayColorSpace

Returns
get a version of KisHandlePalette suited for canvas decorations

Implements KoColorDisplayRendererInterface.

Definition at line 243 of file kis_display_color_converter.cpp.

243 {
245 }
KisHandlePalette handlePaletteForDisplayColorSpace() const
handlePaletteForDisplayColorSpace

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

214 {
215 qreal maxValue = chaninfo->getUIMax();
216
217 if (m_resourceManager) {
218 qreal exposure = m_resourceManager->resource(KoCanvasResource::HdrExposure).value<qreal>();
219 // not sure if *= is what we want
220 maxValue *= std::pow(2.0, -exposure);
221 }
222
223 return maxValue;
224 }
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 210 of file kis_display_color_converter.cpp.

210 {
211 return chaninfo->getUIMin();
212 }
double getUIMin(void) const

References KoChannelInfo::getUIMin().

◆ systemPaletteForDisplayColorSpace()

QPalette KisDisplayColorConverter::Private::DisplayRenderer::systemPaletteForDisplayColorSpace ( ) const
inlineoverridevirtual

systemPaletteForDisplayColorSpace

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

Implements KoColorDisplayRendererInterface.

Definition at line 247 of file kis_display_color_converter.cpp.

247 {
249 }
QPalette systemPaletteForDisplayColorSpace() const
systemPaletteForDisplayColorSpace

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

194 {
195 return m_displayColorConverter->toQColor(c, proofToPaintColors);
196 }
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 189 of file kis_display_color_converter.cpp.

189 {
190 QImage result = m_displayColorConverter->toQImage(srcColorSpace, data, size, proofPaintColors);
191 return result;
192 }
QImage toQImage(KisPaintDeviceSP srcDevice, bool proofPaintColors=false) const

Member Data Documentation

◆ m_displayColorConverter

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

Definition at line 252 of file kis_display_color_converter.cpp.

◆ m_resourceManager

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

Definition at line 253 of file kis_display_color_converter.cpp.


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