Rev 23516 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
15127 | jghali | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
7 | |||
8 | #ifndef SCLCMS2COLORMGMTENGINEIMPL_H |
||
9 | #define SCLCMS2COLORMGMTENGINEIMPL_H |
||
10 | |||
11 | #include <stdexcept> |
||
12 | |||
13 | #include "lcms2.h" |
||
14 | #include "sccolormgmtenginedata.h" |
||
15 | #include "sccolorprofilecache.h" |
||
16 | |||
17 | class ScLcms2ColorMgmtEngineImpl : public ScColorMgmtEngineData |
||
18 | { |
||
19 | friend class ScLcms2ColorProfileImpl; |
||
20 | friend class ScLcms2ColorTransformImpl; |
||
21 | |||
22 | public: |
||
23 | ScLcms2ColorMgmtEngineImpl(); |
||
24 | |||
25 | // Setter, only for color management strategy |
||
26 | virtual void setStrategy(const ScColorMgmtStrategy& strategy); |
||
27 | |||
28 | // function for getting available profile in a directory |
||
29 | virtual QList<ScColorProfileInfo> getAvailableProfileInfo(const QString& directory, bool recursive); |
||
30 | |||
31 | // functions for opening icc profiles |
||
32 | virtual ScColorProfile openProfileFromFile(ScColorMgmtEngine& engine, const QString& filePath); |
||
33 | virtual ScColorProfile openProfileFromMem (ScColorMgmtEngine& engine, const QByteArray& array); |
||
34 | |||
35 | // functions for creating profiles |
||
36 | virtual ScColorProfile createProfile_sRGB(ScColorMgmtEngine& engine); |
||
37 | virtual ScColorProfile createProfile_Lab (ScColorMgmtEngine& engine); |
||
38 | |||
39 | // functions for creating transforms |
||
40 | virtual ScColorTransform createTransform(ScColorMgmtEngine& colorManagementEngine, |
||
41 | const ScColorProfile& inputProfile , eColorFormat inputFormat, |
||
42 | const ScColorProfile& outputProfile, eColorFormat outputFormat, |
||
43 | eRenderIntent renderIntent, long transformFlags); |
||
44 | virtual ScColorTransform createProofingTransform(ScColorMgmtEngine& colorManagementEngine, |
||
45 | const ScColorProfile& inputProfile , eColorFormat inputFormat, |
||
46 | const ScColorProfile& outputProfile, eColorFormat outputFormat, |
||
47 | const ScColorProfile& proofing, eRenderIntent renderIntent, |
||
48 | eRenderIntent proofingIntent, long transformFlags); |
||
49 | |||
50 | protected: |
||
51 | |||
52 | // Color profile cache |
||
53 | static QSharedPointer<ScColorProfileCache> m_profileCache; |
||
54 | |||
55 | // Color transform cache |
||
56 | static QSharedPointer<ScColorTransformPool> m_transformPool; |
||
57 | |||
58 | static cmsUInt32Number translateFlagsToLcmsFlags(long flags); |
||
59 | static cmsUInt32Number translateFormatToLcmsFormat(eColorFormat format); |
||
60 | static int translateIntentToLcmsIntent(eRenderIntent intent, eRenderIntent defaut = Intent_Relative_Colorimetric); |
||
61 | static eColorSpaceType translateLcmsColorSpaceType(cmsColorSpaceSignature); |
||
62 | static eProfileClass translateLcmsProfileClass(cmsProfileClassSignature); |
||
63 | |||
64 | // Exception class thrown by cmsErrorHandler |
||
65 | class lcmsException : public std::runtime_error |
||
66 | { |
||
67 | public : |
||
68 | lcmsException(const char* msg) : std::runtime_error(msg) {} |
||
69 | }; |
||
70 | |||
71 | /*! |
||
72 | \brief Simple error handler for use in conjunction with littlecms |
||
73 | \param ErrorCode error code issued by little cms |
||
74 | \param ErrorText error message corresponding to the error code |
||
75 | */ |
||
76 | static void cmsErrorHandler(cmsContext contextID, cmsUInt32Number ErrorCode, const char *ErrorText); |
||
77 | }; |
||
78 | |||
79 | #endif |