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 .
22 #include <o3tl/cow_wrapper.hxx>
23 #include <basegfx/basegfxdllapi.h>
33 namespace basegfx::utils
35 class ImplB2DClipState
;
37 /** This class provides an optimized, symbolic clip state for graphical output
39 Having a current 'clip' state is a common attribute of
40 almost all graphic output APIs, most of which internally
41 represent it via a list of rectangular bands. In contrast,
42 this implementation purely uses symbolic clips, but in a
43 quite efficient manner, deferring actual evaluation until
44 a clip representation is requested, and using faster code
45 paths for common special cases (like all-rectangle clips)
47 class BASEGFX_DLLPUBLIC B2DClipState
50 typedef o3tl::cow_wrapper
< ImplB2DClipState
> ImplType
;
56 /// Init clip, in 'cleared' state - everything is visible
59 B2DClipState( const B2DClipState
& );
60 B2DClipState( B2DClipState
&& );
61 explicit B2DClipState( const B2DPolyPolygon
& );
62 B2DClipState
& operator=( const B2DClipState
& );
63 B2DClipState
& operator=( B2DClipState
&& );
65 /// Set clip to 'null' - nothing is visible
68 /// returns true when clip is 'cleared' - everything is visible
69 bool isCleared() const;
71 bool operator==(const B2DClipState
&) const;
73 void unionRange(const B2DRange
& );
74 void unionPolyPolygon(const B2DPolyPolygon
& );
76 void intersectRange(const B2DRange
& );
77 void intersectPolyPolygon(const B2DPolyPolygon
& );
79 void subtractRange(const B2DRange
& );
80 void subtractPolyPolygon(const B2DPolyPolygon
& );
82 void xorRange(const B2DRange
& );
83 void xorPolyPolygon(const B2DPolyPolygon
& );
85 void transform(const B2DHomMatrix
& );
87 B2DPolyPolygon
const & getClipPoly() const;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */