#include <Pt/Gfx/Size.h>
Floating-point width and height. More...
Public Member Functions | |
| Float | area () const |
| Returns the area (width * height). | |
| void | transpose () |
| Swaps width and height in place. | |
| Size | toTransposed () const |
| Returns a copy with width and height swapped. | |
| Size (const SizeI &s) | |
| Constructs from a SizeI by widening the dimensions. | |
| Size & | operator= (const SizeI &s) |
| Assigns from a SizeI by widening the dimensions. | |
| SizeI | round () const |
| Rounds each dimension to the nearest integer and returns a SizeI. | |
| SizeI | floor () const |
| Floors each dimension and returns a SizeI. | |
| SizeI | ceil () const |
| Ceils each dimension and returns a SizeI. | |
Size is the logical width and height drawing uses. It is not a pixel count. Image and view dimensions are integers; convert with round(), floor(), or ceil() when a pixel size is required. SizeF is a typedef of this type.
The value is copyable. isEmpty() is true when width or height is zero. area() is width times height. transpose() swaps the components. Arithmetic scales or grows both dimensions.
Construct from two floats, or widen a SizeI with the explicit constructor.
The example builds a logical size and converts it to an integer pixel size by rounding.