Logo Search packages:      
Sourcecode: inkscape version File versions

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

Writes its settings to an incoming repr object, if any.

Definition at line 248 of file displacementmap.cpp.

References Inkscape::XML::Document::createElement(), SPObject::next, SPObject::parent, Inkscape::XML::Node::setAttribute(), sp_filter_name_for_image(), and sp_repr_set_svg_double().

{
    SPFeDisplacementMap *disp = SP_FEDISPLACEMENTMAP(object);
    SPFilter *parent = SP_FILTER(object->parent);

    if (!repr) {
        repr = doc->createElement("svg:feDisplacementMap");
    }

    gchar const *out_name = sp_filter_name_for_image(parent, disp->in2);
    if (out_name) {
        repr->setAttribute("in2", out_name);
    } else {
        SPObject *i = parent->children;
        while (i && i->next != object) i = i->next;
        SPFilterPrimitive *i_prim = SP_FILTER_PRIMITIVE(i);
        out_name = sp_filter_name_for_image(parent, i_prim->image_out);
        repr->setAttribute("in2", out_name);
        if (!out_name) {
            g_warning("Unable to set in2 for feDisplacementMap");
        }
    }

    sp_repr_set_svg_double(repr, "scale", disp->scale);
    repr->setAttribute("xChannelSelector",
                       get_channelselector_name(disp->xChannelSelector));
    repr->setAttribute("yChannelSelector",
                       get_channelselector_name(disp->yChannelSelector));

    if (((SPObjectClass *) feDisplacementMap_parent_class)->write) {
        ((SPObjectClass *) feDisplacementMap_parent_class)->write(object, doc, repr, flags);
    }

    return repr;
}


Generated by  Doxygen 1.6.0   Back to index