[arrayfire] 131/284: FEAT Added isImageIOAvailable function to check support

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit 4d06c748f98cde6840b4cbfdc52dcb50ac53f8d3
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Thu Dec 31 12:11:51 2015 -0500

    FEAT Added isImageIOAvailable function to check support
---
 docs/details/image.dox    |  6 ++++++
 include/af/image.h        | 24 ++++++++++++++++++++++++
 src/api/c/imageio2.cpp    | 12 ++++++++++++
 src/api/cpp/imageio.cpp   |  7 +++++++
 src/api/unified/image.cpp |  5 +++++
 5 files changed, 54 insertions(+)

diff --git a/docs/details/image.dox b/docs/details/image.dox
index 53ac761..288e4f6 100644
--- a/docs/details/image.dox
+++ b/docs/details/image.dox
@@ -430,6 +430,12 @@ Save an array to disk as an image
 Supported formats include JPG, PNG, PPM and other formats supported by freeimage
 
 
+\defgroup imageio_func_available isImageIoAvailable
+\ingroup imageio_mat
+
+Returns true if ArrayFire was compiled with ImageIO (FreeImage) support
+
+
 \defgroup imagemem_func_load loadImageMem
 \ingroup imageio_mat
 
diff --git a/include/af/image.h b/include/af/image.h
index f38bb41..ad56cfc 100644
--- a/include/af/image.h
+++ b/include/af/image.h
@@ -147,6 +147,16 @@ AFAPI array loadImageNative(const char* filename);
 AFAPI void saveImageNative(const char* filename, const array& in);
 #endif
 
+#if AF_API_VERSION >= 33
+/**
+    Function to check if Image IO is available
+
+    \returns true if ArrayFire was commpiled with ImageIO support, false otherwise.
+    \ingroup imageio_func_available
+*/
+AFAPI bool isImageIOAvailable();
+#endif
+
 /**
     C++ Interface for resizing an image to specified dimensions
 
@@ -794,6 +804,20 @@ extern "C" {
     AFAPI af_err af_save_image_native(const char* filename, const af_array in);
 #endif
 
+#if AF_API_VERSION >= 33
+    /**
+        Function to check if Image IO is available
+
+        \param[out] out is true if ArrayFire was commpiled with ImageIO support,
+        false otherwise.
+
+        \return     \ref AF_SUCCESS if successful
+
+        \ingroup imageio_func_available
+    */
+    AFAPI af_err af_is_image_io_available(bool *out);
+#endif
+
     /**
        C Interface for resizing an image to specified dimensions
 
diff --git a/src/api/c/imageio2.cpp b/src/api/c/imageio2.cpp
index d50afef..adc4244 100644
--- a/src/api/c/imageio2.cpp
+++ b/src/api/c/imageio2.cpp
@@ -373,6 +373,12 @@ af_err af_save_image_native(const char* filename, const af_array in)
     return AF_SUCCESS;
 }
 
+af_err af_is_image_io_available(bool *out)
+{
+    *out = true;
+    return AF_SUCCESS;
+}
+
 #else   // WITH_FREEIMAGE
 #include <af/image.h>
 #include <stdio.h>
@@ -386,4 +392,10 @@ af_err af_save_image_native(const char* filename, const af_array in)
 {
     AF_RETURN_ERROR("ArrayFire compiled without Image IO (FreeImage) support", AF_ERR_NOT_CONFIGURED);
 }
+
+af_err af_is_image_io_available(bool *out)
+{
+    *out = false;
+    return AF_SUCCESS;
+}
 #endif  // WITH_FREEIMAGE
diff --git a/src/api/cpp/imageio.cpp b/src/api/cpp/imageio.cpp
index e70b26d..75ef5fe 100644
--- a/src/api/cpp/imageio.cpp
+++ b/src/api/cpp/imageio.cpp
@@ -68,4 +68,11 @@ void saveImageNative(const char* filename, const array& in)
     AF_THROW(af_save_image_native(filename, in.get()));
 }
 
+bool isImageIOAvailable()
+{
+    bool out = false;
+    AF_THROW(af_is_image_io_available(&out));
+    return out;
+}
+
 }
diff --git a/src/api/unified/image.cpp b/src/api/unified/image.cpp
index d0f9aa6..7b11595 100644
--- a/src/api/unified/image.cpp
+++ b/src/api/unified/image.cpp
@@ -55,6 +55,11 @@ af_err af_save_image_native(const char* filename, const af_array in)
     return CALL(filename, in);
 }
 
+af_err af_is_image_io_available(bool *out)
+{
+    return CALL(out);
+}
+
 af_err af_resize(af_array *out, const af_array in, const dim_t odim0, const dim_t odim1, const af_interp_type method)
 {
     CHECK_ARRAYS(in);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list