comparison audacious/util.c @ 1851:aceb472cce6c trunk

[svn] - add audacious_pixmap_resize() for resizing a skin pixmap on demand.
author nenolod
date Mon, 09 Oct 2006 03:44:50 -0700
parents be1c5774f675
children 01103f911aa5
comparison
equal deleted inserted replaced
1850:1014e22133e2 1851:aceb472cce6c
1540 } 1540 }
1541 } 1541 }
1542 1542
1543 return NULL; /* if I have no idea, return NULL. */ 1543 return NULL; /* if I have no idea, return NULL. */
1544 } 1544 }
1545
1546 /*
1547 * Resizes a GDK pixmap.
1548 */
1549 GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height)
1550 {
1551 GdkPixmap *out;
1552 gint owidth, oheight;
1553
1554 g_return_if_fail(src != NULL);
1555 g_return_if_fail(src_gc != NULL);
1556 g_return_if_fail(in != NULL);
1557 g_return_if_fail(width > 0 && height > 0);
1558
1559 gdk_drawable_get_size(in, &owidth, &oheight);
1560
1561 out = gdk_pixmap_new(src, width, height, -1);
1562
1563 gdk_draw_rectangle(out, src_gc, TRUE, 0, 0, width, height);
1564
1565 gdk_window_copy_area(out, src_gc, 0, 0, in, 0, 0, owidth, oheight);
1566 g_object_unref(src);
1567
1568 return out;
1569 }