Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_svg_write_color ( gchar *  buf,
unsigned const   buflen,
guint32 const   rgba32 

Converts an RGBA32 colour to a CSS/SVG representation of the RGB portion of that colour. The result is valid even in SVG Tiny or non-SVG CSS.

rgba32 Colour expressed in form 0xrrggbbaa.
buflen >= 8.

Definition at line 430 of file svg-color.cpp.

References Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), and rgb24_to_css().

Referenced by sp_desktop_set_color(), sp_feDiffuseLighting_write(), sp_feSpecularLighting_write(), sp_gradient_repr_write_vector(), sp_stop_write(), and sp_style_write_ipaint().

    g_assert(8 <= buflen);

    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
    unsigned const rgb24 = rgba32 >> 8;
    if (prefs->getBool("/options/svgoutput/usenamedcolors")) {
        rgb24_to_css(buf, rgb24);
    } else {
        g_snprintf(buf, buflen, "#%06x", rgb24);

Generated by  Doxygen 1.6.0   Back to index