keep the central processing node around here...
2008-01-03 Michael Natterer <mitch@gimp.org> * app/tools/gimpimagemaptool.[ch]: keep the central processing node around here... * app/tools/gimpbrightnesscontrasttool.[ch] * app/tools/gimpthresholdtool.[ch]: ...instead of here. svn path=/trunk/; revision=24517
This commit is contained in:

committed by
Michael Natterer

parent
8e638b0b97
commit
48358e3452
@ -1,3 +1,11 @@
|
|||||||
|
2008-01-03 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/tools/gimpimagemaptool.[ch]: keep the central processing
|
||||||
|
node around here...
|
||||||
|
|
||||||
|
* app/tools/gimpbrightnesscontrasttool.[ch]
|
||||||
|
* app/tools/gimpthresholdtool.[ch]: ...instead of here.
|
||||||
|
|
||||||
2008-01-03 Michael Natterer <mitch@gimp.org>
|
2008-01-03 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpimagemap.c: quite some cleanup (use GeglRectangle
|
* app/core/gimpimagemap.c: quite some cleanup (use GeglRectangle
|
||||||
|
@ -140,12 +140,6 @@ gimp_brightness_contrast_tool_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (object);
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (object);
|
||||||
|
|
||||||
if (bc_tool->bc_node)
|
|
||||||
{
|
|
||||||
g_object_unref (bc_tool->bc_node);
|
|
||||||
bc_tool->bc_node = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bc_tool->lut)
|
if (bc_tool->lut)
|
||||||
{
|
{
|
||||||
gimp_lut_free (bc_tool->lut);
|
gimp_lut_free (bc_tool->lut);
|
||||||
@ -188,24 +182,17 @@ gimp_brightness_contrast_tool_initialize (GimpTool *tool,
|
|||||||
static GeglNode *
|
static GeglNode *
|
||||||
gimp_brightness_contrast_tool_get_operation (GimpImageMapTool *im_tool)
|
gimp_brightness_contrast_tool_get_operation (GimpImageMapTool *im_tool)
|
||||||
{
|
{
|
||||||
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
|
return g_object_new (GEGL_TYPE_NODE,
|
||||||
|
|
||||||
if (! bc_tool->bc_node)
|
|
||||||
{
|
|
||||||
bc_tool->bc_node = g_object_new (GEGL_TYPE_NODE,
|
|
||||||
"operation", "brightness-contrast",
|
"operation", "brightness-contrast",
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bc_tool->bc_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
|
gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
|
||||||
{
|
{
|
||||||
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
|
GimpBrightnessContrastTool *bc_tool = GIMP_BRIGHTNESS_CONTRAST_TOOL (im_tool);
|
||||||
|
|
||||||
if (bc_tool->bc_node)
|
if (im_tool->operation)
|
||||||
{
|
{
|
||||||
gdouble brightness;
|
gdouble brightness;
|
||||||
gdouble contrast;
|
gdouble contrast;
|
||||||
@ -215,7 +202,7 @@ gimp_brightness_contrast_tool_map (GimpImageMapTool *im_tool)
|
|||||||
(bc_tool->contrast + 127.0) / 127.0 :
|
(bc_tool->contrast + 127.0) / 127.0 :
|
||||||
bc_tool->contrast * 4.0 / 127.0 + 1);
|
bc_tool->contrast * 4.0 / 127.0 + 1);
|
||||||
|
|
||||||
gegl_node_set (bc_tool->bc_node,
|
gegl_node_set (im_tool->operation,
|
||||||
"brightness", brightness,
|
"brightness", brightness,
|
||||||
"contrast", contrast,
|
"contrast", contrast,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -44,7 +44,6 @@ struct _GimpBrightnessContrastTool
|
|||||||
gdouble brightness;
|
gdouble brightness;
|
||||||
gdouble contrast;
|
gdouble contrast;
|
||||||
GimpLut *lut;
|
GimpLut *lut;
|
||||||
GeglNode *bc_node;
|
|
||||||
|
|
||||||
/* dialog */
|
/* dialog */
|
||||||
GtkAdjustment *brightness_data;
|
GtkAdjustment *brightness_data;
|
||||||
|
@ -169,6 +169,12 @@ gimp_image_map_tool_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (object);
|
GimpImageMapTool *image_map_tool = GIMP_IMAGE_MAP_TOOL (object);
|
||||||
|
|
||||||
|
if (image_map_tool->operation)
|
||||||
|
{
|
||||||
|
g_object_unref (image_map_tool->operation);
|
||||||
|
image_map_tool->operation = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (image_map_tool->shell)
|
if (image_map_tool->shell)
|
||||||
{
|
{
|
||||||
gtk_widget_destroy (image_map_tool->shell);
|
gtk_widget_destroy (image_map_tool->shell);
|
||||||
@ -446,12 +452,12 @@ gimp_image_map_tool_create_map (GimpImageMapTool *tool)
|
|||||||
g_object_unref (tool->image_map);
|
g_object_unref (tool->image_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tool->use_gegl)
|
if (tool->use_gegl && ! tool->operation)
|
||||||
operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool);
|
tool->operation = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->get_operation (tool);
|
||||||
|
|
||||||
tool->image_map = gimp_image_map_new (tool->drawable,
|
tool->image_map = gimp_image_map_new (tool->drawable,
|
||||||
GIMP_TOOL (tool)->tool_info->blurb,
|
GIMP_TOOL (tool)->tool_info->blurb,
|
||||||
operation);
|
tool->operation);
|
||||||
|
|
||||||
g_signal_connect (tool->image_map, "flush",
|
g_signal_connect (tool->image_map, "flush",
|
||||||
G_CALLBACK (gimp_image_map_tool_flush),
|
G_CALLBACK (gimp_image_map_tool_flush),
|
||||||
|
@ -44,6 +44,7 @@ struct _GimpImageMapTool
|
|||||||
GimpColorTool parent_instance;
|
GimpColorTool parent_instance;
|
||||||
|
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
|
GeglNode *operation;
|
||||||
GimpImageMap *image_map;
|
GimpImageMap *image_map;
|
||||||
|
|
||||||
/* dialog */
|
/* dialog */
|
||||||
|
@ -123,12 +123,6 @@ gimp_threshold_tool_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (object);
|
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (object);
|
||||||
|
|
||||||
if (t_tool->t_node)
|
|
||||||
{
|
|
||||||
g_object_unref (t_tool->t_node);
|
|
||||||
t_tool->t_node = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_slice_free (Threshold, t_tool->threshold);
|
g_slice_free (Threshold, t_tool->threshold);
|
||||||
|
|
||||||
if (t_tool->hist)
|
if (t_tool->hist)
|
||||||
@ -189,26 +183,19 @@ gimp_threshold_tool_initialize (GimpTool *tool,
|
|||||||
static GeglNode *
|
static GeglNode *
|
||||||
gimp_threshold_tool_get_operation (GimpImageMapTool *im_tool)
|
gimp_threshold_tool_get_operation (GimpImageMapTool *im_tool)
|
||||||
{
|
{
|
||||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (im_tool);
|
return g_object_new (GEGL_TYPE_NODE,
|
||||||
|
|
||||||
if (! t_tool->t_node)
|
|
||||||
{
|
|
||||||
t_tool->t_node = g_object_new (GEGL_TYPE_NODE,
|
|
||||||
"operation", "gimp-threshold",
|
"operation", "gimp-threshold",
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return t_tool->t_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_threshold_tool_map (GimpImageMapTool *image_map_tool)
|
gimp_threshold_tool_map (GimpImageMapTool *image_map_tool)
|
||||||
{
|
{
|
||||||
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
|
GimpThresholdTool *t_tool = GIMP_THRESHOLD_TOOL (image_map_tool);
|
||||||
|
|
||||||
if (t_tool->t_node)
|
if (image_map_tool->operation)
|
||||||
{
|
{
|
||||||
gegl_node_set (t_tool->t_node,
|
gegl_node_set (image_map_tool->operation,
|
||||||
"low", t_tool->threshold->low_threshold / 255.0,
|
"low", t_tool->threshold->low_threshold / 255.0,
|
||||||
"high", t_tool->threshold->high_threshold / 255.0,
|
"high", t_tool->threshold->high_threshold / 255.0,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -39,7 +39,6 @@ struct _GimpThresholdTool
|
|||||||
GimpImageMapTool parent_instance;
|
GimpImageMapTool parent_instance;
|
||||||
|
|
||||||
Threshold *threshold;
|
Threshold *threshold;
|
||||||
GeglNode *t_node;
|
|
||||||
|
|
||||||
/* dialog */
|
/* dialog */
|
||||||
GimpHistogram *hist;
|
GimpHistogram *hist;
|
||||||
|
Reference in New Issue
Block a user