2007-02-04 16:32:36 +03:00
|
|
|
/*
|
2009-08-27 15:12:41 +04:00
|
|
|
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
2007-02-04 16:32:36 +03:00
|
|
|
*/
|
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 <InterfaceDefs.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
|
2009-08-26 22:40:04 +04:00
|
|
|
//namespace BPrivate { class BAffineTransform; }
|
|
|
|
//using namespace BPrivate;
|
|
|
|
|
2007-02-04 16:32:36 +03:00
|
|
|
|
|
|
|
class BPolygon {
|
2009-08-26 22:40:04 +04:00
|
|
|
public:
|
|
|
|
BPolygon(const BPoint* points, int32 count);
|
|
|
|
BPolygon(const BPolygon& other);
|
|
|
|
BPolygon(const BPolygon* other);
|
|
|
|
BPolygon();
|
|
|
|
virtual ~BPolygon();
|
|
|
|
|
|
|
|
BPolygon& operator=(const BPolygon& other);
|
|
|
|
|
|
|
|
BRect Frame() const;
|
|
|
|
void AddPoints(const BPoint* points, int32 count);
|
|
|
|
int32 CountPoints() const;
|
|
|
|
void MapTo(BRect srcRect, BRect dstRect);
|
|
|
|
void PrintToStream() const;
|
|
|
|
|
|
|
|
// void TransformBy(const BAffineTransform& transform);
|
|
|
|
// BPolygon& TransformBySelf(
|
|
|
|
// const BAffineTransform& transform);
|
|
|
|
// BPolygon TransformByCopy(
|
|
|
|
// const BAffineTransform& transform) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class BView;
|
|
|
|
|
|
|
|
bool _AddPoints(const BPoint* points, int32 count,
|
|
|
|
bool computeBounds);
|
|
|
|
void _ComputeBounds();
|
|
|
|
void _MapPoint(BPoint* point, const BRect& srcRect,
|
|
|
|
const BRect& dstRect);
|
|
|
|
void _MapRectangle(BRect* rect,
|
|
|
|
const BRect& srcRect,
|
|
|
|
const BRect& dstRect);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BRect fBounds;
|
|
|
|
uint32 fCount;
|
|
|
|
BPoint* fPoints;
|
2002-10-16 08:29:31 +04:00
|
|
|
};
|
|
|
|
|
2007-02-04 16:32:36 +03:00
|
|
|
#endif // _POLYGON_H_
|