~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to src/color-profile.cpp

  • Committer: Alex Valavanis
  • Date: 2012-02-16 09:51:14 UTC
  • mto: (63.1.1 fix-933188) (1.4.4) (2.5.4 sid)
  • mto: This revision was merged to the branch mainline in revision 64.
  • Revision ID: valavanisalex@gmail.com-20120216095114-vxo1i071bw0xxxf3
Tags: upstream-0.48.3
ImportĀ upstreamĀ versionĀ 0.48.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include <cstring>
17
17
#include <string>
 
18
#include <io/sys.h>
18
19
 
19
20
#ifdef WIN32
20
21
#ifndef _WIN32_WINDOWS         // Allow use of features specific to Windows 98 or later. Required for correctly including icm.h
23
24
#include <windows.h>
24
25
#endif
25
26
 
 
27
#if HAVE_LIBLCMS2
 
28
#  include <lcms2.h>
 
29
#elif HAVE_LIBLCMS1
 
30
#  include <lcms.h>
 
31
#endif // HAVE_LIBLCMS2
 
32
 
26
33
#include "xml/repr.h"
27
34
#include "color.h"
28
35
#include "color-profile.h"
29
 
#include "color-profile-fns.h"
 
36
#include "cms-system.h"
 
37
#include "color-profile-cms-fns.h"
30
38
#include "attributes.h"
31
39
#include "inkscape.h"
32
40
#include "document.h"
41
49
 
42
50
using Inkscape::ColorProfile;
43
51
using Inkscape::ColorProfileClass;
 
52
using Inkscape::ColorProfileImpl;
44
53
 
45
 
namespace Inkscape
 
54
namespace
46
55
{
47
 
#if ENABLE_LCMS
48
 
static cmsHPROFILE colorprofile_get_system_profile_handle();
49
 
static cmsHPROFILE colorprofile_get_proof_profile_handle();
50
 
#endif // ENABLE_LCMS
 
56
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
57
cmsHPROFILE getSystemProfileHandle();
 
58
cmsHPROFILE getProofProfileHandle();
 
59
void loadProfiles();
 
60
Glib::ustring getNameFromProfile(cmsHPROFILE profile);
 
61
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
51
62
}
52
63
 
53
64
#ifdef DEBUG_LCMS
85
96
    g_message( __VA_ARGS__ );\
86
97
}
87
98
 
 
99
#else
 
100
#define DEBUG_MESSAGE_SCISLAC(key, ...)
 
101
#define DEBUG_MESSAGE(key, ...)
88
102
#endif // DEBUG_LCMS
89
103
 
90
104
static SPObjectClass *cprof_parent_class;
91
105
 
92
 
#if ENABLE_LCMS
93
 
 
94
 
cmsHPROFILE ColorProfile::_sRGBProf = 0;
95
 
 
96
 
cmsHPROFILE ColorProfile::getSRGBProfile() {
 
106
class ColorProfileImpl {
 
107
public:
 
108
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
109
    static cmsHPROFILE _sRGBProf;
 
110
    static cmsHPROFILE _NullProf;
 
111
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
112
 
 
113
    ColorProfileImpl();
 
114
 
 
115
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
116
    static cmsUInt32Number _getInputFormat( cmsColorSpaceSignature space );
 
117
 
 
118
    static cmsHPROFILE getNULLProfile();
 
119
    static cmsHPROFILE getSRGBProfile();
 
120
 
 
121
    void _clearProfile();
 
122
 
 
123
    cmsHPROFILE _profHandle;
 
124
    cmsProfileClassSignature _profileClass;
 
125
    cmsColorSpaceSignature _profileSpace;
 
126
    cmsHTRANSFORM _transf;
 
127
    cmsHTRANSFORM _revTransf;
 
128
    cmsHTRANSFORM _gamutTransf;
 
129
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
130
};
 
131
 
 
132
 
 
133
 
 
134
namespace Inkscape {
 
135
 
 
136
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
137
cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig)
 
138
{
 
139
    return ColorSpaceSigWrapper(sig);
 
140
}
 
141
 
 
142
cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & sig)
 
143
{
 
144
    return ColorProfileClassSigWrapper(sig);
 
145
}
 
146
#endif //  defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
147
 
 
148
} // namespace Inkscape
 
149
 
 
150
ColorProfileImpl::ColorProfileImpl()
 
151
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
152
        :
 
153
    _profHandle(0),
 
154
    _profileClass(cmsSigInputClass),
 
155
    _profileSpace(cmsSigRgbData),
 
156
    _transf(0),
 
157
    _revTransf(0),
 
158
    _gamutTransf(0)
 
159
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
160
{
 
161
}
 
162
 
 
163
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
164
 
 
165
cmsHPROFILE ColorProfileImpl::_sRGBProf = 0;
 
166
 
 
167
cmsHPROFILE ColorProfileImpl::getSRGBProfile() {
97
168
    if ( !_sRGBProf ) {
98
169
        _sRGBProf = cmsCreate_sRGBProfile();
99
170
    }
100
 
    return _sRGBProf;
 
171
    return ColorProfileImpl::_sRGBProf;
101
172
}
102
173
 
103
 
cmsHPROFILE ColorProfile::_NullProf = 0;
 
174
cmsHPROFILE ColorProfileImpl::_NullProf = 0;
104
175
 
105
 
cmsHPROFILE ColorProfile::getNULLProfile() {
 
176
cmsHPROFILE ColorProfileImpl::getNULLProfile() {
106
177
    if ( !_NullProf ) {
107
178
        _NullProf = cmsCreateNULLProfile();
108
179
    }
109
180
    return _NullProf;
110
181
}
111
182
 
112
 
#endif // ENABLE_LCMS
 
183
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
113
184
 
114
185
/**
115
186
 * Register ColorProfile class and return its type.
158
229
 */
159
230
void ColorProfile::init( ColorProfile *cprof )
160
231
{
 
232
    cprof->impl = new ColorProfileImpl();
 
233
 
161
234
    cprof->href = 0;
162
235
    cprof->local = 0;
163
236
    cprof->name = 0;
164
237
    cprof->intentStr = 0;
165
238
    cprof->rendering_intent = Inkscape::RENDERING_INTENT_UNKNOWN;
166
 
#if ENABLE_LCMS
167
 
    cprof->profHandle = 0;
168
 
    cprof->_profileClass = icSigInputClass;
169
 
    cprof->_profileSpace = icSigRgbData;
170
 
    cprof->_transf = 0;
171
 
    cprof->_revTransf = 0;
172
 
    cprof->_gamutTransf = 0;
173
 
#endif // ENABLE_LCMS
174
239
}
175
240
 
176
241
/**
179
244
void ColorProfile::release( SPObject *object )
180
245
{
181
246
    // Unregister ourselves
182
 
    SPDocument* document = SP_OBJECT_DOCUMENT(object);
183
 
    if ( document ) {
 
247
    if ( object->document ) {
184
248
        sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "iccprofile", SP_OBJECT (object));
185
249
    }
186
250
 
205
269
        cprof->intentStr = 0;
206
270
    }
207
271
 
208
 
#if ENABLE_LCMS
209
 
    cprof->_clearProfile();
210
 
#endif // ENABLE_LCMS
 
272
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
273
    cprof->impl->_clearProfile();
 
274
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
275
 
 
276
    delete cprof->impl;
 
277
    cprof->impl = 0;
211
278
}
212
279
 
213
 
#if ENABLE_LCMS
214
 
void ColorProfile::_clearProfile()
 
280
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
281
void ColorProfileImpl::_clearProfile()
215
282
{
216
 
    _profileSpace = icSigRgbData;
 
283
    _profileSpace = cmsSigRgbData;
217
284
 
218
285
    if ( _transf ) {
219
286
        cmsDeleteTransform( _transf );
227
294
        cmsDeleteTransform( _gamutTransf );
228
295
        _gamutTransf = 0;
229
296
    }
230
 
    if ( profHandle ) {
231
 
        cmsCloseProfile( profHandle );
232
 
        profHandle = 0;
 
297
    if ( _profHandle ) {
 
298
        cmsCloseProfile( _profHandle );
 
299
        _profHandle = 0;
233
300
    }
234
301
}
235
 
#endif // ENABLE_LCMS
 
302
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
236
303
 
237
304
/**
238
305
 * Callback: set attributes from associated repr.
275
342
            if ( value ) {
276
343
                cprof->href = g_strdup( value );
277
344
                if ( *cprof->href ) {
278
 
#if ENABLE_LCMS
 
345
#if HAVE_LIBLCMS1
279
346
                    cmsErrorAction( LCMS_ERROR_SHOW );
 
347
#endif
 
348
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
280
349
 
281
350
                    // TODO open filename and URIs properly
282
351
                    //FILE* fp = fopen_utf8name( filename, "r" );
283
 
                    //LCMSAPI cmsHPROFILE   LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, DWORD dwSize);
 
352
                    //LCMSAPI cmsHPROFILE   LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, cmsUInt32Number dwSize);
284
353
 
285
354
                    // Try to open relative
286
 
                    SPDocument *doc = SP_OBJECT_DOCUMENT(object);
 
355
                    SPDocument *doc = object->document;
287
356
                    if (!doc) {
288
357
                        doc = SP_ACTIVE_DOCUMENT;
289
358
                        g_warning("object has no document.  using active");
306
375
                    //      the w3c specs.  All absolute and relative issues are considered
307
376
                    org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri);
308
377
                    gchar* fullname = g_uri_unescape_string(cprofUri.getNativePath().c_str(), "");
309
 
                    cprof->_clearProfile();
310
 
                    cprof->profHandle = cmsOpenProfileFromFile( fullname, "r" );
311
 
                    if ( cprof->profHandle ) {
312
 
                        cprof->_profileSpace = cmsGetColorSpace( cprof->profHandle );
313
 
                        cprof->_profileClass = cmsGetDeviceClass( cprof->profHandle );
 
378
                    cprof->impl->_clearProfile();
 
379
                    cprof->impl->_profHandle = cmsOpenProfileFromFile( fullname, "r" );
 
380
                    if ( cprof->impl->_profHandle ) {
 
381
                        cprof->impl->_profileSpace = cmsGetColorSpace( cprof->impl->_profHandle );
 
382
                        cprof->impl->_profileClass = cmsGetDeviceClass( cprof->impl->_profHandle );
314
383
                    }
315
 
#ifdef DEBUG_LCMS
316
 
                    DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->profHandle );
317
 
#endif // DEBUG_LCMS
 
384
                    DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->impl->_profHandle );
318
385
                    g_free(escaped);
319
386
                    escaped = 0;
320
387
                    g_free(fullname);
321
 
#endif // ENABLE_LCMS
 
388
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
322
389
                }
323
390
            }
324
391
            object->requestModified(SP_OBJECT_MODIFIED_FLAG);
417
484
}
418
485
 
419
486
 
420
 
#if ENABLE_LCMS
 
487
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
421
488
 
422
489
struct MapMap {
423
 
    icColorSpaceSignature space;
424
 
    DWORD inForm;
 
490
    cmsColorSpaceSignature space;
 
491
    cmsUInt32Number inForm;
425
492
};
426
493
 
427
 
DWORD ColorProfile::_getInputFormat( icColorSpaceSignature space )
 
494
cmsUInt32Number ColorProfileImpl::_getInputFormat( cmsColorSpaceSignature space )
428
495
{
429
496
    MapMap possible[] = {
430
 
        {icSigXYZData,   TYPE_XYZ_16},
431
 
        {icSigLabData,   TYPE_Lab_16},
432
 
        //icSigLuvData
433
 
        {icSigYCbCrData, TYPE_YCbCr_16},
434
 
        {icSigYxyData,   TYPE_Yxy_16},
435
 
        {icSigRgbData,   TYPE_RGB_16},
436
 
        {icSigGrayData,  TYPE_GRAY_16},
437
 
        {icSigHsvData,   TYPE_HSV_16},
438
 
        {icSigHlsData,   TYPE_HLS_16},
439
 
        {icSigCmykData,  TYPE_CMYK_16},
440
 
        {icSigCmyData,   TYPE_CMY_16},
 
497
        {cmsSigXYZData,   TYPE_XYZ_16},
 
498
        {cmsSigLabData,   TYPE_Lab_16},
 
499
        //cmsSigLuvData
 
500
        {cmsSigYCbCrData, TYPE_YCbCr_16},
 
501
        {cmsSigYxyData,   TYPE_Yxy_16},
 
502
        {cmsSigRgbData,   TYPE_RGB_16},
 
503
        {cmsSigGrayData,  TYPE_GRAY_16},
 
504
        {cmsSigHsvData,   TYPE_HSV_16},
 
505
        {cmsSigHlsData,   TYPE_HLS_16},
 
506
        {cmsSigCmykData,  TYPE_CMYK_16},
 
507
        {cmsSigCmyData,   TYPE_CMY_16},
441
508
    };
442
509
 
443
510
    int index = 0;
493
560
    return result;
494
561
}
495
562
 
496
 
cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name )
 
563
cmsHPROFILE Inkscape::CMSSystem::getHandle( SPDocument* document, guint* intent, gchar const* name )
497
564
{
498
565
    cmsHPROFILE prof = 0;
499
566
 
500
567
    SPObject* thing = bruteFind( document, name );
501
568
    if ( thing ) {
502
 
        prof = COLORPROFILE(thing)->profHandle;
 
569
        prof = COLORPROFILE(thing)->impl->_profHandle;
503
570
    }
504
571
 
505
572
    if ( intent ) {
506
573
        *intent = thing ? COLORPROFILE(thing)->rendering_intent : (guint)RENDERING_INTENT_UNKNOWN;
507
574
    }
508
575
 
509
 
#ifdef DEBUG_LCMS
510
576
    DEBUG_MESSAGE( lcmsThree, "<color-profile> queried for profile of '%s'. Returning %p with intent of %d", name, prof, (intent? *intent:0) );
511
 
#endif // DEBUG_LCMS
512
577
 
513
578
    return prof;
514
579
}
515
580
 
 
581
Inkscape::ColorSpaceSig ColorProfile::getColorSpace() const {
 
582
    return ColorSpaceSigWrapper(impl->_profileSpace);
 
583
}
 
584
 
 
585
Inkscape::ColorProfileClassSig ColorProfile::getProfileClass() const {
 
586
    return ColorProfileClassSigWrapper(impl->_profileClass);
 
587
}
 
588
 
516
589
cmsHTRANSFORM ColorProfile::getTransfToSRGB8()
517
590
{
518
 
    if ( !_transf && profHandle ) {
 
591
    if ( !impl->_transf && impl->_profHandle ) {
519
592
        int intent = getLcmsIntent(rendering_intent);
520
 
        _transf = cmsCreateTransform( profHandle, _getInputFormat(_profileSpace), getSRGBProfile(), TYPE_RGBA_8, intent, 0 );
 
593
        impl->_transf = cmsCreateTransform( impl->_profHandle, ColorProfileImpl::_getInputFormat(impl->_profileSpace), ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, intent, 0 );
521
594
    }
522
 
    return _transf;
 
595
    return impl->_transf;
523
596
}
524
597
 
525
598
cmsHTRANSFORM ColorProfile::getTransfFromSRGB8()
526
599
{
527
 
    if ( !_revTransf && profHandle ) {
 
600
    if ( !impl->_revTransf && impl->_profHandle ) {
528
601
        int intent = getLcmsIntent(rendering_intent);
529
 
        _revTransf = cmsCreateTransform( getSRGBProfile(), TYPE_RGBA_8, profHandle, _getInputFormat(_profileSpace), intent, 0 );
 
602
        impl->_revTransf = cmsCreateTransform( ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, impl->_profHandle, ColorProfileImpl::_getInputFormat(impl->_profileSpace), intent, 0 );
530
603
    }
531
 
    return _revTransf;
 
604
    return impl->_revTransf;
532
605
}
533
606
 
534
607
cmsHTRANSFORM ColorProfile::getTransfGamutCheck()
535
608
{
536
 
    if ( !_gamutTransf ) {
537
 
        _gamutTransf = cmsCreateProofingTransform(getSRGBProfile(), TYPE_RGBA_8, getNULLProfile(), TYPE_GRAY_8, profHandle, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, (cmsFLAGS_GAMUTCHECK|cmsFLAGS_SOFTPROOFING));
 
609
    if ( !impl->_gamutTransf ) {
 
610
        impl->_gamutTransf = cmsCreateProofingTransform(ColorProfileImpl::getSRGBProfile(),
 
611
                                                        TYPE_RGBA_8,
 
612
                                                        ColorProfileImpl::getNULLProfile(),
 
613
                                                        TYPE_GRAY_8,
 
614
                                                        impl->_profHandle,
 
615
                                                        INTENT_RELATIVE_COLORIMETRIC,
 
616
                                                        INTENT_RELATIVE_COLORIMETRIC,
 
617
                                                        (cmsFLAGS_GAMUTCHECK | cmsFLAGS_SOFTPROOFING));
538
618
    }
539
 
    return _gamutTransf;
 
619
    return impl->_gamutTransf;
540
620
}
541
621
 
542
 
bool ColorProfile::GamutCheck(SPColor color){
543
 
    BYTE outofgamut = 0;
544
 
    
 
622
bool ColorProfile::GamutCheck(SPColor color)
 
623
{
 
624
    bool result = false;
 
625
 
545
626
    guint32 val = color.toRGBA32(0);
 
627
 
 
628
#if HAVE_LIBLCMS1
 
629
    int alarm_r = 0;
 
630
    int alarm_g = 0;
 
631
    int alarm_b = 0;
 
632
    cmsGetAlarmCodes(&alarm_r, &alarm_g, &alarm_b);
 
633
    cmsSetAlarmCodes(255, 255, 255);
 
634
#elif HAVE_LIBLCMS2
 
635
    cmsUInt16Number oldAlarmCodes[cmsMAXCHANNELS] = {0};
 
636
    cmsGetAlarmCodes(oldAlarmCodes);
 
637
    cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0};
 
638
    newAlarmCodes[0] = ~0;
 
639
    cmsSetAlarmCodes(newAlarmCodes);
 
640
#endif // HAVE_LIBLCMS1
 
641
 
 
642
    cmsUInt8Number outofgamut = 0;
546
643
    guchar check_color[4] = {
547
644
        SP_RGBA32_R_U(val),
548
645
        SP_RGBA32_G_U(val),
549
646
        SP_RGBA32_B_U(val),
550
647
        255};
551
 
 
552
 
    int alarm_r, alarm_g, alarm_b;
553
 
    cmsGetAlarmCodes(&alarm_r, &alarm_g, &alarm_b);
554
 
    cmsSetAlarmCodes(255, 255, 255);
555
648
    cmsDoTransform(ColorProfile::getTransfGamutCheck(), &check_color, &outofgamut, 1);
 
649
 
 
650
#if HAVE_LIBLCMS1
556
651
    cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b);
557
 
    return (outofgamut == 255);
 
652
#elif HAVE_LIBLCMS2
 
653
    cmsSetAlarmCodes(oldAlarmCodes);
 
654
#endif // HAVE_LIBLCMS1
 
655
 
 
656
    result = (outofgamut != 0);
 
657
 
 
658
    return result;
558
659
}
559
660
 
560
 
 
561
 
#include <io/sys.h>
562
 
 
563
661
class ProfileInfo
564
662
{
565
663
public:
566
 
    ProfileInfo( cmsHPROFILE, Glib::ustring const & path );
 
664
    ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path );
567
665
 
568
666
    Glib::ustring const& getName() {return _name;}
569
667
    Glib::ustring const& getPath() {return _path;}
570
 
    icColorSpaceSignature getSpace() {return _profileSpace;}
571
 
    icProfileClassSignature getClass() {return _profileClass;}
 
668
    cmsColorSpaceSignature getSpace() {return _profileSpace;}
 
669
    cmsProfileClassSignature getClass() {return _profileClass;}
572
670
 
573
671
private:
574
672
    Glib::ustring _path;
575
673
    Glib::ustring _name;
576
 
    icColorSpaceSignature _profileSpace;
577
 
    icProfileClassSignature _profileClass;
 
674
    cmsColorSpaceSignature _profileSpace;
 
675
    cmsProfileClassSignature _profileClass;
578
676
};
579
677
 
 
678
#include <iostream>
580
679
 
581
 
ProfileInfo::ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path )
 
680
ProfileInfo::ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path ) :
 
681
    _path( path ),
 
682
    _name( getNameFromProfile(prof) ),
 
683
    _profileSpace( cmsGetColorSpace( prof ) ),
 
684
    _profileClass( cmsGetDeviceClass( prof ) )
582
685
{
583
 
    _path = path;
584
 
    _name = cmsTakeProductDesc(prof);
585
 
    _profileSpace = cmsGetColorSpace( prof );
586
 
    _profileClass = cmsGetDeviceClass( prof );
587
686
}
588
687
 
589
688
 
590
689
 
591
690
static std::vector<ProfileInfo> knownProfiles;
592
691
 
593
 
std::vector<Glib::ustring> Inkscape::colorprofile_get_display_names()
594
 
{
595
 
    std::vector<Glib::ustring> result;
596
 
 
597
 
    for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
598
 
        if ( it->getClass() == icSigDisplayClass && it->getSpace() == icSigRgbData ) {
599
 
            result.push_back( it->getName() );
600
 
        }
601
 
    }
602
 
 
603
 
    return result;
604
 
}
605
 
 
606
 
std::vector<Glib::ustring> Inkscape::colorprofile_get_softproof_names()
607
 
{
608
 
    std::vector<Glib::ustring> result;
609
 
 
610
 
    for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
611
 
        if ( it->getClass() == icSigOutputClass ) {
612
 
            result.push_back( it->getName() );
613
 
        }
614
 
    }
615
 
 
616
 
    return result;
617
 
}
618
 
 
619
 
Glib::ustring Inkscape::get_path_for_profile(Glib::ustring const& name)
620
 
{
 
692
std::vector<Glib::ustring> Inkscape::CMSSystem::getDisplayNames()
 
693
{
 
694
    loadProfiles();
 
695
    std::vector<Glib::ustring> result;
 
696
 
 
697
    for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
 
698
        if ( it->getClass() == cmsSigDisplayClass && it->getSpace() == cmsSigRgbData ) {
 
699
            result.push_back( it->getName() );
 
700
        }
 
701
    }
 
702
    std::sort(result.begin(), result.end());
 
703
 
 
704
    return result;
 
705
}
 
706
 
 
707
std::vector<Glib::ustring> Inkscape::CMSSystem::getSoftproofNames()
 
708
{
 
709
    loadProfiles();
 
710
    std::vector<Glib::ustring> result;
 
711
 
 
712
    for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
 
713
        if ( it->getClass() == cmsSigOutputClass ) {
 
714
            result.push_back( it->getName() );
 
715
        }
 
716
    }
 
717
    std::sort(result.begin(), result.end());
 
718
 
 
719
    return result;
 
720
}
 
721
 
 
722
Glib::ustring Inkscape::CMSSystem::getPathForProfile(Glib::ustring const& name)
 
723
{
 
724
    loadProfiles();
621
725
    Glib::ustring result;
622
726
 
623
727
    for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
629
733
 
630
734
    return result;
631
735
}
632
 
#endif // ENABLE_LCMS
633
 
 
634
 
std::list<Glib::ustring> ColorProfile::getBaseProfileDirs() {
635
 
#if ENABLE_LCMS
 
736
 
 
737
void Inkscape::CMSSystem::doTransform(cmsHTRANSFORM transform, void *inBuf, void *outBuf, unsigned int size)
 
738
{
 
739
    cmsDoTransform(transform, inBuf, outBuf, size);
 
740
}
 
741
 
 
742
bool Inkscape::CMSSystem::isPrintColorSpace(ColorProfile const *profile)
 
743
{
 
744
    bool isPrint = false;
 
745
    if ( profile ) {
 
746
        ColorSpaceSigWrapper colorspace = profile->getColorSpace();
 
747
        isPrint = (colorspace == cmsSigCmykData) || (colorspace == cmsSigCmyData);
 
748
    }
 
749
    return isPrint;
 
750
}
 
751
 
 
752
gint Inkscape::CMSSystem::getChannelCount(ColorProfile const *profile)
 
753
{
 
754
    gint count = 0;
 
755
    if ( profile ) {
 
756
#if HAVE_LIBLCMS1
 
757
        count = _cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) );
 
758
#elif HAVE_LIBLCMS2
 
759
        count = cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) );
 
760
#endif
 
761
    }
 
762
    return count;
 
763
}
 
764
 
 
765
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
766
 
 
767
std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() {
 
768
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
636
769
    static bool warnSet = false;
637
770
    if (!warnSet) {
 
771
#if HAVE_LIBLCMS1
638
772
        cmsErrorAction( LCMS_ERROR_SHOW );
 
773
#endif
639
774
        warnSet = true;
640
775
    }
641
 
#endif // ENABLE_LCMS
642
 
    std::list<Glib::ustring> sources;
 
776
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
777
    std::vector<Glib::ustring> sources;
643
778
 
644
779
    gchar* base = profile_path("XXX");
645
780
    {
665
800
    // On OS X:
666
801
    {
667
802
        bool onOSX = false;
668
 
        std::list<Glib::ustring> possible;
 
803
        std::vector<Glib::ustring> possible;
669
804
        possible.push_back("/System/Library/ColorSync/Profiles");
670
805
        possible.push_back("/Library/ColorSync/Profiles");
671
 
        for ( std::list<Glib::ustring>::const_iterator it = possible.begin(); it != possible.end(); ++it ) {
 
806
        for ( std::vector<Glib::ustring>::const_iterator it = possible.begin(); it != possible.end(); ++it ) {
672
807
            if ( g_file_test(it->c_str(), G_FILE_TEST_EXISTS)  && g_file_test(it->c_str(), G_FILE_TEST_IS_DIR) ) {
673
808
                sources.push_back(it->c_str());
674
809
                onOSX = true;
686
821
#ifdef WIN32
687
822
    wchar_t pathBuf[MAX_PATH + 1];
688
823
    pathBuf[0] = 0;
689
 
    DWORD pathSize = sizeof(pathBuf);
 
824
    cmsUInt32Number pathSize = sizeof(pathBuf);
690
825
    g_assert(sizeof(wchar_t) == sizeof(gunichar2));
691
826
    if ( GetColorDirectoryW( NULL, pathBuf, &pathSize ) ) {
692
827
        gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL );
724
859
            }
725
860
 
726
861
            close(fd);
727
 
#if ENABLE_LCMS
 
862
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
728
863
            if (isIccFile) {
729
864
                cmsHPROFILE prof = cmsOpenProfileFromFile( filepath, "r" );
730
865
                if ( prof ) {
731
 
                    icProfileClassSignature profClass = cmsGetDeviceClass(prof);
732
 
                    if ( profClass == icSigNamedColorClass ) {
 
866
                    cmsProfileClassSignature profClass = cmsGetDeviceClass(prof);
 
867
                    if ( profClass == cmsSigNamedColorClass ) {
733
868
                        isIccFile = false; // Ignore named color profiles for now.
734
869
                    }
735
870
                    cmsCloseProfile( prof );
736
871
                }
737
872
            }
738
 
#endif // ENABLE_LCMS
 
873
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
739
874
        }
740
875
    }
741
876
    return isIccFile;
742
877
}
743
878
 
744
 
std::list<Glib::ustring> ColorProfile::getProfileFiles()
 
879
std::vector<Glib::ustring> ColorProfile::getProfileFiles()
745
880
{
746
 
    std::list<Glib::ustring> files;
 
881
    std::vector<Glib::ustring> files;
747
882
 
748
 
    std::list<Glib::ustring> sources = ColorProfile::getBaseProfileDirs();
 
883
    std::list<Glib::ustring> sources;
 
884
    {
 
885
        std::vector<Glib::ustring> tmp = ColorProfile::getBaseProfileDirs();
 
886
        sources.insert(sources.begin(), tmp.begin(), tmp.end());
 
887
    }
749
888
    for ( std::list<Glib::ustring>::const_iterator it = sources.begin(); it != sources.end(); ++it ) {
750
889
        if ( g_file_test( it->c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->c_str(), G_FILE_TEST_IS_DIR ) ) {
751
890
            GError *err = 0;
777
916
    return files;
778
917
}
779
918
 
780
 
#if ENABLE_LCMS
781
 
static void findThings() {
782
 
    std::list<Glib::ustring> files = ColorProfile::getProfileFiles();
783
 
 
784
 
    for ( std::list<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) {
785
 
        cmsHPROFILE prof = cmsOpenProfileFromFile( it->c_str(), "r" );
786
 
        if ( prof ) {
787
 
            ProfileInfo info( prof, Glib::filename_to_utf8( it->c_str() ) );
788
 
            cmsCloseProfile( prof );
789
 
 
790
 
            bool sameName = false;
791
 
            for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
792
 
                if ( it->getName() == info.getName() ) {
793
 
                    sameName = true;
794
 
                    break;
795
 
                }
796
 
            }
797
 
 
798
 
            if ( !sameName ) {
799
 
                knownProfiles.push_back(info);
800
 
            }
 
919
std::vector<std::pair<Glib::ustring, Glib::ustring> > ColorProfile::getProfileFilesWithNames()
 
920
{
 
921
    std::vector<std::pair<Glib::ustring, Glib::ustring> > result;
 
922
 
 
923
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
924
    std::vector<Glib::ustring> files = getProfileFiles();
 
925
    for ( std::vector<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) {
 
926
        cmsHPROFILE hProfile = cmsOpenProfileFromFile(it->c_str(), "r");
 
927
        if ( hProfile ) {
 
928
            Glib::ustring name = getNameFromProfile(hProfile);
 
929
            result.push_back( std::make_pair(*it, name) );
 
930
            cmsCloseProfile(hProfile);
801
931
        }
802
932
    }
 
933
    std::sort(result.begin(), result.end());
 
934
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
935
 
 
936
    return result;
803
937
}
804
938
 
 
939
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
 
940
#if HAVE_LIBLCMS1
805
941
int errorHandlerCB(int ErrorCode, const char *ErrorText)
806
942
{
807
943
    g_message("lcms: Error %d; %s", ErrorCode, ErrorText);
808
944
 
809
945
    return 1;
810
946
}
 
947
#elif HAVE_LIBLCMS2
 
948
void errorHandlerCB(cmsContext /*contextID*/, cmsUInt32Number errorCode, char const *errorText)
 
949
{
 
950
    g_message("lcms: Error %d", errorCode);
 
951
    g_message("                 %p", errorText);
 
952
    //g_message("lcms: Error %d; %s", errorCode, errorText);
 
953
}
 
954
#endif
 
955
 
 
956
namespace
 
957
{
 
958
 
 
959
Glib::ustring getNameFromProfile(cmsHPROFILE profile)
 
960
{
 
961
    Glib::ustring nameStr;
 
962
    if ( profile ) {
 
963
#if HAVE_LIBLCMS1
 
964
        gchar const *name = cmsTakeProductDesc(profile);
 
965
        if ( !name ) {
 
966
            name = cmsTakeProductName(profile);
 
967
        }
 
968
        if ( name && !g_utf8_validate(name, -1, NULL) ) {
 
969
            name = _("(invalid UTF-8 string)");
 
970
        }
 
971
        nameStr = (name) ? name : _("None");
 
972
#elif HAVE_LIBLCMS2
 
973
    cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", NULL, 0);
 
974
    if (byteLen > 0) {
 
975
        // TODO investigate wchar_t and cmsGetProfileInfo()
 
976
        std::vector<char> data(byteLen);
 
977
        cmsUInt32Number readLen = cmsGetProfileInfoASCII(profile, cmsInfoDescription,
 
978
                                                         "en", "US",
 
979
                                                         data.data(), data.size());
 
980
        if (readLen < data.size()) {
 
981
            data.resize(readLen);
 
982
        }
 
983
        nameStr = Glib::ustring(data.begin(), data.end());
 
984
    }
 
985
    if (nameStr.empty()) {
 
986
        nameStr = _("(invalid UTF-8 string)");
 
987
    }
 
988
#endif
 
989
    }
 
990
    return nameStr;
 
991
}
 
992
 
 
993
/**
 
994
 * This function loads or refreshes data in knownProfiles.
 
995
 * Call it at the start of every call that requires this data.
 
996
 */
 
997
void loadProfiles()
 
998
{
 
999
    static bool error_handler_set = false;
 
1000
    if (!error_handler_set) {
 
1001
#if HAVE_LIBLCMS1
 
1002
        cmsSetErrorHandler(errorHandlerCB);
 
1003
#elif HAVE_LIBLCMS2
 
1004
        //cmsSetLogErrorHandler(errorHandlerCB);
 
1005
        //g_message("LCMS error handler set");
 
1006
#endif
 
1007
        error_handler_set = true;
 
1008
    }
 
1009
 
 
1010
    static bool profiles_searched = false;
 
1011
    if ( !profiles_searched ) {
 
1012
        knownProfiles.clear();
 
1013
        std::vector<Glib::ustring> files = ColorProfile::getProfileFiles();
 
1014
 
 
1015
        for ( std::vector<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) {
 
1016
            cmsHPROFILE prof = cmsOpenProfileFromFile( it->c_str(), "r" );
 
1017
            if ( prof ) {
 
1018
                ProfileInfo info( prof, Glib::filename_to_utf8( it->c_str() ) );
 
1019
                cmsCloseProfile( prof );
 
1020
                prof = 0;
 
1021
 
 
1022
                bool sameName = false;
 
1023
                for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) {
 
1024
                    if ( it->getName() == info.getName() ) {
 
1025
                        sameName = true;
 
1026
                        break;
 
1027
                    }
 
1028
                }
 
1029
 
 
1030
                if ( !sameName ) {
 
1031
                    knownProfiles.push_back(info);
 
1032
                }
 
1033
            }
 
1034
        }
 
1035
        profiles_searched = true;
 
1036
    }
 
1037
}
 
1038
} // namespace
811
1039
 
812
1040
static bool gamutWarn = false;
813
1041
static Gdk::Color lastGamutColor("#808080");
819
1047
static int lastProofIntent = INTENT_PERCEPTUAL;
820
1048
static cmsHTRANSFORM transf = 0;
821
1049
 
822
 
cmsHPROFILE Inkscape::colorprofile_get_system_profile_handle()
 
1050
namespace {
 
1051
cmsHPROFILE getSystemProfileHandle()
823
1052
{
824
1053
    static cmsHPROFILE theOne = 0;
825
1054
    static Glib::ustring lastURI;
826
1055
 
827
 
    static bool init = false;
828
 
    if ( !init ) {
829
 
        cmsSetErrorHandler(errorHandlerCB);
830
 
 
831
 
        findThings();
832
 
        init = true;
833
 
    }
 
1056
    loadProfiles();
834
1057
 
835
1058
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
836
1059
    Glib::ustring uri = prefs->getString("/options/displayprofile/uri");
848
1071
            theOne = cmsOpenProfileFromFile( uri.data(), "r" );
849
1072
            if ( theOne ) {
850
1073
                // a display profile must have the proper stuff
851
 
                icColorSpaceSignature space = cmsGetColorSpace(theOne);
852
 
                icProfileClassSignature profClass = cmsGetDeviceClass(theOne);
 
1074
                cmsColorSpaceSignature space = cmsGetColorSpace(theOne);
 
1075
                cmsProfileClassSignature profClass = cmsGetDeviceClass(theOne);
853
1076
 
854
 
                if ( profClass != icSigDisplayClass ) {
 
1077
                if ( profClass != cmsSigDisplayClass ) {
855
1078
                    g_warning("Not a display profile");
856
1079
                    cmsCloseProfile( theOne );
857
1080
                    theOne = 0;
858
 
                } else if ( space != icSigRgbData ) {
 
1081
                } else if ( space != cmsSigRgbData ) {
859
1082
                    g_warning("Not an RGB profile");
860
1083
                    cmsCloseProfile( theOne );
861
1084
                    theOne = 0;
878
1101
}
879
1102
 
880
1103
 
881
 
cmsHPROFILE Inkscape::colorprofile_get_proof_profile_handle()
 
1104
cmsHPROFILE getProofProfileHandle()
882
1105
{
883
1106
    static cmsHPROFILE theOne = 0;
884
1107
    static Glib::ustring lastURI;
885
1108
 
886
 
    static bool init = false;
887
 
    if ( !init ) {
888
 
        cmsSetErrorHandler(errorHandlerCB);
889
 
 
890
 
        findThings();
891
 
        init = true;
892
 
    }
 
1109
    loadProfiles();
893
1110
 
894
1111
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
895
1112
    bool which = prefs->getBool( "/options/softproof/enable");
908
1125
            theOne = cmsOpenProfileFromFile( uri.data(), "r" );
909
1126
            if ( theOne ) {
910
1127
                // a display profile must have the proper stuff
911
 
                icColorSpaceSignature space = cmsGetColorSpace(theOne);
912
 
                icProfileClassSignature profClass = cmsGetDeviceClass(theOne);
 
1128
                cmsColorSpaceSignature space = cmsGetColorSpace(theOne);
 
1129
                cmsProfileClassSignature profClass = cmsGetDeviceClass(theOne);
913
1130
 
914
1131
                (void)space;
915
1132
                (void)profClass;
916
1133
/*
917
 
                if ( profClass != icSigDisplayClass ) {
 
1134
                if ( profClass != cmsSigDisplayClass ) {
918
1135
                    g_warning("Not a display profile");
919
1136
                    cmsCloseProfile( theOne );
920
1137
                    theOne = 0;
921
 
                } else if ( space != icSigRgbData ) {
 
1138
                } else if ( space != cmsSigRgbData ) {
922
1139
                    g_warning("Not an RGB profile");
923
1140
                    cmsCloseProfile( theOne );
924
1141
                    theOne = 0;
942
1159
 
943
1160
    return theOne;
944
1161
}
 
1162
} // namespace
945
1163
 
946
1164
static void free_transforms();
947
1165
 
948
 
cmsHTRANSFORM Inkscape::colorprofile_get_display_transform()
 
1166
cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform()
949
1167
{
950
1168
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
951
1169
    bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display");
988
1206
    }
989
1207
 
990
1208
    // Fetch these now, as they might clear the transform as a side effect.
991
 
    cmsHPROFILE hprof = Inkscape::colorprofile_get_system_profile_handle();
992
 
    cmsHPROFILE proofProf = hprof ? Inkscape::colorprofile_get_proof_profile_handle() : 0;
 
1209
    cmsHPROFILE hprof = getSystemProfileHandle();
 
1210
    cmsHPROFILE proofProf = hprof ? getProofProfileHandle() : 0;
993
1211
 
994
1212
    if ( !transf ) {
995
1213
        if ( hprof && proofProf ) {
996
 
            DWORD dwFlags = cmsFLAGS_SOFTPROOFING;
 
1214
            cmsUInt32Number dwFlags = cmsFLAGS_SOFTPROOFING;
997
1215
            if ( gamutWarn ) {
998
1216
                dwFlags |= cmsFLAGS_GAMUTCHECK;
 
1217
#if HAVE_LIBLCMS1
999
1218
                cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8);
 
1219
#elif HAVE_LIBLCMS2
 
1220
                cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0};
 
1221
                newAlarmCodes[0] = gamutColor.get_red();
 
1222
                newAlarmCodes[1] = gamutColor.get_green();
 
1223
                newAlarmCodes[2] = gamutColor.get_blue();
 
1224
                newAlarmCodes[3] = ~0;
 
1225
                cmsSetAlarmCodes(newAlarmCodes);
 
1226
#endif
1000
1227
            }
1001
1228
            if ( bpc ) {
1002
1229
                dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
1006
1233
                dwFlags |= cmsFLAGS_PRESERVEBLACK;
1007
1234
            }
1008
1235
#endif // defined(cmsFLAGS_PRESERVEBLACK)
1009
 
            transf = cmsCreateProofingTransform( ColorProfile::getSRGBProfile(), TYPE_RGBA_8, hprof, TYPE_RGBA_8, proofProf, intent, proofIntent, dwFlags );
 
1236
            transf = cmsCreateProofingTransform( ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, hprof, TYPE_RGBA_8, proofProf, intent, proofIntent, dwFlags );
1010
1237
        } else if ( hprof ) {
1011
 
            transf = cmsCreateTransform( ColorProfile::getSRGBProfile(), TYPE_RGBA_8, hprof, TYPE_RGBA_8, intent, 0 );
 
1238
            transf = cmsCreateTransform( ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, hprof, TYPE_RGBA_8, intent, 0 );
1012
1239
        }
1013
1240
    }
1014
1241
 
1056
1283
    }
1057
1284
}
1058
1285
 
1059
 
Glib::ustring Inkscape::colorprofile_get_display_id( int screen, int monitor )
 
1286
Glib::ustring Inkscape::CMSSystem::getDisplayId( int screen, int monitor )
1060
1287
{
1061
1288
    Glib::ustring id;
1062
1289
 
1071
1298
    return id;
1072
1299
}
1073
1300
 
1074
 
Glib::ustring Inkscape::colorprofile_set_display_per( gpointer buf, guint bufLen, int screen, int monitor )
 
1301
Glib::ustring Inkscape::CMSSystem::setDisplayPer( gpointer buf, guint bufLen, int screen, int monitor )
1075
1302
{
1076
1303
    Glib::ustring id;
1077
1304
 
1104
1331
    return id;
1105
1332
}
1106
1333
 
1107
 
cmsHTRANSFORM Inkscape::colorprofile_get_display_per( Glib::ustring const& id )
 
1334
cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id )
1108
1335
{
1109
1336
    cmsHTRANSFORM result = 0;
1110
1337
    if ( id.empty() ) {
1149
1376
                }
1150
1377
 
1151
1378
                // Fetch these now, as they might clear the transform as a side effect.
1152
 
                cmsHPROFILE proofProf = item.hprof ? Inkscape::colorprofile_get_proof_profile_handle() : 0;
 
1379
                cmsHPROFILE proofProf = item.hprof ? getProofProfileHandle() : 0;
1153
1380
 
1154
1381
                if ( !item.transf ) {
1155
1382
                    if ( item.hprof && proofProf ) {
1156
 
                        DWORD dwFlags = cmsFLAGS_SOFTPROOFING;
 
1383
                        cmsUInt32Number dwFlags = cmsFLAGS_SOFTPROOFING;
1157
1384
                        if ( gamutWarn ) {
1158
1385
                            dwFlags |= cmsFLAGS_GAMUTCHECK;
 
1386
#if HAVE_LIBLCMS1
1159
1387
                            cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8);
 
1388
#elif HAVE_LIBLCMS2
 
1389
                            cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0};
 
1390
                            newAlarmCodes[0] = gamutColor.get_red();
 
1391
                            newAlarmCodes[1] = gamutColor.get_green();
 
1392
                            newAlarmCodes[2] = gamutColor.get_blue();
 
1393
                            newAlarmCodes[3] = ~0;
 
1394
                            cmsSetAlarmCodes(newAlarmCodes);
 
1395
#endif
1160
1396
                        }
1161
1397
                        if ( bpc ) {
1162
1398
                            dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
1166
1402
                            dwFlags |= cmsFLAGS_PRESERVEBLACK;
1167
1403
                        }
1168
1404
#endif // defined(cmsFLAGS_PRESERVEBLACK)
1169
 
                        item.transf = cmsCreateProofingTransform( ColorProfile::getSRGBProfile(), TYPE_RGBA_8, item.hprof, TYPE_RGBA_8, proofProf, intent, proofIntent, dwFlags );
 
1405
                        item.transf = cmsCreateProofingTransform( ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, item.hprof, TYPE_RGBA_8, proofProf, intent, proofIntent, dwFlags );
1170
1406
                    } else if ( item.hprof ) {
1171
 
                        item.transf = cmsCreateTransform( ColorProfile::getSRGBProfile(), TYPE_RGBA_8, item.hprof, TYPE_RGBA_8, intent, 0 );
 
1407
                        item.transf = cmsCreateTransform( ColorProfileImpl::getSRGBProfile(), TYPE_RGBA_8, item.hprof, TYPE_RGBA_8, intent, 0 );
1172
1408
                    }
1173
1409
                }
1174
1410
 
1183
1419
 
1184
1420
 
1185
1421
 
1186
 
#endif // ENABLE_LCMS
 
1422
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
1187
1423
 
1188
1424
/*
1189
1425
  Local Variables:
1194
1430
  fill-column:99
1195
1431
  End:
1196
1432
*/
1197
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
 
1433
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :