[Mono-list] nplot + gtk.image?

Miguel de Icaza miguel@ximian.com
Mon, 07 Feb 2005 11:24:25 -0500


Hello,

> I have been trying to get nplot 0.9.8.3 (http://netcontrols.org/nplot/) 
> to work with gtk/glade# but I can't work out how to correctly get the 
> returned system.drawing.graphics into a gtk.image.
> 
> Currently I am using with following:
> ..
>         NPlot.PlotSurface2D plotSurface;
>         [Widget] Gtk.Image image1;  
> 
> ..
>         Bitmap b = new Bitmap (Xmax, Ymax);
>         Graphics g = Graphics.FromImage (b);
>         g.FillRectangle  (Brushes.White, 0, 0, Xmax, Ymax);
>         Rectangle bounds = new Rectangle (0, 0, Xmax, Ymax);
>         plotSurface.Draw(g,bounds);
>         
>         b.Save ("file.png", ImageFormat.Png);
>         image1.FromFile = "file.png";
> 
> This works but doesn't seem very efficient. Should I not be using a 
> gtk.image? Should I be using a pixmap somewhere? Could someone please 
> give me some hints?
> 
> I am developing in linux with mono 1.0.5 and gtk# 1.0.4 but I would also 
> like it to run in win32 with .net/gtk#.  Thanks in advance for any help.

You must use:

	http://primates.ximian.com/~miguel/tmp/nplot-gtk.tar.gz

Until my changes are folded into the main distribution of NPlot.

Or you can borrow the ideas from there.
Miguel.