public static byte[] Serialize(Pixbuf pixbuf) { Pixdata pixdata = new Pixdata (); #if true //We should use_rle, but bgo#553374 prevents this pixdata.FromPixbuf (pixbuf, false); return pixdata.Serialize (); #else IntPtr raw_pixdata = pixdata.FromPixbuf (pixbuf, true); byte [] data = pixdata.Serialize (); GLib.Marshaller.Free (raw_pixdata); return data; #endif }
protected override void OnShown() { base.OnShown (); imagedata = new ImageData (); formsimage1.DataBindings.Add ("ImageData", imagedata, "Pixdata", false, DataSourceUpdateMode.OnPropertyChanged); Pixbuf pixbuf = new Pixbuf ("logo.png"); Pixdata pixdata = new Pixdata (); pixdata.FromPixbuf (pixbuf, false); imagedata.Pixdata = pixdata.Serialize(); }
public void IconRegister() { if (IconFile != null) { Pixbuf pixbuf; try { pixbuf = new Pixbuf(Assembly.GetEntryAssembly(), IconFile); } catch { Console.WriteLine("Icon file: " + IconFile + " not found!"); return; } var data = new Pixdata(); data.FromPixbuf(pixbuf, false); if (!gimp_plugin_icon_register(Name, IconType.InlinePixbuf, data.Serialize())) { throw new GimpSharpException(); } } }