Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSurfaceColorManagerInterface Class Referenceabstract

#include <KisSurfaceColorManagerInterface.h>

+ Inheritance diagram for KisSurfaceColorManagerInterface:

Signals

void sigPreferredSurfaceDescriptionChanged (const KisSurfaceColorimetry::SurfaceDescription &desc)
 
void sigReadyChanged (bool value)
 

Public Member Functions

virtual bool isReady () const =0
 
 KisSurfaceColorManagerInterface (QWindow *window, QObject *parent=nullptr)
 
virtual std::optional< KisSurfaceColorimetry::SurfaceDescriptionpreferredSurfaceDescription () const =0
 
virtual std::optional< KisSurfaceColorimetry::RenderIntentrenderingIntent () const =0
 
virtual QFuture< bool > setSurfaceDescription (const KisSurfaceColorimetry::SurfaceDescription &desc, KisSurfaceColorimetry::RenderIntent intent)=0
 
virtual bool supportsRenderIntent (const KisSurfaceColorimetry::RenderIntent &intent)=0
 
virtual bool supportsSurfaceDescription (const KisSurfaceColorimetry::SurfaceDescription &desc)=0
 
virtual std::optional< KisSurfaceColorimetry::SurfaceDescriptionsurfaceDescription () const =0
 
virtual void unsetSurfaceDescription ()=0
 
virtual ~KisSurfaceColorManagerInterface ()
 

Protected Attributes

QWindow * m_window
 

Detailed Description

An interface for fetching and setting the colorimetry information of a surface underlying a QWindow

Due to complications of some protocols (i.e. Wayland), the construction and initialization of the object may be not straight forward and may include several steps:

1) Initially, When KisSurfaceColorManagerInterface is created, it is created in a "not ready" state:

2) When initialization is completed, the interface emits sigReadyChanged() with argument set to true. At this moment all the functions of the interface are supposed to work and do what expected.

WARNING: Please take it into account that sigPreferredSurfaceDescriptionChanged() is not emitted during the initialization process. You should handle both the signals.

3) When the preferred surface color space is changed, the interface emits sigPreferredSurfaceDescriptionChanged(). This may happen when the QWindow is moved to a different screen or when the user changes the settings of the current screen.

When the connection to the compositor is lost, the interface first emits sigReadyChanged() with argument set to false, and restarts the initialization process.

Definition at line 52 of file KisSurfaceColorManagerInterface.h.

Constructor & Destructor Documentation

◆ KisSurfaceColorManagerInterface()

KisSurfaceColorManagerInterface::KisSurfaceColorManagerInterface ( QWindow * window,
QObject * parent = nullptr )

Definition at line 9 of file KisSurfaceColorManagerInterface.cpp.

10 : QObject(parent)
11 , m_window(window)
12{
13}

◆ ~KisSurfaceColorManagerInterface()

KisSurfaceColorManagerInterface::~KisSurfaceColorManagerInterface ( )
virtual

Definition at line 15 of file KisSurfaceColorManagerInterface.cpp.

16{
17}

Member Function Documentation

◆ isReady()

virtual bool KisSurfaceColorManagerInterface::isReady ( ) const
pure virtual
Returns
true when the interface is considered as "fully initialized", i.e. all the methods of the interface are supposed to work as expected

Implemented in KisWaylandSurfaceColorManager.

◆ preferredSurfaceDescription()

virtual std::optional< KisSurfaceColorimetry::SurfaceDescription > KisSurfaceColorManagerInterface::preferredSurfaceDescription ( ) const
pure virtual
Returns
the preferred description for the underlying surface from the viewpoint of the compositor

It can return std::nullopt only when the interface is not ready

Implemented in KisWaylandSurfaceColorManager.

◆ renderingIntent()

virtual std::optional< KisSurfaceColorimetry::RenderIntent > KisSurfaceColorManagerInterface::renderingIntent ( ) const
pure virtual
Returns
the current rendering intent assign to the surface

It can return std::nullopt if the surface description is unset or if the connection to the compositor has been lost.

Implemented in KisWaylandSurfaceColorManager.

◆ setSurfaceDescription()

virtual QFuture< bool > KisSurfaceColorManagerInterface::setSurfaceDescription ( const KisSurfaceColorimetry::SurfaceDescription & desc,
KisSurfaceColorimetry::RenderIntent intent )
pure virtual

Sets the surface description of the linked QWindow

The operation may be asynchronous on some platforms, so you should handle a QFuture<bool> object to get the actual result.

Returns
a future telling if the description has already been set or not.

WARNING: Please do NOT call future.waitForFinished() from the GUI thread. On some platforms (e.g. wayland) a signal from the even loop should be processed to actually set the surface description, so you'll get a deadlock if you try to wait for it in the event loop's thread.

Implemented in KisWaylandSurfaceColorManager.

◆ sigPreferredSurfaceDescriptionChanged

void KisSurfaceColorManagerInterface::sigPreferredSurfaceDescriptionChanged ( const KisSurfaceColorimetry::SurfaceDescription & desc)
signal

◆ sigReadyChanged

void KisSurfaceColorManagerInterface::sigReadyChanged ( bool value)
signal

◆ supportsRenderIntent()

virtual bool KisSurfaceColorManagerInterface::supportsRenderIntent ( const KisSurfaceColorimetry::RenderIntent & intent)
pure virtual

Test if the rendering intent is supported by the compositor

Implemented in KisWaylandSurfaceColorManager.

◆ supportsSurfaceDescription()

virtual bool KisSurfaceColorManagerInterface::supportsSurfaceDescription ( const KisSurfaceColorimetry::SurfaceDescription & desc)
pure virtual

Test if the surface description is supported by the compositor

Implemented in KisWaylandSurfaceColorManager.

◆ surfaceDescription()

virtual std::optional< KisSurfaceColorimetry::SurfaceDescription > KisSurfaceColorManagerInterface::surfaceDescription ( ) const
pure virtual
Returns
the current description of the underlying surface

It can return std::nullopt if the surface description is unset or if the connection to the compositor has been lost.

Implemented in KisWaylandSurfaceColorManager.

◆ unsetSurfaceDescription()

virtual void KisSurfaceColorManagerInterface::unsetSurfaceDescription ( )
pure virtual

Unset the surface description of the underlying surface. In most of the compositors it means that the surface will be treated as sRGB.

Implemented in KisWaylandSurfaceColorManager.

Member Data Documentation

◆ m_window

QWindow* KisSurfaceColorManagerInterface::m_window
protected

Definition at line 126 of file KisSurfaceColorManagerInterface.h.


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