|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Gtk.Image and System.Drawing.BitmapIs it possible to create a Gtk.Image using a System.Drawing.Bitmap object as the source of the image? If not is there some kind of workaround which I can use to do this.
|
|
|
Re: Gtk.Image and System.Drawing.BitmapThere 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. On Jul 7, 2009 5:16 PM, "spaceyguy" <spaceyguy@...> wrote: _______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@... http://lists.ximian.com/mailman/listinfo/gtk-sharp-list |
|
|
Re: Gtk.Image and System.Drawing.BitmapIve 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. |
|
|
Re: Gtk.Image and System.Drawing.BitmapYou 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:
_______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@... http://lists.ximian.com/mailman/listinfo/gtk-sharp-list |
|
|
Re: Gtk.Image and System.Drawing.Bitmapthe other option is to use Gtk.DotNet.Graphics.FromDrawable ()
s On Mon, 2009-07-06 at 20:59 -0700, spaceyguy wrote: > Is it possible to create a Gtk.Image using a System.Drawing.Bitmap object as > the source of the image? If not is there some kind of workaround which I can > use to do this. _______________________________________________ Gtk-sharp-list maillist - Gtk-sharp-list@... http://lists.ximian.com/mailman/listinfo/gtk-sharp-list |
| Free embeddable forum powered by Nabble | Forum Help |