2015-11-08 23:00:14 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_VCL_BITMAP_TOOLS_HXX
|
|
|
|
#define INCLUDED_VCL_BITMAP_TOOLS_HXX
|
|
|
|
|
|
|
|
#include <vcl/bitmapex.hxx>
|
2016-12-18 14:31:14 +01:00
|
|
|
#include <vcl/ImageTree.hxx>
|
2018-02-09 16:27:35 +02:00
|
|
|
#include <vcl/salbtype.hxx>
|
|
|
|
#include <tools/stream.hxx>
|
2016-10-27 18:18:23 +02:00
|
|
|
|
2016-12-09 23:27:54 +01:00
|
|
|
namespace vcl {
|
|
|
|
namespace bitmap {
|
2015-11-08 23:00:14 +01:00
|
|
|
|
2018-02-09 16:27:35 +02:00
|
|
|
/**
|
2018-02-12 15:31:18 +02:00
|
|
|
* Intended to be used to feed into CreateFromData to create a BitmapEx. RGB data format.
|
2018-02-09 16:27:35 +02:00
|
|
|
*/
|
|
|
|
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)
|
|
|
|
{
|
2018-02-12 15:31:18 +02:00
|
|
|
long p = (nY * maSize.getWidth() + nX) * 3;
|
2018-02-09 16:27:35 +02:00
|
|
|
mpData[ p++ ] = nColor.GetRed();
|
|
|
|
mpData[ p++ ] = nColor.GetGreen();
|
|
|
|
mpData[ p ] = nColor.GetBlue();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-12-09 23:27:54 +01:00
|
|
|
BitmapEx VCL_DLLPUBLIC loadFromName(const OUString& rFileName, const ImageLoadFlags eFlags = ImageLoadFlags::NONE);
|
2016-10-27 17:42:36 +02:00
|
|
|
|
2017-11-28 16:29:28 +02:00
|
|
|
void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScaleFactor);
|
2016-10-27 17:42:36 +02:00
|
|
|
|
2018-02-06 12:00:16 +02:00
|
|
|
/** Copy block of image data into the bitmap.
|
|
|
|
Assumes that the Bitmap has been constructed with the desired size.
|
|
|
|
|
|
|
|
@param pData
|
|
|
|
The block of data to copy
|
|
|
|
@param nStride
|
|
|
|
The number of bytes in a scanline, must >= width
|
|
|
|
*/
|
|
|
|
BitmapEx VCL_DLLPUBLIC CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount );
|
|
|
|
|
2018-02-09 16:27:35 +02:00
|
|
|
BitmapEx VCL_DLLPUBLIC CreateFromData( RawBitmap && data );
|
2018-02-06 12:00:16 +02:00
|
|
|
|
2016-12-09 23:27:54 +01:00
|
|
|
}} // end vcl::bitmap
|
2015-11-08 23:00:14 +01:00
|
|
|
|
|
|
|
#endif // INCLUDED_VCL_BITMAP_TOOLS_HXX
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|