Created
December 12, 2012 19:20
-
-
Save Tefnet/4270725 to your computer and use it in GitHub Desktop.
Shadow for GtkLabel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static gboolean label_exposed(GtkWidget *widget, GdkEventExpose *event, gpointer userdata) | |
{ | |
double width = 4.0; | |
int offset_x = 2; | |
int offset_y = 2; | |
cairo_t *cr = gdk_cairo_create(widget->window); | |
gint x = widget->allocation.x; | |
gint y = widget->allocation.y; | |
PangoLayout *layout = gtk_label_get_layout(GTK_LABEL(widget)); | |
if PANGO_IS_LAYOUT(layout) { | |
cairo_move_to (cr, x+offset_x, y+offset_y); | |
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); | |
cairo_set_line_width (cr, width); | |
pango_cairo_layout_path (cr, layout); | |
cairo_stroke (cr); | |
cairo_move_to (cr, x, y); | |
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); | |
pango_cairo_show_layout(cr, layout); | |
cairo_destroy(cr); | |
} | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment