public static unsafe Pixbuf Deserialize (byte [] data)
	{
		Pixdata pixdata = new Pixdata ();

		pixdata.Deserialize ((uint) data.Length, data);

		return Pixbuf.FromPixdata (pixdata, true);
	}
Example #2
0
    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 ();
		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;
	}
Example #4
0
        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
        }
	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;
	}
Example #6
0
 static extern IntPtr gdk_pixdata_serialize(ref Gdk.Pixdata raw, out uint stream_length_p);
Example #7
0
 static extern unsafe bool gdk_pixdata_deserialize(ref Gdk.Pixdata raw, uint stream_length, byte [] stream, out IntPtr error);
Example #8
0
 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();
     }
     }
 }