[gegl] posterize: propage BablSpace, and explicitly request sRGB TRC



commit fbf0a925352b93d410ee0c3aab2af54e03f4ce58
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Jul 5 21:50:08 2018 +0200

    posterize: propage BablSpace, and explicitly request sRGB TRC
    
    Maybe this should be using R'G'B' instead of R~G~B~ - for consistently useful
    in most workflows though using a perceptual TRC makes sense.

 operations/common/posterize.c              |  10 ++++++++++
 tests/compositions/reference/posterize.png | Bin 300303 -> 118630 bytes
 2 files changed, 10 insertions(+)
---
diff --git a/operations/common/posterize.c b/operations/common/posterize.c
index ff3bfa0e4..1e9e2ccd7 100644
--- a/operations/common/posterize.c
+++ b/operations/common/posterize.c
@@ -38,6 +38,15 @@ property_int  (levels, _("Levels"), 8)
 #define RINT(a) ((gint)(a+0.5))
 #endif
 
+static void
+prepare (GeglOperation *operation)
+{
+  const Babl *space = gegl_operation_get_source_space (operation, "input");
+  gegl_operation_set_format (operation, "input",
+                             babl_format_with_space ("R~G~B~A float", space));
+  gegl_operation_set_format (operation, "output",
+                             babl_format_with_space ("R~G~B~A float", space));
+}
 
 static gboolean process (GeglOperation       *operation,
                          void                *in_buf,
@@ -124,6 +133,7 @@ gegl_op_class_init (GeglOpClass *klass)
   point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
 
   operation_class->opencl_support = TRUE;
+  operation_class->prepare        = prepare;
   point_filter_class->process     = process;
   point_filter_class->cl_process  = cl_process;
 
diff --git a/tests/compositions/reference/posterize.png b/tests/compositions/reference/posterize.png
index ec9440c58..ac440fb16 100644
Binary files a/tests/compositions/reference/posterize.png and b/tests/compositions/reference/posterize.png 
differ


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