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 .
23 #include <vcl/regband.hxx>
24 #include <tools/poly.hxx>
25 #include <vcl/region.hxx>
32 const char* ImplDbgTestRegion( const void* pObj
);
35 // --------------------
36 // - ImplRegionHandle -
37 // --------------------
39 struct ImplRegionHandle
42 ImplRegionBand
* mpCurrRectBand
;
43 ImplRegionBandSep
* mpCurrRectBandSep
;
53 void* mpVoidCurrRectBand
;
54 void* mpVoidCurrRectBandSep
;
64 ImplRegionBase( int nCount
= 1 ); // TODO: replace manual refcounting
65 virtual ~ImplRegionBase();
67 sal_uIntPtr mnRefCount
;
68 sal_uIntPtr mnRectCount
;
69 PolyPolygon
* mpPolyPoly
;
70 basegfx::B2DPolyPolygon
* mpB2DPolyPoly
;
73 class ImplRegion
: public ImplRegionBase
78 ImplRegionBand
* mpFirstBand
; // root of the list with y-bands
79 ImplRegionBand
* mpLastCheckedBand
;
83 ImplRegion( const PolyPolygon
& rPolyPoly
);
84 ImplRegion( const basegfx::B2DPolyPolygon
& );
85 ImplRegion( const ImplRegion
& rImplRegion
);
88 ImplRegionBand
* ImplGetFirstRegionBand() const { return mpFirstBand
; }
89 PolyPolygon
* ImplGetPolyPoly() const { return mpPolyPoly
; }
91 void CreateBandRange( long nYTop
, long nYBottom
);
92 void InsertBands( long nYTop
, long nYBottom
);
93 sal_Bool
InsertSingleBand( ImplRegionBand
* mpImplRegionBand
,
94 long nYBandPosition
);
95 sal_Bool
InsertLine( const Point
& rFirstPoint
,
96 const Point
& rSecondPoint
,
98 sal_Bool
InsertPoint( const Point
&rPoint
,
100 sal_Bool bEndPoint
, LineType eLineType
);
102 /** Insert one band either after another band or as the first or only
103 band. Both the forward as well as the backward links are updated.
105 When <NULL/> then pBandToInsert is inserted as first band or as
106 only band when there are no other bands.
107 When not <NULL/> then pBandToInsert is inserted directly after
112 void InsertBand (ImplRegionBand
* pPreviousBand
,
113 ImplRegionBand
* pBandToInsert
);
115 void Union( long nLeft
, long nTop
, long nRight
, long nBottom
);
116 void Exclude( long nLeft
, long nTop
, long nRight
, long nBottom
);
117 void XOr( long nLeft
, long nTop
, long nRight
, long nBottom
);
119 // remove emtpy rects
120 sal_Bool
OptimizeBandList();
122 friend SvStream
& operator>>( SvStream
& rIStm
, Region
& rRegion
);
123 friend SvStream
& operator<<( SvStream
& rOStm
, const Region
& rRegion
);
126 #endif // _SV_REGION_H
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */