gimp r24588 - in trunk: . app/tools



Author: mitch
Date: Thu Jan 10 13:12:44 2008
New Revision: 24588
URL: http://svn.gnome.org/viewvc/gimp?rev=24588&view=rev

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

	Simplify things a bit and enable gegl-only color correction
	tools (without legacy functions).

	* app/tools/gimpimagemaptool.c (gimp_image_map_tool_create_map):
	always create the operation if ::get_operation() is implemented
	and always use it when creating the GimpImageMap if there is no
	legacy apply_func.

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimpthresholdtool.c (map): set the operation's
	properties unconditionally since it always exists now if we also
	implement ::get_operation().



Modified:
   trunk/ChangeLog
   trunk/app/tools/gimpbrightnesscontrasttool.c
   trunk/app/tools/gimpcolorbalancetool.c
   trunk/app/tools/gimpcolorizetool.c
   trunk/app/tools/gimpimagemaptool.c
   trunk/app/tools/gimplevelstool.c
   trunk/app/tools/gimpposterizetool.c
   trunk/app/tools/gimpthresholdtool.c

Modified: trunk/app/tools/gimpbrightnesscontrasttool.c
==============================================================================
--- trunk/app/tools/gimpbrightnesscontrasttool.c	(original)
+++ trunk/app/tools/gimpbrightnesscontrasttool.c	Thu Jan 10 13:12:44 2008
@@ -196,22 +196,18 @@
 gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
 {
   GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
+  gdouble                     brightness;
+  gdouble                     contrast;
 
-  if (im_tool->operation)
-    {
-      gdouble brightness;
-      gdouble contrast;
-
-      brightness = bc_tool->brightness / 256.0;
-      contrast   = (bc_tool->contrast < 0 ?
-                    (bc_tool->contrast + 127.0) / 127.0 :
-                    bc_tool->contrast * 4.0 / 127.0 + 1);
-
-      gegl_node_set (im_tool->operation,
-                     "brightness", brightness,
-                     "contrast",   contrast,
-                     NULL);
-    }
+  brightness = bc_tool->brightness / 256.0;
+  contrast   = (bc_tool->contrast < 0 ?
+                (bc_tool->contrast + 127.0) / 127.0 :
+                bc_tool->contrast * 4.0 / 127.0 + 1);
+
+  gegl_node_set (im_tool->operation,
+                 "brightness", brightness,
+                 "contrast",   contrast,
+                 NULL);
 
   brightness_contrast_lut_setup (bc_tool->lut,
                                  bc_tool->brightness / 255.0,

Modified: trunk/app/tools/gimpcolorbalancetool.c
==============================================================================
--- trunk/app/tools/gimpcolorbalancetool.c	(original)
+++ trunk/app/tools/gimpcolorbalancetool.c	Thu Jan 10 13:12:44 2008
@@ -177,30 +177,26 @@
 gimp_color_balance_tool_map (GimpImageMapTool *image_map_tool)
 {
   GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (image_map_tool);
+  ColorBalance         *cb      = cb_tool->color_balance;
+  GimpTransferMode      range;
 
-  if (image_map_tool->operation)
+  for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
     {
-      ColorBalance     *cb = cb_tool->color_balance;
-      GimpTransferMode  range;
-
-      for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
-        {
-          gegl_node_set (image_map_tool->operation,
-                         "range", range,
-                         NULL);
-
-          gegl_node_set (image_map_tool->operation,
-                         "cyan-red",      cb->cyan_red[range]      / 256.0,
-                         "magenta-green", cb->magenta_green[range] / 256.0,
-                         "yellow-blue",   cb->yellow_blue[range]   / 256.0,
-                         NULL);
-        }
+      gegl_node_set (image_map_tool->operation,
+                     "range", range,
+                     NULL);
 
       gegl_node_set (image_map_tool->operation,
-                     "preserve-luminosity", cb->preserve_luminosity,
+                     "cyan-red",      cb->cyan_red[range]      / 256.0,
+                     "magenta-green", cb->magenta_green[range] / 256.0,
+                     "yellow-blue",   cb->yellow_blue[range]   / 256.0,
                      NULL);
     }
 
+  gegl_node_set (image_map_tool->operation,
+                 "preserve-luminosity", cb->preserve_luminosity,
+                 NULL);
+
   color_balance_create_lookup_tables (cb_tool->color_balance);
 }
 

Modified: trunk/app/tools/gimpcolorizetool.c
==============================================================================
--- trunk/app/tools/gimpcolorizetool.c	(original)
+++ trunk/app/tools/gimpcolorizetool.c	Thu Jan 10 13:12:44 2008
@@ -171,14 +171,11 @@
 {
   GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
 
-  if (image_map_tool->operation)
-    {
-      gegl_node_set (image_map_tool->operation,
-                     "hue",        col_tool->colorize->hue,
-                     "saturation", col_tool->colorize->saturation,
-                     "lightness",  col_tool->colorize->lightness,
-                     NULL);
-    }
+  gegl_node_set (image_map_tool->operation,
+                 "hue",        col_tool->colorize->hue,
+                 "saturation", col_tool->colorize->saturation,
+                 "lightness",  col_tool->colorize->lightness,
+                 NULL);
 
   colorize_calculate (col_tool->colorize);
 }

Modified: trunk/app/tools/gimpimagemaptool.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool.c	(original)
+++ trunk/app/tools/gimpimagemaptool.c	Thu Jan 10 13:12:44 2008
@@ -468,6 +468,7 @@
 gimp_image_map_tool_create_map (GimpImageMapTool *tool)
 {
   GimpCoreConfig *config = GIMP_TOOL (tool)->tool_info->gimp->config;
+  gboolean        use_gegl;
 
   if (tool->image_map)
     {
@@ -475,14 +476,16 @@
       g_object_unref (tool->image_map);
     }
 
-  if (config->use_gegl && ! tool->operation &&
-      GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation)
+  if (GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation)
     tool->operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool);
 
+  g_assert (tool->operation || tool->apply_func);
+
+  use_gegl = (config->use_gegl || ! tool->apply_func);
+
   tool->image_map = gimp_image_map_new (tool->drawable,
                                         GIMP_TOOL (tool)->tool_info->blurb,
-                                        config->use_gegl ?
-                                        tool->operation : NULL,
+                                        use_gegl ? tool->operation : NULL,
                                         tool->apply_func,
                                         tool->apply_data);
 

Modified: trunk/app/tools/gimplevelstool.c
==============================================================================
--- trunk/app/tools/gimplevelstool.c	(original)
+++ trunk/app/tools/gimplevelstool.c	Thu Jan 10 13:12:44 2008
@@ -269,39 +269,34 @@
 static void
 gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
 {
-  GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
+  GimpLevelsTool       *tool = GIMP_LEVELS_TOOL (image_map_tool);
+  GimpHistogramChannel  channel;
 
-  if (image_map_tool->operation)
+  for (channel = GIMP_HISTOGRAM_VALUE;
+       channel <= GIMP_HISTOGRAM_ALPHA;
+       channel++)
     {
-      Levels               *levels = tool->levels;
-      GimpHistogramChannel  channel;
-
-      for (channel = GIMP_HISTOGRAM_VALUE;
-           channel <= GIMP_HISTOGRAM_ALPHA;
-           channel++)
-        {
-          /* FIXME: hack */
-          if (! tool->color && channel == 1)
-            gegl_node_set (image_map_tool->operation,
-                           "channel", GIMP_HISTOGRAM_ALPHA,
-                           NULL);
-          else
-            gegl_node_set (image_map_tool->operation,
-                           "channel", channel,
-                           NULL);
-
-          gegl_node_set (image_map_tool->operation,
-                         "gamma",       levels->gamma[channel],
-                         "low-input",   levels->low_input[channel]   / 255.0,
-                         "high-input",  levels->high_input[channel]  / 255.0,
-                         "low-output",  levels->low_output[channel]  / 255.0,
-                         "high-output", levels->high_output[channel] / 255.0,
-                         NULL);
+      /* FIXME: hack */
+      if (! tool->color && channel == 1)
+        gegl_node_set (image_map_tool->operation,
+                       "channel", GIMP_HISTOGRAM_ALPHA,
+                       NULL);
+      else
+        gegl_node_set (image_map_tool->operation,
+                       "channel", channel,
+                       NULL);
+
+      gegl_node_set (image_map_tool->operation,
+                     "gamma",       tool->levels->gamma[channel],
+                     "low-input",   tool->levels->low_input[channel]   / 255.0,
+                     "high-input",  tool->levels->high_input[channel]  / 255.0,
+                     "low-output",  tool->levels->low_output[channel]  / 255.0,
+                     "high-output", tool->levels->high_output[channel] / 255.0,
+                     NULL);
 
-          /* FIXME: hack */
-          if (! tool->color && channel == 1)
-            break;
-        }
+      /* FIXME: hack */
+      if (! tool->color && channel == 1)
+        break;
     }
 
   gimp_lut_setup (tool->lut,

Modified: trunk/app/tools/gimpposterizetool.c
==============================================================================
--- trunk/app/tools/gimpposterizetool.c	(original)
+++ trunk/app/tools/gimpposterizetool.c	Thu Jan 10 13:12:44 2008
@@ -174,12 +174,9 @@
 {
   GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (image_map_tool);
 
-  if (image_map_tool->operation)
-    {
-      gegl_node_set (image_map_tool->operation,
-                     "levels", posterize_tool->levels,
-                     NULL);
-    }
+  gegl_node_set (image_map_tool->operation,
+                 "levels", posterize_tool->levels,
+                 NULL);
 
   posterize_lut_setup (posterize_tool->lut,
                        posterize_tool->levels,

Modified: trunk/app/tools/gimpthresholdtool.c
==============================================================================
--- trunk/app/tools/gimpthresholdtool.c	(original)
+++ trunk/app/tools/gimpthresholdtool.c	Thu Jan 10 13:12:44 2008
@@ -198,13 +198,10 @@
 {
   GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
 
-  if (image_map_tool->operation)
-    {
-      gegl_node_set (image_map_tool->operation,
-                     "low",  t_tool->threshold->low_threshold  / 255.0,
-                     "high", t_tool->threshold->high_threshold / 255.0,
-                     NULL);
-    }
+  gegl_node_set (image_map_tool->operation,
+                 "low",  t_tool->threshold->low_threshold  / 255.0,
+                 "high", t_tool->threshold->high_threshold / 255.0,
+                 NULL);
 }
 
 



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