Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

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

Virtual write: write object attributes to repr.

Definition at line 210 of file sp-gradient.cpp.

References SPStop::currentColor, SPStop::offset, SPStop::opacity, sp_color_get_rgba32_ualpha(), sp_repr_new(), sp_repr_set_attr(), sp_repr_set_css_double(), SPStop::specified_color, and Inkscape::CSSOStringStream::str().

Referenced by sp_stop_class_init().

    SPStop *stop = SP_STOP(object);

    if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
        repr = sp_repr_new("svg:stop");

    Inkscape::CSSOStringStream os;
    os << "stop-color:";
    if (stop->currentColor) {
        os << "currentColor";
    } else {
        gchar c[64];
        sp_svg_write_color(c, 64, sp_color_get_rgba32_ualpha(&stop->specified_color, 255));
        os << c;
    os << ";stop-opacity:" << stop->opacity;
    sp_repr_set_attr(repr, "style", os.str().c_str());
    sp_repr_set_attr(repr, "stop-color", NULL);
    sp_repr_set_attr(repr, "stop-opacity", NULL);
    sp_repr_set_css_double(repr, "offset", stop->offset);
    /* strictly speaking, offset an SVG <number> rather than a CSS one, but exponents make no sense
     * for offset proportions. */

    if (((SPObjectClass *) stop_parent_class)->write)
        (* ((SPObjectClass *) stop_parent_class)->write)(object, repr, flags);

    return repr;

Generated by  Doxygen 1.6.0   Back to index