aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-09-17 01:04:30 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-13 22:41:06 +0100
commit368ff00d125f00e9fcfc536f198697aba79c2d40 (patch)
treea4e0d360ef474c58bd173670d6fe359a33c150f5
parentb05920748f2eb83839c7925f3c83530b733331f1 (diff)
downloadusdx-368ff00d125f00e9fcfc536f198697aba79c2d40.tar.gz
usdx-368ff00d125f00e9fcfc536f198697aba79c2d40.tar.xz
usdx-368ff00d125f00e9fcfc536f198697aba79c2d40.zip
utils/image: add shortcut to get image size as Dimension
-rw-r--r--src/utils/image.cpp6
-rw-r--r--src/utils/image.hpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/image.cpp b/src/utils/image.cpp
index 93808f2e..3fd8b3a9 100644
--- a/src/utils/image.cpp
+++ b/src/utils/image.cpp
@@ -81,4 +81,10 @@ namespace usdx
return surface;
}
+
+ const Dimension<int> Image::get_size(void) const
+ {
+ const SDL_Surface* s = get_surface();
+ return Dimension<int>(s->w, s->h);
+ }
};
diff --git a/src/utils/image.hpp b/src/utils/image.hpp
index b968652c..3ca973fd 100644
--- a/src/utils/image.hpp
+++ b/src/utils/image.hpp
@@ -30,6 +30,7 @@
#include <boost/filesystem.hpp>
#include <SDL/SDL.h>
#include <log4cpp/Category.hh>
+#include "dimension.hpp"
namespace usdx
{
@@ -60,6 +61,7 @@ namespace usdx
virtual ~Image();
const SDL_Surface* get_surface(void) const;
+ const Dimension<int> get_size(void) const;
};
};