PSizei Class Reference

Detailed Description

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

Definition at line 27 of file PSizei.h.

#include <PSizei.h>

Constructor & Destructor Documentation

◆ PSizei() [1/4]

PSizei::PSizei ( )

Constructs a size (0,0).

◆ PSizei() [2/4]

PSizei::PSizei ( papillon::int32  n)
explicit

Constructs a size of n x n.

◆ PSizei() [3/4]

PSizei::PSizei ( papillon::int32  width,
papillon::int32  height 
)
explicit

Constructs a size from width and height.

◆ PSizei() [4/4]

PSizei::PSizei ( const PSizei other)

Constructs a shared copy of other.

◆ ~PSizei()

virtual PSizei::~PSizei ( )
virtual

Destroys this object.

Member Function Documentation

◆ Clamped()

PSizei PSizei::Clamped ( papillon::int32  min,
papillon::int32  max 
)

Returns a PSizei which corresponds to this size object clamped with given limit values.

◆ ClampedWH()

PSizei PSizei::ClampedWH ( papillon::int32  minW,
papillon::int32  maxW,
papillon::int32  minH,
papillon::int32  maxH 
)

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

◆ FromString()

static PResult PSizei::FromString ( const PString s,
PSizei 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()

papillon::int32 PSizei::GetHeight ( ) const

Returns the height.

◆ GetWidth()

papillon::int32 PSizei::GetWidth ( ) const

Returns the width.

◆ IsValid()

bool PSizei::IsValid ( ) const

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

◆ IsZero()

bool PSizei::IsZero ( ) const

Returns true if this size is 0x0, false otherwise.

◆ operator!=()

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

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

◆ operator=()

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

Performs a shared copy of other to this object.

◆ operator==()

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

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

◆ Scaled()

PSizei PSizei::Scaled ( float  factor) const

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

◆ ToSizef()

PSizef PSizei::ToSizef ( ) const

Returns a PSizef from this size.

◆ ToStringShort()

PString PSizei::ToStringShort ( ) const

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

◆ Zero()

static const PSizei& PSizei::Zero ( )
inlinestatic

Returns the constant holding the 0x0 size.

Definition at line 33 of file PSizei.h.