/** * gtk_symbolic_color_resolve: * @color: a #GtkSymbolicColor * @props: (allow-none): #GtkStyleProperties to use when resolving * named colors, or %NULL * @resolved_color: (out): return location for the resolved color * * If @color is resolvable, @resolved_color will be filled in * with the resolved color, and %TRUE will be returned. Generally, * if @color can't be resolved, it is due to it being defined on * top of a named color that doesn't exist in @props. * * When @props is %NULL, resolving of named colors will fail, so if * your @color is or references such a color, this function will * return %FALSE. * * Returns: %TRUE if the color has been resolved * * Since: 3.0 * * Deprecated: 3.8: #GtkSymbolicColor is deprecated. **/ gboolean gtk_symbolic_color_resolve (GtkSymbolicColor *color, GtkStyleProperties *props, GdkRGBA *resolved_color) { GdkRGBA pink = { 1.0, 0.5, 0.5, 1.0 }; GtkCssValue *v, *current; g_return_val_if_fail (color != NULL, FALSE); g_return_val_if_fail (resolved_color != NULL, FALSE); g_return_val_if_fail (props == NULL || GTK_IS_STYLE_PROPERTIES (props), FALSE); current = _gtk_css_rgba_value_new_from_rgba (&pink); v = _gtk_css_color_value_resolve (color->value, GTK_STYLE_PROVIDER_PRIVATE (props), current, 0, NULL); _gtk_css_value_unref (current); if (v == NULL) return FALSE; *resolved_color = *_gtk_css_rgba_value_get_rgba (v); _gtk_css_value_unref (v); return TRUE; }
static GtkCssValue * gtk_css_value_rgba_transition (GtkCssValue *start, GtkCssValue *end, guint property_id, double progress) { GdkRGBA result; progress = CLAMP (progress, 0, 1); result.alpha = transition (start->rgba.alpha, end->rgba.alpha, progress); if (result.alpha <= 0.0) { result.red = result.green = result.blue = 0.0; } else { result.red = transition (start->rgba.red * start->rgba.alpha, end->rgba.red * end->rgba.alpha, progress) / result.alpha; result.green = transition (start->rgba.green * start->rgba.alpha, end->rgba.green * end->rgba.alpha, progress) / result.alpha; result.blue = transition (start->rgba.blue * start->rgba.alpha, end->rgba.blue * end->rgba.alpha, progress) / result.alpha; } return _gtk_css_rgba_value_new_from_rgba (&result); }