gimp r24621 - in trunk: . app/gegl app/tools
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24621 - in trunk: . app/gegl app/tools
- Date: Tue, 15 Jan 2008 17:23:45 +0000 (GMT)
Author: mitch
Date: Tue Jan 15 17:23:45 2008
New Revision: 24621
URL: http://svn.gnome.org/viewvc/gimp?rev=24621&view=rev
Log:
2008-01-15 Michael Natterer <mitch gimp org>
* app/gegl/gimpoperationcolorize.[ch]
* app/gegl/gimpoperationlevels.[ch]
* app/gegl/gimpoperationthreshold.[ch]: changed all properties from
float to double.
* app/gegl/gimpoperationcolorize.c: normalized property ranges to
[0.0..1.0] or [-1.0..1.0] resp.
* app/tools/gimpcolorizetool.c: changed accordingly.
Modified:
trunk/ChangeLog
trunk/app/gegl/gimpoperationcolorize.c
trunk/app/gegl/gimpoperationcolorize.h
trunk/app/gegl/gimpoperationlevels.c
trunk/app/gegl/gimpoperationlevels.h
trunk/app/gegl/gimpoperationthreshold.c
trunk/app/gegl/gimpoperationthreshold.h
trunk/app/tools/gimpcolorizetool.c
Modified: trunk/app/gegl/gimpoperationcolorize.c
==============================================================================
--- trunk/app/gegl/gimpoperationcolorize.c (original)
+++ trunk/app/gegl/gimpoperationcolorize.c Tue Jan 15 17:23:45 2008
@@ -77,32 +77,29 @@
gegl_operation_class_set_name (operation_class, "gimp-colorize");
- g_object_class_install_property (object_class,
- PROP_HUE,
- g_param_spec_float ("hue",
- "Hue",
- "Hue",
- 0.0, 360.0, 180.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class,
- PROP_SATURATION,
- g_param_spec_float ("saturation",
- "Saturation",
- "Saturation",
- 0.0, 100.0, 50.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class,
- PROP_LIGHTNESS,
- g_param_spec_float ("lightness",
- "Lightness",
- "Lightness",
- -100.0, 100.0, 0.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class, PROP_HUE,
+ g_param_spec_double ("hue",
+ "Hue",
+ "Hue",
+ 0.0, 1.0, 0.5,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_SATURATION,
+ g_param_spec_double ("saturation",
+ "Saturation",
+ "Saturation",
+ 0.0, 1.0, 0.5,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_LIGHTNESS,
+ g_param_spec_double ("lightness",
+ "Lightness",
+ "Lightness",
+ -1.0, 1.0, 0.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
@@ -121,15 +118,15 @@
switch (property_id)
{
case PROP_HUE:
- g_value_set_float (value, self->hue);
+ g_value_set_double (value, self->hue);
break;
case PROP_SATURATION:
- g_value_set_float (value, self->saturation);
+ g_value_set_double (value, self->saturation);
break;
case PROP_LIGHTNESS:
- g_value_set_float (value, self->lightness);
+ g_value_set_double (value, self->lightness);
break;
default:
@@ -149,15 +146,15 @@
switch (property_id)
{
case PROP_HUE:
- self->hue = g_value_get_float (value);
+ self->hue = g_value_get_double (value);
break;
case PROP_SATURATION:
- self->saturation = g_value_get_float (value);
+ self->saturation = g_value_get_double (value);
break;
case PROP_LIGHTNESS:
- self->lightness = g_value_get_float (value);
+ self->lightness = g_value_get_double (value);
break;
default:
@@ -187,17 +184,17 @@
if (self->lightness > 0)
{
- lum = lum * (100.0 - self->lightness) / 100.0;
+ lum = lum * (1.0 - self->lightness);
- lum += 1.0 - (100.0 - self->lightness) / 100.0;
+ lum += 1.0 - (1.0 - self->lightness);
}
else if (self->lightness < 0)
{
- lum = lum * (self->lightness + 100.0) / 100.0;
+ lum = lum * (self->lightness + 1.0);
}
- hsl.h = self->hue / 360.0;
- hsl.s = self->saturation / 100.0;
+ hsl.h = self->hue;
+ hsl.s = self->saturation;
hsl.l = lum;
gimp_hsl_to_rgb (&hsl, &rgb);
Modified: trunk/app/gegl/gimpoperationcolorize.h
==============================================================================
--- trunk/app/gegl/gimpoperationcolorize.h (original)
+++ trunk/app/gegl/gimpoperationcolorize.h Tue Jan 15 17:23:45 2008
@@ -38,9 +38,9 @@
{
GeglOperationPointFilter parent_instance;
- gfloat hue;
- gfloat saturation;
- gfloat lightness;
+ gdouble hue;
+ gdouble saturation;
+ gdouble lightness;
};
struct _GimpOperationColorizeClass
Modified: trunk/app/gegl/gimpoperationlevels.c
==============================================================================
--- trunk/app/gegl/gimpoperationlevels.c (original)
+++ trunk/app/gegl/gimpoperationlevels.c Tue Jan 15 17:23:45 2008
@@ -91,44 +91,44 @@
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_GAMMA,
- g_param_spec_float ("gamma",
- "Gamma",
- "Gamma",
- 0.1, 10.0, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_param_spec_double ("gamma",
+ "Gamma",
+ "Gamma",
+ 0.1, 10.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_LOW_INPUT,
- g_param_spec_float ("low-input",
- "Low Input",
- "Low Input",
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_param_spec_double ("low-input",
+ "Low Input",
+ "Low Input",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_HIGH_INPUT,
- g_param_spec_float ("high-input",
- "High Input",
- "High Input",
- 0.0, 1.0, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_param_spec_double ("high-input",
+ "High Input",
+ "High Input",
+ 0.0, 1.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_LOW_OUTPUT,
- g_param_spec_float ("low-output",
- "Low Output",
- "Low Output",
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_param_spec_double ("low-output",
+ "Low Output",
+ "Low Output",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_HIGH_OUTPUT,
- g_param_spec_float ("high-output",
- "High Output",
- "High Output",
- 0.0, 1.0, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_param_spec_double ("high-output",
+ "High Output",
+ "High Output",
+ 0.0, 1.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
@@ -165,23 +165,23 @@
break;
case PROP_GAMMA:
- g_value_set_float (value, self->gamma[self->channel]);
+ g_value_set_double (value, self->gamma[self->channel]);
break;
case PROP_LOW_INPUT:
- g_value_set_float (value, self->low_input[self->channel]);
+ g_value_set_double (value, self->low_input[self->channel]);
break;
case PROP_HIGH_INPUT:
- g_value_set_float (value, self->high_input[self->channel]);
+ g_value_set_double (value, self->high_input[self->channel]);
break;
case PROP_LOW_OUTPUT:
- g_value_set_float (value, self->low_output[self->channel]);
+ g_value_set_double (value, self->low_output[self->channel]);
break;
case PROP_HIGH_OUTPUT:
- g_value_set_float (value, self->high_output[self->channel]);
+ g_value_set_double (value, self->high_output[self->channel]);
break;
default:
@@ -205,23 +205,23 @@
break;
case PROP_GAMMA:
- self->gamma[self->channel] = g_value_get_float (value);
+ self->gamma[self->channel] = g_value_get_double (value);
break;
case PROP_LOW_INPUT:
- self->low_input[self->channel] = g_value_get_float (value);
+ self->low_input[self->channel] = g_value_get_double (value);
break;
case PROP_HIGH_INPUT:
- self->high_input[self->channel] = g_value_get_float (value);
+ self->high_input[self->channel] = g_value_get_double (value);
break;
case PROP_LOW_OUTPUT:
- self->low_output[self->channel] = g_value_get_float (value);
+ self->low_output[self->channel] = g_value_get_double (value);
break;
case PROP_HIGH_OUTPUT:
- self->high_output[self->channel] = g_value_get_float (value);
+ self->high_output[self->channel] = g_value_get_double (value);
break;
default:
@@ -230,13 +230,13 @@
}
}
-static inline gfloat
-gimp_operation_levels_map (gfloat value,
- gfloat gamma,
- gfloat low_input,
- gfloat high_input,
- gfloat low_output,
- gfloat high_output)
+static inline gdouble
+gimp_operation_levels_map (gdouble value,
+ gdouble gamma,
+ gdouble low_input,
+ gdouble high_input,
+ gdouble low_output,
+ gdouble high_output)
{
/* determine input intensity */
if (high_input != low_input)
@@ -278,7 +278,7 @@
for (channel = 0; channel < 4; channel++)
{
- gfloat value;
+ gdouble value;
value = gimp_operation_levels_map (src[channel],
self->gamma[channel + 1],
@@ -288,7 +288,7 @@
self->high_output[channel + 1]);
/* don't apply the overall curve to the alpha channel */
- if (channel != 3)
+ if (channel != ALPHA_PIX)
value = gimp_operation_levels_map (value,
self->gamma[0],
self->low_input[0],
Modified: trunk/app/gegl/gimpoperationlevels.h
==============================================================================
--- trunk/app/gegl/gimpoperationlevels.h (original)
+++ trunk/app/gegl/gimpoperationlevels.h Tue Jan 15 17:23:45 2008
@@ -42,13 +42,13 @@
GimpHistogramChannel channel;
- gfloat gamma[5];
+ gdouble gamma[5];
- gfloat low_input[5];
- gfloat high_input[5];
+ gdouble low_input[5];
+ gdouble high_input[5];
- gfloat low_output[5];
- gfloat high_output[5];
+ gdouble low_output[5];
+ gdouble high_output[5];
};
struct _GimpOperationLevelsClass
Modified: trunk/app/gegl/gimpoperationthreshold.c
==============================================================================
--- trunk/app/gegl/gimpoperationthreshold.c (original)
+++ trunk/app/gegl/gimpoperationthreshold.c Tue Jan 15 17:23:45 2008
@@ -76,23 +76,21 @@
gegl_operation_class_set_name (operation_class, "gimp-threshold");
- g_object_class_install_property (object_class,
- PROP_LOW,
- g_param_spec_float ("low",
- "Low",
- "Low threshold",
- 0.0, 1.0, 0.5,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-
- g_object_class_install_property (object_class,
- PROP_HIGH,
- g_param_spec_float ("high",
- "High",
- "High threshold",
- 0.0, 1.0, 1.0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class, PROP_LOW,
+ g_param_spec_double ("low",
+ "Low",
+ "Low threshold",
+ 0.0, 1.0, 0.5,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_HIGH,
+ g_param_spec_double ("high",
+ "High",
+ "High threshold",
+ 0.0, 1.0, 1.0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
@@ -111,11 +109,11 @@
switch (property_id)
{
case PROP_LOW:
- g_value_set_float (value, self->low);
+ g_value_set_double (value, self->low);
break;
case PROP_HIGH:
- g_value_set_float (value, self->high);
+ g_value_set_double (value, self->high);
break;
default:
@@ -135,11 +133,11 @@
switch (property_id)
{
case PROP_LOW:
- self->low = g_value_get_float (value);
+ self->low = g_value_get_double (value);
break;
case PROP_HIGH:
- self->high = g_value_get_float (value);
+ self->high = g_value_get_double (value);
break;
default:
Modified: trunk/app/gegl/gimpoperationthreshold.h
==============================================================================
--- trunk/app/gegl/gimpoperationthreshold.h (original)
+++ trunk/app/gegl/gimpoperationthreshold.h Tue Jan 15 17:23:45 2008
@@ -38,8 +38,8 @@
{
GeglOperationPointFilter parent_instance;
- gfloat low;
- gfloat high;
+ gdouble low;
+ gdouble high;
};
struct _GimpOperationThresholdClass
Modified: trunk/app/tools/gimpcolorizetool.c
==============================================================================
--- trunk/app/tools/gimpcolorizetool.c (original)
+++ trunk/app/tools/gimpcolorizetool.c Tue Jan 15 17:23:45 2008
@@ -172,9 +172,9 @@
GimpColorizeTool *col_tool = GIMP_COLORIZE_TOOL (image_map_tool);
gegl_node_set (image_map_tool->operation,
- "hue", col_tool->colorize->hue,
- "saturation", col_tool->colorize->saturation,
- "lightness", col_tool->colorize->lightness,
+ "hue", col_tool->colorize->hue / 360.0,
+ "saturation", col_tool->colorize->saturation / 100.0,
+ "lightness", col_tool->colorize->lightness / 100.0,
NULL);
colorize_calculate (col_tool->colorize);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]