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 \since BeOS R3 41*/ 42 43 44/*! 45 \fn BPolygon::BPolygon(const BPoint* points, int32 count) 46 \brief Initializes a new BPolygon object from an array of \a points. 47 48 \param points The array of BPoint objects to add. 49 \param count The number of BPoint objects in the array. 50 51 \since BeOS R3 52*/ 53 54 55/*! 56 \fn BPolygon::BPolygon(const BPolygon& other) 57 \brief Initializes a new BPolygon object from another BPolygon and 58 copies the list of BPoint objects from \a other. 59 60 \param other The BPolygon object to copy from. 61 62 \since Haiku R1 63*/ 64 65 66/*! 67 \fn BPolygon::BPolygon(const BPolygon* other) 68 \brief Initializes a new BPolygon object from a pointer to another 69 BPolygon and copies the list of BPoint objects from \a other. 70 71 \param other A pointer to a BPolygon object to copy from. 72 73 \since BeOS R3 74*/ 75 76 77/*! 78 \fn BPolygon::BPolygon() 79 \brief Initializes an empty polygon without any points. 80 81 \see BPolygon::AddPoints() to add points to the BPolygon. 82 83 \since BeOS R3 84*/ 85 86 87/*! 88 \fn BPolygon::~BPolygon() 89 \brief Destroys the object and frees the memory used by the associated 90 BPoint objects. 91 92 \since BeOS R3 93*/ 94 95 96/*! 97 \fn BPolygon& BPolygon::operator=(const BPolygon& other) 98 \brief Initializes a new BPolygon object and copies the list of BPoint 99 objects from \a other. 100 101 \param other The BPolygon object to copy from. 102 103 \since BeOS R3 104*/ 105 106 107/*! 108 \fn BRect BPolygon::Frame() const 109 \brief Returns the frame rectangle that encloses the BPolygon object. 110 111 \since BeOS R3 112*/ 113 114 115/*! 116 \fn void BPolygon::AddPoints(const BPoint* points, int32 count) 117 \brief Adds an array of BPoint objects. 118 119 \param points The array of BPoint objects to add. 120 \param count The number of BPoint objects in the array. 121 122 \since BeOS R3 123*/ 124 125 126/*! 127 \fn int32 BPolygon::CountPoints() const 128 \brief Returns the number of points associated with the polygon. 129 130 \since BeOS R3 131*/ 132 133 134/*! 135 \fn void BPolygon::MapTo(BRect source, BRect destination) 136 \brief Modifies each BPoint in the BPolygon so that the shape fits inside 137 the \a destination rectangle. 138 139 The \a source rectangle is used so that the points are mapped 140 proportionally. To modify a polygon so that it is inscribed in the 141 \a destination rectangle exactly, pass the frame rectangle as the 142 \a source. 143 144 \since BeOS R3 145*/ 146 147 148/*! 149 \fn void BPolygon::PrintToStream() const 150 \brief Prints each of the points of the BPolygon to standard output. 151 152 \see BPoint::PrintToStream() 153 154 \since BeOS R3 155*/ 156