1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
#include "appenv.h"
|
|
|
|
#include "color_balance.h"
|
|
|
|
#include "color_transfer.h"
|
|
|
|
#include "drawable.h"
|
|
|
|
#include "gdisplay.h"
|
1999-09-28 01:58:10 +08:00
|
|
|
#include "gimpui.h"
|
1997-11-25 06:05:25 +08:00
|
|
|
#include "image_map.h"
|
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
app/appenv.h New file. Includes <math.h>. Move G_PI, RINT(), ROUND() etc
1999-09-01 Tor Lillqvist <tml@iki.fi>
* app/appenv.h
* libgimp/gimpmath.h: New file. Includes <math.h>. Move G_PI,
RINT(), ROUND() etc from app/appenv.h here, so plug-ins can
use them, too. Remove some commented-out old stuff in appenv.h.
* libgimp/gimp.h: Include gimpmath.h.
* libgimp/gimp.c (gimp_main): Win32: Don't install signal
handlers, we can't do anything useful in the handler ourselves
anyway (it would be nice to print out a backtrace, but that seems
pretty hard to do, even if not impossible). Let Windows inform the
user about the crash. If the plug-in was compiled with MSVC, and
the user also has it, she is offered a chance to start the
debugger automatically anyway.
* app/*several*.c: Include gimpmath.h for G_PI etc. Don't include
<math.h>, as gimpmath.h includes it.
* plug-ins/*/*many*.c: Include config.h. Don't include <math.h>.
Remove all the duplicated definitions of G_PI and rint(). Use
RINT() instead of rint().
* app/app_procs.[ch]: app_exit() takes a gboolean.
* app/batch.c
* app/commands.c
* app/interface.c: Call app_exit() with FALSE or TRUE.
* app/main.c (on_error): Call gimp_fatal_error. (main): Don't
install any signal handler on Win32 here, either.
* app/errors.c (gimp_fatal_error, gimp_terminate): Win32: Format
the message and call MessageBox with it. g_on_error_query doesn't
do anything useful on Win32, and printf'ing a message to stdout or
stderr doesn't do anything, either, in a windowing application.
1999-09-02 04:30:56 +08:00
|
|
|
#include "libgimp/gimpmath.h"
|
2000-01-03 09:58:43 +08:00
|
|
|
#include "libgimp/gimpcolorspace.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
#define CYAN_RED 0x1
|
|
|
|
#define MAGENTA_GREEN 0x2
|
|
|
|
#define YELLOW_BLUE 0x4
|
|
|
|
#define ALL (CYAN_RED | MAGENTA_GREEN | YELLOW_BLUE)
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the color balance structures */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
typedef struct _ColorBalance ColorBalance;
|
1999-11-21 02:08:41 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
struct _ColorBalance
|
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
gint x, y; /* coords for last mouse click */
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* the color balance tool options */
|
1999-04-13 01:55:06 +08:00
|
|
|
static ToolOptions *color_balance_options = NULL;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
|
|
|
/* the color balance dialog */
|
|
|
|
static ColorBalanceDialog *color_balance_dialog = NULL;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-04-09 06:25:54 +08:00
|
|
|
/* color balance action functions */
|
1999-06-22 06:12:07 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
static void color_balance_control (Tool *, ToolAction, gpointer);
|
1999-06-22 06:12:07 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
static ColorBalanceDialog * color_balance_dialog_new (void);
|
1999-06-22 06:12:07 +08:00
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
static void color_balance_update (ColorBalanceDialog *, int);
|
|
|
|
static void color_balance_preview (ColorBalanceDialog *);
|
1999-11-22 19:14:29 +08:00
|
|
|
static void color_balance_reset_callback (GtkWidget *, gpointer);
|
1999-11-21 02:08:41 +08:00
|
|
|
static void color_balance_ok_callback (GtkWidget *, gpointer);
|
|
|
|
static void color_balance_cancel_callback (GtkWidget *, gpointer);
|
1999-11-22 19:14:29 +08:00
|
|
|
static void color_balance_range_callback (GtkWidget *, gpointer);
|
1999-11-21 02:08:41 +08:00
|
|
|
static void color_balance_preserve_update (GtkWidget *, gpointer);
|
|
|
|
static void color_balance_preview_update (GtkWidget *, gpointer);
|
|
|
|
static void color_balance_cr_adjustment_update (GtkAdjustment *, gpointer);
|
|
|
|
static void color_balance_mg_adjustment_update (GtkAdjustment *, gpointer);
|
|
|
|
static void color_balance_yb_adjustment_update (GtkAdjustment *, gpointer);
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* color balance machinery */
|
|
|
|
|
moved a bunch of PDB stuff here
* app/color_cmds.c: moved a bunch of PDB stuff here
* app/color_balance.[ch]: removed PDB proc, exported TransferMode
enum, ColorBalanceDialog, color_balance_create_lookup_tables, and
color_balance
* app/curves.[ch]: removed PDB procs, exported SMOOTH and GFREE
#defines, CurvesDialog, curves_lut_func and curves_calculate_curve
* app/desaturate.[ch]: removed PDB proc, exported desaturate
* app/equalize.[ch]: removed PDB proc, exported equalize
* app/histogram_tool.[ch]: removed PDB proc, exported HISTOGRAM_WIDTH
and HISTOGRAM_HEIGHT #defines, HistogramToolDialog,
histogram_tool_histogram_range
* app/hue_saturation.[ch]: removed PDB proc, exported HueRange enum,
HueSaturationDialog, hue_saturation_calculate_transfers,
hue_saturation
* app/invert.[ch]: remove PDB proc, export invert
* app/threshold.[ch]: remove PDB proc, export ThresholdDialog and
threshold_2
* internal_procs.c: changes for pdbgen
* app/gimprc.c: removed leftover declaration
* app/image_map.h: add #include "gimpdrawableF.h"
* app/lut_funcs.h: add ALPHA_LUT to ChannelLutType
-Yosh
1999-04-21 13:39:57 +08:00
|
|
|
void
|
1997-11-25 06:05:25 +08:00
|
|
|
color_balance (PixelRegion *srcPR,
|
|
|
|
PixelRegion *destPR,
|
1999-11-21 02:08:41 +08:00
|
|
|
void *data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
1999-11-21 02:08:41 +08:00
|
|
|
guchar *src, *s;
|
|
|
|
guchar *dest, *d;
|
|
|
|
gint alpha;
|
|
|
|
gint r, g, b;
|
|
|
|
gint r_n, g_n, b_n;
|
|
|
|
gint w, h;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd = (ColorBalanceDialog *) data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
h = srcPR->h;
|
|
|
|
src = srcPR->data;
|
|
|
|
dest = destPR->data;
|
|
|
|
alpha = (srcPR->bytes == 4) ? TRUE : FALSE;
|
|
|
|
|
|
|
|
while (h--)
|
|
|
|
{
|
|
|
|
w = srcPR->w;
|
|
|
|
s = src;
|
|
|
|
d = dest;
|
|
|
|
while (w--)
|
|
|
|
{
|
1999-02-01 16:22:18 +08:00
|
|
|
r = s[RED_PIX];
|
|
|
|
g = s[GREEN_PIX];
|
|
|
|
b = s[BLUE_PIX];
|
|
|
|
|
|
|
|
r_n = cbd->r_lookup[r];
|
|
|
|
g_n = cbd->g_lookup[g];
|
|
|
|
b_n = cbd->b_lookup[b];
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (cbd->preserve_luminosity)
|
|
|
|
{
|
2000-01-03 09:58:43 +08:00
|
|
|
gimp_rgb_to_hls (&r_n, &g_n, &b_n);
|
|
|
|
g_n = gimp_rgb_to_l (r, g, b);
|
|
|
|
gimp_hls_to_rgb (&r_n, &g_n, &b_n);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
d[RED_PIX] = r_n;
|
|
|
|
d[GREEN_PIX] = g_n;
|
|
|
|
d[BLUE_PIX] = b_n;
|
|
|
|
|
|
|
|
if (alpha)
|
|
|
|
d[ALPHA_PIX] = s[ALPHA_PIX];
|
|
|
|
|
|
|
|
s += srcPR->bytes;
|
|
|
|
d += destPR->bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
src += srcPR->rowstride;
|
|
|
|
dest += destPR->rowstride;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
/* color balance action functions */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
static void
|
1999-06-22 06:12:07 +08:00
|
|
|
color_balance_control (Tool *tool,
|
|
|
|
ToolAction action,
|
|
|
|
gpointer gdisp_ptr)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalance * color_bal;
|
|
|
|
|
|
|
|
color_bal = (ColorBalance *) tool->private;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
1999-06-22 06:12:07 +08:00
|
|
|
case PAUSE:
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
|
|
|
case RESUME:
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
|
|
|
case HALT:
|
1997-11-25 06:05:25 +08:00
|
|
|
if (color_balance_dialog)
|
1999-06-26 19:16:47 +08:00
|
|
|
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
1999-06-22 06:12:07 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Tool *
|
1999-11-21 02:08:41 +08:00
|
|
|
tools_new_color_balance (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
Tool * tool;
|
|
|
|
ColorBalance * private;
|
|
|
|
|
|
|
|
/* The tool options */
|
|
|
|
if (!color_balance_options)
|
1999-04-09 06:25:54 +08:00
|
|
|
{
|
1999-04-13 01:55:06 +08:00
|
|
|
color_balance_options = tool_options_new (_("Color Balance Options"));
|
|
|
|
tools_register (COLOR_BALANCE, color_balance_options);
|
1999-04-09 06:25:54 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool = tools_new_tool (COLOR_BALANCE);
|
|
|
|
private = g_new (ColorBalance, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool->scroll_lock = TRUE; /* Disallow scrolling */
|
|
|
|
tool->preserve = FALSE; /* Don't preserve on drawable change */
|
1999-06-26 19:16:47 +08:00
|
|
|
|
1999-07-03 01:40:10 +08:00
|
|
|
tool->private = (void *) private;
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
tool->control_func = color_balance_control;
|
|
|
|
|
|
|
|
return tool;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tools_free_color_balance (Tool *tool)
|
|
|
|
{
|
|
|
|
ColorBalance * color_bal;
|
|
|
|
|
|
|
|
color_bal = (ColorBalance *) tool->private;
|
|
|
|
|
|
|
|
/* Close the color select dialog */
|
|
|
|
if (color_balance_dialog)
|
1998-04-02 12:51:44 +08:00
|
|
|
color_balance_cancel_callback (NULL, (gpointer) color_balance_dialog);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
g_free (color_bal);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-06-22 04:17:21 +08:00
|
|
|
color_balance_initialize (GDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (! drawable_color (gimage_active_drawable (gdisp->gimage)))
|
|
|
|
{
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
g_message (_("Color balance operates only on RGB color drawables."));
|
1997-11-25 06:05:25 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The color balance dialog */
|
|
|
|
if (!color_balance_dialog)
|
1999-11-22 19:14:29 +08:00
|
|
|
color_balance_dialog = color_balance_dialog_new ();
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
|
|
|
if (!GTK_WIDGET_VISIBLE (color_balance_dialog->shell))
|
|
|
|
gtk_widget_show (color_balance_dialog->shell);
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
1999-11-22 19:14:29 +08:00
|
|
|
color_balance_dialog->cyan_red[i] = 0.0;
|
1997-11-25 06:05:25 +08:00
|
|
|
color_balance_dialog->magenta_green[i] = 0.0;
|
1999-11-22 19:14:29 +08:00
|
|
|
color_balance_dialog->yellow_blue[i] = 0.0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1998-01-22 15:02:57 +08:00
|
|
|
color_balance_dialog->drawable = gimage_active_drawable (gdisp->gimage);
|
1999-06-26 19:16:47 +08:00
|
|
|
color_balance_dialog->image_map =
|
|
|
|
image_map_create (gdisp, color_balance_dialog->drawable);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
color_balance_update (color_balance_dialog, ALL);
|
|
|
|
}
|
|
|
|
|
1999-06-26 19:16:47 +08:00
|
|
|
/**************************/
|
|
|
|
/* Color Balance dialog */
|
|
|
|
/**************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1998-03-19 06:35:31 +08:00
|
|
|
static ColorBalanceDialog *
|
1999-11-22 19:14:29 +08:00
|
|
|
color_balance_dialog_new (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *start_label;
|
|
|
|
GtkWidget *end_label;
|
|
|
|
GtkWidget *label;
|
1999-11-21 02:08:41 +08:00
|
|
|
GtkWidget *spinbutton;
|
1997-11-25 06:05:25 +08:00
|
|
|
GtkWidget *slider;
|
|
|
|
GtkWidget *toggle;
|
|
|
|
GtkWidget *radio_button;
|
|
|
|
GtkObject *data;
|
|
|
|
GSList *group = NULL;
|
1999-09-28 01:58:10 +08:00
|
|
|
gint i;
|
1999-06-26 19:16:47 +08:00
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
gchar *appl_mode_names[] =
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
N_("Shadows"),
|
|
|
|
N_("Midtones"),
|
|
|
|
N_("Highlights")
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
1999-06-26 19:16:47 +08:00
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd = g_new (ColorBalanceDialog, 1);
|
1997-11-25 06:05:25 +08:00
|
|
|
cbd->preserve_luminosity = TRUE;
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd->preview = TRUE;
|
|
|
|
cbd->application_mode = SHADOWS;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The shell and main vbox */
|
1999-09-28 01:58:10 +08:00
|
|
|
cbd->shell = gimp_dialog_new (_("Color Balance"), "color_balance",
|
|
|
|
tools_help_func, NULL,
|
|
|
|
GTK_WIN_POS_NONE,
|
|
|
|
FALSE, TRUE, FALSE,
|
|
|
|
|
|
|
|
_("OK"), color_balance_ok_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
cbd, NULL, NULL, TRUE, FALSE,
|
1999-12-02 21:00:18 +08:00
|
|
|
_("Reset"), color_balance_reset_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
cbd, NULL, NULL, TRUE, FALSE,
|
1999-09-28 01:58:10 +08:00
|
|
|
_("Cancel"), color_balance_cancel_callback,
|
2000-01-07 00:40:17 +08:00
|
|
|
cbd, NULL, NULL, FALSE, TRUE,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
1999-09-28 01:58:10 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cbd->shell)->vbox), vbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Horizontal box for application mode */
|
1999-11-22 19:14:29 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
label = gtk_label_new (_("Color Levels:"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (label);
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
/* cyan-red spinbutton */
|
1999-11-22 19:14:29 +08:00
|
|
|
data = gtk_adjustment_new (0, -100.0, 100.0, 1.0, 10.0, 0.0);
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd->cyan_red_data = GTK_ADJUSTMENT (data);
|
|
|
|
|
|
|
|
spinbutton = gtk_spin_button_new (cbd->cyan_red_data, 1.0, 0);
|
|
|
|
gtk_widget_set_usize (spinbutton, 75, -1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
/* magenta-green spinbutton */
|
1999-11-22 19:14:29 +08:00
|
|
|
data = gtk_adjustment_new (0, -100.0, 100.0, 1.0, 10.0, 0.0);
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd->magenta_green_data = GTK_ADJUSTMENT (data);
|
|
|
|
|
|
|
|
spinbutton = gtk_spin_button_new (cbd->magenta_green_data, 1.0, 0);
|
|
|
|
gtk_widget_set_usize (spinbutton, 75, -1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
/* yellow-blue spinbutton */
|
1999-11-22 19:14:29 +08:00
|
|
|
data = gtk_adjustment_new (0, -100.0, 100.0, 1.0, 10.0, 0.0);
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd->yellow_blue_data = GTK_ADJUSTMENT (data);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
spinbutton = gtk_spin_button_new (cbd->yellow_blue_data, 1.0, 0);
|
|
|
|
gtk_widget_set_usize (spinbutton, 75, -1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* The table containing sliders */
|
|
|
|
table = gtk_table_new (3, 3, FALSE);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* Create the cyan-red scale widget */
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
start_label = gtk_label_new (_("Cyan"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (start_label), 1.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), start_label, 0, 1, 0, 1,
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
1999-11-21 02:08:41 +08:00
|
|
|
|
|
|
|
slider = gtk_hscale_new (cbd->cyan_red_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_scale_set_digits (GTK_SCALE (slider), 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 0, 1);
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cbd->cyan_red_data), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (color_balance_cr_adjustment_update),
|
1997-11-25 06:05:25 +08:00
|
|
|
cbd);
|
1999-11-21 02:08:41 +08:00
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
end_label = gtk_label_new (_("Red"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (end_label), 0.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), end_label, 2, 3, 0, 1,
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (start_label);
|
|
|
|
gtk_widget_show (end_label);
|
|
|
|
gtk_widget_show (slider);
|
|
|
|
|
|
|
|
/* Create the magenta-green scale widget */
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
start_label = gtk_label_new (_("Magenta"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (start_label), 1.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), start_label, 0, 1, 1, 2,
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
1999-11-21 02:08:41 +08:00
|
|
|
|
|
|
|
slider = gtk_hscale_new (cbd->magenta_green_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_scale_set_digits (GTK_SCALE (slider), 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 1, 2);
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cbd->magenta_green_data), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (color_balance_mg_adjustment_update),
|
1997-11-25 06:05:25 +08:00
|
|
|
cbd);
|
1999-11-21 02:08:41 +08:00
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
end_label = gtk_label_new (_("Green"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (end_label), 0.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), end_label, 2, 3, 1, 2,
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (start_label);
|
|
|
|
gtk_widget_show (end_label);
|
|
|
|
gtk_widget_show (slider);
|
|
|
|
|
|
|
|
/* Create the yellow-blue scale widget */
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
start_label = gtk_label_new (_("Yellow"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (start_label), 1.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), start_label, 0, 1, 2, 3,
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
1999-11-21 02:08:41 +08:00
|
|
|
|
|
|
|
slider = gtk_hscale_new (cbd->yellow_blue_data);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_scale_set_digits (GTK_SCALE (slider), 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), slider, 1, 2, 2, 3);
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (cbd->yellow_blue_data), "value_changed",
|
|
|
|
GTK_SIGNAL_FUNC (color_balance_yb_adjustment_update),
|
1997-11-25 06:05:25 +08:00
|
|
|
cbd);
|
1999-11-21 02:08:41 +08:00
|
|
|
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-15 07:23:52 +08:00
|
|
|
end_label = gtk_label_new (_("Blue"));
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_misc_set_alignment (GTK_MISC (end_label), 0.0, 1.0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), end_label, 2, 3, 2, 3,
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
gtk_widget_show (start_label);
|
|
|
|
gtk_widget_show (end_label);
|
|
|
|
gtk_widget_show (slider);
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_widget_show (table);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Horizontal box for application mode */
|
1999-11-21 02:08:41 +08:00
|
|
|
hbox = gtk_hbox_new (TRUE, 4);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* the radio buttons for application mode */
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
radio_button =
|
|
|
|
gtk_radio_button_new_with_label (group, gettext (appl_mode_names[i]));
|
1997-11-25 06:05:25 +08:00
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button));
|
1999-11-22 19:14:29 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), radio_button, TRUE, FALSE, 0);
|
|
|
|
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (radio_button), (gpointer) i);
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (radio_button), "toggled",
|
1999-11-22 19:14:29 +08:00
|
|
|
GTK_SIGNAL_FUNC (color_balance_range_callback),
|
1997-11-25 06:05:25 +08:00
|
|
|
cbd);
|
1999-11-22 19:14:29 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (radio_button);
|
|
|
|
}
|
1999-11-22 19:14:29 +08:00
|
|
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
/* Horizontal box for preview and preserve luminosity toggle buttons */
|
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* The preserve luminosity toggle */
|
|
|
|
toggle = gtk_check_button_new_with_label (_("Preserve Luminosity"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
|
|
|
cbd->preserve_luminosity);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC (color_balance_preserve_update),
|
|
|
|
cbd);
|
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
|
|
|
/* The preview toggle */
|
|
|
|
toggle = gtk_check_button_new_with_label (_("Preview"));
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), cbd->preview);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
|
|
|
GTK_SIGNAL_FUNC (color_balance_preview_update),
|
|
|
|
cbd);
|
|
|
|
gtk_widget_show (toggle);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
gtk_widget_show (cbd->shell);
|
|
|
|
|
|
|
|
return cbd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_balance_update (ColorBalanceDialog *cbd,
|
1999-11-21 02:08:41 +08:00
|
|
|
gint update)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
if (update & CYAN_RED)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_adjustment_set_value (cbd->cyan_red_data,
|
|
|
|
cbd->cyan_red[cbd->application_mode]);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-11-21 02:08:41 +08:00
|
|
|
if (update & MAGENTA_GREEN)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_adjustment_set_value (cbd->magenta_green_data,
|
|
|
|
cbd->magenta_green[cbd->application_mode]);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
1999-11-21 02:08:41 +08:00
|
|
|
if (update & YELLOW_BLUE)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
gtk_adjustment_set_value (cbd->yellow_blue_data,
|
|
|
|
cbd->yellow_blue[cbd->application_mode]);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
moved a bunch of PDB stuff here
* app/color_cmds.c: moved a bunch of PDB stuff here
* app/color_balance.[ch]: removed PDB proc, exported TransferMode
enum, ColorBalanceDialog, color_balance_create_lookup_tables, and
color_balance
* app/curves.[ch]: removed PDB procs, exported SMOOTH and GFREE
#defines, CurvesDialog, curves_lut_func and curves_calculate_curve
* app/desaturate.[ch]: removed PDB proc, exported desaturate
* app/equalize.[ch]: removed PDB proc, exported equalize
* app/histogram_tool.[ch]: removed PDB proc, exported HISTOGRAM_WIDTH
and HISTOGRAM_HEIGHT #defines, HistogramToolDialog,
histogram_tool_histogram_range
* app/hue_saturation.[ch]: removed PDB proc, exported HueRange enum,
HueSaturationDialog, hue_saturation_calculate_transfers,
hue_saturation
* app/invert.[ch]: remove PDB proc, export invert
* app/threshold.[ch]: remove PDB proc, export ThresholdDialog and
threshold_2
* internal_procs.c: changes for pdbgen
* app/gimprc.c: removed leftover declaration
* app/image_map.h: add #include "gimpdrawableF.h"
* app/lut_funcs.h: add ALPHA_LUT to ChannelLutType
-Yosh
1999-04-21 13:39:57 +08:00
|
|
|
void
|
1999-02-01 16:22:18 +08:00
|
|
|
color_balance_create_lookup_tables (ColorBalanceDialog *cbd)
|
|
|
|
{
|
1999-11-21 02:08:41 +08:00
|
|
|
gdouble *cyan_red_transfer[3];
|
|
|
|
gdouble *magenta_green_transfer[3];
|
|
|
|
gdouble *yellow_blue_transfer[3];
|
|
|
|
gint i;
|
1999-02-08 06:13:10 +08:00
|
|
|
gint32 r_n, g_n, b_n;
|
1999-11-21 02:08:41 +08:00
|
|
|
|
1999-02-01 16:22:18 +08:00
|
|
|
/* Set the transfer arrays (for speed) */
|
|
|
|
cyan_red_transfer[SHADOWS] = (cbd->cyan_red[SHADOWS] > 0) ? shadows_add : shadows_sub;
|
|
|
|
cyan_red_transfer[MIDTONES] = (cbd->cyan_red[MIDTONES] > 0) ? midtones_add : midtones_sub;
|
|
|
|
cyan_red_transfer[HIGHLIGHTS] = (cbd->cyan_red[HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
|
|
|
|
magenta_green_transfer[SHADOWS] = (cbd->magenta_green[SHADOWS] > 0) ? shadows_add : shadows_sub;
|
|
|
|
magenta_green_transfer[MIDTONES] = (cbd->magenta_green[MIDTONES] > 0) ? midtones_add : midtones_sub;
|
|
|
|
magenta_green_transfer[HIGHLIGHTS] = (cbd->magenta_green[HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
|
|
|
|
yellow_blue_transfer[SHADOWS] = (cbd->yellow_blue[SHADOWS] > 0) ? shadows_add : shadows_sub;
|
|
|
|
yellow_blue_transfer[MIDTONES] = (cbd->yellow_blue[MIDTONES] > 0) ? midtones_add : midtones_sub;
|
|
|
|
yellow_blue_transfer[HIGHLIGHTS] = (cbd->yellow_blue[HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
|
|
|
|
|
|
|
|
for (i = 0; i < 256; i++)
|
1999-11-21 02:08:41 +08:00
|
|
|
{
|
|
|
|
r_n = i;
|
|
|
|
g_n = i;
|
|
|
|
b_n = i;
|
|
|
|
|
|
|
|
r_n += cbd->cyan_red[SHADOWS] * cyan_red_transfer[SHADOWS][r_n];
|
|
|
|
r_n = CLAMP0255 (r_n);
|
|
|
|
r_n += cbd->cyan_red[MIDTONES] * cyan_red_transfer[MIDTONES][r_n];
|
|
|
|
r_n = CLAMP0255 (r_n);
|
|
|
|
r_n += cbd->cyan_red[HIGHLIGHTS] * cyan_red_transfer[HIGHLIGHTS][r_n];
|
|
|
|
r_n = CLAMP0255 (r_n);
|
|
|
|
|
|
|
|
g_n += cbd->magenta_green[SHADOWS] * magenta_green_transfer[SHADOWS][g_n];
|
|
|
|
g_n = CLAMP0255 (g_n);
|
|
|
|
g_n += cbd->magenta_green[MIDTONES] * magenta_green_transfer[MIDTONES][g_n];
|
|
|
|
g_n = CLAMP0255 (g_n);
|
|
|
|
g_n += cbd->magenta_green[HIGHLIGHTS] * magenta_green_transfer[HIGHLIGHTS][g_n];
|
|
|
|
g_n = CLAMP0255 (g_n);
|
|
|
|
|
|
|
|
b_n += cbd->yellow_blue[SHADOWS] * yellow_blue_transfer[SHADOWS][b_n];
|
|
|
|
b_n = CLAMP0255 (b_n);
|
|
|
|
b_n += cbd->yellow_blue[MIDTONES] * yellow_blue_transfer[MIDTONES][b_n];
|
|
|
|
b_n = CLAMP0255 (b_n);
|
|
|
|
b_n += cbd->yellow_blue[HIGHLIGHTS] * yellow_blue_transfer[HIGHLIGHTS][b_n];
|
|
|
|
b_n = CLAMP0255 (b_n);
|
|
|
|
|
|
|
|
cbd->r_lookup[i] = r_n;
|
|
|
|
cbd->g_lookup[i] = g_n;
|
|
|
|
cbd->b_lookup[i] = b_n;
|
|
|
|
}
|
1999-02-01 16:22:18 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
color_balance_preview (ColorBalanceDialog *cbd)
|
|
|
|
{
|
|
|
|
if (!cbd->image_map)
|
1999-11-22 19:14:29 +08:00
|
|
|
{
|
|
|
|
g_message ("color_balance_preview(): No image map");
|
|
|
|
return;
|
|
|
|
}
|
1999-11-21 02:08:41 +08:00
|
|
|
|
1998-03-31 15:23:50 +08:00
|
|
|
active_tool->preserve = TRUE;
|
1999-11-21 02:08:41 +08:00
|
|
|
color_balance_create_lookup_tables (cbd);
|
1997-11-25 06:05:25 +08:00
|
|
|
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
|
1998-03-31 15:23:50 +08:00
|
|
|
active_tool->preserve = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
static void
|
|
|
|
color_balance_reset_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
|
|
|
cbd->cyan_red[cbd->application_mode] = 0.0;
|
|
|
|
cbd->magenta_green[cbd->application_mode] = 0.0;
|
|
|
|
cbd->yellow_blue[cbd->application_mode] = 0.0;
|
|
|
|
|
|
|
|
color_balance_update (cbd, ALL);
|
|
|
|
|
|
|
|
if (cbd->preview)
|
|
|
|
color_balance_preview (cbd);
|
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
|
|
|
color_balance_ok_callback (GtkWidget *widget,
|
1999-11-21 02:08:41 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd = (ColorBalanceDialog *) data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (cbd->shell))
|
|
|
|
gtk_widget_hide (cbd->shell);
|
1998-03-31 15:23:50 +08:00
|
|
|
|
|
|
|
active_tool->preserve = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
if (!cbd->preview)
|
|
|
|
image_map_apply (cbd->image_map, color_balance, (void *) cbd);
|
|
|
|
|
|
|
|
if (cbd->image_map)
|
|
|
|
image_map_commit (cbd->image_map);
|
|
|
|
|
1998-03-31 15:23:50 +08:00
|
|
|
active_tool->preserve = FALSE;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
cbd->image_map = NULL;
|
1999-06-26 19:16:47 +08:00
|
|
|
|
|
|
|
active_tool->gdisp_ptr = NULL;
|
|
|
|
active_tool->drawable = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_balance_cancel_callback (GtkWidget *widget,
|
1999-11-21 02:08:41 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
if (GTK_WIDGET_VISIBLE (cbd->shell))
|
|
|
|
gtk_widget_hide (cbd->shell);
|
|
|
|
|
|
|
|
if (cbd->image_map)
|
|
|
|
{
|
1998-03-31 15:23:50 +08:00
|
|
|
active_tool->preserve = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
image_map_abort (cbd->image_map);
|
1998-03-31 15:23:50 +08:00
|
|
|
active_tool->preserve = FALSE;
|
1999-06-26 19:16:47 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
gdisplays_flush ();
|
1999-06-26 19:16:47 +08:00
|
|
|
cbd->image_map = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-06-26 19:16:47 +08:00
|
|
|
active_tool->gdisp_ptr = NULL;
|
|
|
|
active_tool->drawable = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-22 19:14:29 +08:00
|
|
|
color_balance_range_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
1999-11-22 19:14:29 +08:00
|
|
|
TransferMode range;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
1999-11-22 19:14:29 +08:00
|
|
|
range = (TransferMode) gtk_object_get_user_data (GTK_OBJECT (widget));
|
|
|
|
cbd->application_mode = range;
|
1999-11-21 02:08:41 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
color_balance_update (cbd, ALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-21 02:08:41 +08:00
|
|
|
color_balance_preserve_update (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
if (GTK_TOGGLE_BUTTON (widget)->active)
|
|
|
|
cbd->preserve_luminosity = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
1999-11-21 02:08:41 +08:00
|
|
|
cbd->preserve_luminosity = FALSE;
|
|
|
|
|
|
|
|
if (cbd->preview)
|
|
|
|
color_balance_preview (cbd);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-21 02:08:41 +08:00
|
|
|
color_balance_preview_update (GtkWidget *widget,
|
1997-11-25 06:05:25 +08:00
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
1999-11-21 02:08:41 +08:00
|
|
|
if (GTK_TOGGLE_BUTTON (widget)->active)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
cbd->preview = TRUE;
|
|
|
|
color_balance_preview (cbd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cbd->preview = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-21 02:08:41 +08:00
|
|
|
color_balance_cr_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
|
|
|
if (cbd->cyan_red[cbd->application_mode] != adjustment->value)
|
|
|
|
{
|
|
|
|
cbd->cyan_red[cbd->application_mode] = adjustment->value;
|
|
|
|
|
|
|
|
if (cbd->preview)
|
|
|
|
color_balance_preview (cbd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-21 02:08:41 +08:00
|
|
|
color_balance_mg_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
|
|
|
if (cbd->magenta_green[cbd->application_mode] != adjustment->value)
|
|
|
|
{
|
|
|
|
cbd->magenta_green[cbd->application_mode] = adjustment->value;
|
|
|
|
|
|
|
|
if (cbd->preview)
|
|
|
|
color_balance_preview (cbd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1999-11-21 02:08:41 +08:00
|
|
|
color_balance_yb_adjustment_update (GtkAdjustment *adjustment,
|
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
|
|
|
ColorBalanceDialog *cbd;
|
|
|
|
|
|
|
|
cbd = (ColorBalanceDialog *) data;
|
|
|
|
|
|
|
|
if (cbd->yellow_blue[cbd->application_mode] != adjustment->value)
|
|
|
|
{
|
|
|
|
cbd->yellow_blue[cbd->application_mode] = adjustment->value;
|
|
|
|
|
|
|
|
if (cbd->preview)
|
|
|
|
color_balance_preview (cbd);
|
|
|
|
}
|
|
|
|
}
|