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

MDK mdk at mdk.org.pl
Tue Jul 12 19:38:22 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 via:

public Pixbuf (byte[] data, Colorspace colorspace, bool has_alpha,
	       int bits_per_sample, int width, int height,
	       int rowstride, PixbufDestroyNotify destroy_fn)

Now, what's the right way to marshal a guchar array to a byte[] thing? I
tried a simple:

[DllImport ("Gdv")]
private static extern byte[] gdv_framerunner_get_frame (...);

...that kind of works, though there seems to be some garbage at the
begining of the byte[] (not suprising). 

Other possible solutions (creating a pixbuf at the unmananged side?) are
greatly appreciated. 

Thanks in advance, 


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


 


More information about the Gtk-sharp-list mailing list