xref: /haiku/headers/os/interface/Polygon.h (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2001-2002, OpenBeOS
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //
22 //	File Name:		Polygon.h
23 //	Author:			Marc Flerackers (mflerackers@androme.be)
24 //	Description:	BPolygon represents a n-sided area.
25 //------------------------------------------------------------------------------
26 
27 #ifndef _POLYGON_H
28 #define _POLYGON_H
29 
30 // Standard Includes -----------------------------------------------------------
31 
32 // System Includes -------------------------------------------------------------
33 #include <BeBuild.h>
34 #include <InterfaceDefs.h>
35 #include <Rect.h>
36 
37 // Project Includes ------------------------------------------------------------
38 
39 // Local Includes --------------------------------------------------------------
40 
41 // Local Defines ---------------------------------------------------------------
42 
43 // Globals ---------------------------------------------------------------------
44 
45 // BPolygon class --------------------------------------------------------------
46 class BPolygon {
47 
48 public:
49 					BPolygon(const BPoint *ptArray, int32 numPoints);
50 					BPolygon();
51 					BPolygon(const BPolygon *poly);
52 virtual				~BPolygon();
53 
54 					BPolygon	&operator=(const BPolygon &from);
55 
56 		BRect		Frame() const;
57 		void		AddPoints(const BPoint *ptArray, int32 numPoints);
58 		int32		CountPoints() const;
59 		void		MapTo(BRect srcRect, BRect dstRect);
60 		void		PrintToStream() const;
61 
62 private:
63 
64 friend class BView;
65 
66 		void	compute_bounds();
67 		void	map_pt(BPoint *point, BRect srcRect, BRect dstRect);
68 		void	map_rect(BRect *rect, BRect srcRect, BRect dstRect);
69 
70 		BRect	fBounds;
71 		int32	fCount;
72 		BPoint	*fPts;
73 };
74 //------------------------------------------------------------------------------
75 
76 #endif // _POLYGON_H_
77 
78 /*
79  * $Log $
80  *
81  * $Id  $
82  *
83  */
84 
85