[Mono-list] nplot + gtk.image?

Mark Gallop gallopma@cyllene.uwa.edu.au
Mon, 07 Feb 2005 15:37:31 +0800


Hello all,

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.

Cheers,
Mark