mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-04 23:27:58 +02:00
color: add function to create color curve from tf
When we create a parametric color profile (we still do not fully support, but plan to), a struct weston_color_tf_info is created. So add a new function weston_color_curve_from_tf_info() to create a color curve given a transfer function. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
parent
0ebd2b5e0e
commit
2ac863397c
2 changed files with 35 additions and 0 deletions
|
|
@ -189,6 +189,35 @@ weston_color_profile_params_to_str(struct weston_color_profile_params *params,
|
|||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a struct weston_color_curve given a transfer function.
|
||||
*
|
||||
* \param curve The curve to initialize.
|
||||
* \param tf_info The tf_info object.
|
||||
* \param tf_params When the tf is parametric, this is required. Otherwise,
|
||||
* this is ignored.
|
||||
* \param tf_direction Determines if this inits a curve equivalent to the direct
|
||||
* or the inverse of the tf.
|
||||
*/
|
||||
WL_EXPORT void
|
||||
weston_color_curve_from_tf_info(struct weston_color_curve *curve,
|
||||
const struct weston_color_tf_info *tf_info,
|
||||
const float tf_params[MAX_PARAMS_TF],
|
||||
enum weston_tf_direction tf_direction)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
curve->type = WESTON_COLOR_CURVE_TYPE_ENUM;
|
||||
|
||||
curve->u.enumerated.tf = tf_info;
|
||||
curve->u.enumerated.tf_direction = tf_direction;
|
||||
|
||||
for (j = 0; j < tf_info->count_parameters; j++) {
|
||||
for (i = 0; i < 3; i++)
|
||||
curve->u.enumerated.params[i][j] = tf_params[j];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an enumerated color curve, returns an equivalent parametric curve.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -647,6 +647,12 @@ weston_color_curve_enum_get_parametric(struct weston_compositor *compositor,
|
|||
const struct weston_color_curve_enum *curve,
|
||||
struct weston_color_curve_parametric *out);
|
||||
|
||||
void
|
||||
weston_color_curve_from_tf_info(struct weston_color_curve *curve,
|
||||
const struct weston_color_tf_info *tf_info,
|
||||
const float tf_params[MAX_PARAMS_TF],
|
||||
enum weston_tf_direction tf_direction);
|
||||
|
||||
struct weston_color_transform *
|
||||
weston_color_transform_ref(struct weston_color_transform *xform);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue