xlib transparent icons



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



Relevant Pages

  • xlib transparent icons
    ... 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: ... I've tried using XAllocNamedColorand friends to get a blank or transparent colour and then manually draw that over the right pixels in x_image with XPutPixel, ...
    (comp.windows.x)
  • Re: Icons in VS .net 2002
    ... These may be the colors shown for transparent areas (which, ... I could look at an icon if you wanted to provide one but it sounds ... like you have this color in the icon where you wanted transparent pixels to ... transparent colour, it changes all pixels that are RGB 128,128,255 to the ...
    (microsoft.public.vc.mfc)
  • Re: Changing default Icon size -- neverending topic
    ... that draws the icon of a given size to have it draw an icon of another size. ... it is hard coded to the size of 16 pixels in the call LoadImage. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Graphic converter query - transparency
    ... Well, you can, but that isn't what the finder uses for transparent ... icon square that you didn't want to count as `part of the icon'. ... that was an odd thing looking at the manuals. ... TeX isn't that big. ...
    (uk.comp.sys.mac)
  • Re: Graphic converter query - transparency
    ... outside of an image into a transparent region using Graphic Converter? ... icon square that you didn't want to count as `part of the icon'. ... scanned in image of my real HP-32E calculator as its icon. ...
    (uk.comp.sys.mac)

Loading