Logo Search packages:      
Sourcecode: inkscape version File versions

SPCurve* sp_curve_new_from_bpath ( NArtBpath *  bpath  ) 

Returns:
new SPCurve, or NULL if the curve was not created for some reason.

Definition at line 84 of file curve.cpp.

References SPCurve::bpath, SPCurve::closed, SPCurve::end, SPCurve::hascpt, SPCurve::length, SPCurve::moving, SPCurve::posSet, SPCurve::refcount, SPCurve::sbpath, and SPCurve::substart.

{
    g_return_val_if_fail(bpath != NULL, NULL);

    if (!sp_bpath_good(bpath)) {
        NArtBpath *new_bpath = sp_bpath_clean(bpath);
        if (new_bpath == NULL) {
            return NULL;
        }
        nr_free(bpath);
        bpath = new_bpath;
    }

    SPCurve *curve = g_new(SPCurve, 1);

    curve->refcount = 1;
    curve->bpath = bpath;
    curve->length = sp_bpath_length(bpath);
    curve->end = curve->length - 1;
    gint i = curve->end;
    for (; i > 0; i--)
        if ((curve->bpath[i].code == NR_MOVETO) ||
            (curve->bpath[i].code == NR_MOVETO_OPEN))
            break;
    curve->substart = i;
    curve->sbpath = false;
    curve->hascpt = false;
    curve->posSet = false;
    curve->moving = false;
    curve->closed = sp_bpath_closed(bpath);

    return curve;
}


Generated by  Doxygen 1.6.0   Back to index