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/.
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 _BGFX_TOOLS_CLIPSTATE_HXX
21 #define _BGFX_TOOLS_CLIPSTATE_HXX
23 #include <sal/types.h>
24 #include <o3tl/cow_wrapper.hxx>
25 #include <basegfx/basegfxdllapi.h>
27 //////////////////////////////////////////////////////////////////////////////
38 class ImplB2DClipState
;
40 /** This class provides an optimized, symbolic clip state for graphical output
42 Having a current 'clip' state is a common attribute of
43 almost all graphic output APIs, most of which internally
44 represent it via a list of rectangular bands. In contrast,
45 this implementation purely uses symbolic clips, but in a
46 quite efficient manner, deferring actual evaluation until
47 a clip representation is requested, and using faster code
48 paths for common special cases (like all-rectangle clips)
50 class BASEGFX_DLLPUBLIC B2DClipState
53 typedef o3tl::cow_wrapper
< ImplB2DClipState
> ImplType
;
59 /// Init clip, in 'cleared' state - everything is visible
62 B2DClipState( const B2DClipState
& );
63 explicit B2DClipState( const B2DPolyPolygon
& );
64 B2DClipState
& operator=( const B2DClipState
& );
66 /// Set clip to 'null' - nothing is visible
69 /// returns true when clip is 'cleared' - everything is visible
70 bool isCleared() const;
72 bool operator==(const B2DClipState
&) const;
73 bool operator!=(const B2DClipState
&) const;
75 void unionRange(const B2DRange
& );
76 void unionPolyPolygon(const B2DPolyPolygon
& );
78 void intersectRange(const B2DRange
& );
79 void intersectPolyPolygon(const B2DPolyPolygon
& );
81 void subtractRange(const B2DRange
& );
82 void subtractPolyPolygon(const B2DPolyPolygon
& );
84 void xorRange(const B2DRange
& );
85 void xorPolyPolygon(const B2DPolyPolygon
& );
87 B2DPolyPolygon
getClipPoly() const;
92 #endif // _BGFX_TOOLS_CLIPSTATE_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */