[gimp/pippin/linear-is-the-new-black: 2/8] operations: make brightness-contrast, levels and curves operate on linear data



commit c0b71078c4487b165dc5d2ba0b7763b7a61b842f
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Dec 14 06:03:15 2016 +0100

    operations: make brightness-contrast, levels and curves operate on linear data
    
    Part of the blunt way to resolve bug #757444

 app/operations/gimpoperationbrightnesscontrast.c |   11 +++++++++++
 app/operations/gimpoperationcurves.c             |   11 +++++++++++
 app/operations/gimpoperationlevels.c             |   12 ++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/app/operations/gimpoperationbrightnesscontrast.c 
b/app/operations/gimpoperationbrightnesscontrast.c
index e21f149..274f290 100644
--- a/app/operations/gimpoperationbrightnesscontrast.c
+++ b/app/operations/gimpoperationbrightnesscontrast.c
@@ -41,6 +41,7 @@ static gboolean gimp_operation_brightness_contrast_process (GeglOperation
                                                             gint                 level);
 
 
+static void gimp_operation_brightness_contrast_prepare (GeglOperation *operation);
 G_DEFINE_TYPE (GimpOperationBrightnessContrast, gimp_operation_brightness_contrast,
                GIMP_TYPE_OPERATION_POINT_FILTER)
 
@@ -64,6 +65,7 @@ gimp_operation_brightness_contrast_class_init (GimpOperationBrightnessContrastCl
                                  NULL);
 
   point_class->process         = gimp_operation_brightness_contrast_process;
+  operation_class->prepare = gimp_operation_brightness_contrast_prepare;
 
   g_object_class_install_property (object_class,
                                    GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
@@ -80,6 +82,15 @@ gimp_operation_brightness_contrast_init (GimpOperationBrightnessContrast *self)
 {
 }
 
+static void
+gimp_operation_brightness_contrast_prepare (GeglOperation *operation)
+{
+  const Babl *format = babl_format ("RGBA float");
+
+  gegl_operation_set_format (operation, "input",  format);
+  gegl_operation_set_format (operation, "output", format);
+}
+
 static inline gfloat
 gimp_operation_brightness_contrast_map (gfloat  value,
                                         gdouble brightness,
diff --git a/app/operations/gimpoperationcurves.c b/app/operations/gimpoperationcurves.c
index 87eed55..781c667 100644
--- a/app/operations/gimpoperationcurves.c
+++ b/app/operations/gimpoperationcurves.c
@@ -42,6 +42,7 @@ static gboolean gimp_operation_curves_process (GeglOperation       *operation,
                                                const GeglRectangle *roi,
                                                gint                 level);
 
+static void gimp_operation_curves_prepare (GeglOperation *operation);
 
 G_DEFINE_TYPE (GimpOperationCurves, gimp_operation_curves,
                GIMP_TYPE_OPERATION_POINT_FILTER)
@@ -66,6 +67,7 @@ gimp_operation_curves_class_init (GimpOperationCurvesClass *klass)
                                  NULL);
 
   point_class->process = gimp_operation_curves_process;
+  operation_class->prepare = gimp_operation_curves_prepare;
 
   g_object_class_install_property (object_class,
                                    GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
@@ -78,6 +80,15 @@ gimp_operation_curves_class_init (GimpOperationCurvesClass *klass)
 }
 
 static void
+gimp_operation_curves_prepare (GeglOperation *operation)
+{
+  const Babl *format = babl_format ("RGBA float");
+
+  gegl_operation_set_format (operation, "input",  format);
+  gegl_operation_set_format (operation, "output", format);
+}
+
+static void
 gimp_operation_curves_init (GimpOperationCurves *self)
 {
 }
diff --git a/app/operations/gimpoperationlevels.c b/app/operations/gimpoperationlevels.c
index 415a9da..cc3ecdc 100644
--- a/app/operations/gimpoperationlevels.c
+++ b/app/operations/gimpoperationlevels.c
@@ -38,6 +38,7 @@ static gboolean gimp_operation_levels_process (GeglOperation       *operation,
                                                glong                samples,
                                                const GeglRectangle *roi,
                                                gint                 level);
+static void gimp_operation_levels_prepare (GeglOperation *operation);
 
 
 G_DEFINE_TYPE (GimpOperationLevels, gimp_operation_levels,
@@ -46,6 +47,7 @@ G_DEFINE_TYPE (GimpOperationLevels, gimp_operation_levels,
 #define parent_class gimp_operation_levels_parent_class
 
 
+
 static void
 gimp_operation_levels_class_init (GimpOperationLevelsClass *klass)
 {
@@ -62,6 +64,7 @@ gimp_operation_levels_class_init (GimpOperationLevelsClass *klass)
                                  "description", "GIMP Levels operation",
                                  NULL);
 
+  operation_class->prepare = gimp_operation_levels_prepare;
   point_class->process = gimp_operation_levels_process;
 
   g_object_class_install_property (object_class,
@@ -75,6 +78,15 @@ gimp_operation_levels_class_init (GimpOperationLevelsClass *klass)
 }
 
 static void
+gimp_operation_levels_prepare (GeglOperation *operation)
+{
+  const Babl *format = babl_format ("RGBA float");
+
+  gegl_operation_set_format (operation, "input",  format);
+  gegl_operation_set_format (operation, "output", format);
+}
+
+static void
 gimp_operation_levels_init (GimpOperationLevels *self)
 {
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]