mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 04:40:07 +01:00
color: add weston_color_profile_param_builder_set_target_primaries_named()
The protocol does not carry target primaries by enumeration, but in weston.ini I want to be able to use a name rather than raw values. Adding this API makes that possible. main.c cannot look up the enumeration itself, because color-properties.h is private. As it should be. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
9b68277b77
commit
360eef9663
2 changed files with 29 additions and 0 deletions
|
|
@ -234,6 +234,10 @@ bool
|
|||
weston_color_profile_param_builder_set_target_primaries(struct weston_color_profile_param_builder *builder,
|
||||
const struct weston_color_gamut *target_primaries);
|
||||
|
||||
bool
|
||||
weston_color_profile_param_builder_set_target_primaries_named(struct weston_color_profile_param_builder *builder,
|
||||
enum weston_color_primaries target_primaries);
|
||||
|
||||
bool
|
||||
weston_color_profile_param_builder_set_target_luminance(struct weston_color_profile_param_builder *builder,
|
||||
float min_lum, float max_lum);
|
||||
|
|
|
|||
|
|
@ -576,6 +576,31 @@ weston_color_profile_param_builder_set_target_primaries(struct weston_color_prof
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets target primaries for struct weston_color_profile_param_builder object
|
||||
* from the given enumerated primaries.
|
||||
*
|
||||
* If the target primaries are already set, this should fail. Setting a
|
||||
* parameter twice is forbidden.
|
||||
*
|
||||
* If this fails, users can call weston_color_profile_param_builder_get_error()
|
||||
* to get the error details.
|
||||
*
|
||||
* \param builder The builder object whose parameters will be set.
|
||||
* \param target_primaries The entry from the enumeration to use.
|
||||
* \return true on success, false otherwise.
|
||||
*/
|
||||
WL_EXPORT bool
|
||||
weston_color_profile_param_builder_set_target_primaries_named(struct weston_color_profile_param_builder *builder,
|
||||
enum weston_color_primaries target_primaries)
|
||||
{
|
||||
const struct weston_color_primaries_info *info;
|
||||
|
||||
info = weston_color_primaries_info_from(builder->compositor, target_primaries);
|
||||
|
||||
return weston_color_profile_param_builder_set_target_primaries(builder, &info->color_gamut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets target luminance for struct weston_color_profile_param_builder object.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue