libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
Size2DTemplate< T > Class Template Reference

Two-dimensional size (width and height). More...

#include <size2d.h>

Public Member Functions

 Size2DTemplate (const T &width=0, const T &height=0)
 Constructs a 2D size with the given width and height, defaulting to 0x0.
 
 ~Size2DTemplate ()
 Destructor.
 
bool isValid () const
 Returns true if both width and height are greater than zero.
 
void set (const T &w, const T &h)
 Sets both width and height.
 
void setWidth (const T &val)
 Sets the width.
 
const Twidth () const
 Returns the width.
 
void setHeight (const T &val)
 Sets the height.
 
const Theight () const
 Returns the height.
 
T area () const
 Returns the area (width * height).
 
String toString () const
 Returns the size as a string in "WxH" format.
 
 operator String () const
 Converts to a String using toString().
 
template<typename N >
bool pointIsInside (const Point< N, 2 > &p) const
 Returns true if the given 2D point lies within the size bounds.
 

Detailed Description

template<typename T>
class Size2DTemplate< T >

Two-dimensional size (width and height).

A simple value type representing a 2D extent. Supports validity checks, area computation, point containment tests, and string serialization in

Example
Size2Du32 hd(1920, 1080);
uint32_t w = hd.width(); // 1920
uint32_t h = hd.height(); // 1080
String s = hd.toString(); // "1920x1080"
Dynamic array container wrapping std::vector.
Definition list.h:40
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
"WxH" format.
Template Parameters
TThe component type (e.g. size_t, float, double).

The documentation for this class was generated from the following file: