From df7bda1a8b9d4a1c6f0fd4b82cdeb614eb1ea8d2 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 10 Jul 2011 00:13:05 -0700 Subject: Refactored to abstract lcms usage more. Added CMSSystem class. (bzr r10437) --- src/svg/svg-color.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/svg') diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index 3605bde55..9293564d5 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -1,5 +1,3 @@ -#define __SP_SVG_COLOR_C__ - /** * \file * Reading \& writing of SVG/CSS colors. @@ -37,17 +35,16 @@ #include "svg-icc-color.h" #if ENABLE_LCMS -#include #include "color.h" #include "color-profile.h" #include "document.h" #include "inkscape.h" #include "profile-manager.h" -#include "color-profile-cms-fns.h" #endif // ENABLE_LCMS -#include "color-profile-fns.h" +#include "cms-system.h" using std::sprintf; +using Inkscape::CMSSystem; struct SPSVGColor { unsigned long rgb; @@ -467,7 +464,7 @@ sp_svg_create_color_hash() #if ENABLE_LCMS //helper function borrowed from src/widgets/sp-color-icc-selector.cpp: -void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guint const*& scalies ); +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){ guchar color_out[4]; @@ -481,18 +478,18 @@ g_message("profile name: %s", icc->colorProfile.c_str()); gchar const** names = 0; gchar const** tips = 0; guint const* scales = 0; - getThings( asICColorSpaceSig(prof->getColorSpace()), names, tips, scales ); + getThings( prof, names, tips, scales ); - guint count = _cmsChannelsOf( asICColorSpaceSig(prof->getColorSpace()) ); + 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 (guint i=0;icolors[i])*256.0) * (gdouble)scales[i]); g_message("input[%d]: %d",i, color_in[i]); } - cmsDoTransform( trans, color_in, color_out, 1 ); + CMSSystem::doTransform( trans, color_in, color_out, 1 ); g_message("transform to sRGB done"); } *r = color_out[0]; -- cgit v1.2.3