[Gtk-sharp-list] Re: Marshaling a byte[] for a pixbuf

MDK mdk at mdk.org.pl
Tue Jul 12 20:43:56 EDT 2005


> Hello,
> 
> I've got an unmanaged C code that returns a pointer to a guchar memory
> containing RGB data. I'd like to use this data to create a pixbuf...

Okay, now I see that trying to marshal a byte[] was bad right from the
start (strange it worked). I managed to get it working by creating the
pixbuf at the unmanaged side, passing the pointer to it, and getting the
pixbuf back on the managed with 

	new Gdk.Pixbuf (IntPtr raw);

However, it seems I'm know responsible for freeing the rgb data myself.
That should happen when the pixbuf is garbage collected. I'm wondering,
if passing the managed delegate address as a "destroy notification" will
do the trick... in the delegated function I could use
GLib.Marshaler.Free .


-- 
Michał Dominik K.
mdk at mdk.org.pl
www.mdk.org.pl


 


More information about the Gtk-sharp-list mailing list