Re: modifying points of a polyline



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




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