2 * Copyright 2001-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
7 * Stephan Aßmus <superstippi@gmx.de>
26 IntRect(const IntRect
& r
);
27 IntRect(const BRect
& r
);
28 IntRect(int32 l
, int32 t
, int32 r
, int32 b
);
29 IntRect(const IntPoint
& lt
,
32 IntRect
& operator=(const IntRect
&r
);
33 void Set(int32 l
, int32 t
, int32 r
, int32 b
);
35 void PrintToStream() const;
37 IntPoint
LeftTop() const;
38 IntPoint
RightBottom() const;
39 IntPoint
LeftBottom() const;
40 IntPoint
RightTop() const;
42 void SetLeftTop(const IntPoint
& p
);
43 void SetRightBottom(const IntPoint
& p
);
44 void SetLeftBottom(const IntPoint
& p
);
45 void SetRightTop(const IntPoint
& p
);
48 void InsetBy(const IntPoint
& p
);
49 void InsetBy(int32 dx
, int32 dy
);
50 void OffsetBy(const IntPoint
& p
);
51 void OffsetBy(int32 dx
, int32 dy
);
52 void OffsetTo(const IntPoint
& p
);
53 void OffsetTo(int32 x
, int32 y
);
55 // expression transformations
56 IntRect
& InsetBySelf(const IntPoint
& p
);
57 IntRect
& InsetBySelf(int32 dx
, int32 dy
);
58 IntRect
InsetByCopy(const IntPoint
& p
);
59 IntRect
InsetByCopy(int32 dx
, int32 dy
);
60 IntRect
& OffsetBySelf(const IntPoint
& p
);
61 IntRect
& OffsetBySelf(int32 dx
, int32 dy
);
62 IntRect
OffsetByCopy(const IntPoint
& p
);
63 IntRect
OffsetByCopy(int32 dx
, int32 dy
);
64 IntRect
& OffsetToSelf(const IntPoint
& p
);
65 IntRect
& OffsetToSelf(int32 dx
, int32 dy
);
66 IntRect
OffsetToCopy(const IntPoint
& p
);
67 IntRect
OffsetToCopy(int32 dx
, int32 dy
);
70 bool operator==(const IntRect
& r
) const;
71 bool operator!=(const IntRect
& r
) const;
73 // intersection and union
74 IntRect
operator&(const IntRect
& r
) const;
75 IntRect
operator|(const IntRect
& r
) const;
77 // conversion to BRect and clipping_rect
78 operator clipping_rect() const;
79 operator BRect() const
80 { return BRect(left
, top
,
83 bool Intersects(const IntRect
& r
) const;
86 int32
IntegerWidth() const;
88 int32
IntegerHeight() const;
89 bool Contains(const IntPoint
& p
) const;
90 bool Contains(const IntRect
& r
) const;
94 // inline definitions ----------------------------------------------------------
97 IntRect::LeftTop() const
99 return *(const IntPoint
*)&left
;
104 IntRect::RightBottom() const
106 return *(const IntPoint
*)&right
;
111 IntRect::LeftBottom() const
113 return IntPoint(left
, bottom
);
118 IntRect::RightTop() const
120 return IntPoint(right
, top
);
133 IntRect::IntRect(int32 l
, int32 t
, int32 r
, int32 b
)
143 IntRect::IntRect(const IntRect
&r
)
153 IntRect::IntRect(const BRect
&r
)
155 left
= (int32
)r
.left
;
157 right
= (int32
)r
.right
;
158 bottom
= (int32
)r
.bottom
;
163 IntRect::IntRect(const IntPoint
& leftTop
, const IntPoint
& rightBottom
)
167 right
= rightBottom
.x
;
168 bottom
= rightBottom
.y
;
173 IntRect::operator=(const IntRect
& from
)
178 bottom
= from
.bottom
;
184 IntRect::Set(int32 l
, int32 t
, int32 r
, int32 b
)
194 IntRect::IsValid() const
196 return left
<= right
&& top
<= bottom
;
201 IntRect::IntegerWidth() const
208 IntRect::Width() const
215 IntRect::IntegerHeight() const
222 IntRect::Height() const
228 IntRect::operator clipping_rect() const