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 13 //namespace BPrivate { class BAffineTransform; } 14 //using namespace BPrivate; 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 source, BRect destination); 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& source, 45 const BRect& destination); 46 void _MapRectangle(BRect* rect, const BRect& source, 47 const BRect& destination); 48 49 private: 50 BRect fBounds; 51 uint32 fCount; 52 BPoint* fPoints; 53 }; 54 55 #endif // _POLYGON_H 56