[Gtk-sharp-list] Gnome.Canvas slows down

SKeaLoT skealot at gmail.com
Tue Apr 28 14:19:34 EDT 2009

Michael Hutchinson wrote:
> On Sat, Apr 25, 2009 at 3:56 AM, SKeaLoT <skealot at gmail.com> wrote:
>> searched for this around the internet but found nothing...
>> well.
>> i made a little application to test some cylindrical coordinate rendering
>> using a Gnome.Canvas . this is the first time i use this class, so i'm
>> probably missing something, but anyway the problem is that the more i
>> play
>> with a slider, the slower the rendering gets. (each slider controls a
>> point
>> of view property... and redraws the scene)
> I'm not familiar with GnomeCanvas, but I'm pretty sure it's a retained
> mode canvas, i.e. you add a collection of shapes to it, and it handles
> rendering them. Then you can manipulate the shapes (e.g. using affine
> transformations) and add/remove them. It retains the shapes because it
> handles repainting for you, e.g. when the window is invalidated by
> another window moving over it.
>>From a quick look at your code, I suspect you're re-adding the
> transformed shapes every time the scene changes, covering up the old
> ones without removing them. Hence your canvas is filling up with
> unused, hidden items. So, if I'm correct, you should have you sliders
> rotate the existing group instead of re-adding it.
> However, AFAIK GnomeCanvas is deprecated. There are a few alternatives
> for retained mode canvases (such as the Moonlight GTK widget), but it
> looks to me like your drawing model is more suited to immediate mode.
> If you want to do immediate mode graphics, I suggest creating a custom
> widget that subclasses Gtk.DrawingArea, then override OnExposeEvent to
> do the drawing directly:
> http://www.go-mono.com/docs/index.aspx?tlink=22@ecma:871%23DrawingArea/
> You can also use Gdk.CairoHelper to get a Cairo context from the
> GdkWindow, then use Cairo to draw on the GdkWindow.
> -- 
> Michael Hutchinson
> http://mjhutchinson.com
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

yay, thanks, i'm switching to DrawingArea, i think it's more direct in this

again, thanks a lot
View this message in context: http://www.nabble.com/Gnome.Canvas-slows-down-tp23229581p23283329.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list