[arrayfire] 201/408: graphics window set size functions

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:57 UTC 2015


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

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

commit dc38b246f162f2fa1af943653bf77d51d8e3b8fe
Author: pradeep <pradeep at arrayfire.com>
Date:   Thu Aug 6 16:04:08 2015 -0400

    graphics window set size functions
---
 CMakeModules/build_forge.cmake |  2 +-
 include/af/graphics.h          | 22 ++++++++++++++++++++++
 src/api/c/image.cpp            | 19 +++++++++++++++++++
 src/api/cpp/graphics.cpp       |  5 +++++
 4 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/CMakeModules/build_forge.cmake b/CMakeModules/build_forge.cmake
index 0a4933c..a995276 100644
--- a/CMakeModules/build_forge.cmake
+++ b/CMakeModules/build_forge.cmake
@@ -22,7 +22,7 @@ ENDIF()
 ExternalProject_Add(
     forge-ext
     GIT_REPOSITORY https://github.com/arrayfire/forge.git
-    GIT_TAG d58557f130548980af32fc562830c119f9bf71ef
+    GIT_TAG 5e40ded1d5dd43c637f9a041b4c281e8e1715f00
     PREFIX "${prefix}"
     INSTALL_DIR "${prefix}"
     UPDATE_COMMAND ""
diff --git a/include/af/graphics.h b/include/af/graphics.h
index 9c72093..81dc7da 100644
--- a/include/af/graphics.h
+++ b/include/af/graphics.h
@@ -104,6 +104,14 @@ class AFAPI Window {
         void setTitle(const char* const title);
 
         /**
+           Set the window size
+
+           \param[in]   w is target width of the window
+           \param[in]   h is target height of the window
+         */
+        void setSize(const unsigned w, const unsigned h);
+
+        /**
            Set the colormap to be used for subsequent rendering calls
 
            \param[in] cmap should be one of the enum values from \ref ColorMap
@@ -232,6 +240,20 @@ AFAPI af_err af_set_position(const af_window wind, const unsigned x, const unsig
 AFAPI af_err af_set_title(const af_window wind, const char* const title);
 
 /**
+   C Interface wrapper for setting window position
+
+   \param[in]   wind is the window handle
+   \param[in]   w is target width of the window
+   \param[in]   h is target height of the window
+
+   \return     \ref AF_SUCCESS if set size for window is successful, otherwise an appropriate error code
+   is returned.
+
+   \ingroup gfx_func_window
+*/
+AFAPI af_err af_set_size(const af_window wind, const unsigned w, const unsigned h);
+
+/**
    C Interface wrapper for drawing an array as an image
 
    \param[in]   wind is the window handle
diff --git a/src/api/c/image.cpp b/src/api/c/image.cpp
index f375604..c59b31b 100644
--- a/src/api/c/image.cpp
+++ b/src/api/c/image.cpp
@@ -185,6 +185,25 @@ af_err af_set_title(const af_window wind, const char* const title)
 #endif
 }
 
+af_err af_set_size(const af_window wind, const unsigned w, const unsigned h)
+{
+#if defined(WITH_GRAPHICS)
+    if(wind==0) {
+        std::cerr<<"Not a valid window"<<std::endl;
+        return AF_SUCCESS;
+    }
+
+    try {
+        fg::Window* wnd = reinterpret_cast<fg::Window*>(wind);
+        wnd->setSize(w, h);
+    }
+    CATCHALL;
+    return AF_SUCCESS;
+#else
+    return AF_ERR_NO_GFX;
+#endif
+}
+
 af_err af_grid(const af_window wind, const int rows, const int cols)
 {
 #if defined(WITH_GRAPHICS)
diff --git a/src/api/cpp/graphics.cpp b/src/api/cpp/graphics.cpp
index 6e4f3aa..1272d2f 100644
--- a/src/api/cpp/graphics.cpp
+++ b/src/api/cpp/graphics.cpp
@@ -57,6 +57,11 @@ void Window::setTitle(const char* const title)
     AF_THROW(af_set_title(get(), title));
 }
 
+void Window::setSize(const unsigned w, const unsigned h)
+{
+    AF_THROW(af_set_size(get(), w, h));
+}
+
 void Window::setColorMap(const ColorMap cmap)
 {
     _cmap = cmap;

-- 
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