color-profile.cpp revision f4dbc5a10ebf95900d1ef56d74aad0474e159370
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#define noDEBUG_LCMS
#ifdef DEBUG_LCMS
#endif // DEBUG_LCMS
#include <cstring>
#include <string>
#ifdef WIN32
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. Required for correctly including icm.h
#define _WIN32_WINDOWS 0x0410
#endif
#include <windows.h>
#endif
#if HAVE_LIBLCMS2
# include <lcms2.h>
# include <lcms.h>
#endif // HAVE_LIBLCMS2
#include "color.h"
#include "color-profile.h"
#include "cms-system.h"
#include "color-profile-cms-fns.h"
#include "attributes.h"
#include "inkscape.h"
#include "document.h"
#include "preferences.h"
#ifdef WIN32
#include <icm.h>
#endif // WIN32
using Inkscape::ColorProfile;
using Inkscape::ColorProfileClass;
using Inkscape::ColorProfileImpl;
using Inkscape::CColorProfile;
namespace
{
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
void loadProfiles();
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
#ifdef DEBUG_LCMS
extern guint update_in_progress;
#define DEBUG_MESSAGE_SCISLAC(key, ...) \
{\
if ( dump )\
{\
g_message( __VA_ARGS__ );\
\
}\
if ( dumpD )\
{\
);\
dialog); \
}\
}
#define DEBUG_MESSAGE(key, ...)\
{\
g_message( __VA_ARGS__ );\
}
#else
#define DEBUG_MESSAGE_SCISLAC(key, ...)
#define DEBUG_MESSAGE(key, ...)
#endif // DEBUG_LCMS
static SPObjectClass *cprof_parent_class;
class ColorProfileImpl {
public:
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
static cmsHPROFILE _sRGBProf;
static cmsHPROFILE _NullProf;
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
static cmsHPROFILE getNULLProfile();
static cmsHPROFILE getSRGBProfile();
void _clearProfile();
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
};
namespace Inkscape {
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
{
return ColorSpaceSigWrapper(sig);
}
{
return ColorProfileClassSigWrapper(sig);
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
} // namespace Inkscape
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
:
_profHandle(0),
_transf(0),
_revTransf(0),
_gamutTransf(0)
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
{
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if ( !_sRGBProf ) {
}
return ColorProfileImpl::_sRGBProf;
}
if ( !_NullProf ) {
}
return _NullProf;
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/**
* Register ColorProfile class and return its type.
*/
{
return ColorProfile::getType();
}
{
if (!type) {
sizeof(ColorProfileClass),
sizeof(ColorProfile),
16,
NULL, /* value_table */
};
}
return type;
}
/**
* ColorProfile vtable initialization.
*/
{
//sp_object_class->build = ColorProfile::build;
}
this->colorprofile = cp;
}
CColorProfile::~CColorProfile() {
}
/**
* Callback for ColorProfile object initialization.
*/
{
}
/**
* Callback: free object
*/
{
// // Unregister ourselves
// if ( object->document ) {
// object->document->removeResource("iccprofile", object);
// }
//
// ColorProfile *cprof = COLORPROFILE(object);
// if ( cprof->href ) {
// g_free( cprof->href );
// cprof->href = 0;
// }
//
// if ( cprof->local ) {
// g_free( cprof->local );
// cprof->local = 0;
// }
//
// if ( cprof->name ) {
// g_free( cprof->name );
// cprof->name = 0;
// }
//
// if ( cprof->intentStr ) {
// g_free( cprof->intentStr );
// cprof->intentStr = 0;
// }
//
//#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
// cprof->impl->_clearProfile();
//#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
//
// delete cprof->impl;
// cprof->impl = 0;
}
void CColorProfile::onRelease() {
// Unregister ourselves
}
}
}
}
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
void ColorProfileImpl::_clearProfile()
{
if ( _transf ) {
_transf = 0;
}
if ( _revTransf ) {
_revTransf = 0;
}
if ( _gamutTransf ) {
_gamutTransf = 0;
}
if ( _profHandle ) {
_profHandle = 0;
}
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/**
* Callback: set attributes from associated repr.
*/
{
// ColorProfile *cprof = COLORPROFILE(object);
// g_assert(cprof->href == 0);
// g_assert(cprof->local == 0);
// g_assert(cprof->name == 0);
// g_assert(cprof->intentStr == 0);
//
//// if (cprof_parent_class->build) {
//// (* cprof_parent_class->build)(object, document, repr);
//// }
//
// object->readAttr( "xlink:href" );
// object->readAttr( "local" );
// object->readAttr( "name" );
// object->readAttr( "rendering-intent" );
//
// // Register
// if ( document ) {
// document->addResource( "iccprofile", object );
// }
}
// if (cprof_parent_class->build) {
// (* cprof_parent_class->build)(object, document, repr);
// }
// Register
if ( document ) {
}
}
/**
* Callback: set attribute.
*/
{
// ColorProfile *cprof = COLORPROFILE(object);
//
// switch (key) {
// case SP_ATTR_XLINK_HREF:
// if ( cprof->href ) {
// g_free( cprof->href );
// cprof->href = 0;
// }
// if ( value ) {
// cprof->href = g_strdup( value );
// if ( *cprof->href ) {
//#if HAVE_LIBLCMS1
// cmsErrorAction( LCMS_ERROR_SHOW );
//#endif
//#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
//
// // TODO open filename and URIs properly
// //FILE* fp = fopen_utf8name( filename, "r" );
// //LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, cmsUInt32Number dwSize);
//
// // Try to open relative
// SPDocument *doc = object->document;
// if (!doc) {
// doc = SP_ACTIVE_DOCUMENT;
// g_warning("object has no document. using active");
// }
// //# 1. Get complete URI of document
// gchar const *docbase = doc->getURI();
// if (!docbase)
// {
// // Normal for files that have not yet been saved.
// docbase = "";
// }
//
// gchar* escaped = g_uri_escape_string(cprof->href, "!*'();:@=+$,/?#[]", TRUE);
//
// //g_message("docbase:%s\n", docbase);
// org::w3c::dom::URI docUri(docbase);
// //# 2. Get href of icc file. we don't care if it's rel or abs
// org::w3c::dom::URI hrefUri(escaped);
// //# 3. Resolve the href according the docBase. This follows
// // the w3c specs. All absolute and relative issues are considered
// org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri);
// gchar* fullname = g_uri_unescape_string(cprofUri.getNativePath().c_str(), "");
// cprof->impl->_clearProfile();
// cprof->impl->_profHandle = cmsOpenProfileFromFile( fullname, "r" );
// if ( cprof->impl->_profHandle ) {
// cprof->impl->_profileSpace = cmsGetColorSpace( cprof->impl->_profHandle );
// cprof->impl->_profileClass = cmsGetDeviceClass( cprof->impl->_profHandle );
// }
// DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->impl->_profHandle );
// g_free(escaped);
// escaped = 0;
// g_free(fullname);
//#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
// }
// }
// object->requestModified(SP_OBJECT_MODIFIED_FLAG);
// break;
//
// case SP_ATTR_LOCAL:
// if ( cprof->local ) {
// g_free( cprof->local );
// cprof->local = 0;
// }
// cprof->local = g_strdup( value );
// object->requestModified(SP_OBJECT_MODIFIED_FLAG);
// break;
//
// case SP_ATTR_NAME:
// if ( cprof->name ) {
// g_free( cprof->name );
// cprof->name = 0;
// }
// cprof->name = g_strdup( value );
// DEBUG_MESSAGE( lcmsTwo, "<color-profile> name set to '%s'", cprof->name );
// object->requestModified(SP_OBJECT_MODIFIED_FLAG);
// break;
//
// case SP_ATTR_RENDERING_INTENT:
// if ( cprof->intentStr ) {
// g_free( cprof->intentStr );
// cprof->intentStr = 0;
// }
// cprof->intentStr = g_strdup( value );
//
// if ( value ) {
// if ( strcmp( value, "auto" ) == 0 ) {
// cprof->rendering_intent = RENDERING_INTENT_AUTO;
// } else if ( strcmp( value, "perceptual" ) == 0 ) {
// cprof->rendering_intent = RENDERING_INTENT_PERCEPTUAL;
// } else if ( strcmp( value, "relative-colorimetric" ) == 0 ) {
// cprof->rendering_intent = RENDERING_INTENT_RELATIVE_COLORIMETRIC;
// } else if ( strcmp( value, "saturation" ) == 0 ) {
// cprof->rendering_intent = RENDERING_INTENT_SATURATION;
// } else if ( strcmp( value, "absolute-colorimetric" ) == 0 ) {
// cprof->rendering_intent = RENDERING_INTENT_ABSOLUTE_COLORIMETRIC;
// } else {
// cprof->rendering_intent = RENDERING_INTENT_UNKNOWN;
// }
// } else {
// cprof->rendering_intent = RENDERING_INTENT_UNKNOWN;
// }
//
// object->requestModified(SP_OBJECT_MODIFIED_FLAG);
// break;
//
// default:
// if (cprof_parent_class->set) {
// (* cprof_parent_class->set)(object, key, value);
// }
// break;
// }
}
switch (key) {
case SP_ATTR_XLINK_HREF:
}
if ( value ) {
#if HAVE_LIBLCMS1
#endif
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
// TODO open filename and URIs properly
//FILE* fp = fopen_utf8name( filename, "r" );
//LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, cmsUInt32Number dwSize);
// Try to open relative
if (!doc) {
g_warning("object has no document. using active");
}
//# 1. Get complete URI of document
if (!docbase)
{
// Normal for files that have not yet been saved.
docbase = "";
}
//g_message("docbase:%s\n", docbase);
//# 2. Get href of icc file. we don't care if it's rel or abs
//# 3. Resolve the href according the docBase. This follows
// the w3c specs. All absolute and relative issues are considered
}
DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->impl->_profHandle );
escaped = 0;
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
}
break;
case SP_ATTR_LOCAL:
}
break;
case SP_ATTR_NAME:
}
break;
case SP_ATTR_RENDERING_INTENT:
}
if ( value ) {
} else {
}
} else {
}
break;
default:
// if (cprof_parent_class->set) {
// (* cprof_parent_class->set)(object, key, value);
// }
break;
}
}
/**
* Callback: write attributes to associated repr.
*/
Inkscape::XML::Node* ColorProfile::write( SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags )
{
// ColorProfile *cprof = COLORPROFILE(object);
//
// if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
// repr = xml_doc->createElement("svg:color-profile");
// }
//
// if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->href ) {
// repr->setAttribute( "xlink:href", cprof->href );
// }
//
// if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->local ) {
// repr->setAttribute( "local", cprof->local );
// }
//
// if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->name ) {
// repr->setAttribute( "name", cprof->name );
// }
//
// if ( (flags & SP_OBJECT_WRITE_ALL) || cprof->intentStr ) {
// repr->setAttribute( "rendering-intent", cprof->intentStr );
// }
//
// if (cprof_parent_class->write) {
// (* cprof_parent_class->write)(object, xml_doc, repr, flags);
// }
//
// return repr;
}
Inkscape::XML::Node* CColorProfile::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
}
}
}
}
}
// if (cprof_parent_class->write) {
// (* cprof_parent_class->write)(object, xml_doc, repr, flags);
// }
return repr;
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
struct MapMap {
};
{
//cmsSigLuvData
};
int index = 0;
index = i;
break;
}
}
}
{
int intent = INTENT_PERCEPTUAL;
switch ( svgIntent ) {
break;
break;
break;
case Inkscape::RENDERING_INTENT_UNKNOWN:
case Inkscape::RENDERING_INTENT_AUTO:
default:
}
return intent;
}
{
if ( prof ) {
break;
}
}
}
}
return result;
}
cmsHPROFILE Inkscape::CMSSystem::getHandle( SPDocument* document, guint* intent, gchar const* name )
{
cmsHPROFILE prof = 0;
if ( thing ) {
}
if ( intent ) {
}
DEBUG_MESSAGE( lcmsThree, "<color-profile> queried for profile of '%s'. Returning %p with intent of %d", name, prof, (intent? *intent:0) );
return prof;
}
}
}
{
impl->_transf = cmsCreateTransform( impl->_profHandle, ColorProfileImpl::_getInputFormat(impl->_profileSpace), ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, intent, 0 );
}
}
{
impl->_revTransf = cmsCreateTransform( ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, impl->_profHandle, ColorProfileImpl::_getInputFormat(impl->_profileSpace), intent, 0 );
}
return impl->_revTransf;
}
{
if ( !impl->_gamutTransf ) {
}
return impl->_gamutTransf;
}
{
bool result = false;
#if HAVE_LIBLCMS1
int alarm_r = 0;
int alarm_g = 0;
int alarm_b = 0;
newAlarmCodes[0] = ~0;
#endif // HAVE_LIBLCMS1
cmsUInt8Number outofgamut = 0;
255};
#if HAVE_LIBLCMS1
#endif // HAVE_LIBLCMS1
result = (outofgamut != 0);
return result;
}
class ProfileInfo
{
public:
private:
};
#include <iostream>
{
}
{
loadProfiles();
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
}
}
return result;
}
{
loadProfiles();
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
}
}
return result;
}
{
loadProfiles();
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
break;
}
}
return result;
}
void Inkscape::CMSSystem::doTransform(cmsHTRANSFORM transform, void *inBuf, void *outBuf, unsigned int size)
{
}
{
bool isPrint = false;
if ( profile ) {
}
return isPrint;
}
{
if ( profile ) {
#if HAVE_LIBLCMS1
#endif
}
return count;
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
static bool warnSet = false;
if (!warnSet) {
#if HAVE_LIBLCMS1
#endif
warnSet = true;
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
// first try user's local dir
for ( int i = 0; dataDirs[i]; i++ ) {
}
// On OS X:
{
bool onOSX = false;
for ( std::vector<Glib::ustring>::const_iterator it = possible.begin(); it != possible.end(); ++it ) {
if ( g_file_test(it->c_str(), G_FILE_TEST_EXISTS) && g_file_test(it->c_str(), G_FILE_TEST_IS_DIR) ) {
onOSX = true;
}
}
if ( onOSX ) {
}
}
}
#ifdef WIN32
pathBuf[0] = 0;
g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" );
} else {
}
}
#endif // WIN32
return sources;
}
{
bool isIccFile = false;
//0-3 == size
//36-39 == 'acsp' 0x61637370
if ( fd != -1 ) {
//size_t left = 40;
if ( got != -1 ) {
isIccFile = (scratch[36] == 'a') && (scratch[37] == 'c') && (scratch[38] == 's') && (scratch[39] == 'p');
}
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if (isIccFile) {
if ( prof ) {
if ( profClass == cmsSigNamedColorClass ) {
isIccFile = false; // Ignore named color profiles for now.
}
cmsCloseProfile( prof );
}
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
}
return isIccFile;
}
{
{
}
if ( g_file_test( it->c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->c_str(), G_FILE_TEST_IS_DIR ) ) {
if (dir) {
} else {
}
}
}
dir = 0;
} else {
}
}
}
return files;
}
{
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
if ( hProfile ) {
}
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
return result;
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
#if HAVE_LIBLCMS1
{
return 1;
}
{
//g_message("lcms: Error %d; %s", errorCode, errorText);
}
#endif
namespace
{
{
if ( profile ) {
#if HAVE_LIBLCMS1
if ( !name ) {
}
name = _("(invalid UTF-8 string)");
}
if (byteLen > 0) {
// TODO investigate wchar_t and cmsGetProfileInfo()
"en", "US",
}
}
nameStr = _("(invalid UTF-8 string)");
}
#endif
}
return nameStr;
}
/**
* This function loads or refreshes data in knownProfiles.
* Call it at the start of every call that requires this data.
*/
void loadProfiles()
{
static bool error_handler_set = false;
if (!error_handler_set) {
#if HAVE_LIBLCMS1
//cmsSetLogErrorHandler(errorHandlerCB);
//g_message("LCMS error handler set");
#endif
error_handler_set = true;
}
static bool profiles_searched = false;
if ( !profiles_searched ) {
if ( prof ) {
cmsCloseProfile( prof );
prof = 0;
bool sameName = false;
for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
sameName = true;
break;
}
}
if ( !sameName ) {
}
}
}
profiles_searched = true;
}
}
} // namespace
static bool gamutWarn = false;
static bool lastBPC = false;
#if defined(cmsFLAGS_PRESERVEBLACK)
static bool lastPreserveBlack = false;
#endif // defined(cmsFLAGS_PRESERVEBLACK)
static int lastIntent = INTENT_PERCEPTUAL;
static int lastProofIntent = INTENT_PERCEPTUAL;
static cmsHTRANSFORM transf = 0;
namespace {
{
static cmsHPROFILE theOne = 0;
loadProfiles();
if ( theOne ) {
}
if ( transf ) {
transf = 0;
}
if ( theOne ) {
// a display profile must have the proper stuff
if ( profClass != cmsSigDisplayClass ) {
g_warning("Not a display profile");
theOne = 0;
} else if ( space != cmsSigRgbData ) {
g_warning("Not an RGB profile");
theOne = 0;
} else {
}
}
}
} else if ( theOne ) {
theOne = 0;
if ( transf ) {
transf = 0;
}
}
return theOne;
}
{
static cmsHPROFILE theOne = 0;
loadProfiles();
if ( theOne ) {
}
if ( transf ) {
transf = 0;
}
if ( theOne ) {
// a display profile must have the proper stuff
(void)space;
(void)profClass;
/*
if ( profClass != cmsSigDisplayClass ) {
g_warning("Not a display profile");
cmsCloseProfile( theOne );
theOne = 0;
} else if ( space != cmsSigRgbData ) {
g_warning("Not an RGB profile");
cmsCloseProfile( theOne );
theOne = 0;
} else {
*/
/*
}
*/
}
}
} else if ( theOne ) {
theOne = 0;
if ( transf ) {
transf = 0;
}
}
return theOne;
}
} // namespace
static void free_transforms();
{
if ( fromDisplay ) {
if ( transf ) {
transf = 0;
}
return 0;
}
#if defined(cmsFLAGS_PRESERVEBLACK)
#endif //defined(cmsFLAGS_PRESERVEBLACK)
|| (lastIntent != intent)
|| (lastProofIntent != proofIntent)
#if defined(cmsFLAGS_PRESERVEBLACK)
|| (preserveBlack != lastPreserveBlack)
#endif // defined(cmsFLAGS_PRESERVEBLACK)
|| (gamutColor != lastGamutColor)
) {
lastIntent = intent;
#if defined(cmsFLAGS_PRESERVEBLACK)
#endif // defined(cmsFLAGS_PRESERVEBLACK)
}
// Fetch these now, as they might clear the transform as a side effect.
if ( !transf ) {
if ( gamutWarn ) {
#if HAVE_LIBLCMS1
cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8);
newAlarmCodes[3] = ~0;
#endif
}
if ( bpc ) {
}
#if defined(cmsFLAGS_PRESERVEBLACK)
if ( preserveBlack ) {
}
#endif // defined(cmsFLAGS_PRESERVEBLACK)
transf = cmsCreateProofingTransform( ColorProfileImpl::getSRGBProfile(), TYPE_BGRA_8, hprof, TYPE_BGRA_8, proofProf, intent, proofIntent, dwFlags );
} else if ( hprof ) {
transf = cmsCreateTransform( ColorProfileImpl::getSRGBProfile(), TYPE_BGRA_8, hprof, TYPE_BGRA_8, intent, 0 );
}
}
return transf;
}
class MemProfile {
public:
MemProfile();
~MemProfile();
};
MemProfile::MemProfile() :
id(),
hprof(0),
transf(0)
{
}
MemProfile::~MemProfile()
{
}
void free_transforms()
{
if ( transf ) {
transf = 0;
}
for ( std::vector< std::vector<MemProfile> >::iterator it = perMonitorProfiles.begin(); it != perMonitorProfiles.end(); ++it ) {
}
}
}
}
{
}
}
return id;
}
Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, int screen, int monitor )
{
}
}
}
// Note: if this is not a valid profile, item.hprof will be set to null.
}
return id;
}
{
cmsHTRANSFORM result = 0;
return 0;
}
bool found = false;
for ( std::vector< std::vector<MemProfile> >::iterator it = perMonitorProfiles.begin(); it != perMonitorProfiles.end() && !found; ++it ) {
#if defined(cmsFLAGS_PRESERVEBLACK)
#endif //defined(cmsFLAGS_PRESERVEBLACK)
|| (lastIntent != intent)
|| (lastProofIntent != proofIntent)
#if defined(cmsFLAGS_PRESERVEBLACK)
|| (preserveBlack != lastPreserveBlack)
#endif // defined(cmsFLAGS_PRESERVEBLACK)
|| (gamutColor != lastGamutColor)
) {
lastIntent = intent;
#if defined(cmsFLAGS_PRESERVEBLACK)
#endif // defined(cmsFLAGS_PRESERVEBLACK)
}
// Fetch these now, as they might clear the transform as a side effect.
if ( gamutWarn ) {
#if HAVE_LIBLCMS1
cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8);
newAlarmCodes[3] = ~0;
#endif
}
if ( bpc ) {
}
#if defined(cmsFLAGS_PRESERVEBLACK)
if ( preserveBlack ) {
}
#endif // defined(cmsFLAGS_PRESERVEBLACK)
item.transf = cmsCreateProofingTransform( ColorProfileImpl::getSRGBProfile(), TYPE_BGRA_8, item.hprof, TYPE_BGRA_8, proofProf, intent, proofIntent, dwFlags );
item.transf = cmsCreateTransform( ColorProfileImpl::getSRGBProfile(), TYPE_BGRA_8, item.hprof, TYPE_BGRA_8, intent, 0 );
}
}
found = true;
}
}
}
return result;
}
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :