[gimp] Bug 728633 - Improvements to the file-raw plugin



commit c3f2a5a1169c13bd28a1ff252703dc67897f1fc4
Author: Björn Kautler <Bjoern Kautler net>
Date:   Thu Apr 17 03:21:26 2014 +0200

    Bug 728633 - Improvements to the file-raw plugin
    
    Export the image before saving as raw image data.

 plug-ins/common/file-raw-data.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index a57b139..f1f4dcc 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -234,6 +234,7 @@ run (const gchar      *name,
   GError            *error  = NULL;
   gint32             image_id;
   gint32             drawable_id;
+  GimpExportReturn   export = GIMP_EXPORT_CANCEL;
 
   INIT_I18N ();
   gegl_init (NULL, NULL);
@@ -314,6 +315,20 @@ run (const gchar      *name,
       image_id    = param[1].data.d_int32;
       drawable_id = param[2].data.d_int32;
 
+      /* export the image */
+      export = gimp_export_image (&image_id, &drawable_id, NULL,
+                                  GIMP_EXPORT_CAN_HANDLE_RGB     |
+                                  GIMP_EXPORT_CAN_HANDLE_GRAY    |
+                                  GIMP_EXPORT_CAN_HANDLE_INDEXED |
+                                  GIMP_EXPORT_CAN_HANDLE_ALPHA);
+
+      if (export == GIMP_EXPORT_CANCEL)
+        {
+          *nreturn_vals = 1;
+          values[0].data.d_status = GIMP_PDB_CANCEL;
+          return;
+        }
+
       if (run_mode == GIMP_RUN_INTERACTIVE)
         {
           gimp_get_data (SAVE_PROC, runtime);
@@ -341,6 +356,9 @@ run (const gchar      *name,
           status = save_image (param[3].data.d_string, image_id, drawable_id,
                                &error);
         }
+
+      if (export == GIMP_EXPORT_EXPORT)
+        gimp_image_delete (image_id);
     }
 
   g_free (runtime);


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