shadow: add _gtk_icon_shadow_paint()

Paints a shadow of the current source, using the defined colors.
This commit is contained in:
Cosimo Cecchi 2011-05-20 23:51:16 -04:00 committed by Benjamin Otte
parent ef78d5b730
commit b6b66803c0
2 changed files with 26 additions and 0 deletions

View File

@ -275,3 +275,26 @@ _gtk_text_shadow_paint_layout (GtkShadow *shadow,
}
}
void
_gtk_icon_shadow_paint (GtkShadow *shadow,
cairo_t *cr)
{
GList *l;
GtkShadowElement *element;
cairo_pattern_t *pattern;
for (l = g_list_last (shadow->elements); l != NULL; l = l->prev)
{
element = l->data;
cairo_save (cr);
pattern = cairo_pattern_reference (cairo_get_source (cr));
gdk_cairo_set_source_rgba (cr, &element->color);
cairo_translate (cr, element->hoffset, element->voffset);
cairo_mask (cr, pattern);
cairo_restore (cr);
cairo_pattern_destroy (pattern);
}
}

View File

@ -58,6 +58,9 @@ void _gtk_text_shadow_paint_layout (GtkShadow *shadow,
cairo_t *cr,
PangoLayout *layout);
void _gtk_icon_shadow_paint (GtkShadow *shadow,
cairo_t *cr);
G_END_DECLS
#endif /* __GTK_SHADOW_H__ */