Commit 73e00707 authored by Cosimo Cecchi's avatar Cosimo Cecchi

shadow: add a method to paint the shadow for a PangoLayout
parent c3f3e4a6
......@@ -23,6 +23,7 @@
#include "gtkshadowprivate.h"
#include "gtkstylecontext.h"
#include "gtkpango.h"
typedef struct _GtkShadowElement GtkShadowElement;
......@@ -253,3 +254,31 @@ _gtk_shadow_to_string (GtkShadow *shadow)
return g_string_free (str, FALSE);
_gtk_text_shadow_paint_layout (GtkShadow *shadow,
cairo_t *cr,
gdouble x,
gdouble y,
PangoLayout *layout)
GList *l;
GtkShadowElement *element;
/* render shadows starting from the last one,
* and the others on top.
for (l = g_list_last (shadow->elements); l != NULL; l = l->prev)
element = l->data;
cairo_save (cr);
cairo_move_to (cr, x + element->hoffset, y + element->voffset);
gdk_cairo_set_source_rgba (cr, &element->color);
_gtk_pango_fill_layout (cr, layout);
cairo_restore (cr);
......@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <gtk/gtkstyleproperties.h>
#include <gtk/gtksymboliccolor.h>
#include <gtk/gtkicontheme.h>
......@@ -52,6 +53,12 @@ GtkShadow *_gtk_shadow_resolve (GtkShadow *shadow,
GtkStyleProperties *props);
gboolean _gtk_shadow_get_resolved (GtkShadow *shadow);
void _gtk_text_shadow_paint_layout (GtkShadow *shadow,
cairo_t *cr,
gdouble x,
gdouble y,
PangoLayout *layout);
#endif /* __GTK_SHADOW_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment