LibreOffice Module vcl (master) 1
BitmapFilter.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
11#ifndef INCLUDED_VCL_BITMAPFILTER_HXX
12#define INCLUDED_VCL_BITMAPFILTER_HXX
13
14#include <vcl/bitmapex.hxx>
15#include <functional>
16
17class Animation;
18
19namespace vcl::bitmap
20{
21// Generates strip ranges and run the input function with the start and
22// end as parameters. The additional parameter bLast denotes if the
23// iteration is the last one.
24//
25// Example:
26// first = 0, last = 100, STRIP_SIZE = 32
27// this will generate:
28// [0, 31, false], [32, 63, false], [64, 95, false], [96, 100, true]
29template <int STRIP_SIZE>
31 tools::Long nFirst, tools::Long nLast,
32 std::function<void(tools::Long const nStart, tools::Long const nEnd, bool const bLast)>
33 aFunction)
34{
35 tools::Long nStart = nFirst;
36 for (; nStart < nLast - STRIP_SIZE; nStart += STRIP_SIZE)
37 {
38 tools::Long nEnd = nStart + STRIP_SIZE - 1;
39 aFunction(nStart, nEnd, false);
40 }
41 aFunction(nStart, nLast, true);
42}
43
44} // end vcl::bitmap
45
47{
48public:
50 virtual ~BitmapFilter();
51
52 virtual BitmapEx execute(BitmapEx const& rBitmapEx) const = 0;
53
54 static bool Filter(BitmapEx& rBmpEx, BitmapFilter const& rFilter);
55 static bool Filter(Animation& rBmpEx, BitmapFilter const& rFilter);
56};
57
58#endif
59
60/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual BitmapEx execute(BitmapEx const &rBitmapEx) const =0
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
long Long
void generateStripRanges(tools::Long nFirst, tools::Long nLast, std::function< void(tools::Long const nStart, tools::Long const nEnd, bool const bLast)> aFunction)