fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / basebmp / tools.hxx
blob31854a1d5e251a1aa90996c25bf67393e2631e79
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 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BASEBMP_TOOLS_HXX
21 #define INCLUDED_BASEBMP_TOOLS_HXX
23 #include <basegfx/range/b2ibox.hxx>
24 #include <basegfx/point/b2ipoint.hxx>
25 #include <vigra/tuple.hxx>
26 #include <vigra/diff2d.hxx>
28 namespace basebmp
30 inline vigra::Diff2D topLeft( const basegfx::B2IBox& rRange )
31 { return vigra::Diff2D(rRange.getMinX(),rRange.getMinY()); }
33 inline vigra::Diff2D bottomRight( const basegfx::B2IBox& rRange )
34 { return vigra::Diff2D(rRange.getMaxX(),rRange.getMaxY()); }
36 template< class Iterator, class Accessor >
37 inline vigra::triple<Iterator,Iterator,Accessor>
38 destIterRange(Iterator const& begin,
39 Accessor const& accessor,
40 const basegfx::B2IBox& rRange)
42 return vigra::triple<Iterator,Iterator,Accessor>(
43 begin + topLeft(rRange),
44 begin + bottomRight(rRange),
45 accessor);
48 template< class Iterator, class Accessor >
49 inline vigra::triple<Iterator,Iterator,Accessor>
50 srcIterRange(Iterator const& begin,
51 Accessor const& accessor,
52 const basegfx::B2IBox& rRange)
54 return vigra::triple<Iterator,Iterator,Accessor>(
55 begin + topLeft(rRange),
56 begin + bottomRight(rRange),
57 accessor);
60 template< class Iterator, class Accessor >
61 inline vigra::pair<Iterator,Accessor>
62 srcIter(Iterator const& begin,
63 Accessor const& accessor,
64 const basegfx::B2IPoint& rPt)
66 return vigra::pair<Iterator,Accessor>(
67 begin + vigra::Diff2D(rPt.getX(),rPt.getY()),
68 accessor);
71 template< class Iterator, class Accessor >
72 inline vigra::pair<Iterator,Accessor>
73 destIter(Iterator const& begin,
74 Accessor const& accessor,
75 const basegfx::B2IPoint& rPt)
77 return vigra::pair<Iterator,Accessor>(
78 begin + vigra::Diff2D(rPt.getX(),rPt.getY()),
79 accessor);
83 #endif /* INCLUDED_BASEBMP_TOOLS_HXX */
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */