Commit 6e6a0355 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/core/Makefile.am

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

	* app/core/Makefile.am
	* app/core/gimpcurve.[ch]:
	* app/core/gimpcurve-map.[ch]: split curve map functions into
	seperate files.

	* app/gegl/gimpoperationcurves.c
	* app/tools/gimpcurvestool.c
	* app/widgets/gimpcurveview.c: changed accordingly.

	* app/Makefile.am (AM_LDFLAGS): make it link.


svn path=/trunk/; revision=25642
parent a392a231
2008-05-11 Sven Neumann <sven@gimp.org>
* app/core/Makefile.am
* app/core/gimpcurve.[ch]:
* app/core/gimpcurve-map.[ch]: split curve map functions into
seperate files.
* app/gegl/gimpoperationcurves.c
* app/tools/gimpcurvestool.c
* app/widgets/gimpcurveview.c: changed accordingly.
* app/Makefile.am (AM_LDFLAGS): make it link.
2008-05-11 Sven Neumann <sven@gimp.org>
* app/core/gimpcurve.[ch]: renamed gimp_curve_map() to
......
......@@ -95,6 +95,7 @@ AM_LDFLAGS = $(munix) \
-u $(SYMPREFIX)xcf_init \
-u $(SYMPREFIX)internal_procs_init \
-u $(SYMPREFIX)gimp_coords_mix \
-u $(SYMPREFIX)gimp_curve_map_pixels \
-u $(SYMPREFIX)gimp_plug_in_manager_restore
gimp_2_5_LDFLAGS = $(AM_LDFLAGS) $(mwindows)
......
......@@ -93,6 +93,8 @@ libappcore_a_sources = \
gimpcurve.h \
gimpcurve-load.c \
gimpcurve-load.h \
gimpcurve-map.c \
gimpcurve-map.h \
gimpcurve-save.c \
gimpcurve-save.h \
gimpdashpattern.c \
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpmath/gimpmath.h"
#include "core-types.h"
#include "gimpcurve.h"
#include "gimpcurve-map.h"
gdouble
gimp_curve_map_value (GimpCurve *curve,
gdouble value)
{
g_return_val_if_fail (GIMP_IS_CURVE (curve), 0.0);
if (value < 0.0)
{
return curve->samples[0];
}
else if (value >= 1.0)
{
return curve->samples[curve->n_samples - 1];
}
else /* interpolate the curve */
{
gint index = floor (value * (gdouble) (curve->n_samples - 1));
gdouble f = value * (gdouble) (curve->n_samples - 1) - index;
return (1.0 - f) * curve->samples[index] + f * curve->samples[index + 1];
}
}
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;
}
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_CURVE_MAP_H__
#define __GIMP_CURVE_MAP_H__
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);
#endif /* __GIMP_CURVE_MAP_H__ */
......@@ -660,64 +660,6 @@ gimp_curve_set_curve (GimpCurve *curve,
gimp_data_dirty (GIMP_DATA (curve));
}
gdouble
gimp_curve_map_value (GimpCurve *curve,
gdouble value)
{
g_return_val_if_fail (GIMP_IS_CURVE (curve), 0.0);
if (value < 0.0)
{
return curve->samples[0];
}
else if (value >= 1.0)
{
return curve->samples[curve->n_samples - 1];
}
else /* interpolate the curve */
{
gint index = floor (value * (gdouble) (curve->n_samples - 1));
gdouble f = value * (gdouble) (curve->n_samples - 1) - index;
return (1.0 - f) * curve->samples[index] + f * curve->samples[index + 1];
}
}
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,18 +87,6 @@ void gimp_curve_set_curve (GimpCurve *curve,
gdouble x,
gdouble y);
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,
guchar *samples);
......
......@@ -29,6 +29,7 @@
#include "gegl-types.h"
#include "core/gimpcurve.h"
#include "core/gimpcurve-map.h"
#include "gimpcurvesconfig.h"
#include "gimpoperationcurves.h"
......
......@@ -36,6 +36,7 @@
#include "core/gimp.h"
#include "core/gimpcurve.h"
#include "core/gimpcurve-map.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimpimage.h"
......
......@@ -28,6 +28,7 @@
#include "widgets-types.h"
#include "core/gimpcurve.h"
#include "core/gimpcurve-map.h"
#include "core/gimpmarshal.h"
#include "gimpcurveview.h"
......
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