mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 09:40:10 +00:00
image tool: Better color state support
Show cicp color states with their tuple.
This commit is contained in:
parent
b0acf2a7a8
commit
28817b4bb2
@ -48,12 +48,23 @@ static void
|
||||
file_info (const char *filename)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
char *name;
|
||||
char *cicp;
|
||||
|
||||
texture = load_image_file (filename);
|
||||
|
||||
g_print ("%s %dx%d\n", _("Size:"), gdk_texture_get_width (texture), gdk_texture_get_height (texture));
|
||||
g_print ("%s %s\n", _("Format:"), get_format_name (gdk_texture_get_format (texture)));
|
||||
g_print ("%s %s\n", _("Color state:"), get_color_state_name (gdk_texture_get_color_state (texture)));
|
||||
|
||||
name = get_color_state_name (gdk_texture_get_color_state (texture));
|
||||
cicp = get_color_state_cicp (gdk_texture_get_color_state (texture));
|
||||
|
||||
if (name && cicp)
|
||||
g_print ("%s %s (cicp %s)\n", _("Color state:"), name, cicp);
|
||||
else if (cicp)
|
||||
g_print ("%s cicp %s\n", _("Color state:"), cicp);
|
||||
else
|
||||
g_print ("%s %s\n", _("Color state:"), _("unknown"));
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
@ -188,6 +188,27 @@ get_color_state_names (void)
|
||||
return g_strdupv ((char **) names);
|
||||
}
|
||||
|
||||
char *
|
||||
get_color_state_cicp (GdkColorState *color_state)
|
||||
{
|
||||
GdkCicpParams *params;
|
||||
char *str = NULL;
|
||||
|
||||
params = gdk_color_state_create_cicp_params (color_state);
|
||||
|
||||
if (params)
|
||||
{
|
||||
str = g_strdup_printf ("%u/%u/%u/%u",
|
||||
gdk_cicp_params_get_color_primaries (params),
|
||||
gdk_cicp_params_get_transfer_function (params),
|
||||
gdk_cicp_params_get_matrix_coefficients (params),
|
||||
gdk_cicp_params_get_range (params));
|
||||
g_object_unref (params);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
char *
|
||||
get_color_state_name (GdkColorState *color_state)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ GdkColorState * find_color_state_by_name (const char *name);
|
||||
|
||||
char ** get_color_state_names (void);
|
||||
char * get_color_state_name (GdkColorState *color_state);
|
||||
char * get_color_state_cicp (GdkColorState *color_state);
|
||||
|
||||
GdkColorState *parse_cicp_tuple (const char *cicp_tuple,
|
||||
GError **error);
|
||||
|
Loading…
Reference in New Issue
Block a user