[gimp/gimp-2-8] plug-ins: properly "Apply layer masks before saving" when checked.



commit f54659dd93546c4117d0c0d6e698bd0cb63b0079
Author: Jehan <jehan girinstud io>
Date:   Thu Jun 15 20:53:55 2017 +0200

    plug-ins: properly "Apply layer masks before saving" when checked.
    
    The `if` test was inverted. When the option is checked, we don't want to
    add the GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS capability so that
    gimp_export_image() applies the mask.
    This is a first step to fix bug 783528, but it's not finished. Right
    now, when the option is unchecked, the mask is simply ignored. We want
    to export a PDF mask instead.
    
    (cherry picked from commit 0bd94f172ae960c0229d925e08e489ec07cd8fa0)

 plug-ins/common/file-pdf-save.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index 5141abd..d14ff2d 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -459,10 +459,15 @@ run (const gchar      *name,
     }
   cr = cairo_create (pdf_file);
 
-  capabilities = GIMP_EXPORT_CAN_HANDLE_RGB | GIMP_EXPORT_CAN_HANDLE_ALPHA |
-    GIMP_EXPORT_CAN_HANDLE_GRAY | GIMP_EXPORT_CAN_HANDLE_LAYERS |
-    GIMP_EXPORT_CAN_HANDLE_INDEXED;
-  if (optimize.apply_masks)
+  capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB    |
+                  GIMP_EXPORT_CAN_HANDLE_ALPHA  |
+                  GIMP_EXPORT_CAN_HANDLE_GRAY   |
+                  GIMP_EXPORT_CAN_HANDLE_LAYERS |
+                  GIMP_EXPORT_CAN_HANDLE_INDEXED);
+  /* This seems counter-intuitive, but not setting the mask capability
+   * will apply any layer mask upon gimp_export_image().
+   */
+  if (! optimize.apply_masks)
     capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS;
 
   for (i = 0; i < multi_page.image_count; i++)


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