diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2010-07-03 09:34:22 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2010-07-03 09:34:22 +0000 |
| commit | d9c3b46f2c4085fa74b3489719534577a032b528 (patch) | |
| tree | 58a57c8daf22104fc61f98af07bd68ffbbd8ea68 /src/desktop-style.cpp | |
| parent | Tutorials. Forgot to install the png file... (diff) | |
| download | inkscape-d9c3b46f2c4085fa74b3489719534577a032b528.tar.gz inkscape-d9c3b46f2c4085fa74b3489719534577a032b528.zip | |
Create only single-stop gradients when using Fill-n-Stroke to convert solid to a swatch. Preserve CMS colors.
(bzr r9560)
Diffstat (limited to 'src/desktop-style.cpp')
| -rw-r--r-- | src/desktop-style.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 26f29d172..e11fa1493 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -436,6 +436,20 @@ stroke_average_width (GSList const *objects) return avgwidth / (g_slist_length ((GSList *) objects) - n_notstroked); } +static bool vectorsClose( std::vector<double> const &lhs, std::vector<double> const &rhs ) +{ + static double epsilon = 1e-6; + bool isClose = false; + if ( lhs.size() == rhs.size() ) { + isClose = true; + for ( size_t i = 0; (i < lhs.size()) && isClose; ++i ) { + isClose = fabs(lhs[i] - rhs[i]) < epsilon; + } + } + return isClose; +} + + /** * Write to style_res the average fill or stroke of list of objects, if applicable. */ @@ -536,11 +550,15 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill iccColor = paint->value.color.icc; iccSeen = true; } else { - if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2])) + if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2])) { same_color = false; - if ( iccSeen ) { - if(paint->value.color.icc) { - // TODO fix this + iccColor = 0; + } + if ( iccSeen && iccColor ) { + if ( !paint->value.color.icc + || (iccColor->colorProfile != paint->value.color.icc->colorProfile) + || !vectorsClose(iccColor->colors, paint->value.color.icc->colors) ) { + same_color = false; iccColor = 0; } } |
