gimp/app/base/color-balance.c

228 lines
6.0 KiB
C
Raw Normal View History

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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1997-11-25 06:05:25 +08:00
*/
#include "config.h"
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
#include <glib-object.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
#include "base-types.h"
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
#include "color-balance.h"
#include "pixel-region.h"
1997-11-25 06:05:25 +08:00
/* local function prototypes */
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
static void color_balance_transfer_init (void);
namespace cleanups. 1999-06-21 Michael Natterer <mitschel@cs.tu-berlin.de> * app/context_manager.c: namespace cleanups. * app/commands.[ch] * app/menus.c: moved the "Toggle Selection" menu entry to "View", sprinkled some separators and made the layers/channels/paths popup menus consistent with Tigert's last ops buttons change. * app/fileops.c * app/plug_in.c: check for gdisplay_active() returning NULL in some more places. * app/[all tool related files]: - Turned the ToolAction and ToolState #define's into typedef'ed enums, so the compiler can do some more sanity checking. - Removed one more unused global variable "active_tool_layer". - Removed some #include's from tools.c. - Standardized the individual tools' structure names. - Moved showing/hiding the tool options to separate functions. - Stuff... * app/commands.c * app/disp_callbacks.c * app/gdisplay.c * app/tools.c: fixed the segfaults which happened when the image of one of the tools which have dialogs (levels/posterize/...) was deleted. My approach was to do stricter sanity checking and to set some gdisplay pointers correctly where appropriate, so I can't tell exactly where the bug was. The curves tool now(??) updates on every _second_ display change only, which is really obscure. Finding/changing the display to operate on should definitely be done by connecting to the user context's "display_changed" signal. * app/gimpset.c: emit the "remove" signal _after_ removing the pointer from the set. If this was not a bug but a feature, please let me know, we'll need two signals then.
1999-06-22 06:12:07 +08:00
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* private variables */
app/airbrush.c app/bezier_select.c app/blend.c app/brightness_contrast.c 1999-04-12 Michael Natterer <mitschel@cs.tu-berlin.de> * app/airbrush.c * app/bezier_select.c * app/blend.c * app/brightness_contrast.c * app/bucket_fill.c * app/by_color_select.c * app/clone.c * app/color_balance.c * app/color_picker.c * app/convolve.c * app/crop.c * app/curves.c * app/ellipse_select.c * app/eraser.c * app/flip_tool.c * app/free_select.c * app/fuzzy_select.c * app/histogram_tool.c * app/hue_saturation.c * app/ink.c * app/iscissors.c * app/levels.c * app/magnify.c * app/move.c * app/paintbrush.c * app/pencil.c * app/posterize.c * app/rect_select.[ch] * app/text_tool.c * app/threshold.c * app/transform_tool.c * app/tools.[ch] * app/toolsF.h: again: all tools :( * app/Makefile.am * app/tool_options.[ch] * app/selection_options.h * app/tool_options_ui.h: new files. Ok, this time it's general enough for future extensions: - The tool options structures are organized like the gtk object system to allow derived tool options. - Renamed all create and reset functions to *_options_new() and *_options_reset() to reflect this. - Changed tools_register() again. Now it takes just a pointer to a ToolOptions structure. - Moved almost the entire tool options gui code to tool_options.c. - Visually separated the common selection options from the tool-specific ones. I'd like to do the same with opacity/paint mode in all paint tool options but I think this needs some more discussion. * app/histogram_tool.c: changed packing boxes, label alignments. * app/paintbrush.c: some more sensitive settings. The gradient feature can now be toggled with a button. Hopefully didn't break anything.
1999-04-13 01:55:06 +08:00
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
static gboolean transfer_initialized = FALSE;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* for lightening */
static gdouble highlights_add[256] = { 0 };
static gdouble midtones_add[256] = { 0 };
static gdouble shadows_add[256] = { 0 };
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* for darkening */
static gdouble highlights_sub[256] = { 0 };
static gdouble midtones_sub[256] = { 0 };
static gdouble shadows_sub[256] = { 0 };
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* public functions */
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
void
color_balance_init (ColorBalance *cb)
{
GimpTransferMode range;
g_return_if_fail (cb != NULL);
for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++)
color_balance_range_reset (cb, range);
cb->preserve_luminosity = TRUE;
}
void
color_balance_range_reset (ColorBalance *cb,
GimpTransferMode range)
{
g_return_if_fail (cb != NULL);
cb->cyan_red[range] = 0.0;
cb->magenta_green[range] = 0.0;
cb->yellow_blue[range] = 0.0;
}
void
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
color_balance_create_lookup_tables (ColorBalance *cb)
{
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gdouble *cyan_red_transfer[3];
gdouble *magenta_green_transfer[3];
gdouble *yellow_blue_transfer[3];
gint i;
gint32 r_n, g_n, b_n;
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_return_if_fail (cb != NULL);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
if (! transfer_initialized)
{
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
color_balance_transfer_init ();
transfer_initialized = TRUE;
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* Set the transfer arrays (for speed) */
cyan_red_transfer[GIMP_SHADOWS] =
(cb->cyan_red[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
cyan_red_transfer[GIMP_MIDTONES] =
(cb->cyan_red[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
cyan_red_transfer[GIMP_HIGHLIGHTS] =
(cb->cyan_red[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
magenta_green_transfer[GIMP_SHADOWS] =
(cb->magenta_green[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
magenta_green_transfer[GIMP_MIDTONES] =
(cb->magenta_green[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
magenta_green_transfer[GIMP_HIGHLIGHTS] =
(cb->magenta_green[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
yellow_blue_transfer[GIMP_SHADOWS] =
(cb->yellow_blue[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
yellow_blue_transfer[GIMP_MIDTONES] =
(cb->yellow_blue[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
yellow_blue_transfer[GIMP_HIGHLIGHTS] =
(cb->yellow_blue[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
for (i = 0; i < 256; i++)
{
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
r_n = i;
g_n = i;
b_n = i;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
r_n += cb->cyan_red[GIMP_SHADOWS] * cyan_red_transfer[GIMP_SHADOWS][r_n];
r_n = CLAMP0255 (r_n);
r_n += cb->cyan_red[GIMP_MIDTONES] * cyan_red_transfer[GIMP_MIDTONES][r_n];
r_n = CLAMP0255 (r_n);
r_n += cb->cyan_red[GIMP_HIGHLIGHTS] * cyan_red_transfer[GIMP_HIGHLIGHTS][r_n];
r_n = CLAMP0255 (r_n);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
g_n += cb->magenta_green[GIMP_SHADOWS] * magenta_green_transfer[GIMP_SHADOWS][g_n];
g_n = CLAMP0255 (g_n);
g_n += cb->magenta_green[GIMP_MIDTONES] * magenta_green_transfer[GIMP_MIDTONES][g_n];
g_n = CLAMP0255 (g_n);
g_n += cb->magenta_green[GIMP_HIGHLIGHTS] * magenta_green_transfer[GIMP_HIGHLIGHTS][g_n];
g_n = CLAMP0255 (g_n);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
b_n += cb->yellow_blue[GIMP_SHADOWS] * yellow_blue_transfer[GIMP_SHADOWS][b_n];
b_n = CLAMP0255 (b_n);
b_n += cb->yellow_blue[GIMP_MIDTONES] * yellow_blue_transfer[GIMP_MIDTONES][b_n];
b_n = CLAMP0255 (b_n);
b_n += cb->yellow_blue[GIMP_HIGHLIGHTS] * yellow_blue_transfer[GIMP_HIGHLIGHTS][b_n];
b_n = CLAMP0255 (b_n);
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
cb->r_lookup[i] = r_n;
cb->g_lookup[i] = g_n;
cb->b_lookup[i] = b_n;
}
}
void
1997-11-25 06:05:25 +08:00
color_balance (PixelRegion *srcPR,
PixelRegion *destPR,
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
gpointer data)
1997-11-25 06:05:25 +08:00
{
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
ColorBalance *cb;
guchar *src, *s;
guchar *dest, *d;
gboolean alpha;
gint r, g, b;
gint r_n, g_n, b_n;
gint w, h;
cb = (ColorBalance *) data;
h = srcPR->h;
src = srcPR->data;
dest = destPR->data;
1997-11-25 06:05:25 +08:00
alpha = (srcPR->bytes == 4) ? TRUE : FALSE;
while (h--)
{
w = srcPR->w;
s = src;
d = dest;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
1997-11-25 06:05:25 +08:00
while (w--)
{
r = s[RED_PIX];
g = s[GREEN_PIX];
b = s[BLUE_PIX];
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
r_n = cb->r_lookup[r];
g_n = cb->g_lookup[g];
b_n = cb->b_lookup[b];
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
if (cb->preserve_luminosity)
1997-11-25 06:05:25 +08:00
{
gimp_rgb_to_hsl_int (&r_n, &g_n, &b_n);
b_n = gimp_rgb_to_l_int (r, g, b);
gimp_hsl_to_rgb_int (&r_n, &g_n, &b_n);
1997-11-25 06:05:25 +08:00
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
d[RED_PIX] = r_n;
1997-11-25 06:05:25 +08:00
d[GREEN_PIX] = g_n;
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
d[BLUE_PIX] = b_n;
1997-11-25 06:05:25 +08:00
if (alpha)
d[ALPHA_PIX] = s[ALPHA_PIX];
s += srcPR->bytes;
d += destPR->bytes;
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
src += srcPR->rowstride;
1997-11-25 06:05:25 +08:00
dest += destPR->rowstride;
}
}
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
/* private functions */
app/gimpprogress.[ch] s/GDisplay/GimpDisplay/ 2001-10-16 Michael Natterer <mitch@gimp.org> * app/gimpprogress.[ch] * app/undo.c: s/GDisplay/GimpDisplay/ * app/plug_in.[ch]: removed unused boolean "destroy" field of the PlugIn struct. * app/core/gimpedit.c: don't include "app_procs.h" * app/display/gimpdisplay-callbacks.c: moved the "grab_abd_scroll" stuff from gimpdisplay-scroll.* here (less complicated and easier to cleanup...) * app/display/gimpdisplay-scroll.[ch]: removed here. * app/display/gimpdisplay-render.[ch] * app/display/gimpdisplay-selection.[ch] * app/display/gimpdisplayshell.c: s/GDisplay/GimpDisplay/g * app/display/gimpdisplay.[ch]: ditto, removed gdisplay_active() which was just a wrapper around "gimp_context_get_display (gimp_get_user_context (the_gimp))" (which is more to type but makes the use of the global "the_gimp" variable more obvious). * app/gui/color-area.h * app/gui/edit-commands.c * app/gui/file-commands.c * app/gui/file-dialog-utils.c * app/gui/image-commands.c * app/gui/info-window.h * app/gui/paths-dialog.h * app/gui/select-commands.c * app/gui/tool-options-dialog.c * app/gui/tools-commands.c * app/gui/view-commands.c: s/GDisplay/GimpDisplay/, gdisplay_active() removal, include "app_procs.h" for "the_gimp". * app/tools/gimpbezierselecttool.h * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimpeditselectiontool.h * app/tools/gimphistogramtool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpmovetool.h * app/tools/gimpperspectivetool.h * app/tools/gimpposterizetool.[ch] * app/tools/gimprotatetool.h * app/tools/gimpscaletool.h * app/tools/gimpsheartool.h * app/tools/gimptexttool.h * app/tools/gimpthresholdtool.[ch] * app/tools/gimptool.[ch] * app/tools/gimptransformtool.h * app/tools/tool_manager.[ch]: lots of s/GDisplay/GimpDisplay/, made all *_dialog_hide() functions private, cleanup. * app/widgets/*: removed GtkType and gtk_type_* stuff entirely and use GObject functions, removed lots of empty "destroy" methods and use more type checking class cast macros instead of casting directly. * app/widgets/gimpcontainermenu.c: fixed item insert order. * app/widgets/gimphistogramview.[ch]: cleaned up and renamed all functions. * app/widgets/gimpwidgets-utils.[ch]: removed gimp_dialog_hide() as Gtk+ does the right thing (TM) now. * tools/pdbgen/pdb/color.pdb: implemented "histogram" without digging into tools/ and widgets/ (needs to be done for all color PDB functions). * tools/pdbgen/pdb/gimprc.pdb: no need to use "the_gimp" in a PDB function as a "Gimp" pointer is passed to them all. * tools/pdbgen/pdb/image.pdb: don't include "app_procs.h" * app/pdb/color_cmds.c * app/pdb/gimprc_cmds.c * app/pdb/image_cmds.c: regenerated. * app/pdb/procedural_db.c: don't include "app_procs.h"
2001-10-17 19:33:43 +08:00
1997-11-25 06:05:25 +08:00
static void
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
color_balance_transfer_init (void)
{
gint i;
for (i = 0; i < 256; i++)
{
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
highlights_add[i] =
shadows_sub[255 - i] = (1.075 - 1 / ((gdouble) i / 16.0 + 1));
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
midtones_add[i] =
midtones_sub[i] = 0.667 * (1 - SQR (((gdouble) i - 127.0) / 127.0));
1997-11-25 06:05:25 +08:00
Color correction tool chopping: 2002-08-26 Michael Natterer <mitch@gimp.org> Color correction tool chopping: * app/Makefile.am * app/image_map.[ch]: removed... * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimagemap.[ch]: ...and added here as object. * app/base/Makefile.am * app/base/base-types.h * app/base/color-balance.[ch] * app/base/curves.[ch] * app/base/hue-saturation.[ch] * app/base/threshold.[ch]: the lowlevel color correction functions plus their parameter structs cut out of the resp. tools. * app/core/core-enums.[ch]: removed GimpTransferMode enum... * app/base/base-enums.[ch]: ...added it here. Also added GimpHueRange for the new hue-saturation files. * tools/pdbgen/enums.pl * libgimp/gimpenums.h * plug-ins/script-fu/script-fu-constants.c: regenerated. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.c: removed (code went to base/color-balance.c). * app/tools/gimpimagemaptool.[ch]: added most code which was diplicated in subclasses. Create the dialog here with a nice title bar including image preview and name (fixes #66033). Added virtual functions map(), dialog() and reset() which need to be implemented by subclasses. * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpcolorbalancetool.[ch] * app/tools/gimpcurvestool.[ch] * app/tools/gimphuesaturationtool.[ch] * app/tools/gimplevelstool.[ch] * app/tools/gimpposterizetool.[ch] * app/tools/gimpthresholdtool.[ch]: removed tons of duplicated code and simply implement GimpImageMapTool's virtual functions. Removed all dialog structs and keep the variables in the tool structs. The dialogs are now created on-the-fly and destroyed when the tool goes away, which makes all callbacks much simpler and safer. Lots of GUI & code cleanup in all dialogs. * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: added separate "Reset Channel" buttons and let the global "Reset" buttons reset all color channels. * app/tools/tools.c: the various antique foo_free() functions don't exist any more. * app/tools/gimphistogramtool.c: removed ImageMap field from dialog struct (it was unused). Cleaned up dialog a bit. * tools/pdbgen/Makefile.am: don't scan tools/gimphuesaturationtool.h for enums. * tools/pdbgen/pdb/color.pdb: use the new stuff from base/ and don't include stuff from tools/ any more. * app/pdb/color_cmds.c * app/pdb/paint_tools_cmds.c: regenerated.
2002-08-26 19:35:56 +08:00
shadows_add[i] =
highlights_sub[i] = 0.667 * (1 - SQR (((gdouble) i - 127.0) / 127.0));
1997-11-25 06:05:25 +08:00
}
}