2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* 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-17 05:37:03 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2002-05-03 20:45:22 +08:00
|
|
|
#include "tools-types.h"
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
#include "base/gimplut.h"
|
|
|
|
#include "base/lut-funcs.h"
|
|
|
|
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#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
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
#include "gimpbrightnesscontrasttool.h"
|
2004-02-22 22:28:53 +08:00
|
|
|
#include "gimpimagemapoptions.h"
|
2005-06-01 03:33:14 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
|
2001-01-25 06:36:18 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#define SLIDER_WIDTH 200
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
#define BRIGHTNESS 0x1
|
|
|
|
#define CONTRAST 0x2
|
|
|
|
#define ALL (BRIGHTNESS | CONTRAST)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2007-02-28 02:55:12 +08:00
|
|
|
static void gimp_brightness_contrast_tool_finalize (GObject *object);
|
|
|
|
|
|
|
|
static gboolean gimp_brightness_contrast_tool_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
static void gimp_brightness_contrast_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_brightness_contrast_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_brightness_contrast_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
|
|
|
|
|
|
|
static void gimp_brightness_contrast_tool_map (GimpImageMapTool *image_map_tool);
|
|
|
|
static void gimp_brightness_contrast_tool_dialog (GimpImageMapTool *image_map_tool);
|
|
|
|
static void gimp_brightness_contrast_tool_reset (GimpImageMapTool *image_map_tool);
|
|
|
|
|
|
|
|
static void brightness_contrast_update (GimpBrightnessContrastTool *bc_tool,
|
|
|
|
gint update);
|
|
|
|
static void brightness_contrast_brightness_changed (GtkAdjustment *adj,
|
|
|
|
GimpBrightnessContrastTool *bc_tool);
|
|
|
|
static void brightness_contrast_contrast_changed (GtkAdjustment *adj,
|
|
|
|
GimpBrightnessContrastTool *bc_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
G_DEFINE_TYPE (GimpBrightnessContrastTool, gimp_brightness_contrast_tool,
|
2006-05-15 17:46:31 +08:00
|
|
|
GIMP_TYPE_IMAGE_MAP_TOOL)
|
1999-06-22 06:12:07 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
#define parent_class gimp_brightness_contrast_tool_parent_class
|
2001-05-25 07:57:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_brightness_contrast_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_BRIGHTNESS_CONTRAST_TOOL,
|
2004-02-22 22:28:53 +08:00
|
|
|
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
2003-06-28 19:20:37 +08:00
|
|
|
0,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-brightness-contrast-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Brightness-Contrast"),
|
2006-09-19 02:00:22 +08:00
|
|
|
_("Brightness/Contrast Tool: Adjust brightness and contrast"),
|
2004-04-29 21:19:28 +08:00
|
|
|
N_("B_rightness-Contrast..."), NULL,
|
2003-08-22 09:42:57 +08:00
|
|
|
NULL, GIMP_HELP_TOOL_BRIGHTNESS_CONTRAST,
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void
|
|
|
|
gimp_brightness_contrast_tool_class_init (GimpBrightnessContrastToolClass *klass)
|
|
|
|
{
|
2005-12-13 17:13:50 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
object_class->finalize = gimp_brightness_contrast_tool_finalize;
|
2002-08-26 19:35:56 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
tool_class->initialize = gimp_brightness_contrast_tool_initialize;
|
2005-06-01 03:33:14 +08:00
|
|
|
tool_class->button_press = gimp_brightness_contrast_tool_button_press;
|
|
|
|
tool_class->button_release = gimp_brightness_contrast_tool_button_release;
|
|
|
|
tool_class->motion = gimp_brightness_contrast_tool_motion;
|
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
im_tool_class->shell_desc = _("Adjust Brightness and Contrast");
|
2004-02-25 21:55:45 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
im_tool_class->map = gimp_brightness_contrast_tool_map;
|
|
|
|
im_tool_class->dialog = gimp_brightness_contrast_tool_dialog;
|
|
|
|
im_tool_class->reset = gimp_brightness_contrast_tool_reset;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void
|
|
|
|
gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-05-03 02:43:15 +08:00
|
|
|
bc_tool->brightness = 0.0;
|
|
|
|
bc_tool->contrast = 0.0;
|
|
|
|
bc_tool->lut = gimp_lut_new ();
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_brightness_contrast_tool_finalize (GObject *object)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-11-13 19:23:01 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (object);
|
2002-08-26 19:35:56 +08:00
|
|
|
|
|
|
|
if (bc_tool->lut)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
gimp_lut_free (bc_tool->lut);
|
|
|
|
bc_tool->lut = NULL;
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2004-01-22 00:07:48 +08:00
|
|
|
static gboolean
|
2006-09-27 04:55:40 +08:00
|
|
|
gimp_brightness_contrast_tool_initialize (GimpTool *tool,
|
|
|
|
GimpDisplay *display,
|
|
|
|
GError **error)
|
2002-08-26 19:35:56 +08:00
|
|
|
{
|
2003-11-13 19:23:01 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
|
2007-07-19 22:59:51 +08:00
|
|
|
drawable = gimp_image_get_active_drawable (display->image);
|
2002-08-26 19:35:56 +08:00
|
|
|
|
2003-11-13 19:23:01 +08:00
|
|
|
if (! drawable)
|
2004-01-22 00:07:48 +08:00
|
|
|
return FALSE;
|
2002-08-26 19:35:56 +08:00
|
|
|
|
2003-11-13 19:23:01 +08:00
|
|
|
if (gimp_drawable_is_indexed (drawable))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-09-27 04:55:40 +08:00
|
|
|
g_set_error (error, 0, 0,
|
|
|
|
_("Brightness-Contrast does not operate on indexed layers."));
|
2004-01-22 00:07:48 +08:00
|
|
|
return FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->brightness = 0.0;
|
|
|
|
bc_tool->contrast = 0.0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-09-27 04:55:40 +08:00
|
|
|
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
brightness_contrast_update (bc_tool, ALL);
|
2004-01-22 00:07:48 +08:00
|
|
|
|
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-05-25 07:57:08 +08:00
|
|
|
static void
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
|
2001-05-25 07:57:08 +08:00
|
|
|
{
|
2005-12-13 17:13:50 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
|
2002-08-26 19:35:56 +08:00
|
|
|
|
|
|
|
brightness_contrast_lut_setup (bc_tool->lut,
|
|
|
|
bc_tool->brightness / 255.0,
|
2006-04-12 20:49:29 +08:00
|
|
|
bc_tool->contrast / 127.0,
|
|
|
|
gimp_drawable_bytes (im_tool->drawable));
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_image_map_apply (im_tool->image_map,
|
2005-02-15 23:39:27 +08:00
|
|
|
(GimpImageMapApplyFunc) gimp_lut_process,
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->lut);
|
2001-05-25 07:57:08 +08:00
|
|
|
}
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
|
2005-06-01 03:33:14 +08:00
|
|
|
static void
|
|
|
|
gimp_brightness_contrast_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2005-06-01 03:33:14 +08:00
|
|
|
{
|
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
|
|
|
|
|
|
|
|
bc_tool->x = coords->x - bc_tool->contrast;
|
|
|
|
bc_tool->y = coords->y + bc_tool->brightness;
|
|
|
|
bc_tool->dx = bc_tool->contrast;
|
|
|
|
bc_tool->dy = - bc_tool->brightness;
|
|
|
|
|
|
|
|
gimp_tool_control_activate (tool->control);
|
2006-03-29 01:55:52 +08:00
|
|
|
tool->display = display;
|
2005-06-01 03:33:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-02-28 02:55:12 +08:00
|
|
|
gimp_brightness_contrast_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpButtonReleaseType release_type,
|
|
|
|
GimpDisplay *display)
|
2005-06-01 03:33:14 +08:00
|
|
|
{
|
2005-12-13 17:13:50 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
|
|
|
|
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
|
2005-06-01 03:33:14 +08:00
|
|
|
|
|
|
|
gimp_tool_control_halt (tool->control);
|
|
|
|
|
|
|
|
if (bc_tool->dx == 0 && bc_tool->dy == 0)
|
|
|
|
return;
|
|
|
|
|
2007-02-28 02:55:12 +08:00
|
|
|
if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_brightness_contrast_tool_reset (im_tool);
|
2005-06-01 03:33:14 +08:00
|
|
|
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_image_map_tool_preview (im_tool);
|
2005-06-01 03:33:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_brightness_contrast_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2005-06-01 03:33:14 +08:00
|
|
|
{
|
2005-12-13 17:13:50 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (tool);
|
|
|
|
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (tool);
|
2005-06-01 03:33:14 +08:00
|
|
|
|
|
|
|
gimp_tool_control_pause (tool->control);
|
|
|
|
|
|
|
|
bc_tool->dx = (coords->x - bc_tool->x);
|
|
|
|
bc_tool->dy = - (coords->y - bc_tool->y);
|
|
|
|
|
|
|
|
bc_tool->brightness = CLAMP (bc_tool->dy, -127.0, 127.0);
|
|
|
|
bc_tool->contrast = CLAMP (bc_tool->dx, -127.0, 127.0);
|
|
|
|
|
|
|
|
brightness_contrast_update (bc_tool, ALL);
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_image_map_tool_preview (im_tool);
|
2005-06-01 03:33:14 +08:00
|
|
|
|
|
|
|
gimp_tool_control_resume (tool->control);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/********************************/
|
|
|
|
/* Brightness Contrast dialog */
|
|
|
|
/********************************/
|
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
static void
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_brightness_contrast_tool_dialog (GimpImageMapTool *im_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-12-13 17:13:50 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
|
2002-08-26 19:35:56 +08:00
|
|
|
GtkWidget *table;
|
2002-08-29 03:47:07 +08:00
|
|
|
GtkWidget *slider;
|
2002-08-26 19:35:56 +08:00
|
|
|
GtkObject *data;
|
1999-09-28 01:58:10 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* The table containing sliders */
|
|
|
|
table = gtk_table_new (2, 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);
|
2005-12-13 17:13:50 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (im_tool->main_vbox), table,
|
2002-08-26 19:35:56 +08:00
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Create the brightness scale widget */
|
2002-08-26 19:35:56 +08:00
|
|
|
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("_Brightness:"), SLIDER_WIDTH, -1,
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->brightness,
|
|
|
|
-127.0, 127.0, 1.0, 10.0, 0,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
|
|
|
bc_tool->brightness_data = GTK_ADJUSTMENT (data);
|
2002-08-29 03:47:07 +08:00
|
|
|
slider = GIMP_SCALE_ENTRY_SCALE (data);
|
2005-09-03 23:45:04 +08:00
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (data, "value-changed",
|
2007-02-28 02:55:12 +08:00
|
|
|
G_CALLBACK (brightness_contrast_brightness_changed),
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Create the contrast scale widget */
|
2002-08-26 19:35:56 +08:00
|
|
|
data = gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
2002-09-07 04:44:47 +08:00
|
|
|
_("Con_trast:"), SLIDER_WIDTH, -1,
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->contrast,
|
|
|
|
-127.0, 127.0, 1.0, 10.0, 0,
|
|
|
|
TRUE, 0.0, 0.0,
|
|
|
|
NULL, NULL);
|
|
|
|
bc_tool->contrast_data = GTK_ADJUSTMENT (data);
|
2002-08-29 03:47:07 +08:00
|
|
|
slider = GIMP_SCALE_ENTRY_SCALE (data);
|
2005-09-03 23:45:04 +08:00
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_CONTINUOUS);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (data, "value-changed",
|
2007-02-28 02:55:12 +08:00
|
|
|
G_CALLBACK (brightness_contrast_contrast_changed),
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-12-13 17:13:50 +08:00
|
|
|
gimp_brightness_contrast_tool_reset (GimpImageMapTool *im_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-12-13 17:13:50 +08:00
|
|
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
|
1999-06-23 23:24:46 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->brightness = 0.0;
|
|
|
|
bc_tool->contrast = 0.0;
|
1999-06-26 19:16:47 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
brightness_contrast_update (bc_tool, ALL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-08-26 19:35:56 +08:00
|
|
|
brightness_contrast_update (GimpBrightnessContrastTool *bc_tool,
|
2005-06-01 03:33:14 +08:00
|
|
|
gint update)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
if (update & BRIGHTNESS)
|
|
|
|
gtk_adjustment_set_value (bc_tool->brightness_data, bc_tool->brightness);
|
2002-05-09 01:48:24 +08:00
|
|
|
|
2002-08-26 19:35:56 +08:00
|
|
|
if (update & CONTRAST)
|
|
|
|
gtk_adjustment_set_value (bc_tool->contrast_data, bc_tool->contrast);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-02-28 02:55:12 +08:00
|
|
|
brightness_contrast_brightness_changed (GtkAdjustment *adjustment,
|
|
|
|
GimpBrightnessContrastTool *bc_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
if (bc_tool->brightness != adjustment->value)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->brightness = adjustment->value;
|
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 (bc_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-02-28 02:55:12 +08:00
|
|
|
brightness_contrast_contrast_changed (GtkAdjustment *adjustment,
|
|
|
|
GimpBrightnessContrastTool *bc_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
if (bc_tool->contrast != adjustment->value)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-08-26 19:35:56 +08:00
|
|
|
bc_tool->contrast = adjustment->value;
|
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 (bc_tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|