1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* 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
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
#include "config.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
#include "base/hue-saturation.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
#include "core/gimpdrawable.h"
|
|
|
|
#include "core/gimpimage.h"
|
2002-08-26 19:35:56 +08:00
|
|
|
#include "core/gimpimagemap.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
#include "gimphuesaturationtool.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
1998-11-23 22:47:09 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#define SLIDER_WIDTH 200
|
2000-12-31 12:07:42 +08:00
|
|
|
#define DA_WIDTH 40
|
|
|
|
#define DA_HEIGHT 20
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
#define HUE_SLIDER (1 << 0)
|
|
|
|
#define LIGHTNESS_SLIDER (1 << 1)
|
|
|
|
#define SATURATION_SLIDER (1 << 2)
|
|
|
|
#define DRAW (1 << 3)
|
|
|
|
#define SLIDERS (HUE_SLIDER | LIGHTNESS_SLIDER | SATURATION_SLIDER)
|
|
|
|
#define ALL (SLIDERS | DRAW)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
/* local function prototypes */
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass);
|
2002-06-17 01:13:39 +08:00
|
|
|
static void gimp_hue_saturation_tool_init (GimpHueSaturationTool *tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
static void gimp_hue_saturation_tool_finalize (GObject *object);
|
|
|
|
|
|
|
|
static void gimp_hue_saturation_tool_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void gimp_hue_saturation_tool_map (GimpImageMapTool *image_map_tool);
|
|
|
|
static void gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool);
|
|
|
|
static void gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool);
|
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
static void hue_saturation_update (GimpHueSaturationTool *hs_tool,
|
|
|
|
gint update);
|
|
|
|
static void hue_saturation_partition_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
|
|
|
static void hue_saturation_partition_reset_callback (GtkWidget *widget,
|
|
|
|
gpointer data);
|
2002-08-26 19:35:56 +08:00
|
|
|
static void hue_saturation_hue_adjustment_update (GtkAdjustment *adj,
|
|
|
|
gpointer data);
|
|
|
|
static void hue_saturation_lightness_adjustment_update (GtkAdjustment *adj,
|
|
|
|
gpointer data);
|
|
|
|
static void hue_saturation_saturation_adjustment_update (GtkAdjustment *adj,
|
|
|
|
gpointer data);
|
2000-12-31 12:07:42 +08:00
|
|
|
|
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
/* private variables */
|
2002-08-26 19:35:56 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
static gint default_colors[6][3] =
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
1999-11-22 19:14:29 +08:00
|
|
|
{ 255, 0, 0 },
|
|
|
|
{ 255, 255, 0 },
|
|
|
|
{ 0, 255, 0 },
|
|
|
|
{ 0, 255, 255 },
|
|
|
|
{ 0, 0, 255 },
|
|
|
|
{ 255, 0, 255 }
|
1999-04-09 06:25:54 +08:00
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-21 07:00:47 +08:00
|
|
|
static GimpImageMapToolClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_hue_saturation_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_HUE_SATURATION_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
G_TYPE_NONE, NULL,
|
2001-11-21 07:00:47 +08:00
|
|
|
FALSE,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-hue-saturation-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Hue-Saturation"),
|
|
|
|
_("Adjust hue and saturation"),
|
2003-06-10 22:31:53 +08:00
|
|
|
N_("/Tools/Color Tools/Hue-Saturation..."), NULL,
|
2001-11-21 07:00:47 +08:00
|
|
|
NULL, "tools/hue_saturation.html",
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_HUE_SATURATION,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-05-25 07:57:08 +08:00
|
|
|
gimp_hue_saturation_tool_get_type (void)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
if (! tool_type)
|
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpHueSaturationToolClass),
|
2001-08-14 22:53:55 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_hue_saturation_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpHueSaturationTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_hue_saturation_tool_init,
|
2001-05-25 07:57:08 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL,
|
|
|
|
"GimpHueSaturationTool",
|
|
|
|
&tool_info, 0);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return tool_type;
|
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void
|
|
|
|
gimp_hue_saturation_tool_class_init (GimpHueSaturationToolClass *klass)
|
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GObjectClass *object_class;
|
|
|
|
GimpToolClass *tool_class;
|
|
|
|
GimpImageMapToolClass *image_map_tool_class;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
image_map_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
object_class->finalize = gimp_hue_saturation_tool_finalize;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
tool_class->initialize = gimp_hue_saturation_tool_initialize;
|
|
|
|
|
|
|
|
image_map_tool_class->map = gimp_hue_saturation_tool_map;
|
|
|
|
image_map_tool_class->dialog = gimp_hue_saturation_tool_dialog;
|
|
|
|
image_map_tool_class->reset = gimp_hue_saturation_tool_reset;
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpImageMapTool *image_map_tool;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
image_map_tool = GIMP_IMAGE_MAP_TOOL (hs_tool);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2003-05-03 02:43:15 +08:00
|
|
|
image_map_tool->shell_identifier = "gimp-hue-saturation-tool-dialog";
|
|
|
|
image_map_tool->shell_desc = _("Adjust Hue / Lightness / Saturation");
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2003-05-03 02:43:15 +08:00
|
|
|
hs_tool->hue_saturation = g_new0 (HueSaturation, 1);
|
|
|
|
hs_tool->hue_partition = GIMP_ALL_HUES;
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
|
|
|
|
hue_saturation_init (hs_tool->hue_saturation);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_hue_saturation_tool_finalize (GObject *object)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (object);
|
2001-05-25 07:57:08 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
if (hs_tool->hue_saturation)
|
|
|
|
{
|
|
|
|
g_free (hs_tool->hue_saturation);
|
|
|
|
hs_tool->hue_saturation = NULL;
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
static void
|
|
|
|
gimp_hue_saturation_tool_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
if (! gimp_drawable_is_rgb (gimp_image_active_drawable (gdisp->gimage)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
g_message (_("Hue-Saturation operates only on RGB color drawables."));
|
|
|
|
return;
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
hue_saturation_init (hs_tool->hue_saturation);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_partition = GIMP_ALL_HUES;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->initialize (tool, gdisp);
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hue_saturation_update (hs_tool, ALL);
|
|
|
|
}
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
static void
|
|
|
|
gimp_hue_saturation_tool_map (GimpImageMapTool *image_map_tool)
|
|
|
|
{
|
|
|
|
GimpHueSaturationTool *hs_tool;
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
|
|
|
|
|
|
|
|
gimp_image_map_apply (image_map_tool->image_map,
|
2003-03-08 02:08:16 +08:00
|
|
|
(GimpImageMapApplyFunc) hue_saturation,
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_saturation);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
|
1999-06-23 23:24:46 +08:00
|
|
|
/***************************/
|
|
|
|
/* Hue-Saturation dialog */
|
|
|
|
/***************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
static void
|
|
|
|
gimp_hue_saturation_tool_dialog (GimpImageMapTool *image_map_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
2002-08-29 03:47:07 +08:00
|
|
|
GtkWidget *abox;
|
2002-08-26 19:35:56 +08:00
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *slider;
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
GtkWidget *button;
|
2002-08-26 19:35:56 +08:00
|
|
|
GtkWidget *frame;
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
2002-08-26 19:35:56 +08:00
|
|
|
GtkObject *data;
|
|
|
|
GSList *group = NULL;
|
|
|
|
gint i;
|
1999-06-23 23:24:46 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
const struct
|
|
|
|
{
|
|
|
|
const gchar *label;
|
|
|
|
gint label_col;
|
|
|
|
gint label_row;
|
|
|
|
gint frame_col;
|
|
|
|
gint frame_row;
|
|
|
|
}
|
|
|
|
hue_partition_table[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-29 03:47:07 +08:00
|
|
|
{ N_("_Master"), 2, 3, 0, 0 },
|
|
|
|
{ N_("_R"), 2, 1, 2, 0 },
|
|
|
|
{ N_("_Y"), 1, 2, 0, 2 },
|
|
|
|
{ N_("_G"), 1, 4, 0, 4 },
|
|
|
|
{ N_("_C"), 2, 5, 2, 6 },
|
|
|
|
{ N_("_B"), 3, 4, 4, 4 },
|
|
|
|
{ N_("_M"), 3, 2, 4, 2 }
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
1999-06-23 23:24:46 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
frame = gtk_frame_new (_("Select Primary Color to Modify"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), frame,
|
2002-08-26 19:35:56 +08:00
|
|
|
FALSE, FALSE, 0);
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (abox), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), abox);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_widget_show (abox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The table containing hue partitions */
|
2002-08-29 03:47:07 +08:00
|
|
|
table = gtk_table_new (7, 5, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 3, 4);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* the radio buttons for hue partitions */
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
{
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
button = gtk_radio_button_new_with_mnemonic (group, gettext (hue_partition_table[i].label));
|
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
|
|
g_object_set_data (G_OBJECT (button), "hue_partition",
|
2002-08-26 19:35:56 +08:00
|
|
|
GINT_TO_POINTER (i));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
if (i == 0)
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
{
|
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
|
|
|
gimp_help_set_help_data (button, _("Modify all colors"), NULL);
|
|
|
|
}
|
2002-08-29 03:47:07 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gtk_table_attach (GTK_TABLE (table), button,
|
2002-08-29 03:47:07 +08:00
|
|
|
hue_partition_table[i].label_col,
|
|
|
|
hue_partition_table[i].label_col + 1,
|
|
|
|
hue_partition_table[i].label_row,
|
|
|
|
hue_partition_table[i].label_row + 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
|
|
|
|
if (i > 0)
|
|
|
|
{
|
|
|
|
GimpRGB color = { 0.0 };
|
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), frame,
|
|
|
|
hue_partition_table[i].frame_col,
|
|
|
|
hue_partition_table[i].frame_col + 1,
|
|
|
|
hue_partition_table[i].frame_row,
|
|
|
|
hue_partition_table[i].frame_row + 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
2002-08-26 19:35:56 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
hs_tool->hue_partition_da[i - 1] = gimp_color_area_new (&color,
|
|
|
|
GIMP_COLOR_AREA_FLAT,
|
|
|
|
0);
|
|
|
|
gtk_widget_set_size_request (hs_tool->hue_partition_da[i - 1],
|
|
|
|
DA_WIDTH, DA_HEIGHT);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame),
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_partition_da[i - 1]);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_widget_show (hs_tool->hue_partition_da[i - 1]);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (button, "toggled",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (hue_saturation_partition_callback),
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gtk_widget_show (button);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2002-08-29 03:47:07 +08:00
|
|
|
frame = gtk_frame_new (_("Modify Selected Color"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), frame,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The table containing sliders */
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
table = gtk_table_new (3, 3, FALSE);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
2002-08-29 03:47:07 +08:00
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Create the hue scale widget */
|
2002-08-29 03:47:07 +08:00
|
|
|
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("_Hue:"), SLIDER_WIDTH, -1,
|
2002-08-29 03:47:07 +08:00
|
|
|
0.0, -180.0, 180.0, 1.0, 15.0, 0,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_data = GTK_ADJUSTMENT (data);
|
2002-08-29 03:47:07 +08:00
|
|
|
slider = GIMP_SCALE_ENTRY_SCALE (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
2002-08-29 03:47:07 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (data, "value_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (hue_saturation_hue_adjustment_update),
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Create the lightness scale widget */
|
2002-08-29 03:47:07 +08:00
|
|
|
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("_Lightness:"), SLIDER_WIDTH, -1,
|
2002-08-29 03:47:07 +08:00
|
|
|
0.0, -100.0, 100.0, 1.0, 10.0, 0,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->lightness_data = GTK_ADJUSTMENT (data);
|
2002-08-29 03:47:07 +08:00
|
|
|
slider = GIMP_SCALE_ENTRY_SCALE (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
2002-08-29 03:47:07 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (data, "value_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (hue_saturation_lightness_adjustment_update),
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Create the saturation scale widget */
|
2002-08-29 03:47:07 +08:00
|
|
|
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("_Saturation:"), SLIDER_WIDTH, -1,
|
2002-08-29 03:47:07 +08:00
|
|
|
0.0, -100.0, 100.0, 1.0, 10.0, 0,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->saturation_data = GTK_ADJUSTMENT (data);
|
2002-08-29 03:47:07 +08:00
|
|
|
slider = GIMP_SCALE_ENTRY_SCALE (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (hs_tool->saturation_data, "value_changed",
|
2001-08-01 10:57:58 +08:00
|
|
|
G_CALLBACK (hue_saturation_saturation_adjustment_update),
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool);
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
button = gtk_button_new_with_mnemonic (_("R_eset Color"));
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (button, "clicked",
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
G_CALLBACK (hue_saturation_partition_reset_callback),
|
|
|
|
hs_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
static void
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_hue_saturation_tool_reset (GimpImageMapTool *image_map_tool)
|
2001-10-17 19:33:43 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
|
|
|
|
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (image_map_tool);
|
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
hue_saturation_init (hs_tool->hue_saturation);
|
2002-08-26 19:35:56 +08:00
|
|
|
hue_saturation_update (hs_tool, ALL);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2002-08-26 19:35:56 +08:00
|
|
|
hue_saturation_update (GimpHueSaturationTool *hs_tool,
|
|
|
|
gint update)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-29 03:47:07 +08:00
|
|
|
gint rgb[3];
|
|
|
|
GimpRGB color;
|
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
hue_saturation_calculate_transfers (hs_tool->hue_saturation);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (update & HUE_SLIDER)
|
2002-08-26 19:35:56 +08:00
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->hue_data),
|
|
|
|
hs_tool->hue_saturation->hue[hs_tool->hue_partition]);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (update & LIGHTNESS_SLIDER)
|
2002-08-26 19:35:56 +08:00
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->lightness_data),
|
|
|
|
hs_tool->hue_saturation->lightness[hs_tool->hue_partition]);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (update & SATURATION_SLIDER)
|
2002-08-26 19:35:56 +08:00
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (hs_tool->saturation_data),
|
|
|
|
hs_tool->hue_saturation->saturation[hs_tool->hue_partition]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
if (update & DRAW)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
rgb[RED_PIX] = default_colors[i][RED_PIX];
|
|
|
|
rgb[GREEN_PIX] = default_colors[i][GREEN_PIX];
|
|
|
|
rgb[BLUE_PIX] = default_colors[i][BLUE_PIX];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gimp_rgb_to_hls_int (rgb, rgb + 1, rgb + 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
rgb[RED_PIX] = hs_tool->hue_saturation->hue_transfer[i][rgb[RED_PIX]];
|
|
|
|
rgb[GREEN_PIX] = hs_tool->hue_saturation->lightness_transfer[i][rgb[GREEN_PIX]];
|
|
|
|
rgb[BLUE_PIX] = hs_tool->hue_saturation->saturation_transfer[i][rgb[BLUE_PIX]];
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gimp_hls_to_rgb_int (rgb, rgb + 1, rgb + 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gimp_rgb_set_uchar (&color,
|
|
|
|
(guchar) rgb[0], (guchar) rgb[1], (guchar) rgb[2]);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
gimp_color_area_set_color (GIMP_COLOR_AREA (hs_tool->hue_partition_da[i]),
|
|
|
|
&color);
|
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-22 19:14:29 +08:00
|
|
|
hue_saturation_partition_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
|
|
|
GimpHueRange partition;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
partition = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
|
|
|
"hue_partition"));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
if (hs_tool->hue_partition != partition)
|
|
|
|
{
|
|
|
|
hs_tool->hue_partition = partition;
|
|
|
|
hue_saturation_update (hs_tool, SLIDERS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
hue_saturation_partition_reset_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpHueSaturationTool *hs_tool;
|
|
|
|
|
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
|
|
|
|
|
|
|
hue_saturation_partition_reset (hs_tool->hue_saturation,
|
|
|
|
hs_tool->hue_partition);
|
2002-08-26 19:35:56 +08:00
|
|
|
hue_saturation_update (hs_tool, ALL);
|
More color correction stuff cleanup:
2002-09-04 Michael Natterer <mitch@gimp.org>
More color correction stuff cleanup:
* app/base/Makefile.am
* app/base/base-types.h
* app/base/levels.[ch]: new files containing levels_lut_func(), a
new "Levels" parameter struct and the "auto levels" stuff.
* app/base/lut-funcs.[ch]: removed the levels stuff here, added
lots of g_return_if_fail().
* app/base/color-balance.[ch]
* app/base/hue-saturation.[ch]: added init() and reset() functions
so we don't need to duplicate this code in the tool and the pdb
wrappers.
* app/base/curves.[ch]: s/gint/GimpHistogramChannel/g, made
curves_channel_reset() initialize the curves array.
* app/tools/gimpcolorbalancetool.[ch]: use the new functions,
moved the "Range" frame to the top, added a per-range "Reset"
button, made the global "Reset" button reset all ranges and
the "Preserve Luminosity" toggle.
* app/tools/gimpcurvestool.[ch]: don't initialize the curves
array manually, as curves_channel_reset() does that,
s/gint/GimpHistogramChannel/g.
* app/tools/gimphuesaturationtool.c: use the new functions, added
a per-channel "Reset" button and made the global "Reset" button
reset all channels, cleaned up the GUI update function.
* app/tools/gimplevelstool.[ch]: changed to use the new Levels
parameter struct and it's utility functions. Removed stuff
which now lives in base/levels.c
* app/tools/gimpimagemaptool.c: align the "Preview" button
bottom-left, not bottom-right.
* tools/pdbgen/pdb/color.pdb: use the new stuff and removed
uglyness because using the "Levels" struct makes the code more
straightforward.
* app/pdb/color_cmds.c: regenerated.
2002-09-04 23:25:15 +08:00
|
|
|
|
|
|
|
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-22 19:14:29 +08:00
|
|
|
hue_saturation_hue_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
|
|
|
GimpHueRange part;
|
|
|
|
|
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
part = hs_tool->hue_partition;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
if (hs_tool->hue_saturation->hue[part] != adjustment->value)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_saturation->hue[part] = adjustment->value;
|
|
|
|
hue_saturation_update (hs_tool, DRAW);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-22 19:14:29 +08:00
|
|
|
hue_saturation_lightness_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
|
|
|
GimpHueRange part;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
part = hs_tool->hue_partition;
|
|
|
|
|
|
|
|
if (hs_tool->hue_saturation->lightness[part] != adjustment->value)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_saturation->lightness[part] = adjustment->value;
|
|
|
|
hue_saturation_update (hs_tool, DRAW);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-22 19:14:29 +08:00
|
|
|
hue_saturation_saturation_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
GimpHueSaturationTool *hs_tool;
|
|
|
|
GimpHueRange part;
|
|
|
|
|
|
|
|
hs_tool = GIMP_HUE_SATURATION_TOOL (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
part = hs_tool->hue_partition;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
if (hs_tool->hue_saturation->saturation[part] != adjustment->value)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
hs_tool->hue_saturation->saturation[part] = adjustment->value;
|
|
|
|
hue_saturation_update (hs_tool, DRAW);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (hs_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|