summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-10-27 18:18:23 +0200
committerTomaž Vajngerl <quikee@gmail.com>2016-10-29 18:15:04 +0000
commit4a4fd38c876768f28f9c1f0a99faf385515576bc (patch)
tree5279972495777e778c4b64b7001f8440ec010a08 /vcl/source
parent484390a09624f68a8dec01eb5bf06e84cdcb80f6 (diff)
vcl: add bitmap::loadFromResource with additional flags
Sometimes we want to surpress automatic scaling and converting for dark theme. This adds a loadFromResource function with additional flags which makes this possible. Change-Id: I893cee82ad6942644755f0c5b772fb5f073bbf00 Reviewed-on: https://gerrit.libreoffice.org/30341 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/bitmap/BitmapTools.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index fe4736326036..02de4209adc1 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -21,6 +21,10 @@
#include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp>
+#include <tools/resmgr.hxx>
+#include <tools/rc.h>
+#include <vcl/svapp.hxx>
+
using namespace css;
using drawinglayer::primitive2d::Primitive2DSequence;
@@ -32,6 +36,24 @@ namespace vcl
namespace bitmap
{
+BitmapEx loadFromResource(const ResId& rResId, const ImageLoadFlags eFlags)
+{
+ BitmapEx aBitmapEx;
+
+ ResMgr* pResMgr = nullptr;
+
+ ResMgr::GetResourceSkipHeader(rResId.SetRT( RSC_BITMAP ), &pResMgr);
+ pResMgr->ReadLong();
+ pResMgr->ReadLong();
+
+ const OUString aFileName(pResMgr->ReadString());
+ OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+
+ ImplImageTree::get().loadImage(aFileName, aIconTheme, aBitmapEx, true, eFlags);
+
+ return aBitmapEx;
+}
+
void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScalingFactor)
{
uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());