You can get a raw IntPtr to the System.Drawing.Bitmap data, using:
var data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), PixelFormat.Format32bppRgba, ImageLockMode.ReadOnly);
// data.Scan0 contains the pointer
IIRC you can construct a Gtk.Image from a raw pointer (I'm pretty sure I have used this before). Just make sure the pixel formats match and pass this pointer along with data.Stride (if necessary).
Don't forget to unlock and dispose the bitmap when you are done:
bmp.UnlockBits(data);
bmp.Dispose();
On Wed, Jul 8, 2009 at 6:47 AM, spaceyguy
<spaceyguy@...> wrote:
Michael Hutchinson wrote:
There are a few ways to do this, though IMO all are suboptimal. The easiest
would be to save the Bitmap to a MemoryStream then load the Gtk.Image from
that stream.
FWIW, why do you have a Bitmap? Depending on what you're doing, you may be
able to go straight to the Gtk.Image.
Ive been playing around with the facebook api, using something the Facebook Developer Toolkit, and it can return a Bitmap object for getting a profile picture. I wanted to know if it would be easier to just use the Bitmap or use the url instead.
View this message in context: Re: Gtk.Image and System.Drawing.Bitmap
_______________________________________________
Gtk-sharp-list maillist - Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
_______________________________________________
Gtk-sharp-list maillist -
Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list