-
-
Notifications
You must be signed in to change notification settings - Fork 336
/
Region.h
104 lines (75 loc) · 2.31 KB
/
Region.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright 2003-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _REGION_H
#define _REGION_H
#include <Rect.h>
namespace BPrivate {
class ServerLink;
class LinkReceiver;
};
/* Integer rect used to define a clipping rectangle. All bounds are inclusive. */
/* Moved from DirectWindow.h */
typedef struct {
int32 left;
int32 top;
int32 right;
int32 bottom;
} clipping_rect;
class BRegion {
public:
BRegion();
BRegion(const BRegion& other);
BRegion(const BRect rect);
virtual ~BRegion();
BRegion& operator=(const BRegion& other);
bool operator==(const BRegion& other) const;
void Set(BRect newBounds);
void Set(clipping_rect newBounds);
BRect Frame() const;
clipping_rect FrameInt() const;
BRect RectAt(int32 index);
BRect RectAt(int32 index) const;
clipping_rect RectAtInt(int32 index);
clipping_rect RectAtInt(int32 index) const;
int32 CountRects();
int32 CountRects() const;
bool Intersects(BRect rect) const;
bool Intersects(clipping_rect clipping) const;
bool Contains(BPoint point) const;
bool Contains(int32 x, int32 y);
bool Contains(int32 x, int32 y) const;
void PrintToStream() const;
void OffsetBy(const BPoint& point);
void OffsetBy(int32 x, int32 y);
void MakeEmpty();
void Include(BRect rect);
void Include(clipping_rect clipping);
void Include(const BRegion* region);
void Exclude(BRect rect);
void Exclude(clipping_rect clipping);
void Exclude(const BRegion* region);
void IntersectWith(const BRegion* region);
void ExclusiveInclude(const BRegion* region);
private:
friend class BDirectWindow;
friend class BPrivate::ServerLink;
friend class BPrivate::LinkReceiver;
class Support;
friend class Support;
private:
BRegion(const clipping_rect& other);
void _AdoptRegionData(BRegion& region);
bool _SetSize(int32 newSize);
clipping_rect _Convert(const BRect& rect) const;
clipping_rect _ConvertToInternal(const BRect& rect) const;
clipping_rect _ConvertToInternal(
const clipping_rect& rect) const;
private:
int32 fCount;
int32 fDataSize;
clipping_rect fBounds;
clipping_rect* fData;
};
#endif // _REGION_H