[gimp/goat-invasion] plug-ins: return image type and #layers from the JPEG thumbnail procedure



commit 096cc14d89059672c78a0ef2f6034c69f220ddaf
Author: Michael Natterer <mitch gimp org>
Date:   Wed Apr 11 21:48:22 2012 +0200

    plug-ins: return image type and #layers from the JPEG thumbnail procedure

 plug-ins/file-jpeg/jpeg-load.c |   11 +++++++----
 plug-ins/file-jpeg/jpeg-load.h |    9 +++++----
 plug-ins/file-jpeg/jpeg.c      |   18 ++++++++++++------
 3 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index 87267fd..5ff858b 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -653,10 +653,11 @@ term_source (j_decompress_ptr cinfo)
 }
 
 gint32
-load_thumbnail_image (const gchar  *filename,
-                      gint         *width,
-                      gint         *height,
-                      GError      **error)
+load_thumbnail_image (const gchar   *filename,
+                      gint          *width,
+                      gint          *height,
+                      GimpImageType *type,
+                      GError       **error)
 {
   gint32 volatile  image_ID;
   ExifData        *exif_data;
@@ -952,6 +953,8 @@ load_thumbnail_image (const gchar  *filename,
 
   jpeg_exif_rotate (image_ID, orientation);
 
+  *type = layer_type;
+
   return image_ID;
 }
 
diff --git a/plug-ins/file-jpeg/jpeg-load.h b/plug-ins/file-jpeg/jpeg-load.h
index 1225d7e..fe38c41 100644
--- a/plug-ins/file-jpeg/jpeg-load.h
+++ b/plug-ins/file-jpeg/jpeg-load.h
@@ -26,10 +26,11 @@ gint32 load_image           (const gchar  *filename,
 
 #ifdef HAVE_LIBEXIF
 
-gint32 load_thumbnail_image (const gchar  *filename,
-                             gint         *width,
-                             gint         *height,
-                             GError      **error);
+gint32 load_thumbnail_image (const gchar   *filename,
+                             gint          *width,
+                             gint          *height,
+                             GimpImageType *type,
+                             GError       **error);
 
 #endif /* HAVE_LIBEXIF */
 
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index 9f0d069..8afe283 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -191,7 +191,7 @@ run (const gchar      *name,
      gint             *nreturn_vals,
      GimpParam       **return_vals)
 {
-  static GimpParam   values[4];
+  static GimpParam   values[6];
   GimpRunMode        run_mode;
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
   gint32             image_ID;
@@ -257,21 +257,27 @@ run (const gchar      *name,
         }
       else
         {
-          const gchar *filename = param[0].data.d_string;
-          gint         width    = 0;
-          gint         height   = 0;
+          const gchar  *filename = param[0].data.d_string;
+          gint          width    = 0;
+          gint          height   = 0;
+          GimpImageType type     = -1;
 
-          image_ID = load_thumbnail_image (filename, &width, &height, &error);
+          image_ID = load_thumbnail_image (filename, &width, &height, &type,
+                                           &error);
 
           if (image_ID != -1)
             {
-              *nreturn_vals = 4;
+              *nreturn_vals = 6;
               values[1].type         = GIMP_PDB_IMAGE;
               values[1].data.d_image = image_ID;
               values[2].type         = GIMP_PDB_INT32;
               values[2].data.d_int32 = width;
               values[3].type         = GIMP_PDB_INT32;
               values[3].data.d_int32 = height;
+              values[4].type         = GIMP_PDB_INT32;
+              values[4].data.d_int32 = type;
+              values[5].type         = GIMP_PDB_INT32;
+              values[5].data.d_int32 = 1; /* num_layers */
             }
           else
             {



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