[gimp/bug-728633: 3/3] Bug 728633 - Improvements to the file-raw plugin.



commit 1ca556972e09e360782ee17c97fe73661ebd449f
Author: Björn Kautler <Bjoern Kautler net>
Date:   Mon Apr 21 01:44:40 2014 +0200

    Bug 728633 - Improvements to the file-raw plugin.
    
    Allow non-interactive and last-vals call of raw image data export.

 plug-ins/common/file-raw-data.c |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index f52388c..b0cd481 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -453,11 +453,38 @@ run (const gchar      *name,
             status = GIMP_PDB_CANCEL;
           break;
 
-        default:
-          /* we want to make sure we always do save-as for raw images
-           * to avoid confusion and data loss
+        case GIMP_RUN_NONINTERACTIVE:
+          /*
+           * Make sure all the arguments are there!
            */
-          status = GIMP_PDB_CALLING_ERROR;
+          if (nparams != 5)
+            {
+              if (nparams != 7)
+                {
+                  status = GIMP_PDB_CALLING_ERROR;
+                }
+              else
+                {
+                  rawvals.image_type   = param[5].data.d_int32;
+                  rawvals.palette_type = param[6].data.d_int32;
+
+                  if (((rawvals.image_type != RAW_RGB) && (rawvals.image_type != RAW_PLANAR)) ||
+                      ((rawvals.palette_type != RAW_PALETTE_RGB) && (rawvals.palette_type != 
RAW_PALETTE_BGR)))
+                    {
+                      status = GIMP_PDB_CALLING_ERROR;
+                    }
+                }
+            }
+          break;
+
+        case GIMP_RUN_WITH_LAST_VALS:
+          /*
+           * Possibly retrieve data...
+           */
+          gimp_get_data (SAVE_PROC, &rawvals);
+          break;
+
+        default:
           break;
         }
 


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