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

#include <size.h>

Definition

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

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

Inherits xtd::object.

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.
 

Public Member Functions

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

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.
 
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.
 
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.
 
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.
 
static size truncate (const size_f &value)
 Converts the specified size_f to a size by truncating the values of the size_f.
 
- 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.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

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()

xtd::ustring 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: