diff --git a/ChangeLog b/ChangeLog index 16e6a5f11e..a856ce855f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2008-01-10 Michael Natterer + + Simplify things a bit and enable gegl-only color correction + tools (without legacy functions). + + * app/tools/gimpimagemaptool.c (gimp_image_map_tool_create_map): + always create the operation if ::get_operation() is implemented + and always use it when creating the GimpImageMap if there is no + legacy apply_func. + + * app/tools/gimpbrightnesscontrasttool.c + * app/tools/gimpcolorbalancetool.c + * app/tools/gimpcolorizetool.c + * app/tools/gimplevelstool.c + * app/tools/gimpposterizetool.c + * app/tools/gimpthresholdtool.c (map): set the operation's + properties unconditionally since it always exists now if we also + implement ::get_operation(). + 2008-01-10 Michael Natterer * app/gegl/Makefile.am diff --git a/app/tools/gimpbrightnesscontrasttool.c b/app/tools/gimpbrightnesscontrasttool.c index bda9b988fe..da1a1cb46c 100644 --- a/app/tools/gimpbrightnesscontrasttool.c +++ b/app/tools/gimpbrightnesscontrasttool.c @@ -196,22 +196,18 @@ static void gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool) { GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool); + gdouble brightness; + gdouble contrast; - if (im_tool->operation) - { - gdouble brightness; - gdouble contrast; + brightness = bc_tool->brightness / 256.0; + contrast = (bc_tool->contrast < 0 ? + (bc_tool->contrast + 127.0) / 127.0 : + bc_tool->contrast * 4.0 / 127.0 + 1); - brightness = bc_tool->brightness / 256.0; - contrast = (bc_tool->contrast < 0 ? - (bc_tool->contrast + 127.0) / 127.0 : - bc_tool->contrast * 4.0 / 127.0 + 1); - - gegl_node_set (im_tool->operation, - "brightness", brightness, - "contrast", contrast, - NULL); - } + gegl_node_set (im_tool->operation, + "brightness", brightness, + "contrast", contrast, + NULL); brightness_contrast_lut_setup (bc_tool->lut, bc_tool->brightness / 255.0, diff --git a/app/tools/gimpcolorbalancetool.c b/app/tools/gimpcolorbalancetool.c index a9bfbce19a..76086bb4a1 100644 --- a/app/tools/gimpcolorbalancetool.c +++ b/app/tools/gimpcolorbalancetool.c @@ -177,30 +177,26 @@ static void gimp_color_balance_tool_map (GimpImageMapTool *image_map_tool) { GimpColorBalanceTool *cb_tool = GIMP_COLOR_BALANCE_TOOL (image_map_tool); + ColorBalance *cb = cb_tool->color_balance; + GimpTransferMode range; - if (image_map_tool->operation) + for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++) { - ColorBalance *cb = cb_tool->color_balance; - GimpTransferMode range; - - for (range = GIMP_SHADOWS; range <= GIMP_HIGHLIGHTS; range++) - { - gegl_node_set (image_map_tool->operation, - "range", range, - NULL); - - gegl_node_set (image_map_tool->operation, - "cyan-red", cb->cyan_red[range] / 256.0, - "magenta-green", cb->magenta_green[range] / 256.0, - "yellow-blue", cb->yellow_blue[range] / 256.0, - NULL); - } + gegl_node_set (image_map_tool->operation, + "range", range, + NULL); gegl_node_set (image_map_tool->operation, - "preserve-luminosity", cb->preserve_luminosity, + "cyan-red", cb->cyan_red[range] / 256.0, + "magenta-green", cb->magenta_green[range] / 256.0, + "yellow-blue", cb->yellow_blue[range] / 256.0, NULL); } + gegl_node_set (image_map_tool->operation, + "preserve-luminosity", cb->preserve_luminosity, + NULL); + color_balance_create_lookup_tables (cb_tool->color_balance); } diff --git a/app/tools/gimpcolorizetool.c b/app/tools/gimpcolorizetool.c index 08ac3dfcb0..473ea92f94 100644 --- a/app/tools/gimpcolorizetool.c +++ b/app/tools/gimpcolorizetool.c @@ -171,14 +171,11 @@ gimp_colorize_tool_map (GimpImageMapTool *image_map_tool) { GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool); - if (image_map_tool->operation) - { - gegl_node_set (image_map_tool->operation, - "hue", col_tool->colorize->hue, - "saturation", col_tool->colorize->saturation, - "lightness", col_tool->colorize->lightness, - NULL); - } + gegl_node_set (image_map_tool->operation, + "hue", col_tool->colorize->hue, + "saturation", col_tool->colorize->saturation, + "lightness", col_tool->colorize->lightness, + NULL); colorize_calculate (col_tool->colorize); } diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c index d2a13a74a2..18b44159e2 100644 --- a/app/tools/gimpimagemaptool.c +++ b/app/tools/gimpimagemaptool.c @@ -468,6 +468,7 @@ static void gimp_image_map_tool_create_map (GimpImageMapTool *tool) { GimpCoreConfig *config = GIMP_TOOL (tool)->tool_info->gimp->config; + gboolean use_gegl; if (tool->image_map) { @@ -475,14 +476,16 @@ gimp_image_map_tool_create_map (GimpImageMapTool *tool) g_object_unref (tool->image_map); } - if (config->use_gegl && ! tool->operation && - GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation) + if (GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation) tool->operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool); + g_assert (tool->operation || tool->apply_func); + + use_gegl = (config->use_gegl || ! tool->apply_func); + tool->image_map = gimp_image_map_new (tool->drawable, GIMP_TOOL (tool)->tool_info->blurb, - config->use_gegl ? - tool->operation : NULL, + use_gegl ? tool->operation : NULL, tool->apply_func, tool->apply_data); diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index de71e22e78..de6853eb3e 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -269,39 +269,34 @@ gimp_levels_tool_get_operation (GimpImageMapTool *im_tool) static void gimp_levels_tool_map (GimpImageMapTool *image_map_tool) { - GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool); + GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool); + GimpHistogramChannel channel; - if (image_map_tool->operation) + for (channel = GIMP_HISTOGRAM_VALUE; + channel <= GIMP_HISTOGRAM_ALPHA; + channel++) { - Levels *levels = tool->levels; - GimpHistogramChannel channel; + /* FIXME: hack */ + if (! tool->color && channel == 1) + gegl_node_set (image_map_tool->operation, + "channel", GIMP_HISTOGRAM_ALPHA, + NULL); + else + gegl_node_set (image_map_tool->operation, + "channel", channel, + NULL); - for (channel = GIMP_HISTOGRAM_VALUE; - channel <= GIMP_HISTOGRAM_ALPHA; - channel++) - { - /* FIXME: hack */ - if (! tool->color && channel == 1) - gegl_node_set (image_map_tool->operation, - "channel", GIMP_HISTOGRAM_ALPHA, - NULL); - else - gegl_node_set (image_map_tool->operation, - "channel", channel, - NULL); + gegl_node_set (image_map_tool->operation, + "gamma", tool->levels->gamma[channel], + "low-input", tool->levels->low_input[channel] / 255.0, + "high-input", tool->levels->high_input[channel] / 255.0, + "low-output", tool->levels->low_output[channel] / 255.0, + "high-output", tool->levels->high_output[channel] / 255.0, + NULL); - gegl_node_set (image_map_tool->operation, - "gamma", levels->gamma[channel], - "low-input", levels->low_input[channel] / 255.0, - "high-input", levels->high_input[channel] / 255.0, - "low-output", levels->low_output[channel] / 255.0, - "high-output", levels->high_output[channel] / 255.0, - NULL); - - /* FIXME: hack */ - if (! tool->color && channel == 1) - break; - } + /* FIXME: hack */ + if (! tool->color && channel == 1) + break; } gimp_lut_setup (tool->lut, diff --git a/app/tools/gimpposterizetool.c b/app/tools/gimpposterizetool.c index 9e601692ad..ff169af779 100644 --- a/app/tools/gimpposterizetool.c +++ b/app/tools/gimpposterizetool.c @@ -174,12 +174,9 @@ gimp_posterize_tool_map (GimpImageMapTool *image_map_tool) { GimpPosterizeTool *posterize_tool = GIMP_POSTERIZE_TOOL (image_map_tool); - if (image_map_tool->operation) - { - gegl_node_set (image_map_tool->operation, - "levels", posterize_tool->levels, - NULL); - } + gegl_node_set (image_map_tool->operation, + "levels", posterize_tool->levels, + NULL); posterize_lut_setup (posterize_tool->lut, posterize_tool->levels, diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c index 1c98fafac5..3ef83d595a 100644 --- a/app/tools/gimpthresholdtool.c +++ b/app/tools/gimpthresholdtool.c @@ -198,13 +198,10 @@ gimp_threshold_tool_map (GimpImageMapTool *image_map_tool) { GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool); - if (image_map_tool->operation) - { - gegl_node_set (image_map_tool->operation, - "low", t_tool->threshold->low_threshold / 255.0, - "high", t_tool->threshold->high_threshold / 255.0, - NULL); - } + gegl_node_set (image_map_tool->operation, + "low", t_tool->threshold->low_threshold / 255.0, + "high", t_tool->threshold->high_threshold / 255.0, + NULL); }