[gimp] app: use gegl:dither instead of gegl:reduction



commit 5627ad589f6350954000dee9b08a561867752f9f
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Dec 24 19:39:32 2016 +0100

    app: use gegl:dither instead of gegl:reduction

 app/actions/filters-actions.c          |   10 +++++-----
 app/core/gimpchannel.c                 |    6 +++---
 app/core/gimpdrawable.c                |    2 +-
 app/core/gimplayer.c                   |    6 +++---
 app/dialogs/convert-precision-dialog.h |    2 +-
 app/gegl/gimp-gegl-apply-operation.c   |   24 ++++++++++++------------
 app/gegl/gimp-gegl-apply-operation.h   |    4 ++--
 menus/image-menu.xml.in                |    2 +-
 8 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c
index ffc0e00..f214003 100644
--- a/app/actions/filters-actions.c
+++ b/app/actions/filters-actions.c
@@ -152,10 +152,10 @@ static const GimpStringActionEntry filters_actions[] =
     "gegl:color-exchange",
     NULL /* FIXME GIMP_HELP_FILTER_COLOR_EXCHANGE */ },
 
-  { "filters-color-reduction", GIMP_STOCK_GEGL,
-    NC_("filters-action", "Color _Reduction..."), NULL, NULL,
-    "gegl:color-reduction",
-    NULL /* FIXME GIMP_HELP_FILTER_COLOR_TEMPERATURE */ },
+  { "filters-dither", GIMP_STOCK_GEGL,
+    NC_("filters-action", "Dithe_r..."), NULL, NULL,
+    "gegl:dither",
+    NULL /* FIXME GIMP_HELP_FILTER_DITHER */ },
 
   { "filters-color-rotate", GIMP_STOCK_GEGL,
     NC_("filters-action", "_Rotate Colors..."), NULL, NULL,
@@ -665,7 +665,7 @@ filters_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("filters-checkerboard",            writable);
   SET_SENSITIVE ("filters-color-enhance",           writable && !gray);
   SET_SENSITIVE ("filters-color-exchange",          writable);
-  SET_SENSITIVE ("filters-color-reduction",         writable);
+  SET_SENSITIVE ("filters-dither",                  writable);
   SET_SENSITIVE ("filters-color-rotate",            writable);
   SET_SENSITIVE ("filters-color-temperature",       writable && !gray);
   SET_SENSITIVE ("filters-color-to-alpha",          writable && !gray && alpha);
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 68b79ff..65c4c42 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -975,9 +975,9 @@ gimp_channel_convert_type (GimpDrawable     *drawable,
       bits = (babl_format_get_bytes_per_pixel (new_format) * 8 /
               babl_format_get_n_components (new_format));
 
-      gimp_gegl_apply_color_reduction (gimp_drawable_get_buffer (drawable),
-                                       NULL, NULL,
-                                       dest_buffer, bits, mask_dither_type);
+      gimp_gegl_apply_dither (gimp_drawable_get_buffer (drawable),
+                              NULL, NULL,
+                              dest_buffer, 1 << bits, mask_dither_type);
     }
 
   gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 7783af1..13c8e4a 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1071,7 +1071,7 @@ gimp_drawable_convert_type (GimpDrawable      *drawable,
   if (old_bits <= new_bits || new_bits > 16)
     {
       /*  don't dither if we are converting to a higher bit depth,
-       *  or to more than 16 bits (gegl:color-reduction only does
+       *  or to more than 16 bits (gegl:dither only does
        *  16 bits).
        */
       layer_dither_type = GEGL_DITHER_NONE;
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 3d9b4db..d8284b8 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1100,9 +1100,9 @@ gimp_layer_convert_type (GimpDrawable     *drawable,
       bits = (babl_format_get_bytes_per_pixel (new_format) * 8 /
               babl_format_get_n_components (new_format));
 
-      gimp_gegl_apply_color_reduction (gimp_drawable_get_buffer (drawable),
-                                       NULL, NULL,
-                                       src_buffer, bits, layer_dither_type);
+      gimp_gegl_apply_dither (gimp_drawable_get_buffer (drawable),
+                              NULL, NULL,
+                              src_buffer, 1 << bits, layer_dither_type);
     }
 
   dest_buffer =
diff --git a/app/dialogs/convert-precision-dialog.h b/app/dialogs/convert-precision-dialog.h
index d34ba59..7659a5e 100644
--- a/app/dialogs/convert-precision-dialog.h
+++ b/app/dialogs/convert-precision-dialog.h
@@ -20,7 +20,7 @@
 
 
 /*  Don't offer dithering when converting down to more than this
- *  number of bits per component. Note that gegl:color-reduction would
+ *  number of bits per component. Note that gegl:dither would
  *  do 16 bit, so this is a limitation of the GUI to values that make
  *  sense. See bug #735895.
  */
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index 0688b9e..16ca76f 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -271,12 +271,12 @@ gimp_gegl_apply_cached_operation (GeglBuffer          *src_buffer,
 }
 
 void
-gimp_gegl_apply_color_reduction (GeglBuffer   *src_buffer,
-                                 GimpProgress *progress,
-                                 const gchar  *undo_desc,
-                                 GeglBuffer   *dest_buffer,
-                                 gint          bits,
-                                 gint          dither_type)
+gimp_gegl_apply_dither (GeglBuffer   *src_buffer,
+                        GimpProgress *progress,
+                        const gchar  *undo_desc,
+                        GeglBuffer   *dest_buffer,
+                        gint          levels,
+                        gint          dither_type)
 {
   GeglNode *node;
 
@@ -284,14 +284,14 @@ gimp_gegl_apply_color_reduction (GeglBuffer   *src_buffer,
   g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
   g_return_if_fail (GEGL_IS_BUFFER (dest_buffer));
 
-  bits = CLAMP (bits, 1, 16);
+  levels = CLAMP (levels, 2, 65536);
 
   node = gegl_node_new_child (NULL,
-                              "operation",     "gegl:color-reduction",
-                              "red-bits",      bits,
-                              "green-bits",    bits,
-                              "blue-bits",     bits,
-                              "alpha-bits",    bits,
+                              "operation",     "gegl:dither",
+                              "red-levels",    levels,
+                              "green-levels",  levels,
+                              "blue-levels",   levels,
+                              "alpha-bits",    levels,
                               "dither-method", dither_type,
                               NULL);
 
diff --git a/app/gegl/gimp-gegl-apply-operation.h b/app/gegl/gimp-gegl-apply-operation.h
index 9039b5b..cbe0b7d 100644
--- a/app/gegl/gimp-gegl-apply-operation.h
+++ b/app/gegl/gimp-gegl-apply-operation.h
@@ -47,11 +47,11 @@ gboolean   gimp_gegl_apply_cached_operation (GeglBuffer          *src_buffer,
 
 /*  apply specific operations  */
 
-void   gimp_gegl_apply_color_reduction (GeglBuffer             *src_buffer,
+void   gimp_gegl_apply_dither          (GeglBuffer             *src_buffer,
                                         GimpProgress           *progress,
                                         const gchar            *undo_desc,
                                         GeglBuffer             *dest_buffer,
-                                        gint                    bits,
+                                        gint                    levels,
                                         gint                    dither_type);
 
 void   gimp_gegl_apply_flatten         (GeglBuffer             *src_buffer,
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 101b6a0..64687fc 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -601,7 +601,7 @@
       </menu>
       <separator />
       <menuitem action="filters-color-to-alpha" />
-      <menuitem action="filters-color-reduction" />
+      <menuitem action="filters-dither" />
       <menuitem action="filters-color-temperature" />
       <menuitem action="filters-exposure" />
       <placeholder name="Modify" />


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