The Interface Kit Table of Contents | The Interface Kit Index |
Derived from: none
Declared in: be/interface/Polygon.h
Library: libbe.so
A BPolygon object represents a polygon—a closed, many-sided figure that describes an area within a two-dimensional coordinate system. It differs from a BRect object in that it can have any number of sides and the sides don't have to be aligned with the coordinate axes.
A BPolygon is defined as a series of connected points. Each point is a potential vertex in the polygon. An outline of the polygon could be constructed by tracing a straight line from the first point to the second, from the second point to the third, and so on through the whole series, then by connecting the first and last points if they're not identical.
The BView functions that draw a polygon—StrokePolygon() and FillPolygon()—take BPolygon objects as arguments. StrokePolygon() offers the option of leaving the polygon open—of not stroking the line that connects the first and last points in the list. The polygon therefore won't look like a polygon, but like an chain of lines fastened at their endpoints.
|
Initializes the BPolygon by copying numPoints from pointList, or by copying the list of points from another polygon. If one polygon is constructed from another, the original and the copy won't share any data; independent memory is allocated for the copy to hold a duplicate list of points.
If a BPolygon is constructed without a point list, points must be set with the AddPoints() function.
See also: AddPoints()
|
Frees all the memory allocated to hold the list of points.
|
Appends numPoints from pointList to the list of points that already define the polygon.
See also: the BPolygon constructor
|
Returns the number of points that define the polygon.
|
Returns the polygon's frame rectangle—the smallest rectangle that encloses the entire polygon.
|
Modifies the polygon so that it fits the destination rectangle exactly as it originally fit the source rectangle. Each vertex of the polygon is modified so that it has the same proportional position relative to the sides of the destination rectangle as it originally had to the sides of the source rectangle.
The polygon doesn't have to be contained in either rectangle. However, to modify a polygon so that it's exactly inscribed in the destination rectangle, you should pass its frame rectangle as the source:
BRect frame = myPolygon->Frame(); myPolygon->MapTo(frame, anotherRect);
|
Prints the BPolygon's point list to the standard output stream (stdout). The BPoint version of this function is called to report each point as a string in the form
"BPoint(x, y)"
where x and y stand for the coordinate values of the point in question.
See also: BPoint::PrintToStream()
|
Copies the point list of one BPolygon object and assigns it to another BPolygon. After the assignment, the two objects describe the same polygon, but are independent of each other. Destroying one of the objects won't affect the other.
The Interface Kit Table of Contents | The Interface Kit Index |
Copyright © 2000 Be, Inc. All rights reserved..