[gtk+] shadow: add a method to paint the shadow for a PangoLayout
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] shadow: add a method to paint the shadow for a PangoLayout
- Date: Fri, 20 May 2011 23:06:40 +0000 (UTC)
commit 73e00707743f04abeedd26d22b12a4fc3d094e88
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri May 20 16:05:57 2011 -0400
shadow: add a method to paint the shadow for a PangoLayout
https://bugzilla.gnome.org/show_bug.cgi?id=649314
gtk/gtkshadow.c | 29 +++++++++++++++++++++++++++++
gtk/gtkshadowprivate.h | 7 +++++++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkshadow.c b/gtk/gtkshadow.c
index 1825a87..89702c0 100644
--- a/gtk/gtkshadow.c
+++ b/gtk/gtkshadow.c
@@ -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);
}
+
+void
+_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);
+ }
+}
+
diff --git a/gtk/gtkshadowprivate.h b/gtk/gtkshadowprivate.h
index f823911..846b1d3 100644
--- a/gtk/gtkshadowprivate.h
+++ b/gtk/gtkshadowprivate.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <gtk/gtkstyleproperties.h>
#include <gtk/gtksymboliccolor.h>
+#include <gtk/gtkicontheme.h>
G_BEGIN_DECLS
@@ -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);
+
G_END_DECLS
#endif /* __GTK_SHADOW_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]