Commit c5c0a219 authored by Øyvind Kolås's avatar Øyvind Kolås
Browse files

renamed *levels-auto to *levels-stretch

parent caac418c
2004-11-01 Øyvind Kolås <pippin@gimp.org>
* app/actions/drawable-actions.c
* app/actions/drawable-commands.c
* app/actions/drawable-commands.h
* app/base/levels.c
* app/base/levels.h
* app/core/gimpdrawable-levels.c
* app/core/gimpdrawable-levels.h
* app/pdb/color_cmds.c
* app/tools/gimplevelstool.c
* libgimp/gimpcolor_pdb.c
* menus/image-menu.xml
* menus/image-menu.xml.in
* tools/pdbgen/pdb/color.pdb: renamed [drawable-]levels-auto
to [drawable-]levels-stretch, anticipating other ways to automatically
determine levels settings, old PDB command maintained, but marked
as deprecated.
2004-11-01 Sven Neumann <sven@gimp.org>
 
* app/widgets/gimpfiledialog.c (gimp_file_dialog_add_filters):
......
......@@ -41,11 +41,6 @@
static GimpActionEntry drawable_actions[] =
{
{ "drawable-levels-auto", NULL,
N_("_White Balance"), NULL, NULL,
G_CALLBACK (drawable_levels_auto_cmd_callback),
GIMP_HELP_LAYER_WHITE_BALANCE},
{ "drawable-desaturate", GIMP_STOCK_CONVERT_GRAYSCALE,
N_("_Desaturate"), NULL, NULL,
G_CALLBACK (drawable_desaturate_cmd_callback),
......@@ -61,6 +56,11 @@ static GimpActionEntry drawable_actions[] =
G_CALLBACK (drawable_invert_cmd_callback),
GIMP_HELP_LAYER_INVERT },
{ "drawable-levels-stretch", NULL,
N_("_White Balance"), NULL, NULL,
G_CALLBACK (drawable_levels_stretch_cmd_callback),
GIMP_HELP_LAYER_WHITE_BALANCE},
{ "drawable-offset", NULL,
N_("_Offset..."), "<control><shift>O", NULL,
G_CALLBACK (drawable_offset_cmd_callback),
......@@ -178,11 +178,11 @@ drawable_actions_update (GimpActionGroup *group,
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
SET_SENSITIVE ("drawable-levels-auto", drawable && is_rgb);
SET_SENSITIVE ("drawable-desaturate", drawable && is_rgb);
SET_SENSITIVE ("drawable-equalize", drawable && ! is_indexed);
SET_SENSITIVE ("drawable-invert", drawable && ! is_indexed);
SET_SENSITIVE ("drawable-offset", drawable);
SET_SENSITIVE ("drawable-desaturate", drawable && is_rgb);
SET_SENSITIVE ("drawable-equalize", drawable && ! is_indexed);
SET_SENSITIVE ("drawable-invert", drawable && ! is_indexed);
SET_SENSITIVE ("drawable-levels-stretch", drawable && is_rgb);
SET_SENSITIVE ("drawable-offset", drawable);
SET_SENSITIVE ("drawable-visible", drawable);
SET_SENSITIVE ("drawable-linked", drawable);
......
......@@ -45,26 +45,6 @@
/* public functions */
void
drawable_levels_auto_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *drawable;
GimpContext *context;
return_if_no_drawable (gimage, drawable, data);
return_if_no_context (context, data);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("White Balance operates only on RGB color layers."));
return;
}
gimp_drawable_levels_auto (drawable, context);
gimp_image_flush (gimage);
}
void
drawable_desaturate_cmd_callback (GtkAction *action,
gpointer data)
......@@ -119,6 +99,26 @@ drawable_invert_cmd_callback (GtkAction *action,
gimp_image_flush (gimage);
}
void
drawable_levels_stretch_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *gimage;
GimpDrawable *drawable;
GimpContext *context;
return_if_no_drawable (gimage, drawable, data);
return_if_no_context (context, data);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("White Balance operates only on RGB color layers."));
return;
}
gimp_drawable_levels_stretch (drawable, context);
gimp_image_flush (gimage);
}
void
drawable_offset_cmd_callback (GtkAction *action,
gpointer data)
......@@ -134,6 +134,7 @@ drawable_offset_cmd_callback (GtkAction *action,
gtk_widget_show (dialog);
}
void
drawable_linked_cmd_callback (GtkAction *action,
gpointer data)
......@@ -196,6 +197,7 @@ drawable_visible_cmd_callback (GtkAction *action,
}
}
void
drawable_flip_cmd_callback (GtkAction *action,
gint value,
......
......@@ -20,28 +20,35 @@
#define __DRAWABLE_COMMANDS_H__
void drawable_levels_auto_cmd_callback (GtkAction *action,
gpointer data);
void drawable_desaturate_cmd_callback (GtkAction *action,
gpointer data);
void drawable_equalize_cmd_callback (GtkAction *action,
gpointer data);
void drawable_invert_cmd_callback (GtkAction *action,
gpointer data);
void drawable_offset_cmd_callback (GtkAction *action,
gpointer data);
void drawable_desaturate_cmd_callback (GtkAction *action,
gpointer data);
void drawable_equalize_cmd_callback (GtkAction *action,
gpointer data);
void drawable_invert_cmd_callback (GtkAction *action,
gpointer data);
void drawable_levels_stretch_cmd_callback (GtkAction *action,
gpointer data);
void drawable_offset_cmd_callback (GtkAction *action,
gpointer data);
void drawable_desaturate_cmd_callback (GtkAction *action,
gpointer data);
void drawable_equalize_cmd_callback (GtkAction *action,
gpointer data);
void drawable_invert_cmd_callback (GtkAction *action,
gpointer data);
void drawable_offset_cmd_callback (GtkAction *action,
gpointer data);
void drawable_linked_cmd_callback (GtkAction *action,
gpointer data);
void drawable_visible_cmd_callback (GtkAction *action,
gpointer data);
void drawable_flip_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void drawable_rotate_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void drawable_linked_cmd_callback (GtkAction *action,
gpointer data);
void drawable_visible_cmd_callback (GtkAction *action,
gpointer data);
void drawable_flip_cmd_callback (GtkAction *action,
gint value,
gpointer data);
void drawable_rotate_cmd_callback (GtkAction *action,
gint value,
gpointer data);
#endif /* __DRAWABLE_COMMANDS_H__ */
......@@ -62,9 +62,9 @@ levels_channel_reset (Levels *levels,
}
void
levels_auto (Levels *levels,
GimpHistogram *hist,
gboolean is_color)
levels_stretch (Levels *levels,
GimpHistogram *hist,
gboolean is_color)
{
GimpHistogramChannel channel;
......@@ -79,18 +79,18 @@ levels_auto (Levels *levels,
for (channel = GIMP_HISTOGRAM_RED;
channel <= GIMP_HISTOGRAM_BLUE;
channel++)
levels_channel_auto (levels, hist, channel);
levels_channel_stretch (levels, hist, channel);
}
else
{
levels_channel_auto (levels, hist, GIMP_HISTOGRAM_VALUE);
levels_channel_stretch (levels, hist, GIMP_HISTOGRAM_VALUE);
}
}
void
levels_channel_auto (Levels *levels,
GimpHistogram *hist,
GimpHistogramChannel channel)
levels_channel_stretch (Levels *levels,
GimpHistogram *hist,
GimpHistogramChannel channel)
{
gint i;
gdouble count, new_count, percentage, next_percentage;
......
......@@ -37,10 +37,10 @@ struct _Levels
void levels_init (Levels *levels);
void levels_channel_reset (Levels *levels,
GimpHistogramChannel channel);
void levels_auto (Levels *levels,
void levels_stretch (Levels *levels,
GimpHistogram *hist,
gboolean is_color);
void levels_channel_auto (Levels *levels,
void levels_channel_stretch (Levels *levels,
GimpHistogram *hist,
GimpHistogramChannel channel);
void levels_adjust_by_colors (Levels *levels,
......
......@@ -115,8 +115,8 @@ gimp_drawable_levels (GimpDrawable *drawable,
void
gimp_drawable_levels_auto (GimpDrawable *drawable,
GimpContext *context)
gimp_drawable_levels_stretch (GimpDrawable *drawable,
GimpContext *context)
{
gint x, y, width, height;
PixelRegion srcPR, destPR;
......@@ -140,8 +140,8 @@ gimp_drawable_levels_auto (GimpDrawable *drawable,
gimp_drawable_calculate_histogram (drawable, hist);
/* Calculate the levels */
levels_init (&levels);
levels_auto (&levels, hist, ! gimp_drawable_is_gray (drawable));
levels_init (&levels);
levels_stretch (&levels, hist, ! gimp_drawable_is_gray (drawable));
/* Set up the lut */
lut = gimp_lut_new ();
......
......@@ -20,17 +20,17 @@
#define __GIMP_DRAWABLE_LEVELS_H__
void gimp_drawable_levels (GimpDrawable *drawable,
GimpContext *context,
gint32 channel,
gint32 low_input,
gint32 high_input,
gdouble gamma,
gint32 low_output,
gint32 high_output);
void gimp_drawable_levels (GimpDrawable *drawable,
GimpContext *context,
gint32 channel,
gint32 low_input,
gint32 high_input,
gdouble gamma,
gint32 low_output,
gint32 high_output);
void gimp_drawable_levels_auto (GimpDrawable *drawable,
GimpContext *context);
void gimp_drawable_levels_stretch (GimpDrawable *drawable,
GimpContext *context);
#endif /* __GIMP_DRAWABLE_LEVELS_H__ */
......@@ -319,7 +319,7 @@ levels_auto_invoker (Gimp *gimp,
success = FALSE;
if (success)
gimp_drawable_levels_auto (drawable, context);
gimp_drawable_levels_stretch (drawable, context);
}
return procedural_db_return_args (&levels_auto_proc, success);
......@@ -342,7 +342,7 @@ static ProcRecord levels_auto_proc =
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
NULL,
"gimp_levels_stretch",
GIMP_INTERNAL,
1,
levels_auto_inargs,
......
......@@ -113,7 +113,7 @@ static void levels_channel_reset_callback (GtkWidget *widget,
static gboolean levels_menu_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data);
static void levels_auto_callback (GtkWidget *widget,
static void levels_stretch_callback (GtkWidget *widget,
GimpLevelsTool *tool);
static void levels_low_input_adjustment_update (GtkAdjustment *adjustment,
GimpLevelsTool *tool);
......@@ -668,7 +668,7 @@ gimp_levels_tool_dialog (GimpImageMapTool *image_map_tool)
gtk_widget_show (button);
g_signal_connect (button, "clicked",
G_CALLBACK (levels_auto_callback),
G_CALLBACK (levels_stretch_callback),
tool);
button = gimp_levels_tool_color_picker_new (tool,
......@@ -957,10 +957,10 @@ levels_menu_visible_func (GtkTreeModel *model,
}
static void
levels_auto_callback (GtkWidget *widget,
levels_stretch_callback (GtkWidget *widget,
GimpLevelsTool *tool)
{
levels_auto (tool->levels, tool->hist, tool->color);
levels_stretch (tool->levels, tool->hist, tool->color);
levels_update (tool, ALL);
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (tool));
......
......@@ -124,13 +124,7 @@ gimp_levels (gint32 drawable_ID,
* gimp_levels_auto:
* @drawable_ID: The drawable.
*
* Automatically modifies intensity levels in the specified drawable.
*
* This procedure allows intensity levels in the specified drawable to
* be remapped according to a set of guessed parameters. It is
* equivalent to clicking the \"Auto\" button in the Levels tool. This
* procedure is only valid on RGB color and grayscale images. It will
* not operate on indexed drawables.
* This procedure is deprecated! Use gimp_levels_stretch() instead.
*
* Returns: TRUE on success.
*/
......
......@@ -39,7 +39,9 @@ gboolean gimp_levels (gint32 drawable_ID,
gdouble gamma,
gint low_output,
gint high_output);
#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_levels_auto (gint32 drawable_ID);
#endif /* GIMP_DISABLE_DEPRECATED */
gboolean gimp_posterize (gint32 drawable_ID,
gint levels);
gboolean gimp_desaturate (gint32 drawable_ID);
......
......@@ -344,7 +344,7 @@
<menuitem action="drawable-invert" />
<menu action="layers-colors-auto-menu" name="Auto">
<menuitem action="drawable-equalize" />
<menuitem action="drawable-levels-auto" />
<menuitem action="drawable-levels-stretch" />
</menu>
<separator />
<placeholder name="Info">
......
......@@ -145,7 +145,46 @@ CODE
);
}
sub levels_stretch {
$blurb = 'Automatically modifies intensity levels in the specified drawable.';
$help = <<'HELP';
This procedure allows intensity levels in the specified drawable to be
remapped according to a set of guessed parameters. It is equivalent to
clicking the "Auto" button in the Levels tool. This procedure is
only valid on RGB color and grayscale images. It will not operate on
indexed drawables.
HELP
$author = $copyright = 'Joao S.O. Bueno, Shawn Willden';
$date = '2003';
&std_pdb_misc;
@inargs = ( &drawable_arg );
%invoke = (
headers => [ qw("base/levels.h"
"base/gimphistogram.h"
"core/gimpdrawable-histogram.h"
"core/gimpdrawable-levels.h") ],
code => <<'CODE'
{
if (gimp_drawable_is_indexed (drawable))
success = FALSE;
if (success)
gimp_drawable_levels_stretch (drawable, context);
}
CODE
);
}
sub levels_auto {
&std_pdb_deprecated ('gimp_levels_stretch');
$blurb = 'Automatically modifies intensity levels in the specified drawable.';
$help = <<'HELP';
......@@ -174,7 +213,7 @@ HELP
success = FALSE;
if (success)
gimp_drawable_levels_auto (drawable, context);
gimp_drawable_levels_stretch (drawable, context);
}
CODE
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment