diff options
Diffstat (limited to 'src/utils/profile-icon.c')
-rw-r--r-- | src/utils/profile-icon.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/profile-icon.c b/src/utils/profile-icon.c index 20451fa..e4f8d4d 100644 --- a/src/utils/profile-icon.c +++ b/src/utils/profile-icon.c @@ -21,7 +21,10 @@ #include "profile-icon.h" +#include <cairo.h> +#include <gdk-pixbuf/gdk-pixbuf.h> #include <glib.h> +#include <librsvg/rsvg.h> #include "svg.h" @@ -44,3 +47,29 @@ mq_profile_icon_new(const gchar *color) return mq_svg_set_color(profile_svg, color); } + +GdkPixbuf * +mq_profile_icon_new_pixbuf(const gchar *color) +{ + cairo_surface_t *surface; + cairo_t *cr; + gchar *data; + RsvgHandle *handle; + GdkPixbuf *pixbuf; + + surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 16, 16); + cr = cairo_create(surface); + + data = mq_profile_icon_new(color); + handle = rsvg_handle_new_from_data((guint8 *) data, strlen(data), NULL); + rsvg_handle_render_cairo(handle, cr); + + pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, + cairo_image_surface_get_width(surface), + cairo_image_surface_get_height(surface)); + + cairo_destroy(cr); + cairo_surface_destroy(surface); + + return pixbuf; +} |