summaryrefslogtreecommitdiff
path: root/gtk/gtkcssstylepropertyimpl.c
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2016-07-01 09:54:23 -0300
committerMatthias Clasen <mclasen@redhat.com>2016-07-03 17:24:47 -0400
commit369db4a40650bbbcd6125b9b97f486925d93541e (patch)
tree2030f4424121e6ac886800c0b32fcebc0aae55fb /gtk/gtkcssstylepropertyimpl.c
parentc8a74a1f5021fe47c9eaf199390a43a16e9809dd (diff)
downloadgtk+-369db4a40650bbbcd6125b9b97f486925d93541e.tar.gz
css: add background-blend-mode support
CSS supports blend modes, in which a series of layers are merged together according to the given operation or set of operations. Support for blend modes landed on Cairo, which exposes all the commons and also the exquisites blend modes available. Adding support for blend modes, then, is just a matter of using the available Cairo operations. This patch adds the background-blend-mode CSS enum property, and adapts the background rendering code to blend the backgrounds using the available blend modes when they're set. https://bugzilla.gnome.org/show_bug.cgi?id=768305
Diffstat (limited to 'gtk/gtkcssstylepropertyimpl.c')
-rw-r--r--gtk/gtkcssstylepropertyimpl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 138c50fa15..4f191e6d2e 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -986,6 +986,24 @@ parse_border_width (GtkCssStyleProperty *property,
}
static GtkCssValue *
+blend_mode_value_parse_one (GtkCssParser *parser)
+{
+ GtkCssValue *value = _gtk_css_blend_mode_value_try_parse (parser);
+
+ if (value == NULL)
+ _gtk_css_parser_error (parser, "unknown value for property");
+
+ return value;
+}
+
+static GtkCssValue *
+blend_mode_value_parse (GtkCssStyleProperty *property,
+ GtkCssParser *parser)
+{
+ return _gtk_css_array_value_parse (parser, blend_mode_value_parse_one);
+}
+
+static GtkCssValue *
background_repeat_value_parse_one (GtkCssParser *parser)
{
GtkCssValue *value = _gtk_css_background_repeat_value_try_parse (parser);
@@ -1565,6 +1583,16 @@ _gtk_css_style_property_init_properties (void)
background_image_value_assign,
_gtk_css_array_value_new (_gtk_css_image_value_new (NULL)));
+ gtk_css_style_property_register ("background-blend-mode",
+ GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE,
+ G_TYPE_NONE,
+ 0,
+ GTK_CSS_AFFECTS_BACKGROUND,
+ blend_mode_value_parse,
+ NULL,
+ NULL,
+ _gtk_css_array_value_new (_gtk_css_blend_mode_value_new (GTK_CSS_BLEND_MODE_NORMAL)));
+
gtk_css_style_property_register ("border-image-source",
GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE,
CAIRO_GOBJECT_TYPE_PATTERN,