gimp r24637 - in trunk: . app/gegl app/tools
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24637 - in trunk: . app/gegl app/tools
- Date: Thu, 17 Jan 2008 17:18:23 +0000 (GMT)
Author: mitch
Date: Thu Jan 17 17:18:23 2008
New Revision: 24637
URL: http://svn.gnome.org/viewvc/gimp?rev=24637&view=rev
Log:
2008-01-17 Michael Natterer <mitch gimp org>
* app/gegl/Makefile.am
* app/gegl/gegl-types.h
* app/gegl/gimplevelsconfig.[ch]: new config object for the levels
operation's settings.
* app/gegl/gimpoperationlevels.[ch]: remove all properties and add
a "config" property instead.
* app/tools/gimplevelstool.[ch]: keep a GimpLevelsConfig around.
Added:
trunk/app/gegl/gimplevelsconfig.c
trunk/app/gegl/gimplevelsconfig.h
Modified:
trunk/ChangeLog
trunk/app/gegl/Makefile.am
trunk/app/gegl/gegl-types.h
trunk/app/gegl/gimpoperationlevels.c
trunk/app/gegl/gimpoperationlevels.h
trunk/app/tools/gimplevelstool.c
trunk/app/tools/gimplevelstool.h
Modified: trunk/app/gegl/Makefile.am
==============================================================================
--- trunk/app/gegl/Makefile.am (original)
+++ trunk/app/gegl/Makefile.am Thu Jan 17 17:18:23 2008
@@ -7,6 +7,8 @@
gimp-gegl.h \
gimp-gegl-utils.c \
gimp-gegl-utils.h \
+ gimplevelsconfig.c \
+ gimplevelsconfig.h \
gimpoperationcolorbalance.c \
gimpoperationcolorbalance.h \
gimpoperationcolorize.c \
Modified: trunk/app/gegl/gegl-types.h
==============================================================================
--- trunk/app/gegl/gegl-types.h (original)
+++ trunk/app/gegl/gegl-types.h Thu Jan 17 17:18:23 2008
@@ -26,6 +26,8 @@
#include "gegl/gegl-types.h"
+/* operations */
+
typedef struct _GimpOperationColorBalance GimpOperationColorBalance;
typedef struct _GimpOperationColorize GimpOperationColorize;
typedef struct _GimpOperationDesaturate GimpOperationDesaturate;
@@ -37,4 +39,9 @@
typedef struct _GimpOperationTileSource GimpOperationTileSource;
+/* operation config objects */
+
+typedef struct _GimpLevelsConfig GimpLevelsConfig;
+
+
#endif /* __GEGL_TYPES_H__ */
Added: trunk/app/gegl/gimplevelsconfig.c
==============================================================================
--- (empty file)
+++ trunk/app/gegl/gimplevelsconfig.c Thu Jan 17 17:18:23 2008
@@ -0,0 +1,236 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimplevelsconfig.c
+ * Copyright (C) 2007 Michael Natterer <mitch gimp org>
+ *
+ * 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 <gegl.h>
+
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpmath/gimpmath.h"
+
+#include "gegl-types.h"
+
+#include "gimplevelsconfig.h"
+
+
+enum
+{
+ PROP_0,
+ PROP_CHANNEL,
+ PROP_GAMMA,
+ PROP_LOW_INPUT,
+ PROP_HIGH_INPUT,
+ PROP_LOW_OUTPUT,
+ PROP_HIGH_OUTPUT
+};
+
+
+static void gimp_levels_config_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_levels_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+
+G_DEFINE_TYPE (GimpLevelsConfig, gimp_levels_config, G_TYPE_OBJECT)
+
+#define parent_class gimp_levels_config_parent_class
+
+
+static void
+gimp_levels_config_class_init (GimpLevelsConfigClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = gimp_levels_config_set_property;
+ object_class->get_property = gimp_levels_config_get_property;
+
+ g_object_class_install_property (object_class, PROP_CHANNEL,
+ g_param_spec_enum ("channel",
+ "Channel",
+ "The affected channel",
+ GIMP_TYPE_HISTOGRAM_CHANNEL,
+ GIMP_HISTOGRAM_VALUE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_GAMMA,
+ g_param_spec_double ("gamma",
+ "Gamma",
+ "Gamma",
+ 0.1, 10.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_LOW_INPUT,
+ g_param_spec_double ("low-input",
+ "Low Input",
+ "Low Input",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_HIGH_INPUT,
+ g_param_spec_double ("high-input",
+ "High Input",
+ "High Input",
+ 0.0, 1.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_LOW_OUTPUT,
+ g_param_spec_double ("low-output",
+ "Low Output",
+ "Low Output",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_HIGH_OUTPUT,
+ g_param_spec_double ("high-output",
+ "High Output",
+ "High Output",
+ 0.0, 1.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+}
+
+static void
+gimp_levels_config_init (GimpLevelsConfig *self)
+{
+ gimp_levels_config_reset (self);
+}
+
+static void
+gimp_levels_config_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpLevelsConfig *self = GIMP_LEVELS_CONFIG (object);
+
+ switch (property_id)
+ {
+ case PROP_CHANNEL:
+ g_value_set_enum (value, self->channel);
+ break;
+
+ case PROP_GAMMA:
+ g_value_set_double (value, self->gamma[self->channel]);
+ break;
+
+ case PROP_LOW_INPUT:
+ g_value_set_double (value, self->low_input[self->channel]);
+ break;
+
+ case PROP_HIGH_INPUT:
+ g_value_set_double (value, self->high_input[self->channel]);
+ break;
+
+ case PROP_LOW_OUTPUT:
+ g_value_set_double (value, self->low_output[self->channel]);
+ break;
+
+ case PROP_HIGH_OUTPUT:
+ g_value_set_double (value, self->high_output[self->channel]);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_levels_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpLevelsConfig *self = GIMP_LEVELS_CONFIG (object);
+
+ switch (property_id)
+ {
+ case PROP_CHANNEL:
+ self->channel = g_value_get_enum (value);
+ break;
+
+ case PROP_GAMMA:
+ self->gamma[self->channel] = g_value_get_double (value);
+ break;
+
+ case PROP_LOW_INPUT:
+ self->low_input[self->channel] = g_value_get_double (value);
+ break;
+
+ case PROP_HIGH_INPUT:
+ self->high_input[self->channel] = g_value_get_double (value);
+ break;
+
+ case PROP_LOW_OUTPUT:
+ self->low_output[self->channel] = g_value_get_double (value);
+ break;
+
+ case PROP_HIGH_OUTPUT:
+ self->high_output[self->channel] = g_value_get_double (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+/* public functions */
+
+void
+gimp_levels_config_reset (GimpLevelsConfig *self)
+{
+ GimpHistogramChannel channel;
+
+ g_return_if_fail (GIMP_IS_LEVELS_CONFIG (self));
+
+ self->channel = GIMP_HISTOGRAM_VALUE;
+
+ for (channel = GIMP_HISTOGRAM_VALUE;
+ channel <= GIMP_HISTOGRAM_ALPHA;
+ channel++)
+ {
+ gimp_levels_config_reset_channel (self, channel);
+ }
+}
+
+void
+gimp_levels_config_reset_channel (GimpLevelsConfig *self,
+ GimpHistogramChannel channel)
+{
+ g_return_if_fail (GIMP_IS_LEVELS_CONFIG (self));
+
+ self->gamma[channel] = 1.0;
+ self->low_input[channel] = 0.0;
+ self->high_input[channel] = 1.0;
+ self->low_output[channel] = 0.0;
+ self->high_output[channel] = 1.0;
+}
Added: trunk/app/gegl/gimplevelsconfig.h
==============================================================================
--- (empty file)
+++ trunk/app/gegl/gimplevelsconfig.h Thu Jan 17 17:18:23 2008
@@ -0,0 +1,64 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimplevelsconfig.h
+ * Copyright (C) 2007 Michael Natterer <mitch gimp org>
+ *
+ * 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_LEVELS_CONFIG_H__
+#define __GIMP_LEVELS_CONFIG_H__
+
+
+#define GIMP_TYPE_LEVELS_CONFIG (gimp_levels_config_get_type ())
+#define GIMP_LEVELS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfig))
+#define GIMP_LEVELS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
+#define GIMP_IS_LEVELS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LEVELS_CONFIG))
+#define GIMP_IS_LEVELS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LEVELS_CONFIG))
+#define GIMP_LEVELS_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LEVELS_CONFIG, GimpLevelsConfigClass))
+
+
+typedef struct _GimpLevelsConfigClass GimpLevelsConfigClass;
+
+struct _GimpLevelsConfig
+{
+ GObject parent_instance;
+
+ GimpHistogramChannel channel;
+
+ gdouble gamma[5];
+
+ gdouble low_input[5];
+ gdouble high_input[5];
+
+ gdouble low_output[5];
+ gdouble high_output[5];
+};
+
+struct _GimpLevelsConfigClass
+{
+ GObjectClass parent_class;
+};
+
+
+GType gimp_levels_config_get_type (void) G_GNUC_CONST;
+
+void gimp_levels_config_reset (GimpLevelsConfig *self);
+void gimp_levels_config_reset_channel (GimpLevelsConfig *self,
+ GimpHistogramChannel channel);
+
+
+#endif /* __GIMP_LEVELS_CONFIG_H__ */
Modified: trunk/app/gegl/gimpoperationlevels.c
==============================================================================
--- trunk/app/gegl/gimpoperationlevels.c (original)
+++ trunk/app/gegl/gimpoperationlevels.c Thu Jan 17 17:18:23 2008
@@ -28,21 +28,18 @@
#include "gegl-types.h"
+#include "gimplevelsconfig.h"
#include "gimpoperationlevels.h"
enum
{
PROP_0,
- PROP_CHANNEL,
- PROP_GAMMA,
- PROP_LOW_INPUT,
- PROP_HIGH_INPUT,
- PROP_LOW_OUTPUT,
- PROP_HIGH_OUTPUT
+ PROP_CONFIG
};
+static void gimp_operation_levels_finalize (GObject *object);
static void gimp_operation_levels_get_property (GObject *object,
guint property_id,
GValue *value,
@@ -71,6 +68,7 @@
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+ object_class->finalize = gimp_operation_levels_finalize;
object_class->set_property = gimp_operation_levels_set_property;
object_class->get_property = gimp_operation_levels_get_property;
@@ -78,52 +76,11 @@
gegl_operation_class_set_name (operation_class, "gimp-levels");
- g_object_class_install_property (object_class, PROP_CHANNEL,
- g_param_spec_enum ("channel",
- "Channel",
- "The affected channel",
- GIMP_TYPE_HISTOGRAM_CHANNEL,
- GIMP_HISTOGRAM_VALUE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class, PROP_GAMMA,
- g_param_spec_double ("gamma",
- "Gamma",
- "Gamma",
- 0.1, 10.0, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class, PROP_LOW_INPUT,
- g_param_spec_double ("low-input",
- "Low Input",
- "Low Input",
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class, PROP_HIGH_INPUT,
- g_param_spec_double ("high-input",
- "High Input",
- "High Input",
- 0.0, 1.0, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class, PROP_LOW_OUTPUT,
- g_param_spec_double ("low-output",
- "Low Output",
- "Low Output",
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class, PROP_HIGH_OUTPUT,
- g_param_spec_double ("high-output",
- "High Output",
- "High Output",
- 0.0, 1.0, 1.0,
+ g_object_class_install_property (object_class, PROP_CONFIG,
+ g_param_spec_object ("config",
+ "Config",
+ "The config object",
+ GIMP_TYPE_LEVELS_CONFIG,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
@@ -131,20 +88,20 @@
static void
gimp_operation_levels_init (GimpOperationLevels *self)
{
- GimpHistogramChannel channel;
+}
- self->channel = GIMP_HISTOGRAM_VALUE;
+static void
+gimp_operation_levels_finalize (GObject *object)
+{
+ GimpOperationLevels *self = GIMP_OPERATION_LEVELS (object);
- for (channel = GIMP_HISTOGRAM_VALUE;
- channel <= GIMP_HISTOGRAM_ALPHA;
- channel++)
+ if (self->config)
{
- self->gamma[channel] = 1.0;
- self->low_input[channel] = 0.0;
- self->high_input[channel] = 1.0;
- self->low_output[channel] = 0.0;
- self->high_output[channel] = 1.0;
+ g_object_unref (self->config);
+ self->config = NULL;
}
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
@@ -157,28 +114,8 @@
switch (property_id)
{
- case PROP_CHANNEL:
- g_value_set_enum (value, self->channel);
- break;
-
- case PROP_GAMMA:
- g_value_set_double (value, self->gamma[self->channel]);
- break;
-
- case PROP_LOW_INPUT:
- g_value_set_double (value, self->low_input[self->channel]);
- break;
-
- case PROP_HIGH_INPUT:
- g_value_set_double (value, self->high_input[self->channel]);
- break;
-
- case PROP_LOW_OUTPUT:
- g_value_set_double (value, self->low_output[self->channel]);
- break;
-
- case PROP_HIGH_OUTPUT:
- g_value_set_double (value, self->high_output[self->channel]);
+ case PROP_CONFIG:
+ g_value_set_object (value, self->config);
break;
default:
@@ -197,28 +134,10 @@
switch (property_id)
{
- case PROP_CHANNEL:
- self->channel = g_value_get_enum (value);
- break;
-
- case PROP_GAMMA:
- self->gamma[self->channel] = g_value_get_double (value);
- break;
-
- case PROP_LOW_INPUT:
- self->low_input[self->channel] = g_value_get_double (value);
- break;
-
- case PROP_HIGH_INPUT:
- self->high_input[self->channel] = g_value_get_double (value);
- break;
-
- case PROP_LOW_OUTPUT:
- self->low_output[self->channel] = g_value_get_double (value);
- break;
-
- case PROP_HIGH_OUTPUT:
- self->high_output[self->channel] = g_value_get_double (value);
+ case PROP_CONFIG:
+ if (self->config)
+ g_object_unref (self->config);
+ self->config = g_value_dup_object (value);
break;
default:
@@ -264,11 +183,15 @@
void *out_buf,
glong samples)
{
- GimpOperationLevels *self = GIMP_OPERATION_LEVELS (operation);
- gfloat *src = in_buf;
- gfloat *dest = out_buf;
+ GimpOperationLevels *self = GIMP_OPERATION_LEVELS (operation);
+ GimpLevelsConfig *config = self->config;
+ gfloat *src = in_buf;
+ gfloat *dest = out_buf;
glong sample;
+ if (! config)
+ return FALSE;
+
for (sample = 0; sample < samples; sample++)
{
gint channel;
@@ -278,20 +201,20 @@
gdouble value;
value = gimp_operation_levels_map (src[channel],
- self->gamma[channel + 1],
- self->low_input[channel + 1],
- self->high_input[channel + 1],
- self->low_output[channel + 1],
- self->high_output[channel + 1]);
+ config->gamma[channel + 1],
+ config->low_input[channel + 1],
+ config->high_input[channel + 1],
+ config->low_output[channel + 1],
+ config->high_output[channel + 1]);
/* don't apply the overall curve to the alpha channel */
if (channel != ALPHA_PIX)
value = gimp_operation_levels_map (value,
- self->gamma[0],
- self->low_input[0],
- self->high_input[0],
- self->low_output[0],
- self->high_output[0]);
+ config->gamma[0],
+ config->low_input[0],
+ config->high_input[0],
+ config->low_output[0],
+ config->high_output[0]);
dest[channel] = value;
}
Modified: trunk/app/gegl/gimpoperationlevels.h
==============================================================================
--- trunk/app/gegl/gimpoperationlevels.h (original)
+++ trunk/app/gegl/gimpoperationlevels.h Thu Jan 17 17:18:23 2008
@@ -40,15 +40,7 @@
{
GeglOperationPointFilter parent_instance;
- GimpHistogramChannel channel;
-
- gdouble gamma[5];
-
- gdouble low_input[5];
- gdouble high_input[5];
-
- gdouble low_output[5];
- gdouble high_output[5];
+ GimpLevelsConfig *config;
};
struct _GimpOperationLevelsClass
Modified: trunk/app/tools/gimplevelstool.c
==============================================================================
--- trunk/app/tools/gimplevelstool.c (original)
+++ trunk/app/tools/gimplevelstool.c Thu Jan 17 17:18:23 2008
@@ -37,6 +37,9 @@
#include "base/gimplut.h"
#include "base/levels.h"
+#include "gegl/gimplevelsconfig.h"
+#include "gegl/gimpoperationlevels.h"
+
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimpimage.h"
@@ -197,6 +200,12 @@
gimp_lut_free (tool->lut);
g_slice_free (Levels, tool->levels);
+ if (tool->config)
+ {
+ g_object_unref (tool->config);
+ tool->config = NULL;
+ }
+
if (tool->hist)
{
gimp_histogram_free (tool->hist);
@@ -227,6 +236,8 @@
if (! l_tool->hist)
l_tool->hist = gimp_histogram_new ();
+ gimp_levels_config_reset (l_tool->config);
+
levels_init (l_tool->levels);
l_tool->channel = GIMP_HISTOGRAM_VALUE;
@@ -261,9 +272,20 @@
static GeglNode *
gimp_levels_tool_get_operation (GimpImageMapTool *im_tool)
{
- return g_object_new (GEGL_TYPE_NODE,
+ GimpLevelsTool *tool = GIMP_LEVELS_TOOL (im_tool);
+ GeglNode *node;
+
+ node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-levels",
NULL);
+
+ tool->config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL);
+
+ gegl_node_set (node,
+ "config", tool->config,
+ NULL);
+
+ return node;
}
static void
@@ -278,21 +300,21 @@
{
/* FIXME: hack */
if (! tool->color && channel == 1)
- gegl_node_set (image_map_tool->operation,
- "channel", GIMP_HISTOGRAM_ALPHA,
- NULL);
+ g_object_set (tool->config,
+ "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);
+ g_object_set (tool->config,
+ "channel", channel,
+ NULL);
+
+ g_object_set (tool->config,
+ "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)
@@ -704,6 +726,8 @@
{
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
+ gimp_levels_config_reset (tool->config);
+
levels_init (tool->levels);
levels_update_adjustments (tool);
}
@@ -831,20 +855,11 @@
static void
levels_update_input_bar (GimpLevelsTool *tool)
{
- GimpHistogramChannel channel;
+ GimpHistogramChannel channel = tool->channel;
- if (tool->color)
- {
- channel = tool->channel;
- }
- else
- {
- /* FIXME: hack */
- if (tool->channel == 1)
- channel = GIMP_HISTOGRAM_ALPHA;
- else
- channel = GIMP_HISTOGRAM_VALUE;
- }
+ /* FIXME: hack */
+ if (! tool->color && channel == 1)
+ channel = GIMP_HISTOGRAM_ALPHA;
/* Recalculate the transfer arrays */
levels_calculate_transfers (tool->levels);
@@ -897,6 +912,14 @@
levels_channel_reset_callback (GtkWidget *widget,
GimpLevelsTool *tool)
{
+ GimpHistogramChannel channel = tool->channel;
+
+ /* FIXME: hack */
+ if (! tool->color && channel == 1)
+ channel = GIMP_HISTOGRAM_ALPHA;
+
+ gimp_levels_config_reset_channel (tool->config, channel);
+
levels_channel_reset (tool->levels, tool->channel);
levels_update_adjustments (tool);
Modified: trunk/app/tools/gimplevelstool.h
==============================================================================
--- trunk/app/tools/gimplevelstool.h (original)
+++ trunk/app/tools/gimplevelstool.h Thu Jan 17 17:18:23 2008
@@ -40,6 +40,7 @@
GimpLut *lut;
Levels *levels;
+ GimpLevelsConfig *config;
/* dialog */
gboolean color;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]