Commit a392a231 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

renamed gimp_curve_map() to gimp_curve_map_value(). Added new function

2008-05-11  Sven Neumann  <sven@gimp.org>

	* app/core/gimpcurve.[ch]: renamed gimp_curve_map() to
	gimp_curve_map_value(). Added new function 
gimp_curve_map_pixels()
	which will allow for better optimization.

	* app/gegl/gimpoperationcurves.c 
(gimp_operation_curves_process):
	use gimp_curve_map_pixels().

	* app/tools/gimpcurvestool.c
	* app/widgets/gimpcurveview.c: follow API change.


svn path=/trunk/; revision=25641
parent f5c4c35f
2008-05-11 Sven Neumann <sven@gimp.org>
* app/core/gimpcurve.[ch]: renamed gimp_curve_map() to
gimp_curve_map_value(). Added new function gimp_curve_map_pixels()
which will allow for better optimization.
* app/gegl/gimpoperationcurves.c (gimp_operation_curves_process):
use gimp_curve_map_pixels().
* app/tools/gimpcurvestool.c
* app/widgets/gimpcurveview.c: follow API change.
2008-05-11 Martin Nordholts <martinn@svn.gnome.org>
* app/tools/gimpcroptool.[ch]: No need to expose definitions of
......
......@@ -661,8 +661,8 @@ gimp_curve_set_curve (GimpCurve *curve,
}
gdouble
gimp_curve_map (GimpCurve *curve,
gdouble value)
gimp_curve_map_value (GimpCurve *curve,
gdouble value)
{
g_return_val_if_fail (GIMP_IS_CURVE (curve), 0.0);
......@@ -683,6 +683,41 @@ gimp_curve_map (GimpCurve *curve,
}
}
void
gimp_curve_map_pixels (GimpCurve *curve_all,
GimpCurve *curve_red,
GimpCurve *curve_green,
GimpCurve *curve_blue,
GimpCurve *curve_alpha,
gfloat *src,
gfloat *dest,
glong samples)
{
g_return_if_fail (GIMP_IS_CURVE (curve_all));
g_return_if_fail (GIMP_IS_CURVE (curve_red));
g_return_if_fail (GIMP_IS_CURVE (curve_green));
g_return_if_fail (GIMP_IS_CURVE (curve_blue));
g_return_if_fail (GIMP_IS_CURVE (curve_alpha));
while (samples--)
{
dest[0] = gimp_curve_map_value (curve_all,
gimp_curve_map_value (curve_red,
src[0]));
dest[1] = gimp_curve_map_value (curve_all,
gimp_curve_map_value (curve_green,
src[1]));
dest[2] = gimp_curve_map_value (curve_all,
gimp_curve_map_value (curve_blue,
src[2]));
/* don't apply the overall curve to the alpha channel */
dest[3] = gimp_curve_map_value (curve_alpha, src[3]);
src += 4;
dest += 4;
}
}
void
gimp_curve_get_uchar (GimpCurve *curve,
gint n_samples,
......
......@@ -87,8 +87,17 @@ void gimp_curve_set_curve (GimpCurve *curve,
gdouble x,
gdouble y);
gdouble gimp_curve_map (GimpCurve *curve,
gdouble gimp_curve_map_value (GimpCurve *curve,
gdouble value);
void gimp_curve_map_pixels (GimpCurve *curve_all,
GimpCurve *curve_red,
GimpCurve *curve_green,
GimpCurve *curve_blue,
GimpCurve *curve_alpha,
gfloat *src,
gfloat *dest,
glong samples);
void gimp_curve_get_uchar (GimpCurve *curve,
gint n_samples,
......
......@@ -91,26 +91,11 @@ gimp_operation_curves_process (GeglOperation *operation,
if (! config)
return FALSE;
while (samples--)
{
gint channel;
for (channel = 0; channel < 4; channel++)
{
gdouble value;
value = gimp_curve_map (config->curve[channel + 1], src[channel]);
/* don't apply the overall curve to the alpha channel */
if (channel != ALPHA_PIX)
value = gimp_curve_map (config->curve[0], value);
dest[channel] = value;
}
src += 4;
dest += 4;
}
gimp_curve_map_pixels (config->curve[0],
config->curve[1],
config->curve[2],
config->curve[3],
config->curve[4], src, dest, samples);
return TRUE;
}
......@@ -257,7 +257,7 @@ gimp_curves_tool_button_release (GimpTool *tool,
closest);
gimp_curve_set_point (curve, closest,
value, gimp_curve_map (curve, value));
value, gimp_curve_map_value (curve, value));
}
else if (state & GDK_CONTROL_MASK)
{
......@@ -275,7 +275,7 @@ gimp_curves_tool_button_release (GimpTool *tool,
closest);
gimp_curve_set_point (curve, closest,
value, gimp_curve_map (curve, value));
value, gimp_curve_map_value (curve, value));
}
}
......
......@@ -370,7 +370,7 @@ gimp_curve_view_expose (GtkWidget *widget,
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
x = 0.0;
y = 1.0 - gimp_curve_map (view->curve, 0.0);
y = 1.0 - gimp_curve_map_value (view->curve, 0.0);
cairo_move_to (cr,
border + (gdouble) width * x,
......@@ -379,7 +379,7 @@ gimp_curve_view_expose (GtkWidget *widget,
for (i = 1; i < 256; i++)
{
x = (gdouble) i / 255.0;
y = 1.0 - gimp_curve_map (view->curve, x);
y = 1.0 - gimp_curve_map_value (view->curve, x);
cairo_line_to (cr,
border + (gdouble) width * x,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment