Mercurial > geeqie.yaz
annotate src/color-man.c @ 398:c4080362d619
image post-processing (rotation and color management) moved to
pixbuf-renderer
author | nadvornik |
---|---|
date | Thu, 17 Apr 2008 17:44:54 +0000 |
parents | 9995c5fb202a |
children | 26c6e768bd47 |
rev | line source |
---|---|
113 | 1 /* |
196 | 2 * Geeqie |
113 | 3 * (C) 2006 John Ellis |
4 * | |
5 * Author: John Ellis | |
6 * | |
7 * This software is released under the GNU General Public License (GNU GPL). | |
8 * Please read the included file COPYING for more information. | |
9 * This software comes with no warranty of any kind, use at your own risk! | |
10 */ | |
11 | |
12 | |
281 | 13 #include "main.h" |
113 | 14 #include "color-man.h" |
15 | |
16 #include "image.h" | |
17 #include "ui_fileops.h" | |
18 | |
19 | |
20 #ifdef HAVE_LCMS | |
21 /*** color support enabled ***/ | |
22 | |
23 #ifdef HAVE_LCMS_LCMS_H | |
24 #include <lcms/lcms.h> | |
25 #else | |
26 #include <lcms.h> | |
27 #endif | |
28 | |
29 | |
30 typedef struct _ColorManCache ColorManCache; | |
31 struct _ColorManCache { | |
32 cmsHPROFILE profile_in; | |
33 cmsHPROFILE profile_out; | |
34 cmsHTRANSFORM transform; | |
35 | |
36 ColorManProfileType profile_in_type; | |
37 gchar *profile_in_file; | |
38 | |
39 ColorManProfileType profile_out_type; | |
40 gchar *profile_out_file; | |
41 | |
42 gint has_alpha; | |
43 | |
44 gint refcount; | |
45 }; | |
46 | |
47 /* pixels to transform per idle call */ | |
48 #define COLOR_MAN_CHUNK_SIZE 81900 | |
49 | |
50 | |
51 static void color_man_lib_init(void) | |
52 { | |
53 static gint init_done = FALSE; | |
54 | |
55 if (init_done) return; | |
56 init_done = TRUE; | |
57 | |
58 cmsErrorAction(LCMS_ERROR_IGNORE); | |
59 } | |
60 | |
61 | |
62 /* | |
63 *------------------------------------------------------------------- | |
64 * color transform cache | |
65 *------------------------------------------------------------------- | |
66 */ | |
67 | |
68 static GList *cm_cache_list = NULL; | |
69 | |
70 | |
71 static void color_man_cache_ref(ColorManCache *cc) | |
72 { | |
73 if (!cc) return; | |
74 | |
75 cc->refcount++; | |
76 } | |
77 | |
78 static void color_man_cache_unref(ColorManCache *cc) | |
79 { | |
80 if (!cc) return; | |
81 | |
82 cc->refcount--; | |
83 if (cc->refcount < 1) | |
84 { | |
85 if (cc->transform) cmsDeleteTransform(cc->transform); | |
86 if (cc->profile_in) cmsCloseProfile(cc->profile_in); | |
87 if (cc->profile_out) cmsCloseProfile(cc->profile_out); | |
88 | |
89 g_free(cc->profile_in_file); | |
90 g_free(cc->profile_out_file); | |
91 | |
92 g_free(cc); | |
93 } | |
94 } | |
95 | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
96 static cmsHPROFILE color_man_cache_load_profile(ColorManProfileType type, const gchar *file, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
97 unsigned char *data, guint data_len) |
113 | 98 { |
99 cmsHPROFILE profile = NULL; | |
100 | |
101 switch (type) | |
102 { | |
103 case COLOR_PROFILE_FILE: | |
104 if (file) | |
105 { | |
106 gchar *pathl; | |
107 | |
108 pathl = path_from_utf8(file); | |
109 profile = cmsOpenProfileFromFile(pathl, "r"); | |
110 g_free(pathl); | |
111 } | |
112 break; | |
113 case COLOR_PROFILE_SRGB: | |
114 profile = cmsCreate_sRGBProfile(); | |
115 break; | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
116 case COLOR_PROFILE_MEM: |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
117 if (data) |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
118 { |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
119 profile = cmsOpenProfileFromMem(data, data_len); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
120 } |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
121 break; |
113 | 122 case COLOR_PROFILE_NONE: |
123 default: | |
124 break; | |
125 } | |
126 | |
127 return profile; | |
128 } | |
129 | |
130 static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gchar *in_file, | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
131 unsigned char *in_data, guint in_data_len, |
113 | 132 ColorManProfileType out_type, const gchar *out_file, |
133 gint has_alpha) | |
134 { | |
135 ColorManCache *cc; | |
136 | |
137 color_man_lib_init(); | |
138 | |
139 cc = g_new0(ColorManCache, 1); | |
140 cc->refcount = 1; | |
141 | |
142 cc->profile_in_type = in_type; | |
143 cc->profile_in_file = g_strdup(in_file); | |
144 | |
145 cc->profile_out_type = out_type; | |
146 cc->profile_out_file = g_strdup(out_file); | |
147 | |
148 cc->has_alpha = has_alpha; | |
149 | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
150 cc->profile_in = color_man_cache_load_profile(cc->profile_in_type, cc->profile_in_file, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
151 in_data, in_data_len); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
152 cc->profile_out = color_man_cache_load_profile(cc->profile_out_type, cc->profile_out_file, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
153 NULL, 0); |
113 | 154 |
155 if (!cc->profile_in || !cc->profile_out) | |
156 { | |
157 if (debug) printf("failed to load color profile for %s: %d %s\n", | |
158 (!cc->profile_in) ? "input" : "screen", | |
159 (!cc->profile_in) ? cc->profile_in_type : cc->profile_out_type, | |
160 (!cc->profile_in) ? cc->profile_in_file : cc->profile_out_file); | |
161 | |
162 color_man_cache_unref(cc); | |
163 return NULL; | |
164 } | |
165 | |
166 cc->transform = cmsCreateTransform(cc->profile_in, | |
167 (has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8, | |
168 cc->profile_out, | |
169 (has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8, | |
170 INTENT_PERCEPTUAL, 0); | |
171 | |
172 if (!cc->transform) | |
173 { | |
174 if (debug) printf("failed to create color profile transform\n"); | |
175 | |
176 color_man_cache_unref(cc); | |
177 return NULL; | |
178 } | |
179 | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
180 if (cc->profile_in_type != COLOR_PROFILE_MEM) |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
181 { |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
182 cm_cache_list = g_list_append(cm_cache_list, cc); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
183 color_man_cache_ref(cc); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
184 } |
113 | 185 |
186 return cc; | |
187 } | |
188 | |
189 static void color_man_cache_free(ColorManCache *cc) | |
190 { | |
191 if (!cc) return; | |
192 | |
193 cm_cache_list = g_list_remove(cm_cache_list, cc); | |
194 color_man_cache_unref(cc); | |
195 } | |
196 | |
197 static void color_man_cache_reset(void) | |
198 { | |
199 while (cm_cache_list) | |
200 { | |
201 ColorManCache *cc; | |
202 | |
203 cc = cm_cache_list->data; | |
204 color_man_cache_free(cc); | |
205 } | |
206 } | |
207 | |
208 static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gchar *in_file, | |
209 ColorManProfileType out_type, const gchar *out_file, | |
210 gint has_alpha) | |
211 { | |
212 GList *work; | |
213 | |
214 work = cm_cache_list; | |
215 while (work) | |
216 { | |
217 ColorManCache *cc; | |
218 gint match = FALSE; | |
219 | |
220 cc = work->data; | |
221 work = work->next; | |
222 | |
223 if (cc->profile_in_type == in_type && | |
224 cc->profile_out_type == out_type && | |
225 cc->has_alpha == has_alpha) | |
226 { | |
227 match = TRUE; | |
228 } | |
229 | |
230 if (match && cc->profile_in_type == COLOR_PROFILE_FILE) | |
231 { | |
232 match = (cc->profile_in_file && in_file && | |
233 strcmp(cc->profile_in_file, in_file) == 0); | |
234 } | |
235 if (match && cc->profile_out_type == COLOR_PROFILE_FILE) | |
236 { | |
237 match = (cc->profile_out_file && out_file && | |
238 strcmp(cc->profile_out_file, out_file) == 0); | |
239 } | |
240 | |
241 if (match) return cc; | |
242 } | |
243 | |
244 return NULL; | |
245 } | |
246 | |
247 static ColorManCache *color_man_cache_get(ColorManProfileType in_type, const gchar *in_file, | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
248 unsigned char *in_data, guint in_data_len, |
113 | 249 ColorManProfileType out_type, const gchar *out_file, |
250 gint has_alpha) | |
251 { | |
252 ColorManCache *cc; | |
253 | |
254 cc = color_man_cache_find(in_type, in_file, out_type, out_file, has_alpha); | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
255 if (cc) |
113 | 256 { |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
257 color_man_cache_ref(cc); |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
258 return cc; |
113 | 259 } |
260 | |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
261 return color_man_cache_new(in_type, in_file, in_data, in_data_len, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
262 out_type, out_file, has_alpha); |
113 | 263 } |
264 | |
265 | |
266 /* | |
267 *------------------------------------------------------------------- | |
268 * color manager | |
269 *------------------------------------------------------------------- | |
270 */ | |
271 | |
272 static void color_man_done(ColorMan *cm, ColorManReturnType type) | |
273 { | |
274 if (cm->func_done) | |
275 { | |
276 cm->func_done(cm, type, cm->func_done_data); | |
277 } | |
278 } | |
279 | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
280 void color_man_correct_region(ColorMan *cm, GdkPixbuf *pixbuf, gint x, gint y, gint w, gint h) |
113 | 281 { |
282 ColorManCache *cc; | |
283 guchar *pix; | |
284 gint rs; | |
285 gint i; | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
286 gint pixbuf_width, pixbuf_height; |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
287 |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
288 |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
289 pixbuf_width = gdk_pixbuf_get_width(pixbuf); |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
290 pixbuf_height = gdk_pixbuf_get_height(pixbuf); |
113 | 291 |
292 cc = cm->profile; | |
293 | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
294 pix = gdk_pixbuf_get_pixels(pixbuf); |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
295 rs = gdk_pixbuf_get_rowstride(pixbuf); |
113 | 296 |
297 w = MIN(w, pixbuf_width - x); | |
298 h = MIN(h, pixbuf_height - y); | |
299 | |
300 pix += x * ((cc->has_alpha) ? 4 : 3); | |
301 for (i = 0; i < h; i++) | |
302 { | |
303 guchar *pbuf; | |
304 | |
305 pbuf = pix + ((y + i) * rs); | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
306 |
113 | 307 cmsDoTransform(cc->transform, pbuf, pbuf, w); |
308 } | |
309 | |
310 } | |
311 | |
312 static gint color_man_idle_cb(gpointer data) | |
313 { | |
314 ColorMan *cm = data; | |
315 gint width, height; | |
316 gint rh; | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
317 if (!cm->pixbuf) return FALSE; |
113 | 318 |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
319 if (cm->imd && |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
320 cm->pixbuf != image_get_pixbuf(cm->imd)) |
113 | 321 { |
322 cm->idle_id = -1; | |
323 color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED); | |
324 return FALSE; | |
325 } | |
326 | |
327 width = gdk_pixbuf_get_width(cm->pixbuf); | |
328 height = gdk_pixbuf_get_height(cm->pixbuf); | |
329 | |
330 if (cm->row > height) | |
331 { | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
332 if (!cm->incremental_sync && cm->imd) |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
333 { |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
334 image_area_changed(cm->imd, 0, 0, width, height); |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
335 } |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
336 |
113 | 337 cm->idle_id = -1; |
338 color_man_done(cm, COLOR_RETURN_SUCCESS); | |
339 return FALSE; | |
340 } | |
341 | |
342 rh = COLOR_MAN_CHUNK_SIZE / width + 1; | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
343 color_man_correct_region(cm, cm->pixbuf, 0, cm->row, width, rh); |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
344 if (cm->incremental_sync && cm->imd) image_area_changed(cm->imd, 0, cm->row, width, rh); |
113 | 345 cm->row += rh; |
346 | |
347 return TRUE; | |
348 } | |
349 | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
350 static ColorMan *color_man_new_real(ImageWindow *imd, GdkPixbuf *pixbuf, |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
351 ColorManProfileType input_type, const gchar *input_file, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
352 unsigned char *input_data, guint input_data_len, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
353 ColorManProfileType screen_type, const gchar *screen_file) |
113 | 354 { |
355 ColorMan *cm; | |
356 gint has_alpha; | |
357 | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
358 if (imd) pixbuf = image_get_pixbuf(imd); |
113 | 359 |
360 cm = g_new0(ColorMan, 1); | |
361 cm->imd = imd; | |
362 cm->pixbuf = pixbuf; | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
363 if (cm->pixbuf) g_object_ref(cm->pixbuf); |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
364 |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
365 cm->incremental_sync = FALSE; |
113 | 366 cm->row = 0; |
367 cm->idle_id = -1; | |
368 | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
369 has_alpha = pixbuf ? gdk_pixbuf_get_has_alpha(pixbuf) : FALSE; |
113 | 370 |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
371 cm->profile = color_man_cache_get(input_type, input_file, input_data, input_data_len, |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
372 screen_type, screen_file, has_alpha); |
113 | 373 if (!cm->profile) |
374 { | |
375 color_man_free(cm); | |
376 return NULL; | |
377 } | |
378 | |
379 return cm; | |
380 } | |
381 | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
382 ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf, |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
383 ColorManProfileType input_type, const gchar *input_file, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
384 ColorManProfileType screen_type, const gchar *screen_file) |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
385 { |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
386 return color_man_new_real(imd, pixbuf, |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
387 input_type, input_file, NULL, 0, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
388 screen_type, screen_file); |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
389 } |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
390 |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
391 void color_man_start_bg(ColorMan *cm, ColorManDoneFunc done_func, gpointer done_data) |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
392 { |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
393 cm->func_done = done_func; |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
394 cm->func_done_data = done_data; |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
395 cm->idle_id = g_idle_add(color_man_idle_cb, cm); |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
396 } |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
397 |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
398 ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf, |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
399 unsigned char *input_data, guint input_data_len, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
400 ColorManProfileType screen_type, const gchar *screen_file) |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
401 { |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
402 return color_man_new_real(imd, pixbuf, |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
403 COLOR_PROFILE_MEM, NULL, input_data, input_data_len, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
404 screen_type, screen_file); |
114
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
405 } |
50fc73e08550
Mon Nov 27 01:23:23 2006 John Ellis <johne@verizon.net>
gqview
parents:
113
diff
changeset
|
406 |
113 | 407 void color_man_free(ColorMan *cm) |
408 { | |
409 if (!cm) return; | |
410 | |
411 if (cm->idle_id != -1) g_source_remove(cm->idle_id); | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
412 if (cm->pixbuf) g_object_unref(cm->pixbuf); |
113 | 413 |
414 color_man_cache_unref(cm->profile); | |
415 | |
416 g_free(cm); | |
417 } | |
418 | |
419 void color_man_update(void) | |
420 { | |
421 color_man_cache_reset(); | |
422 } | |
423 | |
424 #else | |
425 /*** color support not enabled ***/ | |
426 | |
427 | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
428 ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf, |
113 | 429 ColorManProfileType input_type, const gchar *input_file, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
430 ColorManProfileType screen_type, const gchar *screen_file) |
113 | 431 { |
432 /* no op */ | |
433 return NULL; | |
434 } | |
435 | |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
436 ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf, |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
437 unsigned char *input_data, guint input_data_len, |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
438 ColorManProfileType screen_type, const gchar *screen_file) |
115
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
439 { |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
440 /* no op */ |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
441 return NULL; |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
442 } |
53b2bfdcff69
Tue Nov 28 11:54:30 2006 John Ellis <johne@verizon.net>
gqview
parents:
114
diff
changeset
|
443 |
113 | 444 void color_man_free(ColorMan *cm) |
445 { | |
446 /* no op */ | |
447 } | |
448 | |
449 void color_man_update(void) | |
450 { | |
451 /* no op */ | |
452 } | |
453 | |
398
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
454 void color_man_correct_region(ColorMan *cm, GdkPixbuf *pixbuf, gint x, gint y, gint w, gint h) |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
455 { |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
456 /* no op */ |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
457 } |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
458 |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
459 void color_man_start_bg(ColorMan *cm, ColorManDoneFunc done_func, gpointer done_data) |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
460 { |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
461 /* no op */ |
c4080362d619
image post-processing (rotation and color management) moved to
nadvornik
parents:
281
diff
changeset
|
462 } |
113 | 463 |
464 #endif | |
465 | |
466 |