Logo Search packages:      
Sourcecode: inkscape version File versions

static Inkscape::XML::Node * sp_feBlend_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 228 of file blend.cpp.

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

{
    SPFeBlend *blend = SP_FEBLEND(object);
    SPFilter *parent = SP_FILTER(object->parent);

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

    gchar const *out_name = sp_filter_name_for_image(parent, blend->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 feBlend");
        }
    }

    char const *mode;
    switch(blend->blend_mode) {
        case Inkscape::Filters::BLEND_NORMAL:
            mode = "normal"; break;
        case Inkscape::Filters::BLEND_MULTIPLY:
            mode = "multiply"; break;
        case Inkscape::Filters::BLEND_SCREEN:
            mode = "screen"; break;
        case Inkscape::Filters::BLEND_DARKEN:
            mode = "darken"; break;
        case Inkscape::Filters::BLEND_LIGHTEN:
            mode = "lighten"; break;
        default:
            mode = 0;
    }
    repr->setAttribute("mode", mode);

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

    return repr;
}


Generated by  Doxygen 1.6.0   Back to index