LibreOffice Module vcl (master)  1
BitmapTools.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_VCL_BITMAP_TOOLS_HXX
11 #define INCLUDED_VCL_BITMAP_TOOLS_HXX
12 
13 #include <config_cairo_canvas.h>
14 #include <vcl/bitmapex.hxx>
15 #include <vcl/ImageTree.hxx>
16 #if ENABLE_CAIRO_CANVAS
17 #include <vcl/cairo.hxx>
18 #endif
20 #include <array>
21 #include <vcl/RawBitmap.hxx>
22 
23 class SvStream;
24 namespace basegfx { class B2DHomMatrix; }
25 namespace com::sun::star::geometry { struct IntegerRectangle2D; }
26 
27 namespace vcl::bitmap {
28 
29 typedef sal_uInt8 (*lookup_table)[256];
30 
33 
36 
37 BitmapEx VCL_DLLPUBLIC loadFromName(const OUString& rFileName, const ImageLoadFlags eFlags = ImageLoadFlags::NONE);
38 
39 void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx, double fScaleFactor);
40 
49 BitmapEx VCL_DLLPUBLIC CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount );
50 
52 
53 #if ENABLE_CAIRO_CANVAS
54 VCL_DLLPUBLIC BitmapEx* CreateFromCairoSurface(Size size, cairo_surface_t* pSurface);
55 #endif
56 
58  const ::basegfx::B2DHomMatrix& rTransform,
59  ::basegfx::B2DRectangle const & rDestRect,
60  ::basegfx::B2DHomMatrix const & rLocalTransform );
61 
62 VCL_DLLPUBLIC void DrawAlphaBitmapAndAlphaGradient(BitmapEx & rBitmapEx, bool bFixedTransparence, float fTransparence, AlphaMask & rNewMask);
63 
64 VCL_DLLPUBLIC void DrawAndClipBitmap(const Point& rPos, const Size& rSize, const BitmapEx& rBitmap, BitmapEx & aBmpEx, basegfx::B2DPolyPolygon const & rClipPath);
65 
66 VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > GetMaskDIB(BitmapEx const & aBmpEx);
67 
72 VCL_DLLPUBLIC void CanvasCairoExtractBitmapData( BitmapEx const & rBmpEx, Bitmap & rBitmap, unsigned char*& data, bool& bHasAlpha, long& rnWidth, long& rnHeight );
73 
74 VCL_DLLPUBLIC css::uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx const & rBitmapEx, const css::geometry::IntegerRectangle2D& rect);
75 
76 // helper to construct historical 8x8 bitmaps with two colors
77 
78 BitmapEx VCL_DLLPUBLIC createHistorical8x8FromArray(std::array<sal_uInt8,64> const & pArray, Color aColorPix, Color aColorBack);
79 bool VCL_DLLPUBLIC isHistorical8x8(const BitmapEx& rBitmapEx, Color& o_rBack, Color& o_rFront);
80 
81 VCL_DLLPUBLIC bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult);
82 
83 } // end vcl::bitmap
84 
85 #endif // INCLUDED_VCL_BITMAP_TOOLS_HXX
86 
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void loadFromSvg(SvStream &rStream, const OUString &sPath, BitmapEx &rBitmapEx, double fScalingFactor)
Definition: BitmapTools.cxx:67
sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a)
ImageLoadFlags
Definition: ImageTree.hxx:31
void DrawAlphaBitmapAndAlphaGradient(BitmapEx &rBitmapEx, bool bFixedTransparence, float fTransparence, AlphaMask &rNewMask)
sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
lookup_table get_unpremultiply_table()
sal_uInt8(* lookup_table)[256]
Definition: BitmapTools.hxx:29
void CanvasCairoExtractBitmapData(BitmapEx const &aBmpEx, Bitmap &aBitmap, unsigned char *&data, bool &bHasAlpha, long &rnWidth, long &rnHeight)
BitmapEx CreateFromData(sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_uInt16 nBitCount)
Copy block of image data into the bitmap.
void DrawAndClipBitmap(const Point &rPos, const Size &rSize, const BitmapEx &rBitmap, BitmapEx &aBmpEx, basegfx::B2DPolyPolygon const &rClipPath)
bool isHistorical8x8(const BitmapEx &rBitmapEx, Color &o_rBack, Color &o_rFront)
css::uno::Sequence< sal_Int8 > GetMaskDIB(BitmapEx const &aBmpEx)
uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx const &rBitmapEx, const geometry::IntegerRectangle2D &rect)
Intended to be used to feed into CreateFromData to create a BitmapEx.
Definition: RawBitmap.hxx:21
BitmapEx CanvasTransformBitmap(const BitmapEx &rBitmap, const ::basegfx::B2DHomMatrix &rTransform,::basegfx::B2DRectangle const &rDestRect,::basegfx::B2DHomMatrix const &rLocalTransform)
BitmapEx createHistorical8x8FromArray(std::array< sal_uInt8, 64 > const &pArray, Color aColorPix, Color aColorBack)
lookup_table get_premultiply_table()
unsigned char sal_uInt8
bool convertBitmap32To24Plus8(BitmapEx const &rInput, BitmapEx &rResult)
BitmapEx loadFromName(const OUString &rFileName, const ImageLoadFlags eFlags)
Definition: BitmapTools.cxx:47
struct _cairo_surface cairo_surface_t
Definition: svpgdi.hxx:71