Code

merging gsoc 2009 color management work by Felipe Sanches (a.k.a. JucaBlues)
[inkscape.git] / src / color-profile.h
1 #ifndef SEEN_COLOR_PROFILE_H
2 #define SEEN_COLOR_PROFILE_H
4 /** \file
5  * SPColorProfile: SVG <color-profile> implementation
6  */
8 #include <glib/gtypes.h>
9 #include <sp-object.h>
10 #include <glibmm/ustring.h>
11 #if ENABLE_LCMS
12 #include <lcms.h>
13 #endif // ENABLE_LCMS
15 namespace Inkscape {
17 enum {
18     RENDERING_INTENT_UNKNOWN = 0,
19     RENDERING_INTENT_AUTO = 1,
20     RENDERING_INTENT_PERCEPTUAL = 2,
21     RENDERING_INTENT_RELATIVE_COLORIMETRIC = 3,
22     RENDERING_INTENT_SATURATION = 4,
23     RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 5
24 };
26 /// The SPColorProfile vtable.
27 struct ColorProfileClass {
28     SPObjectClass parent_class;
29 };
31 /** Color Profile. */
32 struct ColorProfile : public SPObject {
33     static GType getType();
34     static void classInit( ColorProfileClass *klass );
36     static std::list<Glib::ustring> getProfileDirs();
37 #if ENABLE_LCMS
38     static cmsHPROFILE getSRGBProfile();
39     static cmsHPROFILE getNULLProfile();
41     icColorSpaceSignature getColorSpace() const {return _profileSpace;}
42     icProfileClassSignature getProfileClass() const {return _profileClass;}
43     cmsHTRANSFORM getTransfToSRGB8();
44     cmsHTRANSFORM getTransfFromSRGB8();
45     cmsHTRANSFORM getTransfGamutCheck();
46     bool GamutCheck(SPColor color);
48 #endif // ENABLE_LCMS
50     gchar* href;
51     gchar* local;
52     gchar* name;
53     gchar* intentStr;
54     guint rendering_intent;
55 #if ENABLE_LCMS
56     cmsHPROFILE profHandle;
57 #endif // ENABLE_LCMS
59 private:
60     static void init( ColorProfile *cprof );
62     static void release( SPObject *object );
63     static void build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr );
64     static void set( SPObject *object, unsigned key, gchar const *value );
65     static Inkscape::XML::Node *write( SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags );
66 #if ENABLE_LCMS
67     static DWORD _getInputFormat( icColorSpaceSignature space );
68     void _clearProfile();
70     static cmsHPROFILE _sRGBProf;
71     static cmsHPROFILE _NullProf;
73     icProfileClassSignature _profileClass;
74     icColorSpaceSignature _profileSpace;
75     cmsHTRANSFORM _transf;
76     cmsHTRANSFORM _revTransf;
77     cmsHTRANSFORM _gamutTransf;
78 #endif // ENABLE_LCMS
79 };
81 } // namespace Inkscape
83 #endif // !SEEN_COLOR_PROFILE_H
85 /*
86   Local Variables:
87   mode:c++
88   c-file-style:"stroustrup"
89   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
90   indent-tabs-mode:nil
91   fill-column:99
92   End:
93 */
94 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :