css: Export some color value api for tests

Export enough api to test color conversion and interpolation.
This commit is contained in:
Matthias Clasen 2024-05-31 19:34:16 -04:00
parent 48e707aceb
commit 8ecb00be66
2 changed files with 19 additions and 1 deletions

View File

@ -608,7 +608,7 @@ gtk_css_color_value_new_literal (const GdkRGBA *color)
return value; return value;
} }
static GtkCssValue * GtkCssValue *
gtk_css_color_value_new_color (GtkCssColorSpace color_space, gtk_css_color_value_new_color (GtkCssColorSpace color_space,
gboolean serialize_as_rgb, gboolean serialize_as_rgb,
float values[4], float values[4],
@ -1633,3 +1633,12 @@ gtk_css_color_value_get_rgba (const GtkCssValue *color)
return &color->rgba; return &color->rgba;
} }
const GtkCssColor *
gtk_css_color_value_get_color (const GtkCssValue *color)
{
g_assert (color->class == &GTK_CSS_VALUE_COLOR);
g_assert (color->type == COLOR_TYPE_COLOR);
return &color->color;
}

View File

@ -21,6 +21,7 @@
#include "gtk/css/gtkcsstokenizerprivate.h" #include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h" #include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h" #include "gtkcssvalueprivate.h"
#include "gtkcsscolorprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -37,6 +38,14 @@ GtkCssValue * gtk_css_color_value_resolve (GtkCssValue *color
GtkCssValue *current); GtkCssValue *current);
const GdkRGBA * gtk_css_color_value_get_rgba (const GtkCssValue *color) G_GNUC_CONST; const GdkRGBA * gtk_css_color_value_get_rgba (const GtkCssValue *color) G_GNUC_CONST;
GtkCssValue * gtk_css_color_value_new_color (GtkCssColorSpace color_space,
gboolean serialize_as_rgb,
float values[4],
gboolean missing[4]) G_GNUC_PURE;
const GtkCssColor *
gtk_css_color_value_get_color (const GtkCssValue *color) G_GNUC_CONST;
G_END_DECLS G_END_DECLS