gimp r25642 - in trunk: . app app/core app/gegl app/tools app/widgets



Author: neo
Date: Sun May 11 14:56:57 2008
New Revision: 25642
URL: http://svn.gnome.org/viewvc/gimp?rev=25642&view=rev

Log:
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.



Added:
   trunk/app/core/gimpcurve-map.c
   trunk/app/core/gimpcurve-map.h
Modified:
   trunk/ChangeLog
   trunk/app/Makefile.am
   trunk/app/core/Makefile.am
   trunk/app/core/gimpcurve.c
   trunk/app/core/gimpcurve.h
   trunk/app/gegl/gimpoperationcurves.c
   trunk/app/tools/gimpcurvestool.c
   trunk/app/widgets/gimpcurveview.c

Modified: trunk/app/Makefile.am
==============================================================================
--- trunk/app/Makefile.am	(original)
+++ trunk/app/Makefile.am	Sun May 11 14:56:57 2008
@@ -95,6 +95,7 @@
 	-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) 

Modified: trunk/app/core/Makefile.am
==============================================================================
--- trunk/app/core/Makefile.am	(original)
+++ trunk/app/core/Makefile.am	Sun May 11 14:56:57 2008
@@ -93,6 +93,8 @@
 	gimpcurve.h				\
 	gimpcurve-load.c			\
 	gimpcurve-load.h			\
+	gimpcurve-map.c				\
+	gimpcurve-map.h				\
 	gimpcurve-save.c			\
 	gimpcurve-save.h			\
 	gimpdashpattern.c			\

Added: trunk/app/core/gimpcurve-map.c
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpcurve-map.c	Sun May 11 14:56:57 2008
@@ -0,0 +1,87 @@
+/* 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;
+    }
+}

Added: trunk/app/core/gimpcurve-map.h
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpcurve-map.h	Sun May 11 14:56:57 2008
@@ -0,0 +1,35 @@
+/* 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__ */

Modified: trunk/app/core/gimpcurve.c
==============================================================================
--- trunk/app/core/gimpcurve.c	(original)
+++ trunk/app/core/gimpcurve.c	Sun May 11 14:56:57 2008
@@ -660,64 +660,6 @@
   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,

Modified: trunk/app/core/gimpcurve.h
==============================================================================
--- trunk/app/core/gimpcurve.h	(original)
+++ trunk/app/core/gimpcurve.h	Sun May 11 14:56:57 2008
@@ -87,18 +87,6 @@
                                               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);

Modified: trunk/app/gegl/gimpoperationcurves.c
==============================================================================
--- trunk/app/gegl/gimpoperationcurves.c	(original)
+++ trunk/app/gegl/gimpoperationcurves.c	Sun May 11 14:56:57 2008
@@ -29,6 +29,7 @@
 #include "gegl-types.h"
 
 #include "core/gimpcurve.h"
+#include "core/gimpcurve-map.h"
 
 #include "gimpcurvesconfig.h"
 #include "gimpoperationcurves.h"

Modified: trunk/app/tools/gimpcurvestool.c
==============================================================================
--- trunk/app/tools/gimpcurvestool.c	(original)
+++ trunk/app/tools/gimpcurvestool.c	Sun May 11 14:56:57 2008
@@ -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"

Modified: trunk/app/widgets/gimpcurveview.c
==============================================================================
--- trunk/app/widgets/gimpcurveview.c	(original)
+++ trunk/app/widgets/gimpcurveview.c	Sun May 11 14:56:57 2008
@@ -28,6 +28,7 @@
 #include "widgets-types.h"
 
 #include "core/gimpcurve.h"
+#include "core/gimpcurve-map.h"
 #include "core/gimpmarshal.h"
 
 #include "gimpcurveview.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]