A closed, many-sided figure which defines an area in a two-dimensional Cartesian coordinate system. More...
Public Member Functions | |
BPolygon () | |
Initializes an empty polygon without any points. | |
BPolygon (const BPoint *points, int32 count) | |
Initializes a new BPolygon object from an array of points. | |
BPolygon (const BPolygon &other) | |
Initializes a new BPolygon object from another BPolygon and copies the list of BPoint objects from other. | |
BPolygon (const BPolygon *other) | |
Initializes a new BPolygon object from a pointer to another BPolygon and copies the list of BPoint objects from other. | |
virtual | ~BPolygon () |
Destroys the object and frees the memory used by the associated BPoint objects. | |
void | AddPoints (const BPoint *points, int32 count) |
Adds an array of BPoint objects. | |
int32 | CountPoints () const |
Returns the number of points associated with the polygon. | |
BRect | Frame () const |
Returns the frame rectangle that encloses the BPolygon object. | |
void | MapTo (BRect source, BRect destination) |
Modifies each BPoint in the BPolygon so that the shape fits inside the destination rectangle. | |
BPolygon & | operator= (const BPolygon &other) |
Initializes a new BPolygon object and copies the list of BPoint objects from other. | |
void | PrintToStream () const |
Prints each of the points of the BPolygon to standard output. | |
A closed, many-sided figure which defines an area in a two-dimensional Cartesian coordinate system.
A BPolygon is defined as a set of BPoint objects, each BPoint represents a vertex of the polygon. Unlike a BRect, a BPolygon can can have any number of sides and the sides don't have to be aligned on coordinate axes.
BPolygon objects are most commonly used for drawing. BView::StrokePolygon() and BView::FillPolygon() allow you to draw a polygon in a BView by taking a BPolygon object as an argument.
BPolygon::BPolygon | ( | const BPolygon & | other | ) |
BPolygon::BPolygon | ( | const BPolygon * | other | ) |
BPolygon::BPolygon | ( | ) |
Initializes an empty polygon without any points.
|
virtual |
Destroys the object and frees the memory used by the associated BPoint objects.
int32 BPolygon::CountPoints | ( | ) | const |
Returns the number of points associated with the polygon.
BRect BPolygon::Frame | ( | ) | const |
Returns the frame rectangle that encloses the BPolygon object.
Modifies each BPoint in the BPolygon so that the shape fits inside the destination rectangle.
The source rectangle is used so that the points are mapped proportionally. To modify a polygon so that it is inscribed in the destination rectangle exactly, pass the frame rectangle as the source.
void BPolygon::PrintToStream | ( | ) | const |
Prints each of the points of the BPolygon to standard output.