Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_offset_top_point ( SPOffset offset,
NR::Point px 
)

Computes a point on the offset; used to set a "seed" position for the control knot.

Returns:
the topmost point on the offset.

Definition at line 1015 of file sp-offset.cpp.

References bpath_to_liv_path(), SPOffset::knot, SPOffset::knotSet, sp_curve_unref(), and sp_offset_set_shape().

{
    (*px) = NR::Point(0, 0);
    if (offset == NULL)
        return;

    if (offset->knotSet)
    {
        (*px) = offset->knot;
        return;
    }

    SPCurve *curve = sp_shape_get_curve (SP_SHAPE (offset));
    if (curve == NULL)
    {
        sp_offset_set_shape (SP_SHAPE (offset));
        curve = sp_shape_get_curve (SP_SHAPE (offset));
        if (curve == NULL)
            return;
    }

    Path *finalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
    if (finalPath == NULL)
    {
        sp_curve_unref (curve);
        return;
    }

    Shape *theShape = new Shape;

    finalPath->Convert (1.0);
    finalPath->Fill (theShape, 0);

    if (theShape->hasPoints())
    {
        theShape->SortPoints ();
        *px = theShape->getPoint(0).x;
    }

    delete theShape;
    delete finalPath;
    sp_curve_unref (curve);
}


Generated by  Doxygen 1.6.0   Back to index