PSizef Class Reference

Detailed Description

The PSizef class represents the size of an image or a rectangle: width (float) and height (float); PSizef instances are immutable (thread-safe).

Definition at line 28 of file PSizef.h.

#include <PSizef.h>

Constructor & Destructor Documentation

◆ PSizef() [1/4]

PSizef::PSizef ( )

Constructs a size (0,0).

◆ PSizef() [2/4]

PSizef::PSizef ( float  s)
explicit

Constructs a size of s x s.

◆ PSizef() [3/4]

PSizef::PSizef ( float  width,
float  height 
)
explicit

Constructs a size from width and height.

◆ PSizef() [4/4]

PSizef::PSizef ( const PSizef other)

Constructs a shared copy of other.

◆ ~PSizef()

virtual PSizef::~PSizef ( )
virtual

Destroys this object.

Member Function Documentation

◆ Bad()

static const PSizef& PSizef::Bad ( )
inlinestatic

Returns the constant holding the NaN x NaN size.

Definition at line 39 of file PSizef.h.

◆ Clamped()

PSizef PSizef::Clamped ( float  min,
float  max 
)

Clamps width and height with given limit values.

◆ ClampedWH()

PSizef PSizef::ClampedWH ( float  minW,
float  maxW,
float  minH,
float  maxH 
)

Returns a PSizei which corresponds to this size object clamped with given limit values; width and height are clamped separately.

◆ FromString()

static PResult PSizef::FromString ( const PString s,
PSizef size 
)
static

Parses the specified string to build a PSizei object.

Expected format is "WxH" or "W,H" or "W;H" or "W H" where W=width and H=height. If failure, size is set to 0x0. Returns PResult::C_OK if success, another result otherwise.

◆ GetHeight()

float PSizef::GetHeight ( ) const

Returns the height.

◆ GetWidth()

float PSizef::GetWidth ( ) const

Returns the width.

◆ IsValid()

bool PSizef::IsValid ( ) const

Returns true if this size is valid (width and height are positive), false otherwise.

◆ operator!=()

bool PSizef::operator!= ( const PSizef other) const

Returns true if this size is different of other, false otherwise.

◆ operator=()

PSizef& PSizef::operator= ( const PSizef other)

Performs a shared copy of other to this object.

◆ operator==()

bool PSizef::operator== ( const PSizef other) const

Returns true if this size is the same than other, false otherwise.

◆ Scaled()

PSizef PSizef::Scaled ( float  factor) const

Returns a PSizef object equal to this one scaled by the specified factor.

◆ ToSizei()

PSizei PSizef::ToSizei ( ) const

Returns a PSizei from this size.

◆ ToStringShort()

PString PSizef::ToStringShort ( ) const

Returns a string representation of this object: "WxH".

◆ Zero()

static const PSizef& PSizef::Zero ( )
inlinestatic

Returns the constant holding the 0 x 0 size.

Definition at line 34 of file PSizef.h.