diff --git a/app/core/gimpdrawable-equalize.c b/app/core/gimpdrawable-equalize.c index ff481e7c149f2734127b6bbc498ed4c4556f365a..0998358b534108a789e6e52d51701dffa46468bb 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 38da9f0581f266ed4ac521e37eaaa4bf6107589d..352382fc2735b646591aae7083ccfe66873267e3 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 f87a8b1e704e7b014423dad8384cddc47a89ad38..ce0be318f29f4b73b4b48839d197f8a119c6d2ea 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 7f8173cdf4d9fa3dc1ad48f749eef094837ad0d1..c8657a2088242dc27e30715087817fb75147130e 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 45c4da1ebf611fbffb9f616fb2f6f40dcd664049..93200113098fb4197296da72a171756577cf9b0a 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 24145c322b47e349d51edaa089393c4beafe5319..315a4a7c1cd9694daf837a8d621bd3fdeb3c0342 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 adb24cc2c77364d7bf05ed124a139a1134b78c76..9338a7c84d8379deacc6b90a35d79551a90431ca 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 220a18bed0ef9517f261471a09779bcef33b9e67..e3d48a12c3883e387972742c8146c401162c212c 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 54c81939d14aa7572b0e224bc4c5467009350895..b2dcde36ae1d9686d15f3a85579b9b21d0953e24 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);