Re: 2.3 Feature Request: Inactive toolbar icons
- From: iain <iain prettypeople org>
- To: shaihulud supereva it
- Cc: desktop-devel-list gnome org
- Subject: Re: 2.3 Feature Request: Inactive toolbar icons
- Date: 07 Feb 2003 16:43:33 +0000
fre, 2003-02-07 kl. 16:12 skrev shaihulud supereva it:
> Jeff Waugh wrote:
>
> >We're mostly looking for "yes, I am coding >this feature" emails, rather than
> >suggestions. Sorry. :-) You may want to >lodge a GTK+ bug on this, though -
> >it would be much prettier!
>
> >- Jeff
>
> Thanks iain for make the patch ! Here is a screenshot:
> http://discomachinegun.prettypeople.org/~iain/insensitive.png
>
> I think that would be better if the alpha is scaled down at 75-80%. In this way the inactive icons look better on a light or dark background.
Alpha is now halfed. Attached patch does so. It could probably be made
faster, by replacing the 2 for loops with one.
http://www.prettypeople.org/~iain/insensitive2.png
iain
Index: gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.139
diff -u -p -r1.139 gtkstyle.c
--- gtkstyle.c 10 Dec 2002 21:39:52 -0000 1.139
+++ gtkstyle.c 7 Feb 2003 16:43:53 -0000
@@ -1988,6 +1988,36 @@ scale_or_ref (GdkPixbuf *src,
}
}
+static void
+set_pixbuf_alpha (GdkPixbuf *src)
+{
+ int width, wb;
+ int height;
+ int rowstride;
+ gboolean has_alpha;
+ guchar *pixels, *p;
+ int i, j;
+
+ width = gdk_pixbuf_get_width (src);
+ height = gdk_pixbuf_get_height (src);
+ rowstride = gdk_pixbuf_get_rowstride (src);
+ has_alpha = gdk_pixbuf_get_has_alpha (src);
+
+ if (has_alpha == FALSE)
+ return;
+
+ pixels = gdk_pixbuf_get_pixels (src);
+
+ wb = width << 2;
+ for (i = 0; i < height; i ++)
+ {
+ p = pixels + (i * rowstride);
+
+ for (j = 0; j < wb; j += 4)
+ p[j + 3] = p[j + 3] >> 2;
+ }
+}
+
static GdkPixbuf *
gtk_default_render_icon (GtkStyle *style,
const GtkIconSource *source,
@@ -2054,8 +2084,9 @@ gtk_default_render_icon (GtkStyle
stated = gdk_pixbuf_copy (scaled);
gdk_pixbuf_saturate_and_pixelate (scaled, stated,
- 0.8, TRUE);
-
+ 0.0, FALSE);
+
+ set_pixbuf_alpha (stated);
g_object_unref (scaled);
}
else if (state == GTK_STATE_PRELIGHT)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]