Logo Search packages:      
Sourcecode: inkscape version File versions

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

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

Definition at line 281 of file sp-filter.cpp.

References Inkscape::XML::Node::setAttribute(), and sp_repr_set_svg_double().

{
    SPFilter *filter = SP_FILTER(object);

    if (!repr) {
        repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME
    }

    if ((flags & SP_OBJECT_WRITE_ALL) || filter->filterUnits_set) {
        switch (filter->filterUnits) {
            case SP_FILTER_UNITS_USERSPACEONUSE:
                repr->setAttribute("filterUnits", "userSpaceOnUse");
                break;
            default:
                repr->setAttribute("filterUnits", "objectBoundingBox");
                break;
        }
    }

    if ((flags & SP_OBJECT_WRITE_ALL) || filter->primitiveUnits_set) {
        switch (filter->primitiveUnits) {
            case SP_FILTER_UNITS_USERSPACEONUSE:
                repr->setAttribute("primitiveUnits", "userSpaceOnUse");
                break;
            default:
                repr->setAttribute("primitiveUnits", "objectBoundingBox");
                break;
        }
    }

    if (filter->x._set) {
        sp_repr_set_svg_double(repr, "x", filter->x.computed);
    } else {
        repr->setAttribute("x", NULL);
    }

    if (filter->y._set) {
        sp_repr_set_svg_double(repr, "y", filter->y.computed);
    } else {
        repr->setAttribute("y", NULL);
    }

    if (filter->width._set) {
        sp_repr_set_svg_double(repr, "width", filter->width.computed);
    } else {
        repr->setAttribute("width", NULL);
    }

    if (filter->height._set) {
        sp_repr_set_svg_double(repr, "height", filter->height.computed);
    } else {
        repr->setAttribute("height", NULL);
    }

    if (filter->filterRes.getNumber()>=0) {
        gchar *tmp = filter->filterRes.getValueString();
        repr->setAttribute("filterRes", tmp);
        g_free(tmp);
    } else {
        repr->setAttribute("filterRes", NULL);
    }

    if (filter->href->getURI()) {
        gchar *uri_string = filter->href->getURI()->toString();
        repr->setAttribute("xlink:href", uri_string);
        g_free(uri_string);
    }

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

    return repr;
}


Generated by  Doxygen 1.6.0   Back to index