diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-07-14 21:09:41 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-07-14 21:09:41 +0000 |
| commit | d32efb61f1c2c18d1018e510bbe9bafc04a03905 (patch) | |
| tree | b447bf9856baf1cf485e38c4ce55edb27285129e /src/svg | |
| parent | Merged from trunk (r12305) (diff) | |
| parent | Minor C++ish refactoring pass. (diff) | |
| download | inkscape-d32efb61f1c2c18d1018e510bbe9bafc04a03905.tar.gz inkscape-d32efb61f1c2c18d1018e510bbe9bafc04a03905.zip | |
Merged from trunk (r12419).
(bzr r11608.1.107)
Diffstat (limited to 'src/svg')
| -rw-r--r-- | src/svg/svg-color.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index e045a23c7..57f542373 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -26,6 +26,7 @@ #include <map> +#include "colorspace.h" #include "strneq.h" #include "preferences.h" #include "svg-color.h" @@ -453,30 +454,24 @@ sp_svg_create_color_hash() } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -//helper function borrowed from src/widgets/sp-color-icc-selector.cpp: -void getThings( Inkscape::ColorProfile *prof, gchar const**& namers, gchar const**& tippies, guint const*& scalies ); -void icc_color_to_sRGB(SVGICCColor* icc, guchar* r, guchar* g, guchar* b){ +void icc_color_to_sRGB(SVGICCColor* icc, guchar* r, guchar* g, guchar* b) +{ guchar color_out[4]; guchar color_in[4]; - if (icc){ + if (icc) { g_message("profile name: %s", icc->colorProfile.c_str()); Inkscape::ColorProfile* prof = SP_ACTIVE_DOCUMENT->profileManager->find(icc->colorProfile.c_str()); if ( prof ) { cmsHTRANSFORM trans = prof->getTransfToSRGB8(); if ( trans ) { - gchar const** names = 0; - gchar const** tips = 0; - guint const* scales = 0; - getThings( prof, names, tips, scales ); - - gint count = CMSSystem::getChannelCount( prof ); - if (count > 4) { - count = 4; //do we need it? Should we allow an arbitrary number of color values? Or should we limit to a maximum? (max==4?) - } - for (gint i = 0; i < count; i++){ - color_in[i] = static_cast<guchar>((((gdouble)icc->colors[i])*256.0) * (gdouble)scales[i]); -g_message("input[%d]: %d",i, color_in[i]); + std::vector<colorspace::Component> comps = colorspace::getColorSpaceInfo( prof ); + + size_t count = CMSSystem::getChannelCount( prof ); + size_t cap = std::min(count, comps.size()); + for (size_t i = 0; i < cap; i++) { + color_in[i] = static_cast<guchar>((((gdouble)icc->colors[i]) * 256.0) * (gdouble)comps[i].scale); + g_message("input[%d]: %d", (int)i, (int)color_in[i]); } CMSSystem::doTransform( trans, color_in, color_out, 1 ); |
