shadow: add a method to paint the shadow for a PangoLayout
https://bugzilla.gnome.org/show_bug.cgi?id=649314
This commit is contained in:
parent
c3f3e4a670
commit
73e0070774
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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__ */
|
||||
|
Loading…
Reference in New Issue
Block a user