public CrossfadeIcon(Gdk.Pixbuf primary, Gdk.Pixbuf secondary) { if (primary == null) { throw new ArgumentNullException("primary"); } if (secondary == null) { throw new ArgumentNullException("secondary"); } this.primary = (Gdk.Pixbuf)primary.Clone(); this.secondary = (Gdk.Pixbuf)secondary.Clone(); }
protected unsafe void RecreateSymbolStateImages() { foreach (StateType st in Enum.GetValues(typeof(StateType))) { if (mSymbolStates.ContainsKey(st)) { mSymbolStates[st].Dispose(); mSymbolStates.Remove(st); } if (mSymbol != null) { Gdk.Color fore_color = this.Style.Foreground(st); Gdk.Pixbuf buf = (Gdk.Pixbuf)mSymbol.Clone(); int h = buf.Height; int w = buf.Width; int stride = buf.Rowstride; int chan = buf.NChannels; byte *cur_row = (byte *)buf.Pixels; for (int j = 0; j < h; j++) { byte *cur_pixel = cur_row; for (int i = 0; i < w; i++) { byte r = (byte)(fore_color.Red / 256); byte g = (byte)(fore_color.Green / 256); byte b = (byte)(fore_color.Blue / 256); byte a = cur_pixel[3]; cur_pixel[0] = r; cur_pixel[1] = g; cur_pixel[2] = b; cur_pixel[3] = a; cur_pixel += chan; } cur_row += stride; } mSymbolStates.Add(st, buf); } } }