From 4a4fd38c876768f28f9c1f0a99faf385515576bc Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 27 Oct 2016 18:18:23 +0200 Subject: vcl: add bitmap::loadFromResource with additional flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Tomaž Vajngerl --- vcl/source/bitmap/BitmapTools.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'vcl/source') 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 +#include +#include +#include + 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 xContext(comphelper::getProcessComponentContext()); -- cgit