#include <base.h>
A size is specified by a width and a height.
The coordinate type is FGCOORD (defined as int). The minimum value of FGCOORD is FGCOORD_MIN (-2147483648) and the maximum value is FGCOORD_MAX (2147483647).
The size can be set in the constructor and changed with setWidth() and setHeight(), or using operator+=(), operator-=(), operator*=() and operator/=(), etc. You can swap the width and height with transpose(). You can get a size which holds the maximum height and width of two sizes using expandedTo(), and the minimum height and width of two sizes using boundedTo().
Public Member Functions | |
| FGSize () | |
| FGSize (int w, int h) | |
| bool | isNull () const |
| bool | isEmpty () const |
| bool | isValid () const |
| int | width () const |
| int | height () const |
| void | setWidth (int w) |
| void | setHeight (int h) |
| void | transpose () |
| FGSize | expandedTo (const FGSize &) const |
| FGSize | boundedTo (const FGSize &) const |
| void | scale (int w, int h, ScaleMode mode) |
| void | scale (const FGSize &s, ScaleMode mode) |
| FGCOORD & | rwidth () |
| FGCOORD & | rheight () |
| FGSize & | operator+= (const FGSize &) |
| FGSize & | operator-= (const FGSize &) |
| FGSize & | operator *= (int c) |
| FGSize & | operator *= (double c) |
| FGSize & | operator/= (int c) |
| FGSize & | operator/= (double c) |
Public Attributes | |
| FGCOORD | wd |
| FGCOORD | ht |
Friends | |
| bool | operator== (const FGSize &, const FGSize &) |
| bool | operator!= (const FGSize &, const FGSize &) |
| const FGSize | operator+ (const FGSize &, const FGSize &) |
| const FGSize | operator- (const FGSize &, const FGSize &) |
| const FGSize | operator * (const FGSize &, int) |
| const FGSize | operator * (int, const FGSize &) |
| const FGSize | operator * (const FGSize &, double) |
| const FGSize | operator * (double, const FGSize &) |
| const FGSize | operator/ (const FGSize &, int) |
| const FGSize | operator/ (const FGSize &, double) |
|
|
Constructs a size with invalid (negative) width and height. |
|
||||||||||||
|
Constructs a size with width w and height h. |
|
|
Returns a size with the minimum width and height of this size and otherSize. |
|
|
Returns a size with the maximum width and height of this size and otherSize. |
|
|
Returns the height.
|
|
|
Returns TRUE if the width is less than or equal to 0, or the height is less than or equal to 0; otherwise returns FALSE. |
|
|
Returns TRUE if the width is 0 and the height is 0; otherwise returns FALSE. |
|
|
Returns TRUE if the width is equal to or greater than 0 and the height is equal to or greater than 0; otherwise returns FALSE. |
|
|
Multiplies both the width and height by c and returns a reference to the size. |
|
|
Adds s to the size and returns a reference to this size. Example: |
|
|
Subtracts s from the size and returns a reference to this size. Example: |
|
|
Divides both the width and height by c and returns a reference to the size. Note that the result is truncated. |
|
|
Returns a reference to the height. Using a reference makes it possible to directly manipulate the height. Example: FGSize s( 100, 10 ); s.rheight() += 5; // s becomes (100,15)
|
|
|
Returns a reference to the width. Using a reference makes it possible to directly manipulate the width. Example: FGSize s( 100, 10 ); s.rwidth() += 20; // s becomes (120,10)
|
|
||||||||||||
|
||||||||||||||||
|
Scales the size to a rectangle of width w and height h according to the ScaleMode mode.
Example: |
|
|
Sets the height to h.
|
|
|
Sets the width to w.
|
|
|
Swaps the values of width and height. |
|
|
Returns the width.
|
1.4.0