Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / include / basegfx / tools / b2dclipstate.hxx
blobbd57a120a2ef80b2d97c8eee98b671e656170b53
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_BASEGFX_TOOLS_B2DCLIPSTATE_HXX
21 #define INCLUDED_BASEGFX_TOOLS_B2DCLIPSTATE_HXX
23 #include <sal/types.h>
24 #include <o3tl/cow_wrapper.hxx>
25 #include <basegfx/basegfxdllapi.h>
28 namespace basegfx
30 class B2DRange;
31 class B2DPolyRange;
32 class B2DPolygon;
33 class B2DPolyPolygon;
35 namespace tools
37 class ImplB2DClipState;
39 /** This class provides an optimized, symbolic clip state for graphical output
41 Having a current 'clip' state is a common attribute of
42 almost all graphic output APIs, most of which internally
43 represent it via a list of rectangular bands. In contrast,
44 this implementation purely uses symbolic clips, but in a
45 quite efficient manner, deferring actual evaluation until
46 a clip representation is requested, and using faster code
47 paths for common special cases (like all-rectangle clips)
49 class BASEGFX_DLLPUBLIC B2DClipState
51 public:
52 typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType;
54 private:
55 ImplType mpImpl;
57 public:
58 /// Init clip, in 'cleared' state - everything is visible
59 B2DClipState();
60 ~B2DClipState();
61 B2DClipState( const B2DClipState& );
62 explicit B2DClipState( const B2DPolyPolygon& );
63 B2DClipState& operator=( const B2DClipState& );
65 /// Set clip to 'null' - nothing is visible
66 void makeNull();
68 /// returns true when clip is 'cleared' - everything is visible
69 bool isCleared() const;
71 bool operator==(const B2DClipState&) const;
72 bool operator!=(const B2DClipState&) const;
74 void unionRange(const B2DRange& );
75 void unionPolyPolygon(const B2DPolyPolygon& );
77 void intersectRange(const B2DRange& );
78 void intersectPolyPolygon(const B2DPolyPolygon& );
80 void subtractRange(const B2DRange& );
81 void subtractPolyPolygon(const B2DPolyPolygon& );
83 void xorRange(const B2DRange& );
84 void xorPolyPolygon(const B2DPolyPolygon& );
86 B2DPolyPolygon getClipPoly() const;
91 #endif // INCLUDED_BASEGFX_TOOLS_B2DCLIPSTATE_HXX
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */