gimp r25747 - in trunk: . app/core



Author: neo
Date: Thu May 22 06:04:01 2008
New Revision: 25747
URL: http://svn.gnome.org/viewvc/gimp?rev=25747&view=rev

Log:
2008-05-22  Sven Neumann  <sven gimp org>

	* core/gimpdrawable-brightness-contrast.c
	* core/gimpdrawable-color-balance.c
	* core/gimpdrawable-colorize.c
	* core/gimpdrawable-equalize.c
	* core/gimpdrawable-hue-saturation.c
	* core/gimpdrawable-posterize.c
	* core/gimpdrawable-threshold.c: ported to 
gimp_drawable_process().



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpdrawable-brightness-contrast.c
   trunk/app/core/gimpdrawable-color-balance.c
   trunk/app/core/gimpdrawable-colorize.c
   trunk/app/core/gimpdrawable-equalize.c
   trunk/app/core/gimpdrawable-hue-saturation.c
   trunk/app/core/gimpdrawable-posterize.c
   trunk/app/core/gimpdrawable-threshold.c

Modified: trunk/app/core/gimpdrawable-brightness-contrast.c
==============================================================================
--- trunk/app/core/gimpdrawable-brightness-contrast.c	(original)
+++ trunk/app/core/gimpdrawable-brightness-contrast.c	Thu May 22 06:04:01 2008
@@ -24,8 +24,6 @@
 
 #include "base/gimplut.h"
 #include "base/lut-funcs.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 
 #include "gegl/gimpbrightnesscontrastconfig.h"
 
@@ -36,7 +34,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-brightness-contrast.h"
 #include "gimpdrawable-operation.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -76,35 +74,16 @@
     }
   else
     {
-      gint x, y, width, height;
+      GimpLut *lut;
 
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          GimpLut     *lut;
-          PixelRegion  srcPR, destPR;
-
-          lut = brightness_contrast_lut_new (config->brightness / 2.0,
-                                             config->contrast,
-                                             gimp_drawable_bytes (drawable));
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc)
-                                          gimp_lut_process,
-                                          lut, 2, &srcPR, &destPR);
-
-          gimp_lut_free (lut);
-
-          gimp_drawable_merge_shadow_tiles (drawable, TRUE,
-                                            _("Brightness-Contrast"));
-          gimp_drawable_free_shadow_tiles (drawable);
+      lut = brightness_contrast_lut_new (config->brightness / 2.0,
+                                         config->contrast,
+                                         gimp_drawable_bytes (drawable));
 
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
+      gimp_drawable_process (drawable, progress, _("Brightness-Contrast"),
+                             (PixelProcessorFunc) gimp_lut_process, lut);
+
+      gimp_lut_free (lut);
     }
 
   g_object_unref (config);

Modified: trunk/app/core/gimpdrawable-color-balance.c
==============================================================================
--- trunk/app/core/gimpdrawable-color-balance.c	(original)
+++ trunk/app/core/gimpdrawable-color-balance.c	Thu May 22 06:04:01 2008
@@ -23,8 +23,6 @@
 #include "core-types.h"
 
 #include "base/color-balance.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 
 #include "gegl/gimpcolorbalanceconfig.h"
 
@@ -35,7 +33,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-color-balance.h"
 #include "gimpdrawable-operation.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -86,29 +84,12 @@
     }
   else
     {
-      gint x, y, width, height;
+      ColorBalance cruft;
 
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          ColorBalance cruft;
-          PixelRegion  srcPR, destPR;
+      gimp_color_balance_config_to_cruft (config, &cruft);
 
-          gimp_color_balance_config_to_cruft (config, &cruft);
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
-                                          &cruft, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Color Balance"));
-          gimp_drawable_free_shadow_tiles (drawable);
-
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
+      gimp_drawable_process (drawable, progress, _("Color Balance"),
+                             (PixelProcessorFunc) color_balance, &cruft);
     }
 
   g_object_unref (config);

Modified: trunk/app/core/gimpdrawable-colorize.c
==============================================================================
--- trunk/app/core/gimpdrawable-colorize.c	(original)
+++ trunk/app/core/gimpdrawable-colorize.c	Thu May 22 06:04:01 2008
@@ -23,8 +23,6 @@
 #include "core-types.h"
 
 #include "base/colorize.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 
 #include "gegl/gimpcolorizeconfig.h"
 
@@ -35,7 +33,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-operation.h"
 #include "gimpdrawable-colorize.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -79,29 +77,12 @@
     }
   else
     {
-      gint x, y, width, height;
+      Colorize cruft;
 
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          Colorize    cruft;
-          PixelRegion srcPR, destPR;
+      gimp_colorize_config_to_cruft (config, &cruft);
 
-          gimp_colorize_config_to_cruft (config, &cruft);
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
-                                          &cruft, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Colorize"));
-          gimp_drawable_free_shadow_tiles (drawable);
-
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
+      gimp_drawable_process (drawable, progress, _("Colorize"),
+                             (PixelProcessorFunc) colorize, &cruft);
     }
 
   g_object_unref (config);

Modified: trunk/app/core/gimpdrawable-equalize.c
==============================================================================
--- trunk/app/core/gimpdrawable-equalize.c	(original)
+++ trunk/app/core/gimpdrawable-equalize.c	Thu May 22 06:04:01 2008
@@ -25,15 +25,11 @@
 #include "base/gimphistogram.h"
 #include "base/gimplut.h"
 #include "base/lut-funcs.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 
-#include "gimp.h"
 #include "gimpdrawable.h"
 #include "gimpdrawable-equalize.h"
 #include "gimpdrawable-histogram.h"
-#include "gimpdrawable-shadow.h"
-#include "gimpimage.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -42,41 +38,20 @@
 gimp_drawable_equalize (GimpDrawable *drawable,
                         gboolean      mask_only)
 {
-  PixelRegion    srcPR, destPR;
-  gint           bytes;
-  gint           x, y, width, height;
   GimpHistogram *hist;
   GimpLut       *lut;
-  GimpImage     *image;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
 
-  image = gimp_item_get_image (GIMP_ITEM (drawable));
-  bytes  = gimp_drawable_bytes (drawable);
-
-  if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-    return;
-
   hist = gimp_histogram_new ();
   gimp_drawable_calculate_histogram (drawable, hist);
 
-  lut = equalize_lut_new (hist, bytes);
-
-  /*  Apply the histogram  */
-  pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                     x, y, width, height, FALSE);
-  pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                     x, y, width, height, TRUE);
-
-  pixel_regions_process_parallel ((PixelProcessorFunc) gimp_lut_process,
-                                  lut, 2, &srcPR, &destPR);
-
-  gimp_lut_free (lut);
+  lut = equalize_lut_new (hist, gimp_drawable_bytes (drawable));
   gimp_histogram_unref (hist);
 
-  gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Equalize"));
-  gimp_drawable_free_shadow_tiles (drawable);
+  gimp_drawable_process (drawable, NULL, _("Equalize"),
+                         (PixelProcessorFunc) gimp_lut_process, lut);
 
-  gimp_drawable_update (drawable, x, y, width, height);
+  gimp_lut_free (lut);
 }

Modified: trunk/app/core/gimpdrawable-hue-saturation.c
==============================================================================
--- trunk/app/core/gimpdrawable-hue-saturation.c	(original)
+++ trunk/app/core/gimpdrawable-hue-saturation.c	Thu May 22 06:04:01 2008
@@ -23,8 +23,6 @@
 #include "core-types.h"
 
 #include "base/hue-saturation.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 
 #include "gegl/gimphuesaturationconfig.h"
 
@@ -35,7 +33,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-hue-saturation.h"
 #include "gimpdrawable-operation.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -84,30 +82,12 @@
     }
   else
     {
-      gint x, y, width, height;
+      HueSaturation cruft;
 
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          HueSaturation cruft;
-          PixelRegion   srcPR, destPR;
-
-          gimp_hue_saturation_config_to_cruft (config, &cruft);
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
-                                          &cruft, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow_tiles (drawable, TRUE,
-                                            _("Hue_Saturation"));
-          gimp_drawable_free_shadow_tiles (drawable);
+      gimp_hue_saturation_config_to_cruft (config, &cruft);
 
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
+      gimp_drawable_process (drawable, progress, _("Hue_Saturation"),
+                             (PixelProcessorFunc) hue_saturation, &cruft);
     }
 
   g_object_unref (config);

Modified: trunk/app/core/gimpdrawable-posterize.c
==============================================================================
--- trunk/app/core/gimpdrawable-posterize.c	(original)
+++ trunk/app/core/gimpdrawable-posterize.c	Thu May 22 06:04:01 2008
@@ -24,8 +24,6 @@
 
 #include "base/gimplut.h"
 #include "base/lut-funcs.h"
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 
 #include "gegl/gimpposterizeconfig.h"
 
@@ -36,7 +34,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-operation.h"
 #include "gimpdrawable-posterize.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -76,32 +74,14 @@
     }
   else
     {
-      gint x, y, width, height;
+      GimpLut *lut;
 
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          GimpLut     *lut;
-          PixelRegion  srcPR, destPR;
+      lut = posterize_lut_new (config->levels, gimp_drawable_bytes (drawable));
 
-          lut = posterize_lut_new (config->levels,
-                                   gimp_drawable_bytes (drawable));
+      gimp_drawable_process (drawable, progress, _("Posterize"),
+                             (PixelProcessorFunc) gimp_lut_process, lut);
 
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
-
-          pixel_regions_process_parallel ((PixelProcessorFunc) gimp_lut_process,
-                                          lut, 2, &srcPR, &destPR);
-
-          gimp_lut_free (lut);
-
-          gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Posterize"));
-          gimp_drawable_free_shadow_tiles (drawable);
-
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
+      gimp_lut_free (lut);
     }
 
   g_object_unref (config);

Modified: trunk/app/core/gimpdrawable-threshold.c
==============================================================================
--- trunk/app/core/gimpdrawable-threshold.c	(original)
+++ trunk/app/core/gimpdrawable-threshold.c	Thu May 22 06:04:01 2008
@@ -22,8 +22,6 @@
 
 #include "core-types.h"
 
-#include "base/pixel-processor.h"
-#include "base/pixel-region.h"
 #include "base/threshold.h"
 
 #include "gegl/gimpthresholdconfig.h"
@@ -35,7 +33,7 @@
 #include "gimpdrawable.h"
 #include "gimpdrawable-operation.h"
 #include "gimpdrawable-threshold.h"
-#include "gimpdrawable-shadow.h"
+#include "gimpdrawable-process.h"
 
 #include "gimp-intl.h"
 
@@ -77,30 +75,13 @@
     }
   else
     {
-      gint x, y, width, height;
+      Threshold cruft;
 
-      /* The application should occur only within selection bounds */
-      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-        {
-          Threshold   cruft;
-          PixelRegion srcPR, destPR;
-
-          gimp_threshold_config_to_cruft (config, &cruft,
-                                          gimp_drawable_is_rgb (drawable));
-
-          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                             x, y, width, height, FALSE);
-          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
-                             x, y, width, height, TRUE);
+      gimp_threshold_config_to_cruft (config, &cruft,
+                                      gimp_drawable_is_rgb (drawable));
 
-          pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
-                                          &cruft, 2, &srcPR, &destPR);
-
-          gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Threshold"));
-          gimp_drawable_free_shadow_tiles (drawable);
-
-          gimp_drawable_update (drawable, x, y, width, height);
-        }
+      gimp_drawable_process (drawable, progress, _("Threshold"),
+                             (PixelProcessorFunc) threshold, &cruft);
     }
 
   g_object_unref (config);



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