On Fri, 15 Sep 2000, Martin Grimme wrote:
> Hello,
>
> I am currently writing an image viewer with thumbnail browser
> (you can get information and the latest version from http://www.pycage.de )
> and had a strange experience with Imlib.
>
> When I load graphics containing transparencies (XPM, GIF, PNG) then
> Imlib only loads the images without creating the transparency-masks
> unless I add the following lines of code to my program or use a
> GTK-Theme that contains something similar:
>
> # set style to make transparent pixmaps possible
> rcstring = """
> style "trans" {
> engine "pixmap" {}
> }
> class "GtkWindow" style "trans"
> """
> gtk.rc_parse_string(rcstring)
>
> Why does Imlib only recognize transparency when having an engine "pixmap"
> entry (even an empty one) for windows in the gtkrc?
>
> Is there any way around this? I don't want my program to be dependent on
> GTK-Engines.
By the sounds of things, this is only incidentally to do with the theme
you use. The difference between the two cases is that without the pixmap
theme engine, libgdk_imlib is loaded without the RTLD_GLOBAL flag, while
with the theme it is. gdk_imlib's image loaders are shared libraries that
expect imlib's symbols to be in the global namespace, and get a link error
otherwise.
In that case, they fall back on netpbm or imagemagick, which are probably
not handling the transparency. That would probably be the problem you are
seeing.
The two options to fix this problem are:
1) modify python so that it uses RTLD_GLOBAL when loading extension
modules. This is what Red Hat does with their distro, but has the
problem that symbols in separate modules may cause conflicts (of
course, modules should keep their global C symbols to a minimum so
things don't break on systems that don't handle things the same way).
2) modify imlib so that the image loader shared libraries link back to
libgdk_imlib. As imlib uses libtool to build, you will need to use
libtool-1.3b to do the build, as previous versions don't handle
linking one libtool library to another. The cons are that
libtool-1.3b is a beta, and is fairly old and doesn't support some of
the new architectures found in the latest non beta libtools.
>
> Please help if you can.
>
> Martin Grimme - http://www.pycage.de
>
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk