Documentation for <wlr/render/color.h>

Back to index

Table of contents

struct wlr_color_cie1931_xy

struct wlr_color_cie1931_xy {
	float x, y;
};

CIE 1931 xy chromaticity coordinates.

struct wlr_color_luminances

struct wlr_color_luminances {
	float min, max, reference;
};

Luminance range and reference white luminance level, in cd/m².

enum wlr_color_named_primaries

enum wlr_color_named_primaries {
	WLR_COLOR_NAMED_PRIMARIES_SRGB,
	WLR_COLOR_NAMED_PRIMARIES_BT2020,
};

Well-known color primaries.

struct wlr_color_primaries

struct wlr_color_primaries {
	struct wlr_color_cie1931_xy red, green, blue, white;
};

Color primaries and white point describing a color volume.

enum wlr_color_transfer_function

enum wlr_color_transfer_function {
	WLR_COLOR_TRANSFER_FUNCTION_SRGB,
	WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ,
};

Well-known color transfer functions.

struct wlr_color_transform

struct wlr_color_transform;

A color transformation formula, which maps a linear color space with sRGB primaries to an output color space.

For ease of use, this type is heap allocated and reference counted. Use wlr_color_transform_ref()/wlr_color_transform_unref(). The initial reference count after creation is 1.

Color transforms are immutable; their type/parameters should not be changed, and this API provides no functions to modify them after creation.

This formula may be implemented using a 3d look-up table, or some other means.

wlr_color_transform_init_linear_to_icc()

struct wlr_color_transform *wlr_color_transform_init_linear_to_icc(​const void *data, size_t size);

Initialize a color transformation to convert linear (with sRGB(?) primaries) to an ICC profile. Returns NULL on failure.

wlr_color_transform_init_srgb()

struct wlr_color_transform *wlr_color_transform_init_srgb(​void);

Initialize a color transformation to apply sRGB encoding. Returns NULL on failure.

wlr_color_transform_ref()

struct wlr_color_transform *wlr_color_transform_ref(​struct wlr_color_transform *tr);

Increase the reference count of the color transform by 1.

wlr_color_transform_unref()

void wlr_color_transform_unref(​struct wlr_color_transform *tr);

Reduce the reference count of the color transform by 1; freeing it and all associated resources when the reference count hits zero.