1 /* 2 * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Marc Flerackers, mflerackers@androme.be 7 */ 8 #ifndef _POLYGON_H 9 #define _POLYGON_H 10 11 12 #include <BeBuild.h> 13 #include <InterfaceDefs.h> 14 #include <Rect.h> 15 16 17 class BPolygon { 18 public: 19 BPolygon(const BPoint *ptArray, int32 numPoints); 20 BPolygon(const BPolygon *polygon); 21 BPolygon(); 22 virtual ~BPolygon(); 23 24 BPolygon &operator=(const BPolygon &from); 25 26 BRect Frame() const; 27 void AddPoints(const BPoint *ptArray, int32 numPoints); 28 int32 CountPoints() const; 29 void MapTo(BRect srcRect, BRect dstRect); 30 void PrintToStream() const; 31 32 private: 33 friend class BView; 34 35 void _ComputeBounds(); 36 void _MapPoint(BPoint *point, BRect srcRect, BRect dstRect); 37 void _MapRectangle(BRect *rect, BRect srcRect, BRect dstRect); 38 39 private: 40 BRect fBounds; 41 uint32 fCount; 42 BPoint *fPoints; 43 }; 44 45 #endif // _POLYGON_H_ 46