static int
vbs_init(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
{
    PyGimpVectors *vectors;
    double *controlpoints;
    gboolean closed = FALSE;
    PyObject *py_controlpoints, *item;
    int i, num_points;

    static char *kwlist[] = { "vectors", "controlpoints", "closed", NULL };

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                     "O!O|i:gimp.VectorsBezierStroke.__init__",
                                     kwlist,
                                     &PyGimpVectors_Type, &vectors,
                                     &py_controlpoints, &closed));
        return -1;

    if (!PySequence_Check(py_controlpoints)) {
        PyErr_SetString(PyExc_TypeError,
                        "controlpoints must be a sequence");
        return -1;
    }

    num_points = PySequence_Length(py_controlpoints);
    controlpoints = g_new(gdouble, num_points);

    for (i = 0; i < num_points; i++) {
        item = PySequence_GetItem(py_controlpoints, i);

        if (!PyFloat_Check(item)) {
            PyErr_SetString(PyExc_TypeError,
                            "controlpoints must be a sequence of floats");
            g_free(controlpoints);
            return -1;
        }

        controlpoints[i] = PyFloat_AsDouble(item);
    }

    self->vectors_ID = vectors->ID;
    self->stroke =
        gimp_vectors_stroke_new_from_points(self->vectors_ID,
                                            GIMP_VECTORS_STROKE_TYPE_BEZIER,
                                            num_points, controlpoints, closed);

    g_free(controlpoints);

    return 0;
}
/* -------------------------------
 * p_set_2_vector_points
 * -------------------------------
 * remove all strokes from the active path vectors
 * and set a new stroke containing targetCoords (one or 2 depend on the valid flag)
 * For better visualisation set guide lines crossing at the first target coords.
 */
static void
p_set_2_vector_points(gint32 imageId, PixelCoords *targetCoords, PixelCoords *targetCoords2)
{
    gint32  activeVectorsId;
    /* gint    newStrokeId; */

    gdouble  *points;
    gint      num_points;
    gboolean  closed;
    GimpVectorsStrokeType type;


    gimp_image_add_hguide(imageId, targetCoords->py);
    gimp_image_add_vguide(imageId, targetCoords->px);


    activeVectorsId = gimp_image_get_active_vectors(imageId);
    if(activeVectorsId >= 0)
    {
        gint num_strokes;
        gint *strokes;

        strokes = gimp_vectors_get_strokes (activeVectorsId, &num_strokes);
        if(strokes)
        {
            if(num_strokes > 0)
            {
                gint ii;
                for(ii=0; ii < num_strokes; ii++)
                {
                    gimp_vectors_remove_stroke(activeVectorsId, strokes[ii]);
                }
            }
            g_free(strokes);

        }

        if (targetCoords->valid)
        {
            closed = FALSE;
            num_points = 6;
            if (targetCoords2->valid)
            {
                num_points = 12;
            }
            points = g_new (gdouble, num_points);
            points[0] = targetCoords->px;
            points[1] = targetCoords->py;
            points[2] = targetCoords->px;
            points[3] = targetCoords->py;
            points[4] = targetCoords->px;
            points[5] = targetCoords->py;
            if(targetCoords2->valid)
            {
                points[6] = targetCoords2->px;
                points[7] = targetCoords2->py;
                points[8] = targetCoords2->px;
                points[9] = targetCoords2->py;
                points[10] = targetCoords2->px;
                points[11] = targetCoords2->py;
            }

            type = GIMP_VECTORS_STROKE_TYPE_BEZIER;
            /* newStrokeId = */ gimp_vectors_stroke_new_from_points (activeVectorsId
                    , type
                    , num_points
                    , points
                    , closed
                                                                    );
            g_free(points);
        }


    }

}  /* end p_set_2_vector_points */