diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-03-09 19:14:19 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-03-09 19:14:19 +0100 |
commit | c32c6f5ad024cf4ca396b867d82693501e341659 (patch) | |
tree | 1bc6912e7eb1565797565d982c1cad38021ccb5e /wallpapers.c | |
parent | b13140f726ee9c3c8fbcc870d673dbfa37ffb23e (diff) |
Implemented zoom buttons.
Diffstat (limited to 'wallpapers.c')
-rw-r--r-- | wallpapers.c | 15 |
1 files changed, 15 insertions, 0 deletions
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; +} |