xref: /haiku/headers/os/interface/Polygon.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2  * Copyright 2001-2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _POLYGON_H
6 #define _POLYGON_H
7 
8 
9 #include <InterfaceDefs.h>
10 #include <Rect.h>
11 
12 //namespace BPrivate { class BAffineTransform; }
13 //using namespace BPrivate;
14 
15 
16 class BPolygon {
17 public:
18 								BPolygon(const BPoint* points, int32 count);
19 								BPolygon(const BPolygon& other);
20 								BPolygon(const BPolygon* other);
21 								BPolygon();
22 	virtual						~BPolygon();
23 
24 			BPolygon&			operator=(const BPolygon& other);
25 
26 			BRect				Frame() const;
27 			void				AddPoints(const BPoint* points, int32 count);
28 			int32				CountPoints() const;
29 			void				MapTo(BRect srcRect, BRect dstRect);
30 			void				PrintToStream() const;
31 
32 //			void				TransformBy(const BAffineTransform& transform);
33 //			BPolygon&			TransformBySelf(
34 //									const BAffineTransform& transform);
35 //			BPolygon			TransformByCopy(
36 //									const BAffineTransform& transform) const;
37 
38 private:
39 	friend class BView;
40 
41 			bool				_AddPoints(const BPoint* points, int32 count,
42 									bool computeBounds);
43 			void				_ComputeBounds();
44 			void				_MapPoint(BPoint* point, const BRect& srcRect,
45 										const BRect& dstRect);
46 			void				_MapRectangle(BRect* rect,
47 									const BRect& srcRect,
48 									const BRect& dstRect);
49 
50 private:
51 			BRect				fBounds;
52 			uint32				fCount;
53 			BPoint*				fPoints;
54 };
55 
56 #endif // _POLYGON_H_
57