diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-09 16:27:35 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-02-10 17:57:09 +0100 |
commit | ac98ff5e869ca23dfa6174704f0eb56fbb1ae734 (patch) | |
tree | 4cbbc9de890e69bb78ad6f91cf8ff6f995bc53a6 /include/vcl/BitmapTools.hxx | |
parent | fc763bd9b96eb99c40734bd3db332c2d4bd84d06 (diff) |
use RawBitmap and BitmapEx in icgm filter
Change-Id: Icaffda666c27f733c0d490905e91a68b72073bcb
Reviewed-on: https://gerrit.libreoffice.org/49502
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'include/vcl/BitmapTools.hxx')
-rw-r--r-- | include/vcl/BitmapTools.hxx | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx index ed448dfa0e1c..6339994a285d 100644 --- a/include/vcl/BitmapTools.hxx +++ b/include/vcl/BitmapTools.hxx @@ -11,13 +11,36 @@ #define INCLUDED_VCL_BITMAP_TOOLS_HXX #include <vcl/bitmapex.hxx> -#include <tools/stream.hxx> - #include <vcl/ImageTree.hxx> +#include <vcl/salbtype.hxx> +#include <tools/stream.hxx> namespace vcl { namespace bitmap { +/** + * intended to be used to feed into CreateFromData to create a BitmapEx + */ +class VCL_DLLPUBLIC RawBitmap +{ +friend BitmapEx VCL_DLLPUBLIC CreateFromData( RawBitmap&& rawBitmap ); + std::unique_ptr<sal_uInt8[]> mpData; + Size maSize; +public: + RawBitmap(Size const & rSize) + : mpData(new sal_uInt8[ rSize.getWidth() * 3 * rSize.getHeight()]), + maSize(rSize) + { + } + void SetPixel(long nY, long nX, BitmapColor nColor) + { + long p = nY * maSize.getWidth() + nX; + mpData[ p++ ] = nColor.GetRed(); + mpData[ p++ ] = nColor.GetGreen(); + mpData[ p ] = nColor.GetBlue(); + } +}; + BitmapEx VCL_DLLPUBLIC loadFromName(const OUString& rFileName, const ImageLoadFlags eFlags = ImageLoadFlags::NONE); void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScaleFactor); @@ -32,6 +55,7 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, */ BitmapEx VCL_DLLPUBLIC CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount ); +BitmapEx VCL_DLLPUBLIC CreateFromData( RawBitmap && data ); }} // end vcl::bitmap |