add utility function gimp_levels_config_to_levels_cruft() which fills the
2008-01-21 Michael Natterer <mitch@gimp.org> * app/gegl/gimplevelsconfig.[ch]: add utility function gimp_levels_config_to_levels_cruft() which fills the old Levels struct from a GimpLevelsConfig object. * app/tools/gimplevelstool.c: use it. svn path=/trunk/; revision=24658
This commit is contained in:

committed by
Michael Natterer

parent
d32f480ee8
commit
89146f4433
@ -1,3 +1,11 @@
|
|||||||
|
2008-01-21 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/gegl/gimplevelsconfig.[ch]: add utility function
|
||||||
|
gimp_levels_config_to_levels_cruft() which fills the old Levels
|
||||||
|
struct from a GimpLevelsConfig object.
|
||||||
|
|
||||||
|
* app/tools/gimplevelstool.c: use it.
|
||||||
|
|
||||||
2008-01-21 Michael Natterer <mitch@gimp.org>
|
2008-01-21 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/gegl/gimpcolorizeconfig.h
|
* app/gegl/gimpcolorizeconfig.h
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
|
|
||||||
#include "base/gimphistogram.h"
|
#include "base/gimphistogram.h"
|
||||||
|
|
||||||
|
/* temp cruft */
|
||||||
|
#include "base/levels.h"
|
||||||
|
|
||||||
#include "gimplevelsconfig.h"
|
#include "gimplevelsconfig.h"
|
||||||
|
|
||||||
|
|
||||||
@ -409,3 +412,37 @@ gimp_levels_config_adjust_by_colors (GimpLevelsConfig *config,
|
|||||||
config->gamma[channel] = log (inten) / log (out_light);
|
config->gamma[channel] = log (inten) / log (out_light);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* temp cruft */
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_levels_config_to_levels_cruft (GimpLevelsConfig *config,
|
||||||
|
Levels *cruft,
|
||||||
|
gboolean is_color)
|
||||||
|
{
|
||||||
|
GimpHistogramChannel channel;
|
||||||
|
|
||||||
|
g_return_if_fail (GIMP_IS_LEVELS_CONFIG (config));
|
||||||
|
g_return_if_fail (cruft != NULL);
|
||||||
|
|
||||||
|
for (channel = GIMP_HISTOGRAM_VALUE;
|
||||||
|
channel <= GIMP_HISTOGRAM_ALPHA;
|
||||||
|
channel++)
|
||||||
|
{
|
||||||
|
cruft->gamma[channel] = config->gamma[channel];
|
||||||
|
cruft->low_input[channel] = config->low_input[channel] * 255.999;
|
||||||
|
cruft->high_input[channel] = config->high_input[channel] * 255.999;
|
||||||
|
cruft->low_output[channel] = config->low_output[channel] * 255.999;
|
||||||
|
cruft->high_output[channel] = config->high_output[channel] * 255.999;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_color)
|
||||||
|
{
|
||||||
|
cruft->gamma[1] = cruft->gamma[GIMP_HISTOGRAM_ALPHA];
|
||||||
|
cruft->low_input[1] = cruft->low_input[GIMP_HISTOGRAM_ALPHA];
|
||||||
|
cruft->high_input[1] = cruft->high_input[GIMP_HISTOGRAM_ALPHA];
|
||||||
|
cruft->low_output[1] = cruft->low_output[GIMP_HISTOGRAM_ALPHA];
|
||||||
|
cruft->high_output[1] = cruft->high_output[GIMP_HISTOGRAM_ALPHA];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -72,6 +72,10 @@ void gimp_levels_config_adjust_by_colors (GimpLevelsConfig *config,
|
|||||||
const GimpRGB *gray,
|
const GimpRGB *gray,
|
||||||
const GimpRGB *white);
|
const GimpRGB *white);
|
||||||
|
|
||||||
|
/* temp cruft */
|
||||||
|
void gimp_levels_config_to_levels_cruft (GimpLevelsConfig *config,
|
||||||
|
Levels *cruft,
|
||||||
|
gboolean is_color);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_LEVELS_CONFIG_H__ */
|
#endif /* __GIMP_LEVELS_CONFIG_H__ */
|
||||||
|
@ -284,35 +284,13 @@ gimp_levels_tool_get_operation (GimpImageMapTool *im_tool)
|
|||||||
static void
|
static void
|
||||||
gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
|
gimp_levels_tool_map (GimpImageMapTool *image_map_tool)
|
||||||
{
|
{
|
||||||
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
|
||||||
GimpLevelsConfig *config = tool->config;
|
|
||||||
Levels *levels = tool->levels;
|
|
||||||
GimpHistogramChannel channel;
|
|
||||||
|
|
||||||
for (channel = GIMP_HISTOGRAM_VALUE;
|
gimp_levels_config_to_levels_cruft (tool->config, tool->levels, tool->color);
|
||||||
channel <= GIMP_HISTOGRAM_ALPHA;
|
|
||||||
channel++)
|
|
||||||
{
|
|
||||||
levels->gamma[channel] = config->gamma[channel];
|
|
||||||
levels->low_input[channel] = config->low_input[channel] * 255.999;
|
|
||||||
levels->high_input[channel] = config->high_input[channel] * 255.999;
|
|
||||||
levels->low_output[channel] = config->low_output[channel] * 255.999;
|
|
||||||
levels->high_output[channel] = config->high_output[channel] * 255.999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: hack */
|
|
||||||
if (! tool->color)
|
|
||||||
{
|
|
||||||
levels->gamma[1] = levels->gamma[GIMP_HISTOGRAM_ALPHA];
|
|
||||||
levels->low_input[1] = levels->low_input[GIMP_HISTOGRAM_ALPHA];
|
|
||||||
levels->high_input[1] = levels->high_input[GIMP_HISTOGRAM_ALPHA];
|
|
||||||
levels->low_output[1] = levels->low_output[GIMP_HISTOGRAM_ALPHA];
|
|
||||||
levels->high_output[1] = levels->high_output[GIMP_HISTOGRAM_ALPHA];
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_lut_setup (tool->lut,
|
gimp_lut_setup (tool->lut,
|
||||||
(GimpLutFunc) levels_lut_func,
|
(GimpLutFunc) levels_lut_func,
|
||||||
levels,
|
tool->levels,
|
||||||
gimp_drawable_bytes (image_map_tool->drawable));
|
gimp_drawable_bytes (image_map_tool->drawable));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,6 +831,7 @@ static void
|
|||||||
levels_update_input_bar (GimpLevelsTool *tool)
|
levels_update_input_bar (GimpLevelsTool *tool)
|
||||||
{
|
{
|
||||||
/* Recalculate the transfer arrays */
|
/* Recalculate the transfer arrays */
|
||||||
|
gimp_levels_config_to_levels_cruft (tool->config, tool->levels, tool->color);
|
||||||
levels_calculate_transfers (tool->levels);
|
levels_calculate_transfers (tool->levels);
|
||||||
|
|
||||||
switch (tool->channel)
|
switch (tool->channel)
|
||||||
|
Reference in New Issue
Block a user