GooCanvasPolyline

GooCanvasPolyline — a polyline item (a series of lines with optional arrows).

Properties

gdouble arrow-length Read / Write
gdouble arrow-tip-length Read / Write
gdouble arrow-width Read / Write
gboolean close-path Read / Write
gboolean end-arrow Read / Write
gdouble height Read / Write
GooCanvasPoints * points Read / Write
gboolean start-arrow Read / Write
gdouble width Read / Write
gdouble x Read / Write
gdouble y Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GooCanvasItemSimple
        ╰── GooCanvasPolyline

Implemented Interfaces

GooCanvasPolyline implements GooCanvasItem.

Description

GooCanvasPolyline represents a polyline item, which is a series of one or more lines, with optional arrows at either end.

It is a subclass of GooCanvasItemSimple and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width".

It also implements the GooCanvasItem interface, so you can use the GooCanvasItem functions such as goo_canvas_item_raise() and goo_canvas_item_rotate().

To create a GooCanvasPolyline use goo_canvas_polyline_new(), or goo_canvas_polyline_new_line() for a simple line between two points.

To get or set the properties of an existing GooCanvasPolyline, use g_object_get() and g_object_set().

Functions

goo_canvas_polyline_new ()

GooCanvasItem *
goo_canvas_polyline_new (GooCanvasItem *parent,
                         gboolean close_path,
                         gint num_points,
                         ...);

Creates a new polyline item.

Here's an example showing how to create a filled triangle with vertices at (100,100), (300,100), and (200,300).

1
2
3
4
5
6
7
8
GooCanvasItem *polyline = goo_canvas_polyline_new (mygroup, TRUE, 3,
                                                   100.0, 100.0,
                                                   300.0, 100.0,
                                                   200.0, 300.0,
                                                   "stroke-color", "red",
                                                   "line-width", 5.0,
                                                   "fill-color", "blue",
                                                   NULL);

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 g_object_unref() to free it.

[skip]

close_path

if the last point should be connected to the first.

 

num_points

the number of points in the polyline.

 

...

the pairs of coordinates for each point in the line, followed by optional pairs of property names and values, and a terminating NULL.

 

Returns

a new polyline item.

[transfer full]


goo_canvas_polyline_new_line ()

GooCanvasItem *
goo_canvas_polyline_new_line (GooCanvasItem *parent,
                              gdouble x1,
                              gdouble y1,
                              gdouble x2,
                              gdouble y2,
                              ...);

Creates a new polyline item with a single line.

Here's an example showing how to create a line from (100,100) to (300,300).

1
2
3
4
5
6
GooCanvasItem *polyline = goo_canvas_polyline_new_line (mygroup,
                                                        100.0, 100.0,
                                                        300.0, 300.0,
                                                        "stroke-color", "red",
                                                        "line-width", 5.0,
                                                        NULL);

Parameters

parent

the parent item, or NULL.

[skip]

x1

the x coordinate of the start of the line.

 

y1

the y coordinate of the start of the line.

 

x2

the x coordinate of the end of the line.

 

y2

the y coordinate of the end of the line.

 

...

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

 

Returns

a new polyline item.

[transfer full]

Types and Values

struct GooCanvasPolyline

struct GooCanvasPolyline;

The GooCanvasPolyline struct contains private data only.

Property Details

The “arrow-length” property

  “arrow-length”             gdouble

The length of the arrows, as a multiple of the line width.

Flags: Read / Write

Allowed values: >= 0

Default value: 5


The “arrow-tip-length” property

  “arrow-tip-length”         gdouble

The length of the arrow tip, as a multiple of the line width.

Flags: Read / Write

Allowed values: >= 0

Default value: 4


The “arrow-width” property

  “arrow-width”              gdouble

The width of the arrows, as a multiple of the line width.

Flags: Read / Write

Allowed values: >= 0

Default value: 4


The “close-path” property

  “close-path”               gboolean

If the last point should be connected to the first.

Flags: Read / Write

Default value: FALSE


The “end-arrow” property

  “end-arrow”                gboolean

If an arrow should be displayed at the end of the polyline.

Flags: Read / Write

Default value: FALSE


The “height” property

  “height”                   gdouble

The height of the polyline.

Flags: Read / Write

Allowed values: >= 0

Default value: 0


The “points” property

  “points”                   GooCanvasPoints *

The array of points.

Flags: Read / Write


The “start-arrow” property

  “start-arrow”              gboolean

If an arrow should be displayed at the start of the polyline.

Flags: Read / Write

Default value: FALSE


The “width” property

  “width”                    gdouble

The width of the polyline.

Flags: Read / Write

Allowed values: >= 0

Default value: 0


The “x” property

  “x”                        gdouble

The x coordinate of the left-most point of the polyline.

Flags: Read / Write

Default value: 0


The “y” property

  “y”                        gdouble

The y coordinate of the top-most point of the polyline.

Flags: Read / Write

Default value: 0