Re: modifying points of a polyline



On Fri, 2009-12-18 at 11:20 +0000, Damon Chaplin wrote:
> On Fri, 2009-12-18 at 10:13 +0200, Stefan Kost wrote:
> > Am 18.12.2009 01:27, schrieb Damon Chaplin:
> > > 
> > > On Fri, 2009-12-18 at 00:10 +0200, Stefan Kost wrote:
> > >> hi,
> > >>
> > >> I have a polyline initialy created as
> > >>       item->citem = goo_canvas_polyline_new (self->priv->canvas_root, FALSE, 2,
> > >>         item->ns->x, item->ns->y,
> > >>         item->ne->x, item->ne->y,
> > >>         "stroke-color", "red",
> > >>         "line-width", 1.0,
> > >>         NULL);
> > >>
> > >> later on the coorinates change. Is this the way to update them?
> > >>
> > >>       GooCanvasPoints *points;
> > >>       // modify the points
> > >>       g_object_get (item->citem, "points", &points, NULL);
> > >>       points->coords[0]=item->ns->x;
> > >>       points->coords[1]=item->ns->y;
> > >>       points->coords[2]=item->ne->x;
> > >>       points->coords[3]=item->ne->y;
> > >>       g_object_set (item->citem, "points", points, NULL);
> > >>       goo_canvas_points_unref (points);
> > > 
> > > Yes, I think so. Does it work OK?
> > > 
> > > Damon
> > > 
> > 
> > I experiment with soem live-updated graph display. The lines are quite wrong
> > right now. But then I am not sure if they are properly redraws. If I understood
> > right, goocanvas updates in a idle-callback. That could be a problem, as my app
> > receives logdata from a sockets and emits signals for log-events. Those
> > log-events cause graph changes. The graphs is not changing very smoothly. Is
> > there any way to force a redraw (if only for debugging it right now)?
> 
> There is no GooCanvas-specific way to force a redraw.
> 
> But you may be able to use something like gdk_window_process_updates().

I forgot - you'd need to call goo_canvas_update() first to update the
items, before redrawing.

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]