diff --git a/app/core/gimpdrawable-equalize.c b/app/core/gimpdrawable-equalize.c index ff481e7c14..0998358b53 100644 --- a/app/core/gimpdrawable-equalize.c +++ b/app/core/gimpdrawable-equalize.c @@ -40,7 +40,7 @@ gimp_drawable_equalize (GimpDrawable *drawable, g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable))); - hist = gimp_histogram_new (); + hist = gimp_histogram_new (TRUE); gimp_drawable_calculate_histogram (drawable, hist); equalize = gegl_node_new_child (NULL, diff --git a/app/core/gimpdrawable-levels.c b/app/core/gimpdrawable-levels.c index 38da9f0581..352382fc27 100644 --- a/app/core/gimpdrawable-levels.c +++ b/app/core/gimpdrawable-levels.c @@ -52,7 +52,7 @@ gimp_drawable_levels_stretch (GimpDrawable *drawable, config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL); - histogram = gimp_histogram_new (); + histogram = gimp_histogram_new (TRUE); gimp_drawable_calculate_histogram (drawable, histogram); gimp_levels_config_stretch (config, histogram, diff --git a/app/core/gimphistogram.c b/app/core/gimphistogram.c index f87a8b1e70..ce0be318f2 100644 --- a/app/core/gimphistogram.c +++ b/app/core/gimphistogram.c @@ -42,6 +42,7 @@ enum struct _GimpHistogramPrivate { + gboolean gamma_correct; gint n_channels; gint n_bins; gdouble *values; @@ -185,9 +186,13 @@ gimp_histogram_get_memsize (GimpObject *object, /* public functions */ GimpHistogram * -gimp_histogram_new (void) +gimp_histogram_new (gboolean gamma_correct) { - return g_object_new (GIMP_TYPE_HISTOGRAM, NULL); + GimpHistogram *histogram = g_object_new (GIMP_TYPE_HISTOGRAM, NULL); + + histogram->priv->gamma_correct = gamma_correct; + + return histogram; } /** @@ -206,7 +211,7 @@ gimp_histogram_duplicate (GimpHistogram *histogram) g_return_val_if_fail (GIMP_IS_HISTOGRAM (histogram), NULL); - dup = gimp_histogram_new (); + dup = gimp_histogram_new (histogram->priv->gamma_correct); dup->priv->n_channels = histogram->priv->n_channels; dup->priv->n_bins = histogram->priv->n_bins; @@ -257,7 +262,10 @@ gimp_histogram_calculate (GimpHistogram *histogram, if (model == babl_model ("Y")) { - format = babl_format ("Y float"); + if (priv->gamma_correct) + format = babl_format ("Y' float"); + else + format = babl_format ("Y float"); } else if (model == babl_model ("Y'")) { @@ -265,7 +273,10 @@ gimp_histogram_calculate (GimpHistogram *histogram, } else if (model == babl_model ("YA")) { - format = babl_format ("YA float"); + if (priv->gamma_correct) + format = babl_format ("Y'A float"); + else + format = babl_format ("YA float"); } else if (model == babl_model ("Y'A")) { @@ -273,7 +284,10 @@ gimp_histogram_calculate (GimpHistogram *histogram, } else if (model == babl_model ("RGB")) { - format = babl_format ("RGB float"); + if (priv->gamma_correct) + format = babl_format ("R'G'B' float"); + else + format = babl_format ("RGB float"); } else if (model == babl_model ("R'G'B'")) { @@ -281,7 +295,10 @@ gimp_histogram_calculate (GimpHistogram *histogram, } else if (model == babl_model ("RGBA")) { - format = babl_format ("RGBA float"); + if (priv->gamma_correct) + format = babl_format ("R'G'B'A float"); + else + format = babl_format ("RGBA float"); } else if (model == babl_model ("R'G'B'A")) { diff --git a/app/core/gimphistogram.h b/app/core/gimphistogram.h index 7f8173cdf4..c8657a2088 100644 --- a/app/core/gimphistogram.h +++ b/app/core/gimphistogram.h @@ -50,7 +50,7 @@ struct _GimpHistogramClass GType gimp_histogram_get_type (void) G_GNUC_CONST; -GimpHistogram * gimp_histogram_new (void); +GimpHistogram * gimp_histogram_new (gboolean gamma_correct); GimpHistogram * gimp_histogram_duplicate (GimpHistogram *histogram); diff --git a/app/pdb/color-cmds.c b/app/pdb/color-cmds.c index 45c4da1ebf..9320011309 100644 --- a/app/pdb/color-cmds.c +++ b/app/pdb/color-cmds.c @@ -623,7 +623,7 @@ histogram_invoker (GimpProcedure *procedure, if (success) { - GimpHistogram *histogram = gimp_histogram_new (); + GimpHistogram *histogram = gimp_histogram_new (TRUE); gimp_drawable_calculate_histogram (drawable, histogram); diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 24145c322b..315a4a7c1c 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -212,7 +212,7 @@ gimp_curves_tool_initialize (GimpTool *tool, gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (c_tool->channel_menu), curves_menu_sensitivity, drawable, NULL); - histogram = gimp_histogram_new (); + histogram = gimp_histogram_new (TRUE); gimp_drawable_calculate_histogram (drawable, histogram); gimp_histogram_view_set_background (GIMP_HISTOGRAM_VIEW (c_tool->graph), histogram); diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index adb24cc2c7..9338a7c84d 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -177,7 +177,7 @@ gimp_levels_tool_class_init (GimpLevelsToolClass *klass) static void gimp_levels_tool_init (GimpLevelsTool *tool) { - tool->histogram = gimp_histogram_new (); + tool->histogram = gimp_histogram_new (TRUE); } static void diff --git a/app/tools/gimpthresholdtool.c b/app/tools/gimpthresholdtool.c index 220a18bed0..e3d48a12c3 100644 --- a/app/tools/gimpthresholdtool.c +++ b/app/tools/gimpthresholdtool.c @@ -116,7 +116,7 @@ gimp_threshold_tool_class_init (GimpThresholdToolClass *klass) static void gimp_threshold_tool_init (GimpThresholdTool *t_tool) { - t_tool->histogram = gimp_histogram_new (); + t_tool->histogram = gimp_histogram_new (TRUE); } static void diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c index 54c81939d1..b2dcde36ae 100644 --- a/app/widgets/gimphistogrameditor.c +++ b/app/widgets/gimphistogrameditor.c @@ -280,7 +280,7 @@ gimp_histogram_editor_set_image (GimpImageEditor *image_editor, if (image) { - editor->histogram = gimp_histogram_new (); + editor->histogram = gimp_histogram_new (TRUE); gimp_histogram_view_set_histogram (view, editor->histogram);