Exemplo n.º 1
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
        }
Exemplo n.º 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();
    }
Exemplo n.º 3
0
	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;
	}
Exemplo n.º 4
0
	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;
	}
Exemplo n.º 5
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();
     }
     }
 }