Logo Search packages:      
Sourcecode: inkscape version File versions

static Inkscape::XML::Node * sp_offset_write ( SPObject object,
Inkscape::XML::Node repr,
guint  flags 
) [static]

Virtual write: write offset attributes to corresponding repr.

Todo:
Fixme: we may replace these attributes by inkscape:offset="cx cy exp revo rad arg t0"

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

References SPOffset::original, SPOffset::rad, Inkscape::XML::Node::setAttribute(), SPOffset::sourceHref, sp_offset_set_shape(), and sp_repr_set_svg_double().

Referenced by sp_offset_class_init().

{
    SPOffset *offset = SP_OFFSET (object);

    if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
        Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(object)->document();
        repr = xml_doc->createElement("svg:path");
    }

    if (flags & SP_OBJECT_WRITE_EXT) {
        /** \todo
         * Fixme: we may replace these attributes by
         * inkscape:offset="cx cy exp revo rad arg t0"
         */
        repr->setAttribute("sodipodi:type", "inkscape:offset");
        sp_repr_set_svg_double(repr, "inkscape:radius", offset->rad);
        repr->setAttribute("inkscape:original", offset->original);
        repr->setAttribute("inkscape:href", offset->sourceHref);
    }


    // Make sure the object has curve
    SPCurve *curve = sp_shape_get_curve (SP_SHAPE (offset));
    if (curve == NULL) {
        sp_offset_set_shape (SP_SHAPE (offset));
    }

    // write that curve to "d"
    char *d = sp_svg_write_path (SP_CURVE_BPATH(((SPShape *) offset)->curve));
    repr->setAttribute("d", d);
    g_free (d);

    if (((SPObjectClass *) (parent_class))->write)
        ((SPObjectClass *) (parent_class))->write (object, repr,
                                                   flags | SP_SHAPE_WRITE_PATH);

    return repr;
}


Generated by  Doxygen 1.6.0   Back to index