[Gtk-sharp-list] Gtk.Image with transparency
Aaron Radich
aaron at radich.com
Wed Jan 20 14:18:17 EST 2010
Thanks for the input. That gets me closer, but some of the transparent
areas are still pocked marked with visible white areas. When I view the
image transparency in a tool like PaintShopPro or PhotoShop, it looks
great. Can you think of anything that might be causing the pocked marked
transparency when using Pixbug.AddAlpha?
Aaron
Here's the current code:
//imgCartIcon.Pixbuf = new Gdk.Pixbuf(sCartIconPathFilename);
Gdk.Pixbuf objPixbuf = new Gdk.Pixbuf(sCartIconPathFilename);
// need to handle the transparency
//imgCartIcon.Pixbuf.AddAlpha(true, 255, 255, 255);
objPixbuf = objPixbuf.AddAlpha(true, 255, 255, 255);
imgCartIcon.Pixbuf = objPixbuf;
----------------------------------------
From: "Chris Szikszoy" <chris at szikszoy.com>
Sent: Wednesday, January 20, 2010 12:12 AM
To: gtk-sharp-list at lists.ximian.com
Subject: Re: [Gtk-sharp-list] Gtk.Image with transparency
Ratfish wrote:
>
> I think it has something to do with the Pixmap of the Gtk.Image, but I
> can't find any examples. My image has a white color that represents the
> transparency. Can anyone set me straight?
>
You can do this by specifying the transparent color of the pixbuf.
You can use Pixbuf.AddAlpha (). This will return a new pixbuf, as
specified
by the gdk docs here:
http://www.pygtk.org/docs/pygtk/class-gdkpixbuf.html#method-gdkpixbuf--add-a
lpha
I don't think you need to mess with the .Pixmap of the image, just create
a
new pixbuf from the file, add alpha, and assign the resulting pixbuf to
imgCartIcon.Pixbuf.
--
View this message in context:
http://old.nabble.com/Gtk.Image-with-transparency-tp27237130p27238075.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
_______________________________________________
Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100120/0be84dcc/attachment.html
More information about the Gtk-sharp-list
mailing list