xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
xtd::drawing::size Class Reference

Stores an ordered pair of integers, which specify a height and width. More...

#include <size.h>

Public Member Functions

 size ()=default
 Initializes a new instance of the Size class that has a Height and Width value of 0. More...
 
 size (const xtd::drawing::point &point)
 IInitializes a new instance of the Size class from the specified Point class. More...
 
 size (int32_t width, int32_t height)
 Initializes a new instance of the Size class from the specified dimensions. More...
 
int32_t height () const
 Gets he vertical component of this Size Class. More...
 
void height (int32_t height)
 Sets the vertical component of this Size Class. More...
 
bool is_empty () const
 Tests whether this Size class has width and height of 0. More...
 
std::string to_string () const noexcept override
 Creates a human-readable string that represents this size class. More...
 
int32_t width () const
 Gets the horizontal component of this Size class. More...
 
void width (int32_t width)
 Sets the horizontal component of this Size class. More...
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
template<typename object_t >
std::shared_ptr< objectmemberwise_clone () const
 Gets the type of the current instance. More...
 

Static Public Member Functions

static size add (const size &size1, const size &size2)
 Adds the width and height of one Size class to the width and height of another size class. More...
 
static size ceiling (const size_f &value)
 Converts the specified size_f to a size by rounding the values of the size_f to the next higher integer values. More...
 
static size round (const size_f &value)
 Converts the specified size_f to a size object by rounding the size_f values to the nearest integer. More...
 
static xtd::drawing::size subtract (const xtd::drawing::size &sz1, const xtd::drawing::size &sz2)
 Returns the result of subtracting specified size from the specified size. More...
 
static size truncate (const size_f &value)
 Converts the specified size_f to a size by truncating the values of the size_f. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

Static Public Attributes

static const xtd::drawing::size empty
 Gets a Size class that has a Height and Width value of 0. This field is constant. More...
 

Detailed Description

Stores an ordered pair of integers, which specify a height and width.

Library
xtd.drawing
Examples:
settings_example.cpp, and user_control.cpp.

Constructor & Destructor Documentation

◆ size() [1/3]

xtd::drawing::size::size ( )
default

Initializes a new instance of the Size class that has a Height and Width value of 0.

◆ size() [2/3]

xtd::drawing::size::size ( const xtd::drawing::point point)
explicit

IInitializes a new instance of the Size class from the specified Point class.

Parameters
pointThe Point class from which to initialize this Size class

◆ size() [3/3]

xtd::drawing::size::size ( int32_t  width,
int32_t  height 
)
inline

Initializes a new instance of the Size class from the specified dimensions.

Parameters
widthThe width component of the new Size
heightThe height component of the new Size

Member Function Documentation

◆ add()

static size xtd::drawing::size::add ( const size size1,
const size size2 
)
static

Adds the width and height of one Size class to the width and height of another size class.

Parameters
size1The first Size class to add.
size2The second Size class to add.
Returns
Size A Size class that is the result of the addition operation.

◆ ceiling()

static size xtd::drawing::size::ceiling ( const size_f value)
static

Converts the specified size_f to a size by rounding the values of the size_f to the next higher integer values.

Parameters
valueThe size_f to convert.
Returns
The size this method converts to.

◆ height() [1/2]

int32_t xtd::drawing::size::height ( ) const
inline

Gets he vertical component of this Size Class.

Returns
int The vertical component of this Size class, typically measured in pixels.
Remarks
The unit for the Height and Width of the Size class depend on the PageUnit and PageScale settings for the Graphics object that is used to draw.
Examples:
screen.cpp.

◆ height() [2/2]

void xtd::drawing::size::height ( int32_t  height)
inline

Sets the vertical component of this Size Class.

Returns
int The vertical component of this Size class, typically measured in pixels.
Remarks
The unit for the Height and Width of the Size class depend on the PageUnit and PageScale settings for the Graphics object that is used to draw.

◆ is_empty()

bool xtd::drawing::size::is_empty ( ) const
inline

Tests whether this Size class has width and height of 0.

Returns
bool Returns true when this Size class has both a width and height of 0; otherwise, false.

◆ round()

static size xtd::drawing::size::round ( const size_f value)
static

Converts the specified size_f to a size object by rounding the size_f values to the nearest integer.

Parameters
valueThe size_f to convert.
Returns
The size this method converts to.

◆ subtract()

static xtd::drawing::size xtd::drawing::size::subtract ( const xtd::drawing::size sz1,
const xtd::drawing::size sz2 
)
static

Returns the result of subtracting specified size from the specified size.

Parameters
sz1The Size to be subtracted from.
sz2The Size to subtract from the Size.
Returns
The Size that is the result of the subtraction operation.
Exceptions
ArgumentNullExceptionsz1 or sz2 are null.

◆ to_string()

std::string xtd::drawing::size::to_string ( ) const
inlineoverridevirtualnoexcept

Creates a human-readable string that represents this size class.

Returns
string A string that represents this size.

Reimplemented from xtd::object.

◆ truncate()

static size xtd::drawing::size::truncate ( const size_f value)
static

Converts the specified size_f to a size by truncating the values of the size_f.

Parameters
valueThe size_f to convert.
Returns
The size this method converts to.

◆ width() [1/2]

int32_t xtd::drawing::size::width ( ) const
inline

Gets the horizontal component of this Size class.

Returns
int The horizontal component of this Size class, typically measured in pixels.
Remarks
The unit for the Height and Width of the Size class depend on the PageUnit and PageScale settings for the Graphics object that is used to draw.
Examples:
screen.cpp.

◆ width() [2/2]

void xtd::drawing::size::width ( int32_t  width)
inline

Sets the horizontal component of this Size class.

Returns
int The horizontal component of this Size class, typically measured in pixels.
Remarks
The unit for the Height and Width of the Size class depend on the PageUnit and PageScale settings for the Graphics object that is used to draw.

Member Data Documentation

◆ empty

const xtd::drawing::size xtd::drawing::size::empty
static

Gets a Size class that has a Height and Width value of 0. This field is constant.


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