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 KoColorSpace * getPaintingColorSpace () 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

KisDisplayColorConverter * m_displayColorConverter
 
QPointer< KoCanvasResourceProvider > m_resourceManager
 

Additional Inherited Members

- Signals inherited from KoColorDisplayRendererInterface
void displayConfigurationChanged ()
 

Detailed Description

Definition at line 182 of file kis_display_color_converter.cpp.

Constructor & Destructor Documentation

◆ DisplayRenderer()

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

Definition at line 184 of file kis_display_color_converter.cpp.

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

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

201 {
203 }
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 233 of file kis_display_color_converter.cpp.

233 {
235 }
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 237 of file kis_display_color_converter.cpp.

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

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

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

229 {
231 }
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 246 of file kis_display_color_converter.cpp.

246 {
248 }
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 217 of file kis_display_color_converter.cpp.

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

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

250 {
252 }
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 197 of file kis_display_color_converter.cpp.

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

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

Member Data Documentation

◆ m_displayColorConverter

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

Definition at line 255 of file kis_display_color_converter.cpp.

◆ m_resourceManager

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

Definition at line 256 of file kis_display_color_converter.cpp.


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