CanvasPath


Description:

[ CCode ( has_construct_function = false , type = "GooCanvasItem*" ) ]
public CanvasPath (CanvasItem? parent, string path_data, ...)

Creates a new path item.

Here's an example showing how to create a red line from (20,20) to (40,40):

<informalexample><programlisting> GooCanvasItem *path = goo_canvas_path_new (mygroup, "M 20 20 L 40 40", "stroke-color", "red", NULL); </programlisting></informalexample>

This example creates a cubic bezier curve from (20,100) to (100,100) with the control points at (20,50) and (100,50):

<informalexample><programlisting> GooCanvasItem *path = goo_canvas_path_new (mygroup, "M20,100 C20,50 100,50 100,100", "stroke-color", "blue", NULL); </programlisting></informalexample>

This example uses an elliptical arc to create a filled circle with one quarter missing:

<informalexample><programlisting> GooCanvasItem *path = goo_canvas_path_new (mygroup, "M200,500 h-150 a150,150 0 1,0 150,-150 z", "fill-color", "red", "stroke-color", "blue", "line-width", 5.0, NULL); </programlisting></informalexample>

Parameters:

parent

the parent item, or null. If a parent is specified, it will assume ownership of the item, and the item will automatically be freed when it is removed from the parent. Otherwise call unref to free it.

path_data

the sequence of path commands, specified as a string using the same syntax as in the <ulink url="http://www.w3.org/Graphics/SVG/">Scalable Vector Graphics (SVG)</ulink> path element.

...

optional pairs of property names and values, and a terminating null.

Returns:

a new path item.




2022 vala-language.org