X-Git-Url: https://git.tokkee.org/?p=inkscape.git;a=blobdiff_plain;f=src%2Fsp-stop.cpp;fp=src%2Fsp-stop.cpp;h=0c0a3b03aa19f3c9fbf981227e634ef47ddca7a6;hp=740cfef7853e49dc0eedf63a13ea247ccb08d388;hb=9dc68827cbd515262ecb8d5ae8547d9e82c72e00;hpb=072de79e6270f4137fa48a8a73491e8a0904d8f8 diff --git a/src/sp-stop.cpp b/src/sp-stop.cpp index 740cfef78..0c0a3b03a 100644 --- a/src/sp-stop.cpp +++ b/src/sp-stop.cpp @@ -15,7 +15,7 @@ #include "sp-stop.h" - +#include "style.h" // A stop might have some non-stop siblings SPStop* SPStop::getNextStop() @@ -52,6 +52,34 @@ SPStop* SPStop::getPrevStop() return result; } +SPColor SPStop::readStopColor( Glib::ustring const &styleStr, guint32 dfl ) +{ + SPColor color(dfl); + SPStyle* style = sp_style_new(0); + SPIPaint paint; + paint.read( styleStr.c_str(), *style ); + if ( paint.isColor() ) { + color = paint.value.color; + } + sp_style_unref(style); + return color; +} + +SPColor SPStop::getEffectiveColor() const +{ + SPColor ret; + if (currentColor) { + char const *str = getStyleProperty("color", NULL); + /* Default value: arbitrarily black. (SVG1.1 and CSS2 both say that the initial + * value depends on user agent, and don't give any further restrictions that I can + * see.) */ + ret = readStopColor( str, 0 ); + } else { + ret = specified_color; + } + return ret; +} + /* @@ -63,4 +91,4 @@ SPStop* SPStop::getPrevStop() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :