
#include "Image/Rectangle.H"#include "Util/Assert.H"#include "Util/StringConversions.H"#include "Util/log.H"#include <sstream>
Go to the source code of this file.
Functions | |
| std::string | convertToString (const Rectangle &val) |
| Rectangle overload: format is "<int>,<int>,<int>,<int>". | |
| void | convertFromString (const std::string &str, Rectangle &val) |
| Rectangle overload: format is "<int>,<int>,<int>,<int>". | |
| Rectangle | constrainRect (const Rectangle &in, const Rectangle &bounds, int minw, int maxw, int minh, int maxh) |
| Return a new rectangle that is a constrained version of the input. | |
A basic rectangle class
Definition in file Rectangle.C.
| Rectangle constrainRect | ( | const Rectangle & | in, | |
| const Rectangle & | bounds, | |||
| int | minw, | |||
| int | maxw, | |||
| int | minh, | |||
| int | maxh | |||
| ) |
Return a new rectangle that is a constrained version of the input.
| in | The original rectangle on which to base the constrained output. | |
| bounds | The output rectangle will be constrained to be contained within these bounds. | |
| minw | The minimum width for the output rectangle. Caller must ensure minw>=0. If the output rectangle would naturally be narrower than this width, then it will be widened to the smaller of minw and bounds.width(). | |
| maxw | The maximum width for the output rectangle. Caller must ensure maxw>=minw. If the output rectangle would naturally be wider than this width, then it will be narrowed to the smaller of maxw and bounds.width(). | |
| minh | The minimum height for the output rectangle. Caller must ensure minh>=0. If the output rectangle would naturally be shorter than this height, then it will be lengthened to the smaller of minh and bounds.height(). | |
| maxh | The maximum height for the output rectangle. Caller must ensure maxh>=minh. If the output rectangle would naturally be taller than this height, then it will be shortened to the smaller of maxh and bounds.height(). |
Definition at line 75 of file Rectangle.C.
References ASSERT, Rectangle::bottomO(), Rectangle::contains(), Rectangle::getOverlap(), Rectangle::height(), Rectangle::left(), min(), Rectangle::rightO(), Rectangle::tlbrO(), Rectangle::top(), and Rectangle::width().
Referenced by constrainRect().
| void convertFromString | ( | const std::string & | str, | |
| Rectangle & | val | |||
| ) |
Rectangle overload: format is "<int>,<int>,<int>,<int>".
Definition at line 64 of file Rectangle.C.
References Rectangle::tlbrO().
| std::string convertToString | ( | const Rectangle & | val | ) |
Rectangle overload: format is "<int>,<int>,<int>,<int>".
Format corresponds to "xtopleft,ytopleft,xbottomright,ybottomright"
Definition at line 51 of file Rectangle.C.
References Rectangle::bottomO(), Rectangle::isValid(), Rectangle::left(), Rectangle::rightO(), and Rectangle::top().
1.6.3