[Mono-dev] Mono/C# pointer for using Gdk/Pixbuf

Mark E Mason mark.e.mason at broadcom.com
Fri Nov 10 13:23:42 EST 2006


Hello,

Thanks Cody - that got me unblocked.

Cheers,
Mark 

> -----Original Message-----
> From: Cody Russell [mailto:bratsche at gnome.org] 
> Sent: Thursday, November 09, 2006 10:19 PM
> To: Mark E Mason
> Cc: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Mono/C# pointer for using Gdk/Pixbuf
> 
> On Thu, 2006-11-09 at 18:10 -0800, Mark E Mason wrote:
> > Hello all,
> >  
> > I'm looking for a pointer for doing low-level drawing in a Mono/C#
> > application developed under MonoDevelop.  Basically, all I 
> need to do is
> > allocate a pixel buffer, manually set specific pixels to specific
> > colors, and have it drawn correctly in whatever widget it's 
> attached to.
> > [Basically I'm taking the results of numerical functions, and
> > representing them as colors in a pixmap].
> > 
> > I've been looking at using a Pixbuf (or was it Pixmap) and 
> a DrawingArea
> > widget, but  getting a handle on where to start has been 
> difficult (ie.
> > How to blit the pixmap into the DrawingArea after an expose 
> event, etc).
> > I looked at Cairo briefly, but even the docs at go-mono says it's
> > overkill for what I'm doing.
> > 
> > Any pointers or advice greatly appreciated.
> 
> I think you want to start with something like this:
> 
> class MyDrawingArea : Gtk.DrawingArea
> {
>   Gdk.Pixbuf mypixbuf;
> 
>   void OnExposed (object o, ExposeEventArgs args)
>   {
>     mypixbuf.RenderToDrawable (this.GdkWindow, Style.WhiteGC,
>                                0, 0, x, y, w, h, 
> RgbDither.None, 0, 0);
>   }
> }
> 
> Look up Gdk.Pixbuf on http://www.go-mono.com/docs/ and read about its
> member RenderToDrawable for more details.
> 
> / Cody
> 
> 
> 




More information about the Mono-devel-list mailing list