gimp r24658 - in trunk: . app/gegl app/tools



Author: mitch
Date: Mon Jan 21 12:03:19 2008
New Revision: 24658
URL: http://svn.gnome.org/viewvc/gimp?rev=24658&view=rev

Log:
2008-01-21  Michael Natterer  <mitch gimp org>

	* app/gegl/gimplevelsconfig.[ch]: add utility function
	gimp_levels_config_to_levels_cruft() which fills the old Levels
	struct from a GimpLevelsConfig object.

	* app/tools/gimplevelstool.c: use it.



Modified:
   trunk/ChangeLog
   trunk/app/gegl/gimplevelsconfig.c
   trunk/app/gegl/gimplevelsconfig.h
   trunk/app/tools/gimplevelstool.c

Modified: trunk/app/gegl/gimplevelsconfig.c
==============================================================================
--- trunk/app/gegl/gimplevelsconfig.c	(original)
+++ trunk/app/gegl/gimplevelsconfig.c	Mon Jan 21 12:03:19 2008
@@ -30,6 +30,9 @@
 
 #include "base/gimphistogram.h"
 
+/*  temp cruft  */
+#include "base/levels.h"
+
 #include "gimplevelsconfig.h"
 
 
@@ -409,3 +412,37 @@
       config->gamma[channel] = log (inten) / log (out_light);
     }
 }
+
+
+/*  temp cruft  */
+
+void
+gimp_levels_config_to_levels_cruft (GimpLevelsConfig *config,
+                                    Levels           *cruft,
+                                    gboolean          is_color)
+{
+  GimpHistogramChannel channel;
+
+  g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
+  g_return_if_fail (cruft != NULL);
+
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
+    {
+      cruft->gamma[channel]       = config->gamma[channel];
+      cruft->low_input[channel]   = config->low_input[channel]   * 255.999;
+      cruft->high_input[channel]  = config->high_input[channel]  * 255.999;
+      cruft->low_output[channel]  = config->low_output[channel]  * 255.999;
+      cruft->high_output[channel] = config->high_output[channel] * 255.999;
+    }
+
+  if (! is_color)
+    {
+      cruft->gamma[1]       = cruft->gamma[GIMP_HISTOGRAM_ALPHA];
+      cruft->low_input[1]   = cruft->low_input[GIMP_HISTOGRAM_ALPHA];
+      cruft->high_input[1]  = cruft->high_input[GIMP_HISTOGRAM_ALPHA];
+      cruft->low_output[1]  = cruft->low_output[GIMP_HISTOGRAM_ALPHA];
+      cruft->high_output[1] = cruft->high_output[GIMP_HISTOGRAM_ALPHA];
+    }
+}

Modified: trunk/app/gegl/gimplevelsconfig.h
==============================================================================
--- trunk/app/gegl/gimplevelsconfig.h	(original)
+++ trunk/app/gegl/gimplevelsconfig.h	Mon Jan 21 12:03:19 2008
@@ -72,6 +72,10 @@
                                              const GimpRGB        *gray,
                                              const GimpRGB        *white);
 
+/*  temp cruft  */
+void    gimp_levels_config_to_levels_cruft  (GimpLevelsConfig     *config,
+                                             Levels               *cruft,
+                                             gboolean              is_color);
 
 
 #endif /* __GIMP_LEVELS_CONFIG_H__ */

Modified: trunk/app/tools/gimplevelstool.c
==============================================================================
--- trunk/app/tools/gimplevelstool.c	(original)
+++ trunk/app/tools/gimplevelstool.c	Mon Jan 21 12:03:19 2008
@@ -284,35 +284,13 @@
 static void
 gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpLevelsTool       *tool   = GIMP_LEVELS_TOOL (image_map_tool);
-  GimpLevelsConfig     *config = tool->config;
-  Levels               *levels = tool->levels;
-  GimpHistogramChannel  channel;
-
-  for (channel = GIMP_HISTOGRAM_VALUE;
-       channel <= GIMP_HISTOGRAM_ALPHA;
-       channel++)
-    {
-      levels->gamma[channel]       = config->gamma[channel];
-      levels->low_input[channel]   = config->low_input[channel]   * 255.999;
-      levels->high_input[channel]  = config->high_input[channel]  * 255.999;
-      levels->low_output[channel]  = config->low_output[channel]  * 255.999;
-      levels->high_output[channel] = config->high_output[channel] * 255.999;
-    }
-
-  /* FIXME: hack */
-  if (! tool->color)
-    {
-      levels->gamma[1]       = levels->gamma[GIMP_HISTOGRAM_ALPHA];
-      levels->low_input[1]   = levels->low_input[GIMP_HISTOGRAM_ALPHA];
-      levels->high_input[1]  = levels->high_input[GIMP_HISTOGRAM_ALPHA];
-      levels->low_output[1]  = levels->low_output[GIMP_HISTOGRAM_ALPHA];
-      levels->high_output[1] = levels->high_output[GIMP_HISTOGRAM_ALPHA];
-    }
+  GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
+
+  gimp_levels_config_to_levels_cruft (tool->config, tool->levels, tool->color);
 
   gimp_lut_setup (tool->lut,
                   (GimpLutFunc) levels_lut_func,
-                  levels,
+                  tool->levels,
                   gimp_drawable_bytes (image_map_tool->drawable));
 }
 
@@ -853,6 +831,7 @@
 levels_update_input_bar (GimpLevelsTool *tool)
 {
   /*  Recalculate the transfer arrays  */
+  gimp_levels_config_to_levels_cruft (tool->config, tool->levels, tool->color);
   levels_calculate_transfers (tool->levels);
 
   switch (tool->channel)



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