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

void sp_desktop_set_color ( SPDesktop desktop,
ColorRGBA const &  color,
bool  is_relative,
bool  fill 
)

Set color on selection on desktop.

Todo:
relative color setting

Definition at line 44 of file desktop-style.cpp.

References sp_desktop_set_style(), and Inkscape::CSSOStringStream::str().

{
    /// \todo relative color setting
    if (is_relative) {
        g_warning("FIXME: relative color setting not yet implemented");
        return;
    }

    guint32 rgba = SP_RGBA32_F_COMPOSE(color[0], color[1], color[2], color[3]);
    gchar b[64];
    sp_svg_write_color(b, 64, rgba);
    SPCSSAttr *css = sp_repr_css_attr_new();
    if (fill) {
        sp_repr_css_set_property(css, "fill", b);
        Inkscape::CSSOStringStream osalpha;
        osalpha << color[3];
        sp_repr_css_set_property(css, "fill-opacity", osalpha.str().c_str());
    } else {
        sp_repr_css_set_property(css, "stroke", b);
        Inkscape::CSSOStringStream osalpha;
        osalpha << color[3];
        sp_repr_css_set_property(css, "stroke-opacity", osalpha.str().c_str());
    }

    sp_desktop_set_style(desktop, css);

    sp_repr_css_attr_unref(css);
}


Generated by  Doxygen 1.6.0   Back to index