diff options
Diffstat (limited to 'demos/testpixbuf-scale.c')
-rw-r--r-- | demos/testpixbuf-scale.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c index a99977fbd..f0059d4ab 100644 --- a/demos/testpixbuf-scale.c +++ b/demos/testpixbuf-scale.c @@ -29,19 +29,41 @@ gboolean expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) { GdkPixbuf *dest; + GdkGC *gc; + GdkColormap *colormap; + GdkColor color; - gdk_window_set_back_pixmap (widget->window, NULL, FALSE); + color.red = 0xffff; + color.green = 0xffff; + color.blue = 0xffff; - dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height); + gc = gdk_gc_new (widget->window); + colormap = gdk_window_get_colormap (widget->window); + gdk_colormap_alloc_color (colormap, &color, TRUE, TRUE); + gdk_gc_set_foreground (gc, &color); + gdk_draw_rectangle (widget->window, gc, + TRUE, + event->area.x, + event->area.y, + event->area.width, event->area.height); + + gdk_window_set_back_pixmap (widget->window, NULL, FALSE); - gdk_pixbuf_composite_color (pixbuf, dest, - 0, 0, event->area.width, event->area.height, - -event->area.x, -event->area.y, - (double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf), - (double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf), - interp_type, overall_alpha, - event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555); + dest = gdk_pixbuf_get_from_drawable(NULL, + widget->window, + gdk_window_get_colormap (widget->window), + event->area.x, + event->area.y, + 0, 0, event->area.width, event->area.height); + + gdk_pixbuf_composite (pixbuf, dest, + 0, 0, event->area.width, event->area.height, + -event->area.x, -event->area.y, + (double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf), + (double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf), + interp_type, overall_alpha); + gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], 0, 0, event->area.x, event->area.y, event->area.width, event->area.height, |