GooCanvasPathModel: GooCanvas Reference Manual

## GooCanvasPathModel GooCanvasPathModel — a model for path items (a series of lines and curves). |

## Functions

GooCanvasItemModel * | goo_canvas_path_model_new ()

## Properties

gchar * | data | Write
gdouble | height | Read / Write
gdouble | width | Read / Write
gdouble | x | Read / Write
gdouble | y | Read / Write

## Types and Values

struct | GooCanvasPathModel

## Object Hierarchy

        GObject
        ╰── GooCanvasItemModelSimple
            ╰── GooCanvasPathModel

## Implemented Interfaces

GooCanvasPathModel implements GooCanvasItemModel.

## Description

GooCanvasPathModel represents a model for path items, which are a series of one or more lines, bezier curves, or elliptical arcs.

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

It also implements the GooCanvasItemModel interface, so you can use the GooCanvasItemModel functions such as `goo_canvas_item_model_raise()` and `goo_canvas_item_model_rotate()`.

GooCanvasPathModel uses the same path specification strings as the Scalable Vector Graphics (SVG) path element. For details see the

SVG specification.

To create a GooCanvasPathModel use `goo_canvas_path_model_new()`.

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

To respond to events such as mouse clicks on the path you must connect to the signal handlers of the corresponding GooCanvasPath objects. (See `goo_canvas_get_item()` and “item-created”.)

## Functions

### goo_canvas_path_model_new ()

    GooCanvasItemModel *
    goo_canvas_path_model_new (GooCanvasItemModel *parent,
                               const gchar *path_data,
                               ...);

Creates a new path model.

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

    1
    2
    3
    4
    GooCanvasItemModel *path = goo_canvas_path_model_new (mygroup,
                                                          "M 20 20 L 40 40",
                                                          "stroke-color", "red",
                                                          NULL);

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

    1
    2
    3
    4
    GooCanvasItemModel *path = goo_canvas_path_model_new (mygroup,
                                                          "M20,100 C20,50 100,50 100,100",
                                                          "stroke-color", "blue",
                                                          NULL);

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

    1
    2
    3
    4
    5
    6
    GooCanvasItemModel *path = goo_canvas_path_model_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);

#### Parameters

parent | the parent model, 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]
path_data | the sequence of path commands, specified as a string using the same syntax as in the Scalable Vector Graphics (SVG) path element. |
... | optional pairs of property names and values, and a terminating `NULL`. |

#### Returns

a new path model.

[transfer full]

## Types and Values

### struct GooCanvasPathModel

    struct GooCanvasPathModel;

The GooCanvasPathModel struct contains private data only.

## Property Details

### The `“data”` property

      “data”                     gchar *

The sequence of path commands.

Flags: Write

Default value: NULL

### The `“height”` property

      “height”                   gdouble

The height of the path.

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“width”` property

      “width”                    gdouble

The width of the path.

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“x”` property

      “x”                        gdouble

The x coordinate of the path.

Flags: Read / Write

Default value: 0

### The `“y”` property

      “y”                        gdouble

The y coordinate of the path.

Flags: Read / Write

Default value: 0