Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / vcl / BitmapBasicMorphologyFilter.hxx
blob055e1e14e637a6cb373fc868b5a60d1d37e49803
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 */
11 #ifndef INCLUDED_VCL_BITMAPBASICMORPHOLOGYFILTER_HXX
12 #define INCLUDED_VCL_BITMAPBASICMORPHOLOGYFILTER_HXX
14 #include <vcl/bitmap.hxx>
15 #include <vcl/bitmapex.hxx>
16 #include <vcl/BitmapFilter.hxx>
18 enum class BasicMorphologyOp
20 erode,
21 dilate
24 /* Black is foreground, white is background */
25 class VCL_DLLPUBLIC BitmapBasicMorphologyFilter : public BitmapFilter
27 public:
28 BitmapBasicMorphologyFilter(BasicMorphologyOp op, sal_Int32 nRadius);
29 BitmapBasicMorphologyFilter(BasicMorphologyOp op, sal_Int32 nRadius, sal_uInt8 nValueOutside);
30 virtual ~BitmapBasicMorphologyFilter();
32 virtual BitmapEx execute(BitmapEx const& rBitmap) const override;
34 private:
35 Bitmap filter(Bitmap const& rBitmap) const;
37 BasicMorphologyOp m_eOp;
38 sal_Int32 m_nRadius;
39 sal_uInt8 m_nValueOutside = 0;
40 bool m_bUseValueOutside = false;
43 class BitmapErodeFilter final : public BitmapBasicMorphologyFilter
45 public:
46 BitmapErodeFilter(sal_Int32 nRadius)
47 : BitmapBasicMorphologyFilter(BasicMorphologyOp::erode, nRadius)
50 BitmapErodeFilter(sal_Int32 nRadius, sal_uInt8 nValueOutside)
51 : BitmapBasicMorphologyFilter(BasicMorphologyOp::erode, nRadius, nValueOutside)
56 class BitmapDilateFilter final : public BitmapBasicMorphologyFilter
58 public:
59 BitmapDilateFilter(sal_Int32 nRadius)
60 : BitmapBasicMorphologyFilter(BasicMorphologyOp::dilate, nRadius)
63 BitmapDilateFilter(sal_Int32 nRadius, sal_uInt8 nValueOutside)
64 : BitmapBasicMorphologyFilter(BasicMorphologyOp::dilate, nRadius, nValueOutside)
69 #endif // INCLUDED_VCL_BITMAPBASICMORPHOLOGYFILTER_HXX
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */