gdk_pixbuf_composite_color() issue resolved..




I got it to work. Went back to using GtkImage.  Seems the problem was caused by
how I loaded the file originally.  The file load killed the alpha channel for
some reason,  don't really care why as now I have it working. It was my own
fault originally, as I'm 99% sure I used the wrong function or func args, I
know that...  By using gdk-pixmap-csource to convert my .png file into a header
and load that into a pixbuf and feed that into GtkImage it works great.  Thanks
for the help...




Date: Tue, 26 Aug 2003 13:08:43 +1200
From: Tim Evans <t evans aranz com>
Organization: Applied Research Associates NZ Ltd
To: gtk-app-devel-list gnome org
Subject: Re: gdk_pixbuf_composite_color()  help needed.

This is a multi-part message in MIME format.
--------------060103070209070708090605
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

 >> 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


=====
Dave J. Andruczyk

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]