render/color: add wlr_color_primaries_to_xyz()

This commit is contained in:
Simon Ser 2025-01-27 18:04:02 +01:00
parent d8ad4809fc
commit 156201fe71
3 changed files with 68 additions and 0 deletions

View file

@ -45,4 +45,9 @@ struct wlr_color_transform_lut3d {
struct wlr_color_transform_lut3d *wlr_color_transform_lut3d_from_base(
struct wlr_color_transform *tr);
/**
* Compute the matrix to convert RGB color values to CIE 1931 XYZ.
*/
void wlr_color_primaries_to_xyz(const struct wlr_color_primaries *primaries, float matrix[static 9]);
#endif

View file

@ -12,6 +12,20 @@
#include <stdbool.h>
#include <sys/types.h>
/**
* CIE 1931 xy chromaticity coordinates.
*/
struct wlr_color_cie1931_xy {
float x, y;
};
/**
* Color primaries and white point describing a color volume.
*/
struct wlr_color_primaries {
struct wlr_color_cie1931_xy red, green, blue, white;
};
/**
* A color transformation formula, which maps a linear color space with
* sRGB primaries to an output color space.