Louvre  v2.13.0-1
C++ library for Wayland compositors
Public Member Functions | List of all members
LGammaTable Class Reference

Gamma correction table for outputs. More...

Public Member Functions

 LGammaTable (UInt32 size=0) noexcept
 Constructs an LGammaTable with the specified size. More...
 
 ~LGammaTable ()
 Destructor for LGammaTable. More...
 
 LGammaTable (const LGammaTable &other) noexcept
 Copy constructor for LGammaTable. More...
 
LGammaTableoperator= (const LGammaTable &other) noexcept
 Assignment operator for LGammaTable. More...
 
void setSize (UInt32 size) noexcept
 Set the size of the gamma correction table. More...
 
UInt32 size () const noexcept
 Gets the size of the gamma correction table. More...
 
void fill (Float64 gamma, Float64 brightness, Float64 contrast) noexcept
 Fill method for setting table values. More...
 
UInt16red () const noexcept
 Gets a pointer to the beginning of the red curve in the array. More...
 
UInt16green () const noexcept
 Gets a pointer to the beginning of the green curve in the array. More...
 
UInt16blue () const noexcept
 Gets a pointer to the beginning of the blue curve in the array. More...
 

Detailed Description

Gamma correction table for outputs.

The LGammaTable class allows to define the gamma correction curves for each RGB component of an LOutput, applicable through the LOutput::setGamma() method.

Note
Clients using the Wlr Gamma Control protocol can also request to set the gamma table of an output via LOutput::setGammaRequest().

The curves (red, green and blue) are stored in a single array of type UInt16. The table size (size()) indicates how many UInt16 values each curve contains. For example, if size() is 256, the array would have 256 * 3 UInt16 values, where the first 256 represent the red curve, the next 256 represent the green curve, and the remaining values represent the blue curve.

The table size must match the LOutput::gammaSize() property of the output to which the correction is applied. If not, LOutput::setGamma() will fail. To modify table values, you can use the fill() auxiliary method or directly modify each curve using red(), green(), and blue(), which return the address of each curve in the array.

See also
LOutput::gammaSize()
LOutput::setGamma()
LOutput::setGammaRequest()

Constructor & Destructor Documentation

◆ LGammaTable() [1/2]

LGammaTable ( UInt32  size = 0)
inlinenoexcept

Constructs an LGammaTable with the specified size.

Parameters
sizeThe size of the gamma correction table. Defaults to 0.

◆ ~LGammaTable()

~LGammaTable ( )
inline

Destructor for LGammaTable.

Destroys the gamma correction table.

◆ LGammaTable() [2/2]

LGammaTable ( const LGammaTable other)
inlinenoexcept

Copy constructor for LGammaTable.

Creates a new LGammaTable by copying the content of another table.

Parameters
otherThe LGammaTable object to be copied.

Member Function Documentation

◆ operator=()

LGammaTable& operator= ( const LGammaTable other)
inlinenoexcept

Assignment operator for LGammaTable.

Assigns the content of another LGammaTable to this table.

Parameters
otherThe LGammaTable object to be assigned.
Returns
A reference to the modified LGammaTable.

◆ setSize()

void setSize ( UInt32  size)
inlinenoexcept

Set the size of the gamma correction table.

Note
This operation removes previous values.
Parameters
sizeThe new size for the gamma correction table.

◆ size()

UInt32 size ( ) const
inlinenoexcept

Gets the size of the gamma correction table.

The size represents the number of UInt16 values used to independently represent each RGB curve.

Returns
The size of the gamma correction table.

◆ fill()

void fill ( Float64  gamma,
Float64  brightness,
Float64  contrast 
)
noexcept

Fill method for setting table values.

This auxiliary method allows setting gamma, brightness, and contrast values for the table.

Parameters
gammaThe gamma correction value.
brightnessThe brightness adjustment value.
contrastThe contrast adjustment value.

◆ red()

UInt16* red ( ) const
inlinenoexcept

Gets a pointer to the beginning of the red curve in the array.

Returns
Pointer to the red curve in the array, or nullptr if the table size is 0.

◆ green()

UInt16* green ( ) const
inlinenoexcept

Gets a pointer to the beginning of the green curve in the array.

Returns
Pointer to the green curve in the array, or nullptr if the table size is 0.

◆ blue()

UInt16* blue ( ) const
inlinenoexcept

Gets a pointer to the beginning of the blue curve in the array.

Returns
Pointer to the blue curve in the array, or nullptr if the table size is 0.