Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
GIMP
Commits
32fb2d1f
Commit
32fb2d1f
authored
Feb 14, 1999
by
Tor Lillqvist
Browse files
Fix for the colour balance filter on systems with signed chars.
Added function rgb_to_l for use when we just need the luminosity.
parent
f12faae8
Changes
9
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
32fb2d1f
Sun Feb 14 22:16:16 1999 Tor Lillqvist <tml@iki.fi>
* app/paint_funcs.c app/paint_funcs.h : New function rgb_to_l for
when we only want the luminosity. (rgb_to_hls): Use "else if" for
case which can't be true if previous test succeeded.
* app/color_balance.c (struct _ColorBalanceDialog): use
lookup tables with unsigned values for the RGB components.
Sun Feb 14 23:27:57 CET 1999 Marc Lehmann <pcg@goof.com>
* docs/parasites.txt: Added some suggestions from Jay Cox.
...
...
app/base/color-balance.c
View file @
32fb2d1f
...
...
@@ -71,9 +71,9 @@ struct _ColorBalanceDialog
double
magenta_green
[
3
];
double
yellow_blue
[
3
];
char
r_lookup
[
255
];
char
g_lookup
[
255
];
char
b_lookup
[
255
];
gu
char
r_lookup
[
255
];
gu
char
g_lookup
[
255
];
gu
char
b_lookup
[
255
];
gint
preserve_luminosity
;
gint
preview
;
...
...
app/color_balance.c
View file @
32fb2d1f
...
...
@@ -71,9 +71,9 @@ struct _ColorBalanceDialog
double
magenta_green
[
3
];
double
yellow_blue
[
3
];
char
r_lookup
[
255
];
char
g_lookup
[
255
];
char
b_lookup
[
255
];
gu
char
r_lookup
[
255
];
gu
char
g_lookup
[
255
];
gu
char
b_lookup
[
255
];
gint
preserve_luminosity
;
gint
preview
;
...
...
app/paint-funcs/paint-funcs.c
View file @
32fb2d1f
...
...
@@ -5327,7 +5327,7 @@ rgb_to_hls (int *r,
if
(
h
<
0
)
h
+=
255
;
if
(
h
>
255
)
else
if
(
h
>
255
)
h
-=
255
;
}
...
...
@@ -5337,6 +5337,45 @@ rgb_to_hls (int *r,
}
/* Just compute the luminosity component. */
int
rgb_to_l
(
int
red
,
int
green
,
int
blue
)
{
float
h
,
l
,
s
;
int
min
,
max
;
int
delta
;
if
(
red
>
green
)
{
if
(
red
>
blue
)
max
=
red
;
else
max
=
blue
;
if
(
green
<
blue
)
min
=
green
;
else
min
=
blue
;
}
else
{
if
(
green
>
blue
)
max
=
green
;
else
max
=
blue
;
if
(
red
<
blue
)
min
=
red
;
else
min
=
blue
;
}
return
(
max
+
min
)
/
2
.
0
;
}
static
int
hls_value
(
float
n1
,
float
n2
,
...
...
app/paint-funcs/paint-funcs.h
View file @
32fb2d1f
...
...
@@ -571,6 +571,7 @@ void combine_regions_replace (PixelRegion *, PixelRegion *,
void
rgb_to_hsv
(
int
*
,
int
*
,
int
*
);
void
hsv_to_rgb
(
int
*
,
int
*
,
int
*
);
void
rgb_to_hls
(
int
*
,
int
*
,
int
*
);
int
rgb_to_l
(
int
,
int
,
int
);
void
hls_to_rgb
(
int
*
,
int
*
,
int
*
);
/* Opacities */
...
...
app/paint_funcs.c
View file @
32fb2d1f
...
...
@@ -5327,7 +5327,7 @@ rgb_to_hls (int *r,
if
(
h
<
0
)
h
+=
255
;
if
(
h
>
255
)
else
if
(
h
>
255
)
h
-=
255
;
}
...
...
@@ -5337,6 +5337,45 @@ rgb_to_hls (int *r,
}
/* Just compute the luminosity component. */
int
rgb_to_l
(
int
red
,
int
green
,
int
blue
)
{
float
h
,
l
,
s
;
int
min
,
max
;
int
delta
;
if
(
red
>
green
)
{
if
(
red
>
blue
)
max
=
red
;
else
max
=
blue
;
if
(
green
<
blue
)
min
=
green
;
else
min
=
blue
;
}
else
{
if
(
green
>
blue
)
max
=
green
;
else
max
=
blue
;
if
(
red
<
blue
)
min
=
red
;
else
min
=
blue
;
}
return
(
max
+
min
)
/
2
.
0
;
}
static
int
hls_value
(
float
n1
,
float
n2
,
...
...
app/paint_funcs.h
View file @
32fb2d1f
...
...
@@ -571,6 +571,7 @@ void combine_regions_replace (PixelRegion *, PixelRegion *,
void
rgb_to_hsv
(
int
*
,
int
*
,
int
*
);
void
hsv_to_rgb
(
int
*
,
int
*
,
int
*
);
void
rgb_to_hls
(
int
*
,
int
*
,
int
*
);
int
rgb_to_l
(
int
,
int
,
int
);
void
hls_to_rgb
(
int
*
,
int
*
,
int
*
);
/* Opacities */
...
...
app/tools/color_balance.c
View file @
32fb2d1f
...
...
@@ -71,9 +71,9 @@ struct _ColorBalanceDialog
double
magenta_green
[
3
];
double
yellow_blue
[
3
];
char
r_lookup
[
255
];
char
g_lookup
[
255
];
char
b_lookup
[
255
];
gu
char
r_lookup
[
255
];
gu
char
g_lookup
[
255
];
gu
char
b_lookup
[
255
];
gint
preserve_luminosity
;
gint
preview
;
...
...
app/tools/gimpcolorbalancetool.c
View file @
32fb2d1f
...
...
@@ -71,9 +71,9 @@ struct _ColorBalanceDialog
double
magenta_green
[
3
];
double
yellow_blue
[
3
];
char
r_lookup
[
255
];
char
g_lookup
[
255
];
char
b_lookup
[
255
];
gu
char
r_lookup
[
255
];
gu
char
g_lookup
[
255
];
gu
char
b_lookup
[
255
];
gint
preserve_luminosity
;
gint
preview
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment