1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
24 /* Black is foreground, white is background */
25 class VCL_DLLPUBLIC BitmapBasicMorphologyFilter
: public BitmapFilter
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
;
35 Bitmap
filter(Bitmap
const& rBitmap
) const;
37 BasicMorphologyOp m_eOp
;
39 sal_uInt8 m_nValueOutside
= 0;
40 bool m_bUseValueOutside
= false;
43 class BitmapErodeFilter final
: public BitmapBasicMorphologyFilter
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
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: */