diff options
-rw-r--r-- | generic/Icon.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/generic/Icon.c b/generic/Icon.c index 407302f..6b3ce64 100644 --- a/generic/Icon.c +++ b/generic/Icon.c @@ -55,8 +55,8 @@ typedef struct _IconItemStruct { ZnAnchor anchor; ZnAnchor connection_anchor; Pixmap mask; /* Used only if the image is *NOT* specified */ - ZnColor color; /* Used with the mask */ - int alpha; + ZnColor color; /* Used only with the mask in GLX */ + int alpha; /* Used only with the image in GLX */ /* Private data */ ZnPoint pos_dev; @@ -65,7 +65,7 @@ typedef struct _IconItemStruct { static ZnAttrConfig icon_attrs[] = { - { ZN_CONFIG_UINT, "-alpha", NULL, + { ZN_CONFIG_ALPHA, "-alpha", NULL, Tk_Offset(IconItemStruct, alpha), 0, ZN_DRAW_FLAG, False }, { ZN_CONFIG_ANCHOR, "-anchor", NULL, Tk_Offset(IconItemStruct, anchor), 0, ZN_COORDS_FLAG, False }, @@ -157,7 +157,7 @@ Init(Item item, icon->connection_anchor = ZnAnchorSW; icon->mask = ZnUnspecifiedPattern; icon->color = ZnGetColorByValue(wi->win, wi->fore_color); - icon->alpha = 255; + icon->alpha = 100; return ZN_OK; } @@ -537,28 +537,18 @@ Draw(Item item) static void Render(Item item) { -#ifdef LIBART +#ifdef GLX WidgetInfo *wi = item->wi; IconItem icon = (IconItem) item; + if (icon->image != ZnUnspecifiedImage) { - ArtPixBuf *pixbuf; - pixbuf = GetImagePixbuf(wi->win, icon->image_name, icon->image); - rgb_image(wi->buf.buf, wi->buf.ox, wi->buf.oy, - wi->buf.cx, wi->buf.cy, wi->buf.rowstride, - pixbuf, icon->pos_dev.x, icon->pos_dev.y, icon->alpha); - } + RenderImage(wi, GetImageTexture(wi->win, icon->image_name, icon->image), + NULL, icon->alpha, &icon->pos_dev); + } else if (icon->mask != ZnUnspecifiedPattern) { - BitmapBits *bitmap = GetBitmapMask(wi->dpy, icon->mask); - art_u32 rgba; - - rgba = (((icon->color->red & 0xff00) << 16) | - ((icon->color->green & 0xff00) << 8) | - (icon->color->blue & 0xff00) | (icon->alpha & 0xff)); - rgb_bitmap(wi->buf.buf, wi->buf.ox, wi->buf.oy, - wi->buf.cx, wi->buf.cy, wi->buf.rowstride, - bitmap->pixels, icon->pos_dev.x, icon->pos_dev.y, - bitmap->width, bitmap->height, bitmap->rowstride, rgba); + RenderImage(wi, (ImageBits *) GetBitmapTexture(wi->dpy, icon->mask), + icon->color, icon->alpha, &icon->pos_dev); } #endif } |