1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
$NetBSD: patch-ae,v 1.1 2005/03/16 18:32:50 rillig Exp $
gcc-2.95.3 cannot handle declarations intermixed with code.
--- app/color_correction.c.orig Tue Nov 23 12:58:15 2004
+++ app/color_correction.c Wed Mar 16 18:13:56 2005
@@ -103,16 +103,19 @@ color_correction_free_transfer_LUTs (voi
void
color_correction_init_lab_transforms (GImage *image)
{ CMSProfile *image_profile = gimage_get_cms_profile(image);
+ CMSProfile *lab_profile;
+ GSList *profiles = NULL;
+ Tag t;
+ DWORD lcms_format;
if (!image_profile)
{ image_profile = cms_get_srgb_profile();
}
- CMSProfile *lab_profile = cms_get_lab_profile(NULL);
- GSList *profiles = NULL;
+ lab_profile = cms_get_lab_profile(NULL);
profiles = g_slist_append(profiles, image_profile);
profiles = g_slist_append(profiles, lab_profile);
- Tag t = canvas_tag(drawable_data(gimage_active_drawable(image)));
- DWORD lcms_format = cms_get_lcms_format(t, image_profile);
+ t = canvas_tag(drawable_data(gimage_active_drawable(image)));
+ lcms_format = cms_get_lcms_format(t, image_profile);
color_correction_to_lab_transform = cms_get_transform(profiles, lcms_format, TYPE_Lab_16, INTENT_PERCEPTUAL, 0);
profiles = g_slist_remove(profiles, image_profile);
@@ -141,6 +144,13 @@ color_correction (PixelArea *src_area,
/* r,g,b values of the colour we are interpolating with, sat and lightness */
gfloat rgb[3][3];
int i=0;
+ gint width, height, num_channels, row_overhead;
+ gboolean has_alpha;
+ guint16 Lab[3],new_Lab[3];
+ gint16 new_col[3];
+ /* buffers to hold a colour value in float, used with HLS */
+ float fcol[3], fnew_col[3];
+ guint8 *s, *d;
/* get the fully saturated colour of given hue in rgb
this is the colour we are moving towards/interpolating with */
@@ -155,21 +165,17 @@ color_correction (PixelArea *src_area,
i++;
}
- gint width = pixelarea_width(src_area);
- gint height = pixelarea_height(src_area);
- gint num_channels = tag_num_channels(pixelarea_tag(src_area));
+ width = pixelarea_width(src_area);
+ height = pixelarea_height(src_area);
+ num_channels = tag_num_channels(pixelarea_tag(src_area));
/* overhead is in pixels */
- gint row_overhead = pixelarea_rowstride(src_area)/pixelarea_bytes(src_area) - width;
- gboolean has_alpha = tag_alpha(pixelarea_tag(src_area)) == ALPHA_YES ? TRUE : FALSE;
+ row_overhead = pixelarea_rowstride(src_area)/pixelarea_bytes(src_area) - width;
+ has_alpha = tag_alpha(pixelarea_tag(src_area)) == ALPHA_YES ? TRUE : FALSE;
/* buffers to hold a Lab colour value, used with Lab */
- guint16 Lab[3],new_Lab[3];
- gint16 new_col[3];
- /* buffers to hold a colour value in float, used with HLS */
- float fcol[3], fnew_col[3];
- guint8 *s = (guint8 *)pixelarea_data(src_area);
- guint8 *d = (guint8 *)pixelarea_data(dest_area);
+ s = (guint8 *)pixelarea_data(src_area);
+ d = (guint8 *)pixelarea_data(dest_area);
while (height--)
{
while (width--) {
|