public static Gdk.Pixbuf DesaturateIcon(Gdk.Pixbuf source) { Gdk.Pixbuf dest = new Gdk.Pixbuf(source.Colorspace, source.HasAlpha, source.BitsPerSample, source.Width, source.Height); dest.Fill(0); source.SaturateAndPixelate(dest, 0, false); return(dest); }
/// <summary> /// This creates a new gray scale pixbuf. Note that this pixbuf needs to be disposed. /// </summary> /// <param name="icon"> /// A <see cref="Gdk.Pixbuf"/>. /// </param> /// <returns> /// A <see cref="Gdk.Pixbuf"/> gray scale version of "icon". /// </returns> public static Gdk.Pixbuf MakeGrayscale(Gdk.Pixbuf icon) { Gdk.Pixbuf copy = icon.Copy(); copy.SaturateAndPixelate(copy, 0, false); var icon2x = Get2xIconVariant(icon); if (icon2x != null) { Set2xIconVariant(copy, MakeGrayscale(icon2x)); } return(copy); }
/// <summary> /// This creates a new gray scale pixbuf. Note that this pixbuf needs to be disposed. /// </summary> /// <param name="icon"> /// A <see cref="Gdk.Pixbuf"/>. /// </param> /// <returns> /// A <see cref="Gdk.Pixbuf"/> gray scale version of "icon". /// </returns> public static Gdk.Pixbuf MakeGrayscale(Gdk.Pixbuf icon) { Gdk.Pixbuf copy = icon.Copy(); copy.SaturateAndPixelate(copy, 0, false); return(copy); }
public void UpdateTab() { if (Child != null) { Widget w = Child; Remove(w); w.Destroy(); } mainBox = new Alignment(0, 0, 1, 1); if (bar.Orientation == Gtk.Orientation.Horizontal) { box = new HBox(); if (bar.AlignToEnd) { mainBox.SetPadding(3, 3, 11, 9); } else { mainBox.SetPadding(3, 3, 9, 11); } } else { box = new VBox(); if (bar.AlignToEnd) { mainBox.SetPadding(11, 9, 3, 3); } else { mainBox.SetPadding(9, 11, 3, 3); } } Gtk.Widget customLabel = null; if (it.DockLabelProvider != null) { customLabel = it.DockLabelProvider.CreateLabel(bar.Orientation); } if (customLabel != null) { customLabel.ShowAll(); box.PackStart(customLabel, true, true, 0); } else { if (it.Icon != null) { Gdk.Pixbuf desat = it.Icon.Copy(); desat.SaturateAndPixelate(desat, 0.5f, false); crossfade = new CrossfadeIcon(desat, it.Icon); box.PackStart(crossfade, false, false, 0); desat.Dispose(); } if (!string.IsNullOrEmpty(it.Title)) { label = new Gtk.Label(it.Title); label.UseMarkup = true; if (bar.Orientation == Gtk.Orientation.Vertical) { label.Angle = 270; } box.PackStart(label, true, true, 0); } else { label = null; } } box.Spacing = 2; mainBox.Add(box); mainBox.ShowAll(); Add(mainBox); QueueDraw(); }