From c32c6f5ad024cf4ca396b867d82693501e341659 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 9 Mar 2010 19:14:19 +0100 Subject: Implemented zoom buttons. --- wallpapers.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'wallpapers.c') diff --git a/wallpapers.c b/wallpapers.c index a4bfb60..0d37f5e 100644 --- a/wallpapers.c +++ b/wallpapers.c @@ -223,3 +223,18 @@ GdkPixbuf *resize_pixbuf(GdkPixbuf *orig, gint win_width, gint win_height, gint return pb; } + +GdkPixbuf *zoom_pixbuf(GdkPixbuf *orig, gdouble zoom) { + GdkPixbuf *pb; + gint img_width, img_height, width, height; + + img_width = gdk_pixbuf_get_width(orig); + img_height = gdk_pixbuf_get_height(orig); + + width = img_width * zoom; + height = img_height * zoom; + pb = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); + gdk_pixbuf_scale(orig, pb, 0, 0, width, height, 0, 0, + (gdouble)width / (gdouble)img_width, (gdouble)height / (gdouble)img_height, GDK_INTERP_BILINEAR); + return pb; +} -- cgit v1.2.3