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/color-profile.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/color-profile.cpp') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 4bc37fdf8..f858f7f70 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -31,7 +31,7 @@ #include "xml/repr.h" #include "color.h" #include "color-profile.h" -#include "color-profile-fns.h" +#include "cms-system.h" #include "color-profile-cms-fns.h" #include "attributes.h" #include "inkscape.h" @@ -552,7 +552,7 @@ static SPObject* bruteFind( SPDocument* document, gchar const* name ) return result; } -cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name ) +cmsHPROFILE Inkscape::CMSSystem::getHandle( SPDocument* document, guint* intent, gchar const* name ) { cmsHPROFILE prof = 0; @@ -652,7 +652,7 @@ ProfileInfo::ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path ) static std::vector knownProfiles; -std::vector Inkscape::colorprofile_get_display_names() +std::vector Inkscape::CMSSystem::getDisplayNames() { loadProfiles(); std::vector result; @@ -666,7 +666,7 @@ std::vector Inkscape::colorprofile_get_display_names() return result; } -std::vector Inkscape::colorprofile_get_softproof_names() +std::vector Inkscape::CMSSystem::getSoftproofNames() { loadProfiles(); std::vector result; @@ -680,7 +680,7 @@ std::vector Inkscape::colorprofile_get_softproof_names() return result; } -Glib::ustring Inkscape::get_path_for_profile(Glib::ustring const& name) +Glib::ustring Inkscape::CMSSystem::getPathForProfile(Glib::ustring const& name) { loadProfiles(); Glib::ustring result; @@ -695,12 +695,12 @@ Glib::ustring Inkscape::get_path_for_profile(Glib::ustring const& name) return result; } -void Inkscape::colorprofile_cmsDoTransform(cmsHTRANSFORM transform, void *inBuf, void *outBuf, unsigned int size) +void Inkscape::CMSSystem::doTransform(cmsHTRANSFORM transform, void *inBuf, void *outBuf, unsigned int size) { cmsDoTransform(transform, inBuf, outBuf, size); } -bool Inkscape::colorprofile_isPrintColorSpace(ColorProfile const *profile) +bool Inkscape::CMSSystem::isPrintColorSpace(ColorProfile const *profile) { bool isPrint = false; if ( profile ) { @@ -710,6 +710,15 @@ bool Inkscape::colorprofile_isPrintColorSpace(ColorProfile const *profile) return isPrint; } +gint Inkscape::CMSSystem::getChannelCount(ColorProfile const *profile) +{ + gint count = 0; + if ( profile ) { + count = _cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) ); + } + return count; +} + #endif // ENABLE_LCMS std::vector ColorProfile::getBaseProfileDirs() { @@ -1077,7 +1086,7 @@ cmsHPROFILE getProofProfileHandle() static void free_transforms(); -cmsHTRANSFORM Inkscape::colorprofile_get_display_transform() +cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform() { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display"); @@ -1188,7 +1197,7 @@ void free_transforms() } } -Glib::ustring Inkscape::colorprofile_get_display_id( int screen, int monitor ) +Glib::ustring Inkscape::CMSSystem::getDisplayId( int screen, int monitor ) { Glib::ustring id; @@ -1203,7 +1212,7 @@ Glib::ustring Inkscape::colorprofile_get_display_id( int screen, int monitor ) return id; } -Glib::ustring Inkscape::colorprofile_set_display_per( gpointer buf, guint bufLen, int screen, int monitor ) +Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, int screen, int monitor ) { Glib::ustring id; @@ -1236,7 +1245,7 @@ Glib::ustring Inkscape::colorprofile_set_display_per( gpointer buf, guint bufLen return id; } -cmsHTRANSFORM Inkscape::colorprofile_get_display_per( Glib::ustring const& id ) +cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) { cmsHTRANSFORM result = 0; if ( id.empty() ) { -- cgit v1.2.3