xlib transparent icons
- From: John Smith <not@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 08 Mar 2007 12:27:43 +1100
I've been trying to set a window's icon from an array of ARGB quads. So far, I've come up with the following, which creates an image, draws it to a pixmap and then assigns the pixmap to be the window's icon:
x_image = XCreateImage(g_display, CopyFromParent, 24,
ZPixmap, 0, bytes, 16, 16, 32, 0);
icon_pixmap = XCreatePixmap(g_display, sw->wnd, 16, 16, 24);
XPutImage(g_display, icon_pixmap, g_gc, x_image, 0, 0, 0, 0, 16, 16);
win_hints = XAllocWMHints();
win_hints->flags = IconPixmapHint;
win_hints->icon_pixmap = icon_pixmap;
XSetWMHints(g_display, sw->wnd, win_hints);
That works (though it's probably not the most elegant way of doing things and it's hard-coded to only work for a 16x16 image), but I've run into a block with transparency. I can't figure out how to set pixels to be transparent - they're just coming up black. I've tried using XAllocNamedColor() and friends to get a blank or transparent colour and then manually draw that over the right pixels in x_image with XPutPixel(), but didn't have any luck. How would I go about setting certain pixels in the pixmap to be transparent?
Cheers,
John.
.
- Follow-Ups:
- Re: xlib transparent icons
- From: Steve Kirkendall
- Re: xlib transparent icons
- Prev by Date: Re: simulate mouse buttons using Xlib
- Next by Date: Re: xlib transparent icons
- Previous by thread: Re: simulate mouse buttons using Xlib
- Next by thread: Re: xlib transparent icons
- Index(es):
Loading