Re: [gnome-print] How to create GnomeCanvasBpath?



Okay, first of all I think you meant to use ART_MOVETO, not
ART_MOVE_OPEN.  I don't know what that is.

Second, you don't define a GPPath like that.  You would define an
ArtBpath like that, and then create a GPPath in the same way that I
created a GnomeCanvasPathDef in my previous email. (sorry,
GnomeCanvasPathDef is the new thing in Gnome 2.0, but it works mostly
like GPPath).

GnomeCanvasItem *item;
ArtBpath *bpath;
GPPath *gppath;

bpath = art_new (ArtBpath, 3);
bpath[0].code = ART_MOVETO;
/* Fill in coords */
bpath[1].code = ART_CURVETO;
/* Fill in coords */
bpath[2].code = ART_END;
/* No need to fill in coords here. */

gppath = gp_path_new_from_bpath (bpath);

item = gnome_canvas_item_new (group,
                              gnome_canvas_bpath_get_type (),
                              "bpath", gppath,
                              "fill_color", "#ff0000",
                              NULL);

On Wed, 2002-03-06 at 07:25, kevinmay@public.xm.fj.cn wrote:
> i wrote the following code, gcc did not report any error, but when running,
> the curve item did not appear in the canvas immediatly, it was drawn after
> refresh. and when pointer closed to the curve, progrom crashed -(
> what's wrong?
> thanks!
> 
> GnomeCanvasGroup * group = group;
> GnomeCanvasItem;
> GPPath * bpath;
> 
> bpath = gp_path_new();
> 
> bpath->path[0].code = ART_MOVE_OPEN;
> bpath->path[0].x1 = x01;
> bpath->path[0].y1 = y01;
> bpath->path[0].x2 = x02;
> bpath->path[0].y2 = y02;
> bpath->path[0].x3 = x03;
> bpath->path[0].y3 = y03;
> 
> bpath->path[1].code = ART_CURVETO;
> bpath->path[1].x1 = x11;
> bpath->path[1].y1 = y11;
> bpath->path[1].x2 = x12;
> bpath->path[1].y2 = y12;
> bpath->path[1].x3 = x13;
> bpath->path[1].y3 = y13;
> 
> bpath->path[2].code = ART_END;
> bpath->path[2].x1 = x21;
> bpath->path[2].y1 = y21;
> bpath->path[2].x2 = x22;
> bpath->path[2].y2 = y22;
> bpath->path[2].x3 = x23;
> bpath->path[2].y3 = y23;
> 
> item = gnome_canvas_item_new(group,
>                              gnome_canvas_bpath_get_type(),
>                              "bpath", bpath,
>                              "fill_color", "#ff0000",
>                              NULL);
> 
> 
> 
> 
> _______________________________________________
> Gnome-print maillist  -  Gnome-print@ximian.com
> http://lists.ximian.com/mailman/listinfo/gnome-print
> 






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