Make sure the pixmap is masked correctly
2001-12-17 Bradford Hovinen <hovinen@ximian.com> * applier.c (applier_get_preview_widget): Make sure the pixmap is masked correctly
This commit is contained in:
parent
fd0119b1e9
commit
933f9f190d
2 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2001-12-17 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* applier.c (applier_get_preview_widget): Make sure the pixmap is
|
||||
masked correctly
|
||||
|
||||
2001-12-07 Bradford Hovinen <hovinen@ximian.com>
|
||||
|
||||
* preferences.c (read_color_from_string): Check if string is
|
||||
|
|
|
@ -416,7 +416,7 @@ GtkWidget *
|
|||
applier_get_preview_widget (Applier *applier)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixmap *pixmap, *pixmap1;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
|
@ -447,16 +447,27 @@ applier_get_preview_widget (Applier *applier)
|
|||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
visual->depth);
|
||||
mask = gdk_pixmap_new (GDK_ROOT_PARENT (),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
1);
|
||||
|
||||
gc = gdk_gc_new (GDK_ROOT_PARENT ());
|
||||
|
||||
gdk_pixbuf_render_threshold_alpha (pixbuf, mask,
|
||||
0, 0, 0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
1);
|
||||
|
||||
gdk_gc_set_clip_mask (gc, mask);
|
||||
|
||||
gdk_pixbuf_render_to_drawable (pixbuf, pixmap, gc,
|
||||
0, 0, 0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
GDK_RGB_DITHER_MAX, 0, 0);
|
||||
|
||||
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap1, &mask, 0);
|
||||
|
||||
applier->p->preview_widget = gtk_pixmap_new (pixmap, mask);
|
||||
gtk_widget_show (applier->p->preview_widget);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
|
@ -465,8 +476,6 @@ applier_get_preview_widget (Applier *applier)
|
|||
gtk_widget_pop_visual ();
|
||||
gtk_widget_pop_colormap ();
|
||||
|
||||
gdk_pixmap_unref (pixmap1);
|
||||
|
||||
return applier->p->preview_widget;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue