2007-02-04 16:32:36 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Marc Flerackers, mflerackers@androme.be
|
|
|
|
*/
|
2002-10-16 08:29:31 +04:00
|
|
|
#ifndef _POLYGON_H
|
2007-02-04 16:32:36 +03:00
|
|
|
#define _POLYGON_H
|
2002-10-16 08:29:31 +04:00
|
|
|
|
2007-02-04 16:32:36 +03:00
|
|
|
|
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <InterfaceDefs.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
|
2008-10-16 23:10:10 +04:00
|
|
|
namespace BPrivate { class BAffineTransform; }
|
|
|
|
using namespace BPrivate;
|
2007-02-04 16:32:36 +03:00
|
|
|
|
|
|
|
class BPolygon {
|
|
|
|
public:
|
2008-10-16 23:10:10 +04:00
|
|
|
BPolygon(const BPoint *ptArray, int32 numPoints);
|
|
|
|
BPolygon(const BPolygon *polygon);
|
|
|
|
BPolygon();
|
|
|
|
virtual ~BPolygon();
|
|
|
|
|
|
|
|
BPolygon &operator=(const BPolygon &from);
|
|
|
|
|
|
|
|
BRect Frame() const;
|
|
|
|
void AddPoints(const BPoint *ptArray, int32 numPoints);
|
|
|
|
int32 CountPoints() const;
|
|
|
|
void MapTo(BRect srcRect, BRect dstRect);
|
|
|
|
void PrintToStream() const;
|
|
|
|
|
|
|
|
void Transform(const BAffineTransform& transform);
|
|
|
|
BPolygon& TransformBySelf(const BAffineTransform& transform);
|
|
|
|
BPolygon* TransformByCopy(const BAffineTransform& transform) const;
|
2007-02-04 16:32:36 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class BView;
|
|
|
|
|
|
|
|
void _ComputeBounds();
|
|
|
|
void _MapPoint(BPoint *point, BRect srcRect, BRect dstRect);
|
|
|
|
void _MapRectangle(BRect *rect, BRect srcRect, BRect dstRect);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BRect fBounds;
|
2007-11-11 00:23:04 +03:00
|
|
|
uint32 fCount;
|
2007-02-04 16:32:36 +03:00
|
|
|
BPoint *fPoints;
|
2002-10-16 08:29:31 +04:00
|
|
|
};
|
|
|
|
|
2007-02-04 16:32:36 +03:00
|
|
|
#endif // _POLYGON_H_
|