[gimp] Bug 736199 - Precision Conversion Dithering doesn't work at >16-bit precision
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 736199 - Precision Conversion Dithering doesn't work at >16-bit precision
- Date: Sun, 7 Sep 2014 21:29:16 +0000 (UTC)
commit 77482620b478229bdef55a47306fc76890cbbfdb
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 7 23:25:25 2014 +0200
Bug 736199 - Precision Conversion Dithering doesn't work at >16-bit precision
Don't allow to select dithering != "none" in the convert precision
dialog if the precision has more than 16 bits.
app/dialogs/convert-precision-dialog.c | 42 ++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/app/dialogs/convert-precision-dialog.c b/app/dialogs/convert-precision-dialog.c
index 67511a7..30b7bec 100644
--- a/app/dialogs/convert-precision-dialog.c
+++ b/app/dialogs/convert-precision-dialog.c
@@ -25,6 +25,7 @@
#include "dialogs-types.h"
+#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-utils.h"
#include "core/gimp.h"
@@ -50,9 +51,9 @@ typedef struct
GimpImage *image;
GimpProgress *progress;
- GimpContext *context;
GimpPrecision precision;
+ gint bits;
gint layer_dither_type;
gint text_layer_dither_type;
gint mask_dither_type;
@@ -93,6 +94,8 @@ convert_precision_dialog_new (GimpImage *image,
const gchar *enum_desc;
gchar *blurb;
GType dither_type;
+ const Babl *format;
+ gint bits;
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
@@ -101,12 +104,23 @@ convert_precision_dialog_new (GimpImage *image,
dialog = g_slice_new0 (ConvertDialog);
- dialog->image = image;
- dialog->precision = precision;
- dialog->progress = progress;
- dialog->layer_dither_type = saved_layer_dither_type;
- dialog->text_layer_dither_type = saved_text_layer_dither_type;
- dialog->mask_dither_type = saved_mask_dither_type;
+ /* a random format with precision */
+ format = gimp_babl_format (GIMP_RGB, precision, FALSE);
+ bits = (babl_format_get_bytes_per_pixel (format) * 8 /
+ babl_format_get_n_components (format));
+
+ dialog->image = image;
+ dialog->progress = progress;
+ dialog->precision = precision;
+ dialog->bits = bits;
+
+ /* gegl:color-reduction only does 16 bits */
+ if (bits <= 16)
+ {
+ dialog->layer_dither_type = saved_layer_dither_type;
+ dialog->text_layer_dither_type = saved_text_layer_dither_type;
+ dialog->mask_dither_type = saved_mask_dither_type;
+ }
gimp_enum_get_value (GIMP_TYPE_PRECISION, precision,
NULL, NULL, &enum_desc, NULL);
@@ -169,6 +183,9 @@ convert_precision_dialog_new (GimpImage *image,
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_widget_show (vbox);
+ /* gegl:color-reduction only does 16 bits */
+ gtk_widget_set_sensitive (vbox, bits <= 16);
+
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* layers */
@@ -273,9 +290,14 @@ convert_precision_dialog_response (GtkWidget *widget,
gimp_image_flush (dialog->image);
- /* Save defaults for next time */
- saved_layer_dither_type = dialog->layer_dither_type;
- saved_mask_dither_type = dialog->mask_dither_type;
+ /* gegl:color-reduction only does 16 bits */
+ if (dialog->bits <= 16)
+ {
+ /* Save defaults for next time */
+ saved_layer_dither_type = dialog->layer_dither_type;
+ saved_text_layer_dither_type = dialog->text_layer_dither_type;
+ saved_mask_dither_type = dialog->mask_dither_type;
+ }
}
gtk_widget_destroy (dialog->dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]