gimp r24664 - in branches/weskaggs: . app/base app/core app/gegl app/gegl/gegl app/tools app/widgets



Author: weskaggs
Date: Mon Jan 21 19:06:35 2008
New Revision: 24664
URL: http://svn.gnome.org/viewvc/gimp?rev=24664&view=rev

Log:
Bill Skaggs  <weskaggs primate ucdavis edu>

	Merged 24651:24662 from trunk.


Removed:
   branches/weskaggs/app/gegl/gegl/
Modified:
   branches/weskaggs/ChangeLog
   branches/weskaggs/app/base/levels.c
   branches/weskaggs/app/base/levels.h
   branches/weskaggs/app/core/gimpdrawable-levels.c
   branches/weskaggs/app/core/gimpselection.c
   branches/weskaggs/app/gegl/gimpcolorizeconfig.h
   branches/weskaggs/app/gegl/gimplevelsconfig.c
   branches/weskaggs/app/gegl/gimplevelsconfig.h
   branches/weskaggs/app/gegl/gimpoperationcolorbalance.h
   branches/weskaggs/app/gegl/gimpoperationcolorize.h
   branches/weskaggs/app/gegl/gimpoperationdesaturate.h
   branches/weskaggs/app/gegl/gimpoperationhuesaturation.h
   branches/weskaggs/app/gegl/gimpoperationlevels.h
   branches/weskaggs/app/gegl/gimpoperationposterize.h
   branches/weskaggs/app/gegl/gimpoperationthreshold.h
   branches/weskaggs/app/gegl/gimpoperationtilesink.h
   branches/weskaggs/app/gegl/gimpoperationtilesource.h
   branches/weskaggs/app/tools/gimpeditselectiontool.c
   branches/weskaggs/app/tools/gimplevelstool.c
   branches/weskaggs/app/widgets/gimpcolorbar.c

Modified: branches/weskaggs/app/base/levels.c
==============================================================================
--- branches/weskaggs/app/base/levels.c	(original)
+++ branches/weskaggs/app/base/levels.c	Mon Jan 21 19:06:35 2008
@@ -27,7 +27,6 @@
 
 #include "base-types.h"
 
-#include "gimphistogram.h"
 #include "levels.h"
 
 
@@ -44,177 +43,11 @@
        channel <= GIMP_HISTOGRAM_ALPHA;
        channel++)
     {
-      levels_channel_reset (levels, channel);
-    }
-}
-
-void
-levels_channel_reset (Levels               *levels,
-                      GimpHistogramChannel  channel)
-{
-  g_return_if_fail (levels != NULL);
-
-  levels->gamma[channel]       = 1.0;
-  levels->low_input[channel]   = 0;
-  levels->high_input[channel]  = 255;
-  levels->low_output[channel]  = 0;
-  levels->high_output[channel] = 255;
-}
-
-void
-levels_stretch (Levels        *levels,
-                GimpHistogram *hist,
-                gboolean       is_color)
-{
-  GimpHistogramChannel channel;
-
-  g_return_if_fail (levels != NULL);
-  g_return_if_fail (hist != NULL);
-
-  if (is_color)
-    {
-      /*  Set the overall value to defaults  */
-      levels_channel_reset (levels, GIMP_HISTOGRAM_VALUE);
-
-      for (channel = GIMP_HISTOGRAM_RED;
-           channel <= GIMP_HISTOGRAM_BLUE;
-           channel++)
-        levels_channel_stretch (levels, hist, channel);
-    }
-  else
-    {
-      levels_channel_stretch (levels, hist, GIMP_HISTOGRAM_VALUE);
-    }
-}
-
-void
-levels_channel_stretch (Levels               *levels,
-                        GimpHistogram        *hist,
-                        GimpHistogramChannel  channel)
-{
-  gint    i;
-  gdouble count, new_count, percentage, next_percentage;
-
-  g_return_if_fail (levels != NULL);
-  g_return_if_fail (hist != NULL);
-
-  levels->gamma[channel]       = 1.0;
-  levels->low_output[channel]  = 0;
-  levels->high_output[channel] = 255;
-
-  count = gimp_histogram_get_count (hist, channel, 0, 255);
-
-  if (count == 0.0)
-    {
-      levels->low_input[channel]  = 0;
-      levels->high_input[channel] = 0;
-    }
-  else
-    {
-      /*  Set the low input  */
-      new_count = 0.0;
-
-      for (i = 0; i < 255; i++)
-        {
-          new_count += gimp_histogram_get_value (hist, channel, i);
-          percentage = new_count / count;
-          next_percentage =
-            (new_count + gimp_histogram_get_value (hist,
-                                                   channel,
-                                                   i + 1)) / count;
-          if (fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
-            {
-              levels->low_input[channel] = i + 1;
-              break;
-            }
-        }
-      /*  Set the high input  */
-      new_count = 0.0;
-      for (i = 255; i > 0; i--)
-        {
-          new_count += gimp_histogram_get_value (hist, channel, i);
-          percentage = new_count / count;
-          next_percentage =
-            (new_count + gimp_histogram_get_value (hist,
-                                                   channel,
-                                                   i - 1)) / count;
-          if (fabs (percentage - 0.006) < fabs (next_percentage - 0.006))
-            {
-              levels->high_input[channel] = i - 1;
-              break;
-            }
-        }
-    }
-}
-
-static gint
-levels_input_from_color (GimpHistogramChannel  channel,
-                         guchar               *color)
-{
-  switch (channel)
-    {
-    case GIMP_HISTOGRAM_VALUE:
-      return MAX (MAX (color[RED_PIX], color[GREEN_PIX]), color[BLUE_PIX]);
-    case GIMP_HISTOGRAM_RED:
-      return color[RED_PIX];
-    case GIMP_HISTOGRAM_GREEN:
-      return color[GREEN_PIX];
-    case GIMP_HISTOGRAM_BLUE:
-      return color[BLUE_PIX];
-    case GIMP_HISTOGRAM_ALPHA:
-      return color[ALPHA_PIX];
-    case GIMP_HISTOGRAM_RGB:
-      return MIN (MIN (color[RED_PIX], color[GREEN_PIX]), color[BLUE_PIX]);
-    }
-
-  return 0;  /* just to please the compiler */
-}
-
-void
-levels_adjust_by_colors (Levels               *levels,
-                         GimpHistogramChannel  channel,
-                         guchar               *black,
-                         guchar               *gray,
-                         guchar               *white)
-{
-  g_return_if_fail (levels != NULL);
-
-  if (black)
-    levels->low_input[channel] = levels_input_from_color (channel, black);
-
-  if (white)
-    levels->high_input[channel] = levels_input_from_color (channel, white);
-
-  if (gray)
-    {
-      gint    input;
-      gint    range;
-      gdouble inten;
-      gdouble out_light;
-      guchar lightness;
-
-      /* Calculate lightness value */
-      lightness = GIMP_RGB_LUMINANCE (gray[0], gray[1], gray[2]);
-
-      input = levels_input_from_color (channel, gray);
-
-      range = levels->high_input[channel] - levels->low_input[channel];
-      if (range <= 0)
-        return;
-
-      input -= levels->low_input[channel];
-      if (input < 0)
-        return;
-
-      /* Normalize input and lightness */
-      inten = (gdouble) input / (gdouble) range;
-      out_light = (gdouble) lightness/ (gdouble) range;
-
-      if (out_light <= 0)
-        return;
-
-      /* Map selected color to corresponding lightness */
-      levels->gamma[channel] = log (inten) / log (out_light);
+      levels->gamma[channel]       = 1.0;
+      levels->low_input[channel]   = 0;
+      levels->high_input[channel]  = 255;
+      levels->low_output[channel]  = 0;
+      levels->high_output[channel] = 255;
     }
 }
 

Modified: branches/weskaggs/app/base/levels.h
==============================================================================
--- branches/weskaggs/app/base/levels.h	(original)
+++ branches/weskaggs/app/base/levels.h	Mon Jan 21 19:06:35 2008
@@ -34,25 +34,12 @@
 };
 
 
-void     levels_init                (Levels               *levels);
-void     levels_channel_reset       (Levels               *levels,
-                                     GimpHistogramChannel  channel);
-void     levels_stretch             (Levels               *levels,
-                                     GimpHistogram        *hist,
-                                     gboolean              is_color);
-void     levels_channel_stretch     (Levels               *levels,
-                                     GimpHistogram        *hist,
-                                     GimpHistogramChannel  channel);
-void     levels_adjust_by_colors    (Levels               *levels,
-                                     GimpHistogramChannel  channel,
-                                     guchar               *black,
-                                     guchar               *gray,
-                                     guchar               *white);
-void     levels_calculate_transfers (Levels               *levels);
-gfloat   levels_lut_func            (Levels               *levels,
-                                     gint                  n_channels,
-                                     gint                  channel,
-                                     gfloat                value);
+void     levels_init                (Levels *levels);
+void     levels_calculate_transfers (Levels *levels);
+gfloat   levels_lut_func            (Levels *levels,
+                                     gint    n_channels,
+                                     gint    channel,
+                                     gfloat  value);
 
 
 #endif  /*  __LEVELS_H__  */

Modified: branches/weskaggs/app/core/gimpdrawable-levels.c
==============================================================================
--- branches/weskaggs/app/core/gimpdrawable-levels.c	(original)
+++ branches/weskaggs/app/core/gimpdrawable-levels.c	Mon Jan 21 19:06:35 2008
@@ -18,24 +18,28 @@
 
 #include "config.h"
 
-#include <string.h>
-
-#include <glib-object.h>
+#include <gegl.h>
 
 #include "core-types.h"
 
 #include "base/gimphistogram.h"
 #include "base/gimplut.h"
 #include "base/levels.h"
-#include "base/lut-funcs.h"
 #include "base/pixel-processor.h"
 #include "base/pixel-region.h"
 
+#include "gegl/gimplevelsconfig.h"
+
+/* temp */
+#include "config/gimpcoreconfig.h"
 #include "gimp.h"
+#include "gimpimage.h"
+
 #include "gimpcontext.h"
 #include "gimpdrawable.h"
 #include "gimpdrawable-histogram.h"
 #include "gimpdrawable-levels.h"
+#include "gimpdrawable-operation.h"
 
 #include "gimp-intl.h"
 
@@ -49,12 +53,8 @@
                       gint32          low_output,
                       gint32          high_output)
 {
-  gint         x, y, width, height;
-  PixelRegion  srcPR, destPR;
-  Levels       levels;
-  GimpLut     *lut;
+  GimpLevelsConfig *config;
 
-  /* parameter checking */
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (! gimp_drawable_is_indexed (drawable));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
@@ -73,54 +73,83 @@
     g_return_if_fail (channel == GIMP_HISTOGRAM_VALUE ||
                       channel == GIMP_HISTOGRAM_ALPHA);
 
-  if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
-    return;
+  config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL);
 
-  /* FIXME: hack */
-  if (gimp_drawable_is_gray (drawable) &&
-      channel == GIMP_HISTOGRAM_ALPHA)
-    channel = 1;
-
-  lut = gimp_lut_new ();
-
-  levels_init (&levels);
-
-  levels.low_input[channel]   = low_input;
-  levels.high_input[channel]  = high_input;
-  levels.gamma[channel]       = gamma;
-  levels.low_output[channel]  = low_output;
-  levels.high_output[channel] = high_output;
-
-  /* setup the lut */
-  gimp_lut_setup (lut,
-                  (GimpLutFunc) levels_lut_func,
-                   &levels,
-                   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);
+  g_object_set (config,
+                "channel", channel,
+                NULL);
+
+  g_object_set (config,
+                "low-input",   low_input   / 255.0,
+                "high-input",  high_input  / 255.0,
+                "gamma",       gamma,
+                "low-output",  low_output  / 255.0,
+                "high-output", high_output / 255.0,
+                NULL);
+
+  if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
+    {
+      GeglNode *levels;
+
+      levels = g_object_new (GEGL_TYPE_NODE,
+                             "operation", "gimp-levels",
+                             NULL);
+
+      gegl_node_set (levels,
+                     "config", config,
+                     NULL);
+
+      gimp_drawable_apply_operation (drawable, levels, TRUE,
+                                     NULL, _("Levels"));
+
+      g_object_unref (levels);
+    }
+  else
+    {
+      PixelRegion  srcPR, destPR;
+      Levels       levels;
+      GimpLut     *lut;
+      gint         x, y;
+      gint         width, height;
+
+      if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
+        return;
+
+      gimp_levels_config_to_levels_cruft (config, &levels,
+                                          gimp_drawable_is_rgb (drawable));
+
+      lut = gimp_lut_new ();
+      gimp_lut_setup (lut,
+                      (GimpLutFunc) levels_lut_func,
+                      &levels,
+                      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);
 
-  pixel_regions_process_parallel ((PixelProcessorFunc) gimp_lut_process,
-                                  lut, 2, &srcPR, &destPR);
+      gimp_lut_free (lut);
 
-  gimp_lut_free (lut);
+      gimp_drawable_merge_shadow (drawable, TRUE, _("Levels"));
 
-  gimp_drawable_merge_shadow (drawable, TRUE, _("Levels"));
-  gimp_drawable_update (drawable, x, y, width, height);
-}
+      gimp_drawable_update (drawable, x, y, width, height);
+    }
 
+  g_object_unref (config);
+}
 
 void
 gimp_drawable_levels_stretch (GimpDrawable *drawable,
                               GimpContext  *context)
 {
-  gint           x, y, width, height;
-  PixelRegion    srcPR, destPR;
-  Levels         levels;
-  GimpLut       *lut;
-  GimpHistogram *hist;
+  GimpLevelsConfig *config;
+  GimpHistogram    *histogram;
+  gint              x, y;
+  gint              width, height;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (! gimp_drawable_is_indexed (drawable));
@@ -130,33 +159,62 @@
   if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
     return;
 
-  /* Build the histogram */
-  hist = gimp_histogram_new ();
+  config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL);
+
+  histogram = gimp_histogram_new ();
+  gimp_drawable_calculate_histogram (drawable, histogram);
+
+  gimp_levels_config_stretch (config, histogram,
+                              gimp_drawable_is_rgb (drawable));
+
+  gimp_histogram_free (histogram);
+
+  if (GIMP_ITEM (drawable)->image->gimp->config->use_gegl)
+    {
+      GeglNode *levels;
+
+      levels = g_object_new (GEGL_TYPE_NODE,
+                             "operation", "gimp-levels",
+                             NULL);
+
+      gegl_node_set (levels,
+                     "config", config,
+                     NULL);
+
+      gimp_drawable_apply_operation (drawable, levels, TRUE,
+                                     NULL, _("Levels"));
+
+      g_object_unref (levels);
+    }
+  else
+    {
+      PixelRegion  srcPR, destPR;
+      Levels       levels;
+      GimpLut     *lut;
+
+      gimp_levels_config_to_levels_cruft (config, &levels,
+                                          gimp_drawable_is_rgb (drawable));
+
+      lut  = gimp_lut_new ();
+      gimp_lut_setup (lut,
+                      (GimpLutFunc) levels_lut_func,
+                      &levels,
+                      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);
 
-  gimp_drawable_calculate_histogram (drawable, hist);
+      pixel_regions_process_parallel ((PixelProcessorFunc) gimp_lut_process,
+                                      lut, 2, &srcPR, &destPR);
 
-  /* Calculate the levels */
-  levels_init    (&levels);
-  levels_stretch (&levels, hist, ! gimp_drawable_is_gray (drawable));
-
-  /* Set up the lut */
-  lut  = gimp_lut_new ();
-  gimp_lut_setup (lut,
-                  (GimpLutFunc) levels_lut_func,
-                  &levels,
-                  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);
+      gimp_lut_free (lut);
 
-  pixel_regions_process_parallel ((PixelProcessorFunc) gimp_lut_process,
-                                  lut, 2, &srcPR, &destPR);
+      gimp_drawable_merge_shadow (drawable, TRUE, _("Levels"));
 
-  gimp_lut_free (lut);
-  gimp_histogram_free (hist);
+      gimp_drawable_update (drawable, x, y, width, height);
+    }
 
-  gimp_drawable_merge_shadow (drawable, TRUE, _("Levels"));
-  gimp_drawable_update (drawable, x, y, width, height);
+  g_object_unref (config);
 }

Modified: branches/weskaggs/app/core/gimpselection.c
==============================================================================
--- branches/weskaggs/app/core/gimpselection.c	(original)
+++ branches/weskaggs/app/core/gimpselection.c	Mon Jan 21 19:06:35 2008
@@ -732,9 +732,6 @@
 
       if (GIMP_IS_DRAWABLE (pickable) && cut_image)
         {
-          /*  Clear the region  */
-          gimp_channel_clear (selection, NULL, TRUE);
-
           /*  Update the region  */
           gimp_drawable_update (GIMP_DRAWABLE (pickable),
                                 x1, y1, (x2 - x1), (y2 - y1));

Modified: branches/weskaggs/app/gegl/gimpcolorizeconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpcolorizeconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimpcolorizeconfig.h	Mon Jan 21 19:06:35 2008
@@ -23,10 +23,12 @@
 #define __GIMP_COLORIZE_CONFIG_H__
 
 
-#define GIMP_TYPE_COLORIZE_CONFIG           (gimp_colorize_config_get_type ())
-#define GIMP_COLORIZE_CONFIG(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfig))
-#define GIMP_COLORIZE_CONFIG_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfigClass))
-#define GIMP_COLORIZE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfigClass))
+#define GIMP_TYPE_COLORIZE_CONFIG            (gimp_colorize_config_get_type ())
+#define GIMP_COLORIZE_CONFIG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfig))
+#define GIMP_COLORIZE_CONFIG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfigClass))
+#define GIMP_IS_COLORIZE_CONFIG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLORIZE_CONFIG))
+#define GIMP_IS_COLORIZE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GIMP_TYPE_COLORIZE_CONFIG))
+#define GIMP_COLORIZE_CONFIG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_COLORIZE_CONFIG, GimpColorizeConfigClass))
 
 
 typedef struct _GimpColorizeConfigClass GimpColorizeConfigClass;

Modified: branches/weskaggs/app/gegl/gimplevelsconfig.c
==============================================================================
--- branches/weskaggs/app/gegl/gimplevelsconfig.c	(original)
+++ branches/weskaggs/app/gegl/gimplevelsconfig.c	Mon Jan 21 19:06:35 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: branches/weskaggs/app/gegl/gimplevelsconfig.h
==============================================================================
--- branches/weskaggs/app/gegl/gimplevelsconfig.h	(original)
+++ branches/weskaggs/app/gegl/gimplevelsconfig.h	Mon Jan 21 19:06:35 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: branches/weskaggs/app/gegl/gimpoperationcolorbalance.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationcolorbalance.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationcolorbalance.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_COLOR_BALANCE_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
 #define GIMP_TYPE_OPERATION_COLOR_BALANCE            (gimp_operation_color_balance_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationcolorize.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationcolorize.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationcolorize.h	Mon Jan 21 19:06:35 2008
@@ -23,13 +23,15 @@
 #define __GIMP_OPERATION_COLORIZE_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
-#define GIMP_TYPE_OPERATION_COLORIZE           (gimp_operation_colorize_get_type ())
-#define GIMP_OPERATION_COLORIZE(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_COLORIZE, GimpOperationColorize))
-#define GIMP_OPERATION_COLORIZE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_OPERATION_COLORIZE, GimpOperationColorizeClass))
-#define GIMP_OPERATION_COLORIZE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_OPERATION_COLORIZE, GimpOperationColorizeClass))
+#define GIMP_TYPE_OPERATION_COLORIZE            (gimp_operation_colorize_get_type ())
+#define GIMP_OPERATION_COLORIZE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_COLORIZE, GimpOperationColorize))
+#define GIMP_OPERATION_COLORIZE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_OPERATION_COLORIZE, GimpOperationColorizeClass))
+#define GIMP_IS_OPERATION_COLORIZE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_COLORIZE))
+#define GIMP_IS_OPERATION_COLORIZE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GIMP_TYPE_OPERATION_COLORIZE))
+#define GIMP_OPERATION_COLORIZE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_OPERATION_COLORIZE, GimpOperationColorizeClass))
 
 
 typedef struct _GimpOperationColorizeClass GimpOperationColorizeClass;

Modified: branches/weskaggs/app/gegl/gimpoperationdesaturate.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationdesaturate.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationdesaturate.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_DESATURATE_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
 #define GIMP_TYPE_OPERATION_DESATURATE           (gimp_operation_desaturate_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationhuesaturation.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationhuesaturation.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationhuesaturation.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_HUE_SATURATION_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
 #define GIMP_TYPE_OPERATION_HUE_SATURATION            (gimp_operation_hue_saturation_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationlevels.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationlevels.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationlevels.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_LEVELS_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
 #define GIMP_TYPE_OPERATION_LEVELS            (gimp_operation_levels_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationposterize.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationposterize.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationposterize.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_POSTERIZE_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
 #define GIMP_TYPE_OPERATION_POSTERIZE           (gimp_operation_posterize_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationthreshold.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationthreshold.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationthreshold.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_THRESHOLD_H__
 
 
-#include "gegl/gegl-operation-point-filter.h"
+#include <operation/gegl-operation-point-filter.h>
 
 
 #define GIMP_TYPE_OPERATION_THRESHOLD           (gimp_operation_threshold_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationtilesink.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationtilesink.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationtilesink.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_TILE_SINK_H__
 
 
-#include "gegl/gegl-operation-sink.h"
+#include <operation/gegl-operation-sink.h>
 
 
 #define GIMP_TYPE_OPERATION_TILE_SINK           (gimp_operation_tile_sink_get_type ())

Modified: branches/weskaggs/app/gegl/gimpoperationtilesource.h
==============================================================================
--- branches/weskaggs/app/gegl/gimpoperationtilesource.h	(original)
+++ branches/weskaggs/app/gegl/gimpoperationtilesource.h	Mon Jan 21 19:06:35 2008
@@ -23,7 +23,7 @@
 #define __GIMP_OPERATION_TILE_SOURCE_H__
 
 
-#include "gegl/gegl-operation-source.h"
+#include <operation/gegl-operation-source.h>
 
 
 #define GIMP_TYPE_OPERATION_TILE_SOURCE           (gimp_operation_tile_source_get_type ())

Modified: branches/weskaggs/app/tools/gimpeditselectiontool.c
==============================================================================
--- branches/weskaggs/app/tools/gimpeditselectiontool.c	(original)
+++ branches/weskaggs/app/tools/gimpeditselectiontool.c	Mon Jan 21 19:06:35 2008
@@ -543,6 +543,7 @@
   GimpItem              *active_item;
   gint                   off_x, off_y;
   gdouble                motion_x, motion_y;
+  gint                   x, y;
 
   gdk_flush ();
 
@@ -568,120 +569,111 @@
   gimp_edit_selection_tool_calc_coords (edit_select,
                                         motion_x,
                                         motion_y);
+  x = edit_select->x;
+  y = edit_select->y;
 
-  /******************************************* adam's live move *******/
-  /********************************************************************/
-  {
-    gint x, y;
-
-    x = edit_select->x;
-    y = edit_select->y;
-
-    /* if there has been movement, move the selection  */
-    if (edit_select->origx != x || edit_select->origy != y)
-      {
-        gint    xoffset;
-        gint    yoffset;
-        GError *error = NULL;
-
-        xoffset = x - edit_select->origx;
-        yoffset = y - edit_select->origy;
-
-        edit_select->cumlx += xoffset;
-        edit_select->cumly += yoffset;
-
-        switch (edit_select->edit_mode)
-          {
-          case GIMP_TRANSLATE_MODE_LAYER_MASK:
-          case GIMP_TRANSLATE_MODE_MASK:
-            /*  we don't do the actual edit selection move here.  */
-            edit_select->origx = x;
-            edit_select->origy = y;
-            break;
-
-          case GIMP_TRANSLATE_MODE_VECTORS:
-          case GIMP_TRANSLATE_MODE_CHANNEL:
-            edit_select->origx = x;
-            edit_select->origy = y;
-
-            /*  fallthru  */
-
-          case GIMP_TRANSLATE_MODE_LAYER:
-            /*  for CHANNEL_TRANSLATE, only translate the linked layers
-             *  and vectors on-the-fly, the channel is translated
-             *  on button_release.
-             */
-            if (edit_select->edit_mode != GIMP_TRANSLATE_MODE_CHANNEL)
-              gimp_item_translate (active_item, xoffset, yoffset,
-                                   edit_select->first_move);
+  /* if there has been movement, move the selection  */
+  if (edit_select->origx != x || edit_select->origy != y)
+    {
+      gint    xoffset;
+      gint    yoffset;
+      GError *error = NULL;
 
-            if (gimp_item_get_linked (active_item))
-              {
-                /*  translate all linked layers & vectors as well  */
+      xoffset = x - edit_select->origx;
+      yoffset = y - edit_select->origy;
 
-                GList *linked;
+      edit_select->cumlx += xoffset;
+      edit_select->cumly += yoffset;
 
-                linked = gimp_image_item_list_get_list (display->image,
-                                                        active_item,
-                                                        GIMP_ITEM_TYPE_LAYERS |
-                                                        GIMP_ITEM_TYPE_VECTORS,
-                                                        GIMP_ITEM_SET_LINKED);
-
-                gimp_image_item_list_translate (display->image,
-                                                linked,
-                                                xoffset, yoffset,
-                                                edit_select->first_move);
+      switch (edit_select->edit_mode)
+        {
+        case GIMP_TRANSLATE_MODE_LAYER_MASK:
+        case GIMP_TRANSLATE_MODE_MASK:
+          /*  we don't do the actual edit selection move here.  */
+          edit_select->origx = x;
+          edit_select->origy = y;
+          break;
 
-                g_list_free (linked);
-              }
-            break;
+        case GIMP_TRANSLATE_MODE_VECTORS:
+        case GIMP_TRANSLATE_MODE_CHANNEL:
+          edit_select->origx = x;
+          edit_select->origy = y;
+
+          /*  fallthru  */
+
+        case GIMP_TRANSLATE_MODE_LAYER:
+          /*  for CHANNEL_TRANSLATE, only translate the linked layers
+           *  and vectors on-the-fly, the channel is translated
+           *  on button_release.
+           */
+          if (edit_select->edit_mode != GIMP_TRANSLATE_MODE_CHANNEL)
+            gimp_item_translate (active_item, xoffset, yoffset,
+                                 edit_select->first_move);
 
-          case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
-          case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
-            if (! gimp_selection_float (gimp_image_get_mask (display->image),
-                                        GIMP_DRAWABLE (active_item),
-                                        gimp_get_user_context (display->image->gimp),
-                                        edit_select->edit_mode ==
-                                        GIMP_TRANSLATE_MODE_MASK_TO_LAYER,
-                                        0, 0, &error))
-              {
-                /* no region to float, abort safely */
-                gimp_message (display->image->gimp, G_OBJECT (display),
-                              GIMP_MESSAGE_WARNING,
-                              "%s", error->message);
-                g_clear_error (&error);
-                gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
+          if (gimp_item_get_linked (active_item))
+            {
+              /*  translate all linked layers & vectors as well  */
 
-                return;
-              }
+              GList *linked;
 
-            edit_select->origx -= edit_select->x1;
-            edit_select->origy -= edit_select->y1;
-            edit_select->x2    -= edit_select->x1;
-            edit_select->y2    -= edit_select->y1;
-            edit_select->x1     = 0;
-            edit_select->y1     = 0;
+              linked = gimp_image_item_list_get_list (display->image,
+                                                      active_item,
+                                                      GIMP_ITEM_TYPE_LAYERS |
+                                                      GIMP_ITEM_TYPE_VECTORS,
+                                                      GIMP_ITEM_SET_LINKED);
+
+              gimp_image_item_list_translate (display->image,
+                                              linked,
+                                              xoffset, yoffset,
+                                              edit_select->first_move);
 
-            edit_select->edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
+              g_list_free (linked);
+            }
+          break;
 
-            active_item =
-              GIMP_ITEM (gimp_image_get_active_drawable (display->image));
+        case GIMP_TRANSLATE_MODE_MASK_TO_LAYER:
+        case GIMP_TRANSLATE_MODE_MASK_COPY_TO_LAYER:
+          if (! gimp_selection_float (gimp_image_get_mask (display->image),
+                                      GIMP_DRAWABLE (active_item),
+                                      gimp_get_user_context (display->image->gimp),
+                                      edit_select->edit_mode ==
+                                      GIMP_TRANSLATE_MODE_MASK_TO_LAYER,
+                                      0, 0, &error))
+            {
+              /* no region to float, abort safely */
+              gimp_message (display->image->gimp, G_OBJECT (display),
+                            GIMP_MESSAGE_WARNING,
+                            "%s", error->message);
+              g_clear_error (&error);
+              gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
 
-            /* fall through */
+              return;
+            }
 
-          case GIMP_TRANSLATE_MODE_FLOATING_SEL:
-            gimp_item_translate (active_item, xoffset, yoffset,
-                                 edit_select->first_move);
-            break;
-          }
+          edit_select->origx -= edit_select->x1;
+          edit_select->origy -= edit_select->y1;
+          edit_select->x2    -= edit_select->x1;
+          edit_select->y2    -= edit_select->y1;
+          edit_select->x1     = 0;
+          edit_select->y1     = 0;
+
+          edit_select->edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
+
+          active_item =
+            GIMP_ITEM (gimp_image_get_active_drawable (display->image));
+
+          /* fall through */
+
+        case GIMP_TRANSLATE_MODE_FLOATING_SEL:
+          gimp_item_translate (active_item, xoffset, yoffset,
+                               edit_select->first_move);
+          break;
+        }
 
-        edit_select->first_move = FALSE;
-      }
+      edit_select->first_move = FALSE;
+    }
 
-    gimp_projection_flush (display->image->projection);
-  }
-  /********************************************************************/
-  /********************************************************************/
+  gimp_projection_flush (display->image->projection);
 
   gimp_tool_pop_status (tool, display);
   gimp_tool_push_status_coords (tool, display,

Modified: branches/weskaggs/app/tools/gimplevelstool.c
==============================================================================
--- branches/weskaggs/app/tools/gimplevelstool.c	(original)
+++ branches/weskaggs/app/tools/gimplevelstool.c	Mon Jan 21 19:06:35 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)

Modified: branches/weskaggs/app/widgets/gimpcolorbar.c
==============================================================================
--- branches/weskaggs/app/widgets/gimpcolorbar.c	(original)
+++ branches/weskaggs/app/widgets/gimpcolorbar.c	Mon Jan 21 19:06:35 2008
@@ -87,7 +87,7 @@
                                                         GIMP_PARAM_WRITABLE |
                                                         G_PARAM_CONSTRUCT));
 
-  g_object_class_install_property (object_class, PROP_ORIENTATION,
+  g_object_class_install_property (object_class, PROP_CHANNEL,
                                    g_param_spec_enum ("histogram-channel",
                                                       NULL, NULL,
                                                       GIMP_TYPE_HISTOGRAM_CHANNEL,



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