Handling transparency with gdk_pixmap_create_from_xpm()
- From: Rich Burridge <Rich Burridge Sun COM>
- To: gtk-app-devel-list gnome org
- Subject: Handling transparency with gdk_pixmap_create_from_xpm()
- Date: Wed, 26 Feb 2003 09:38:40 -0800 (PST)
Hi,
I'm converting one of my applications (faces - faces.sourceforge.net)
from Gtk 1.x to Gtk 2.x. I'm seeing an inconsistency with the
gdk_pixmap_create_from_xpm() call.
I had a routine:
int
get_xpm_icon(char *name, enum icon_type itype) /* Load XPM icon file. */
{
GdkBitmap *mask;
GdkPixmap *pixmap;
if ((pixmap = gdk_pixmap_create_from_xpm(GDK_ROOT_PARENT(),
&mask, NULL, name)) == NULL) {
return(-1);
}
images[(int) itype] = pixmap;
return(0);
}
which I've adjusted to:
int
get_xpm_icon(char *name, enum icon_type itype) /* Load XPM icon file. */
{
GdkBitmap *mask;
GdkPixmap *pixmap;
if ((pixmap = gdk_pixmap_create_from_xpm(gdk_get_default_root_window(),
&mask, NULL, name)) == NULL) {
return(-1);
}
images[(int) itype] = pixmap;
return(0);
}
I.e. changed GDK_ROOT_PARENT to gdk_get_default_root_window
With Gtk 1.x the transparent pixels were shown in white, whereas now they
are black. Did I just get lucky?
I've tried doing:
...
GdkColor *color;
gdk_color_parse("white", &color);
if ((pixmap = gdk_pixmap_create_from_xpm(gdk_get_default_root_window(),
&mask, &color, name)) == NULL) {
...
and I get a pastel blue color for transparent bits.
What's the magic to get this right?
Thanks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]