diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-08-08 17:27:51 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-08-08 17:27:51 +0000 |
| commit | 60d3113d1f022a3de7cf04c7979d4751b3fe21f6 (patch) | |
| tree | ca33e2a9a1af6b5911598fa1c6a1d77087b71dd2 /src/sp-stop.cpp | |
| parent | Minor cleanups (diff) | |
| parent | Add a constrained snap method that takes multiple constraints. This reduces t... (diff) | |
| download | inkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.tar.gz inkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.zip | |
merge from trunk
(bzr r9508.1.52)
Diffstat (limited to 'src/sp-stop.cpp')
| -rw-r--r-- | src/sp-stop.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/sp-stop.cpp b/src/sp-stop.cpp index 740cfef78..71f937927 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 = sp_object_get_style_property(this, "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; +} + /* |
