1/* 2 * Copyright 2014 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * 8 * Corresponds to: 9 * headers/os/interface/Polygon.h hrev47240 10 * src/kits/interface/Polygon.cpp hrev47240 11 */ 12 13 14/*! 15 \file Polygon.h 16 \ingroup interface 17 \ingroup libbe 18 \brief BPolygon class definition. 19*/ 20 21 22/*! 23 \class BPolygon 24 \ingroup interface 25 \ingroup libbe 26 \brief A closed, many-sided figure which defines an area in a 27 two-dimensional Cartesian coordinate system. 28 29 A BPolygon is defined as a set of BPoint objects, each BPoint represents 30 a vertex of the polygon. Unlike a BRect, a BPolygon can can have any number 31 of sides and the sides don't have to be aligned on coordinate axes. 32 33 BPolygon objects are most commonly used for drawing. BView::StrokePolygon() 34 and BView::FillPolygon() allow you to draw a polygon in a BView by taking a 35 BPolygon object as an argument. 36 37 \sa BView::StrokePolygon() 38 \sa BView::FillPolygon() 39*/ 40 41 42/*! 43 \fn BPolygon::BPolygon(const BPoint* points, int32 count) 44 \brief Initializes a new BPolygon object from an array of \a points. 45 46 \param points The array of BPoint objects to add. 47 \param count The number of BPoint objects in the array. 48*/ 49 50 51/*! 52 \fn BPolygon::BPolygon(const BPolygon& other) 53 \brief Initializes a new BPolygon object from another BPolygon and 54 copies the list of BPoint objects from \a other. 55 56 \note This method was not available in BeOS R5. 57 58 \param other The BPolygon object to copy from. 59*/ 60 61 62/*! 63 \fn BPolygon::BPolygon(const BPolygon* other) 64 \brief Initializes a new BPolygon object from a pointer to another 65 BPolygon and copies the list of BPoint objects from \a other. 66 67 \param other A pointer to a BPolygon object to copy from. 68*/ 69 70 71/*! 72 \fn BPolygon::BPolygon() 73 \brief Initializes an empty polygon without any points. 74 75 \see BPolygon::AddPoints() to add points to the BPolygon. 76*/ 77 78 79/*! 80 \fn BPolygon::~BPolygon() 81 \brief Destroys the object and frees the memory used by the associated 82 BPoint objects. 83*/ 84 85 86/*! 87 \fn BPolygon& BPolygon::operator=(const BPolygon& other) 88 \brief Initializes a new BPolygon object and copies the list of BPoint 89 objects from \a other. 90 91 \param other The BPolygon object to copy from. 92*/ 93 94 95/*! 96 \fn BRect BPolygon::Frame() const 97 \brief Returns the frame rectangle that encloses the BPolygon object. 98*/ 99 100 101/*! 102 \fn void BPolygon::AddPoints(const BPoint* points, int32 count) 103 \brief Adds an array of BPoint objects. 104 105 \param points The array of BPoint objects to add. 106 \param count The number of BPoint objects in the array. 107*/ 108 109 110/*! 111 \fn int32 BPolygon::CountPoints() const 112 \brief Returns the number of points associated with the polygon. 113*/ 114 115 116/*! 117 \fn void BPolygon::MapTo(BRect source, BRect destination) 118 \brief Modifies each BPoint in the BPolygon so that the shape fits inside 119 the \a destination rectangle. 120 121 The \a source rectangle is used so that the points are mapped 122 proportionally. To modify a polygon so that it is inscribed in the 123 \a destination rectangle exactly, pass the frame rectangle as the 124 \a source. 125*/ 126 127 128/*! 129 \fn void BPolygon::PrintToStream() const 130 \brief Prints each of the points of the BPolygon to standard output. 131 132 \see BPoint::PrintToStream() 133*/ 134