Logo Search packages:      
Sourcecode: inkscape version File versions

SPCurve* sp_curve_concat ( GSList const *  list  ) 

Return new curve that is the concatenation of all curves in list.

Definition at line 199 of file curve.cpp.

References SPCurve::_bpath, NArtBpath::code, SPCurve::end, NR_END, NR_MOVETO, NR_MOVETO_OPEN, sp_curve_new_sized(), and SPCurve::substart.

Referenced by Inkscape::Text::Layout::convertToCurves().

{
    g_return_val_if_fail(list != NULL, NULL);

    gint length = 0;

    for (GSList const *l = list; l != NULL; l = l->next) {
        SPCurve *c = (SPCurve *) l->data;
        length += c->end;
    }

    SPCurve *new_curve = sp_curve_new_sized(length + 1);

    NArtBpath *bp = new_curve->_bpath;

    for (GSList const *l = list; l != NULL; l = l->next) {
        SPCurve *c = (SPCurve *) l->data;
        memcpy(bp, c->_bpath, c->end * sizeof(NArtBpath));
        bp += c->end;
    }

    bp->code = NR_END;

    new_curve->end = length;
    gint i;
    for (i = new_curve->end; i > 0; i--) {
        if ((new_curve->_bpath[i].code == NR_MOVETO)     ||
            (new_curve->_bpath[i].code == NR_MOVETO_OPEN)  )
            break;
    }

    new_curve->substart = i;

    return new_curve;
}


Generated by  Doxygen 1.6.0   Back to index