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 static byte [] Serialize(Pixbuf pixbuf) { Pixdata pixdata = new Pixdata(); IntPtr raw_pixdata = pixdata.FromPixbuf(pixbuf, false); // FIXME GTK# shouldn't this be a constructor or something? // It's probably because we need the IntPtr to free it afterwards uint data_length; IntPtr raw_data = gdk_pixdata_serialize(ref pixdata, out data_length); byte [] data = new byte [data_length]; Marshal.Copy(raw_data, data, 0, (int)data_length); GLib.Marshaller.Free(new IntPtr[] { raw_data, raw_pixdata }); return(data); }
public static byte [] Serialize(Pixbuf pixbuf) { Pixdata pixdata = new Pixdata(); pixdata.FromPixbuf(pixbuf, true); // FIXME GTK# shouldn't this be a constructor or something? uint data_length; IntPtr raw_data = gdk_pixdata_serialize(ref pixdata, out data_length); byte [] data = new byte [data_length]; Marshal.Copy(raw_data, data, 0, (int)data_length); GLib.Marshaller.Free(raw_data); return(data); }
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(); } } }