[gimp/gimp-2-10] plug-ins: fix #7086 Can't remove color space from a 1bit monochrome palette



commit b274cc07d961e66c9b233a14423e2ead0b93f6b7
Author: Jacob Boerema <jgboerema gmail com>
Date:   Tue Aug 3 14:51:15 2021 -0400

    plug-ins: fix #7086 Can't remove color space from a 1bit monochrome palette
    
    For 1-bit BMP export we did not show the save dialog, making it
    impossible to change settings interactively.
    
    We enable the save dialog for 1-bit too, making sure to disable RLE, which
    is not available for 1-bit.

 plug-ins/file-bmp/bmp-save.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/file-bmp/bmp-save.c b/plug-ins/file-bmp/bmp-save.c
index 4294ce526f..9d9ad2d164 100644
--- a/plug-ins/file-bmp/bmp-save.c
+++ b/plug-ins/file-bmp/bmp-save.c
@@ -66,7 +66,8 @@ static  void      write_image     (FILE   *f,
                                    gint    mask_info_size,
                                    gint    color_space_size);
 
-static  gboolean  save_dialog     (gint    channels);
+static  gboolean  save_dialog     (gint    channels,
+                                   gint    bpp);
 
 
 static struct
@@ -259,9 +260,10 @@ save_image (const gchar  *filename,
 
   if (run_mode == GIMP_RUN_INTERACTIVE &&
       (BitsPerPixel == 8 ||
-       BitsPerPixel == 4))
+       BitsPerPixel == 4 ||
+       BitsPerPixel == 1))
     {
-      if (! save_dialog (1))
+      if (! save_dialog (1, BitsPerPixel))
         return GIMP_PDB_CANCEL;
     }
   else if (BitsPerPixel == 24 ||
@@ -269,7 +271,7 @@ save_image (const gchar  *filename,
     {
       if (run_mode == GIMP_RUN_INTERACTIVE)
         {
-          if (! save_dialog (channels))
+          if (! save_dialog (channels, BitsPerPixel))
             return GIMP_PDB_CANCEL;
         }
 
@@ -714,6 +716,8 @@ write_image (FILE   *f,
     }
   else
     {
+      if (bpp == 1)
+        use_run_length_encoding = 0;
       switch (use_run_length_encoding)  /* now it gets more difficult */
         {               /* uncompressed 1,4 and 8 bit */
         case 0:
@@ -893,7 +897,7 @@ format_callback (GtkToggleButton *toggle,
 }
 
 static gboolean
-save_dialog (gint channels)
+save_dialog (gint channels, gint bpp)
 {
   GtkWidget *dialog;
   GtkWidget *toggle;
@@ -922,7 +926,7 @@ save_dialog (gint channels)
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
                                 BMPSaveData.use_run_length_encoding);
   gtk_widget_show (toggle);
-  if (channels > 1)
+  if (channels > 1 || bpp == 1)
     gtk_widget_set_sensitive (toggle, FALSE);
 
   g_signal_connect (toggle, "toggled",


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