1 /*
2  * * Copyright (C) 2006-2011 Anders Brander <anders@brander.dk>,
3  * * Anders Kvist <akv@lnxbx.dk> and Klaus Post <klauspost@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19 
20 #ifndef RS_ICC_PROFILE_H
21 #define RS_ICC_PROFILE_H
22 
23 #include <glib-object.h>
24 
25 G_BEGIN_DECLS
26 
27 #define RS_TYPE_ICC_PROFILE rs_icc_profile_get_type()
28 #define RS_ICC_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_ICC_PROFILE, RSIccProfile))
29 #define RS_ICC_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RS_TYPE_ICC_PROFILE, RSIccProfileClass))
30 #define RS_IS_ICC_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RS_TYPE_ICC_PROFILE))
31 #define RS_IS_ICC_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RS_TYPE_ICC_PROFILE))
32 #define RS_ICC_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RS_TYPE_ICC_PROFILE, RSIccProfileClass))
33 
34 typedef struct _RSIccProfile RSIccProfile;
35 
36 typedef struct {
37 	GObjectClass parent_class;
38 } RSIccProfileClass;
39 
40 GType rs_icc_profile_get_type(void);
41 
42 typedef enum {
43 	RS_ICC_COLORSPACE_UNDEFINED = 0x0,
44 	RS_ICC_COLORSPACE_XYZ       = 0x58595A20,
45 	RS_ICC_COLORSPACE_LAB       = 0x4C616220,
46 	RS_ICC_COLORSPACE_LUV       = 0x4C757620,
47 	RS_ICC_COLORSPACE_YCBCR     = 0x59436272,
48 	RS_ICC_COLORSPACE_YXY       = 0x59787920,
49 	RS_ICC_COLORSPACE_RGB       = 0x52474220,
50 	RS_ICC_COLORSPACE_GREY      = 0x47524159,
51 	RS_ICC_COLORSPACE_HSV       = 0x48535620,
52 	RS_ICC_COLORSPACE_HLS       = 0x484C5320,
53 	RS_ICC_COLORSPACE_CMYK      = 0x434D594B,
54 	RS_ICC_COLORSPACE_CMY       = 0x434D5920
55 } RSIccProfile_ColorSpace;
56 
57 #define RS_TYPE_ICC_COLORSPACE rs_icc_colorspace_get_type()
58 GType rs_icc_colorspace_get_type(void);
59 
60 typedef enum {
61 	RS_ICC_PROFILE_UNDEFINED             = 0x0,
62 	RS_ICC_PROFILE_INPUT                 = 0x73636E72,
63 	RS_ICC_PROFILE_DISPLAY               = 0x6D6E7472,
64 	RS_ICC_PROFILE_OUTPUT                = 0x70727472,
65 	RS_ICC_PROFILE_DEVICELINK            = 0x6C696E6B,
66 	RS_ICC_PROFILE_COLORSPACE_CONVERSION = 0x73706163,
67 	RS_ICC_PROFILE_ACSTRACT              = 0x61627374,
68 	RS_ICC_PROFILE_NAMED_COLOR           = 0x6E6D636C
69 } RSIccProfile_Class;
70 
71 #define RS_TYPE_ICC_PROFILE_CLASS rs_icc_profile_class_get_type()
72 GType rs_icc_profile_class_get_type(void);
73 
74 typedef enum {
75 	RS_ICC_INTENT_PERCEPTUAL            = 0,
76 	RS_ICC_INTENT_RELATIVE_COLORIMETRIC = 1,
77 	RS_ICC_INTENT_SATURATION            = 2,
78 	RS_ICC_INTENT_ABSOLUTE_COLORIMETRIC = 3
79 } RSIccIntent;
80 
81 #define RS_TYPE_ICC_INTENT rs_icc_intent_get_type()
82 GType rs_icc_intent_get_type(void);
83 
84 /**
85  * Construct new RSIccProfile from an ICC profile on disk
86  * @param path An absolute path to an ICC profile
87  * @return A new RSIccProfile object or NULL on error
88  */
89 RSIccProfile *
90 rs_icc_profile_new_from_file(const gchar *path);
91 
92 /**
93  * Construct new RSIccProfile from an in-memory ICC profile
94  * @param map A pointer to a complete ICC profile
95  * @param map_length The length of the profile in bytes
96  * @param copy TRUE if the data should be copied, FALSE otherwise
97  * @return A new RSIccProfile object or NULL on error
98  */
99 RSIccProfile *
100 rs_icc_profile_new_from_memory(gchar *map, gsize map_length, gboolean copy);
101 
102 /**
103  * Get binary profile data
104  * @param profile A RSIccProfile
105  * @param map A pointer to a gchar pointer
106  * @param map_length A pointer to a gsize, the length of the profile will be written here
107  */
108 gboolean
109 rs_icc_profile_get_data(const RSIccProfile *icc, gchar **data, gsize *length);
110 
111 const gchar *
112 rs_icc_profile_get_description(const RSIccProfile *profile);
113 
114 G_END_DECLS
115 
116 #endif /* RS_ICC_PROFILE_H */
117