[gimp] Issue #2431: After coloring a selection and exporting to PDF, file...
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #2431: After coloring a selection and exporting to PDF, file...
- Date: Thu, 8 Nov 2018 14:26:54 +0000 (UTC)
commit ba98b98f58ef19262177fa43a18120ecb3be25a5
Author: Jehan <jehan girinstud io>
Date: Thu Nov 8 15:20:20 2018 +0100
Issue #2431: After coloring a selection and exporting to PDF, file...
... only shows the color (and nothing else) when "Convert bitmaps to
vector graphics where possible" was set.
This is because gimp_drawable_histogram() only checks selected pixels.
So let's make sure we work on a duplicate of the image so that we can
safely remove the selection before processing the export.
(cherry picked from commit 679e341285f5547d68863e646ae5411da65d8de4)
plug-ins/common/file-pdf-save.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index e7fc3b2cff..89d74d6dc9 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -502,7 +502,6 @@ run (const gchar *name,
for (i = 0; i < multi_page.image_count; i++)
{
gint32 image_ID = multi_page.images[i];
- gboolean exported;
gint32 *layers;
gint32 n_layers;
gdouble x_res, y_res;
@@ -519,15 +518,18 @@ run (const gchar *name,
*/
cairo_save (cr);
- if (gimp_export_image (&image_ID, &temp, NULL,
- capabilities) == GIMP_EXPORT_EXPORT)
+ if (! (gimp_export_image (&image_ID, &temp, NULL,
+ capabilities) == GIMP_EXPORT_EXPORT))
{
- exported = TRUE;
- }
- else
- {
- exported = FALSE;
+ /* gimp_drawable_histogram() only works within the bounds of
+ * the selection, which is a problem (see issue #2431).
+ * Instead of saving the selection, unselecting to later
+ * reselect, let's just always work on a duplicate of the
+ * image.
+ */
+ image_ID = gimp_image_duplicate (image_ID);
}
+ gimp_selection_none (image_ID);
gimp_image_get_resolution (image_ID, &x_res, &y_res);
x_scale = 72.0 / x_res;
@@ -701,8 +703,7 @@ run (const gchar *name,
cairo_show_page (cr);
cairo_restore (cr);
- if (exported)
- gimp_image_delete (image_ID);
+ gimp_image_delete (image_ID);
}
/* We are done with all the images - time to free the resources */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]