From 1c54ad7fd637880075a23d92a20c2d94ac5e230b Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Mon, 19 Feb 2024 17:42:03 -0300 Subject: [PATCH] color: make some color struct's and enum's public In the next commits we are going to introduce a public API to libweston to allow creating color profiles from parameters. This should be used by both the frontend and by the color protocol implementation. This API require some color struct's and enum's that are currently defined in libweston core, so move them to a public header. Signed-off-by: Leandro Ribeiro --- include/libweston/libweston.h | 38 ++++++++++++++++++++++++++++++++ libweston/color-properties.h | 41 ----------------------------------- 2 files changed, 38 insertions(+), 41 deletions(-) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 3253408cf..793df34bc 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -311,6 +311,44 @@ struct weston_CIExy { float y; }; +/** Chromaticity coordinates and white point that defines the color gamut */ +struct weston_color_gamut { + struct weston_CIExy primary[3]; /* RGB order */ + struct weston_CIExy white_point; +}; + +/** Color primaries known by libweston */ +enum weston_color_primaries { + WESTON_PRIMARIES_CICP_SRGB = 0, + WESTON_PRIMARIES_CICP_PAL_M, + WESTON_PRIMARIES_CICP_PAL, + WESTON_PRIMARIES_CICP_NTSC, + WESTON_PRIMARIES_CICP_GENERIC_FILM, + WESTON_PRIMARIES_CICP_BT2020, + WESTON_PRIMARIES_CICP_CIE1931_XYZ, + WESTON_PRIMARIES_CICP_DCI_P3, + WESTON_PRIMARIES_CICP_DISPLAY_P3, + WESTON_PRIMARIES_ADOBE_RGB, +}; + +/** Transfer functions known by libweston */ +enum weston_transfer_function { + WESTON_TF_LINEAR = 0, + WESTON_TF_GAMMA22, + WESTON_TF_GAMMA28, + WESTON_TF_SRGB, + WESTON_TF_EXT_SRGB, + WESTON_TF_BT709, + WESTON_TF_BT1361, + WESTON_TF_ST240, + WESTON_TF_ST428, + WESTON_TF_ST2084_PQ, + WESTON_TF_LOG_100, + WESTON_TF_LOG_316, + WESTON_TF_XVYCC, + WESTON_TF_HLG, +}; + enum weston_color_characteristics_groups { /** weston_color_characteristics::primary is set */ WESTON_COLOR_CHARACTERISTICS_GROUP_PRIMARIES = 0x01, diff --git a/libweston/color-properties.h b/libweston/color-properties.h index 4156971b9..2285426c3 100644 --- a/libweston/color-properties.h +++ b/libweston/color-properties.h @@ -56,42 +56,6 @@ enum weston_render_intent { WESTON_RENDER_INTENT_RELATIVE_BPC, }; -/** - * Color primaries. - */ -enum weston_color_primaries { - WESTON_PRIMARIES_CICP_SRGB = 0, - WESTON_PRIMARIES_CICP_PAL_M, - WESTON_PRIMARIES_CICP_PAL, - WESTON_PRIMARIES_CICP_NTSC, - WESTON_PRIMARIES_CICP_GENERIC_FILM, - WESTON_PRIMARIES_CICP_BT2020, - WESTON_PRIMARIES_CICP_CIE1931_XYZ, - WESTON_PRIMARIES_CICP_DCI_P3, - WESTON_PRIMARIES_CICP_DISPLAY_P3, - WESTON_PRIMARIES_ADOBE_RGB, -}; - -/** - * Transfer functions. - */ -enum weston_transfer_function { - WESTON_TF_LINEAR = 0, - WESTON_TF_GAMMA22, - WESTON_TF_GAMMA28, - WESTON_TF_SRGB, - WESTON_TF_EXT_SRGB, - WESTON_TF_BT709, - WESTON_TF_BT1361, - WESTON_TF_ST240, - WESTON_TF_ST428, - WESTON_TF_ST2084_PQ, - WESTON_TF_LOG_100, - WESTON_TF_LOG_316, - WESTON_TF_XVYCC, - WESTON_TF_HLG, -}; - struct weston_color_feature_info { /** Our internal representation for the features. */ enum weston_color_feature feature; @@ -120,11 +84,6 @@ struct weston_render_intent_info { bool bps; }; -struct weston_color_gamut { - struct weston_CIExy primary[3]; /* RGB order */ - struct weston_CIExy white_point; -}; - struct weston_color_primaries_info { /** Our internal representation for the primaries. */ enum weston_color_primaries primaries;