From 8ba9dc8011a3b17d97828f9a8b800f8ad56459bf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 14 Jul 2012 12:39:24 +0300 Subject: Add to resourcemanager method to load imageset from image. --- src/gui/theme.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gui/theme.cpp') diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 4d22612fb..77fe24d51 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -895,3 +895,27 @@ Image *Theme::getImageFromThemeXml(const std::string &name) } return nullptr; } + +ImageSet *Theme::getImageSetFromThemeXml(const std::string &name, + int w, int h) +{ + Theme *theme = Theme::instance(); + Skin *skin = theme->load(name); + if (skin) + { + const ImageRect &rect = skin->getBorder(); + if (rect.grid[0]) + { + Image *image = rect.grid[0]; + + ResourceManager *resman = ResourceManager::getInstance(); + ImageSet *imageSet = resman->getSubImageSet(image, w, h); + +// image->incRef(); + theme->unload(skin); + return imageSet; + } + theme->unload(skin); + } + return nullptr; +} -- cgit v1.2.3-70-g09d2