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

Constructor & Destructor Documentation

◆ DisplayRenderer()

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

Definition at line 183 of file kis_display_color_converter.cpp.

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

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

200 {
202 }
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 232 of file kis_display_color_converter.cpp.

232 {
234 }
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 236 of file kis_display_color_converter.cpp.

236 {
237 // Limited to 8bit sRGB for now...
239 srcDevice->convertFromQImage(source, KoColorSpaceRegistry::instance()->p709SRGBProfile(), 0, 0);
240 QImage destination = m_displayColorConverter->convertImageToDisplayColorSpace(srcDevice);
241 destination.setDevicePixelRatio(source.devicePixelRatio());
242 return destination;
243 }
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 204 of file kis_display_color_converter.cpp.

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

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

228 {
230 }
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 245 of file kis_display_color_converter.cpp.

245 {
247 }
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 216 of file kis_display_color_converter.cpp.

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

212 {
213 return chaninfo->getUIMin();
214 }
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 249 of file kis_display_color_converter.cpp.

249 {
251 }
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 196 of file kis_display_color_converter.cpp.

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

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

Member Data Documentation

◆ m_displayColorConverter

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

Definition at line 254 of file kis_display_color_converter.cpp.

◆ m_resourceManager

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

Definition at line 255 of file kis_display_color_converter.cpp.


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