Re: gdk_pixbuf_composite_color() help needed.
- From: Tim Evans <t evans aranz com>
- To: gtk-app-devel-list gnome org
- Subject: Re: gdk_pixbuf_composite_color() help needed.
- Date: Tue, 26 Aug 2003 13:08:43 +1200
>> Why not just create a GtkImage widget and use that to display your
pixbuf? GtkImage is a subclass of GtkMisc, just like GtkLabel, so
it's basically a label that displays an image instead of some text.
Use gtk_image_new_from_pixbuf to easily create the widget and set it
to display your pixbuf.
I did that originally, but the logo has an alpha channel and a
gentle fade at the edges, since X11 doesn't natively handle alpha
channels, the GtkImage clips it and make the logo look like crap.
(sharp edge) By compositing it with the color of the background it
has a nice smooth transition, the problem comes with getting the
background color in the same format that gdk_pixbuf_composite_color
accepts (I get the color back in 16 bit, the gdk call wants it in
packed 8 bit, the resolution loss causes errors and leaves unwated
artifacts onscreen.
If I could find the code to actually take a screenshot of the empty
space on my app before the pixmap is placed and use that as my
compositing source, that would solve all of my problems. Thus far I
haven't figured out how to do that.
The attached screenshot shows a GtkImage displaying a png image with an
alpha channel (the glade icon). The shadow on the icon is an alpha
channel and the GtkImage widget renders it correctly. The code (in
Python) was:
import gtk
w = gtk.Window()
i = gtk.Image()
i.set_from_file('glade.png')
w.add(i)
w.show_all()
gtk.main()
Perhaps you need to upgrade your version of GTK, I'm using 2.2.2
--
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]