xtd 0.2.0
Loading...
Searching...
No Matches
xtd::drawing::size Class Reference
Inheritance diagram for xtd::drawing::size:
xtd::object xtd::iequatable< size > xtd::interface

Definition

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

Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:40
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
Inheritance
xtd::objectxtd::drawing::size
Namespace
xtd::drawing
Library
xtd.drawing
Examples
about_dialog_with_user_pages.cpp, application_settings_without_cmake_setting_commands.cpp, auto_scroll.cpp, colored_tab_pages.cpp, demo.cpp, docked_panels.cpp, draw_image.cpp, emplace.cpp, form_background_image.cpp, form_resize.cpp, form_show.cpp, images2.cpp, images3.cpp, point.cpp, process_form.cpp, system_sound.cpp, test_forms.cpp, track_bar2.cpp, tutorial_button.cpp, and user_control.cpp.

Public Fields

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

Public Constructors

 size ()=default
 Initializes a new instance of the xtd::drawing::size class that has a Height and Width value of 0.
 
 size (const xtd::drawing::point &point) noexcept
 Initializes a new instance of the xtd::drawing::size class from the specified xtd::drawing::point class.
 
 size (int32 width, int32 height) noexcept
 Initializes a new instance of the xtd::drawing::size class from the specified dimensions.
 

Public Properties

int32 height () const noexcept
 Gets he vertical component of this xtd::drawing::size class.
 
void height (int32 value) noexcept
 Sets the vertical component of this xtd::drawing::size class.
 
bool is_empty () const noexcept
 Tests whether this xtd::drawing::size class has xtd::drawing::size_fwidth and xtd::drawing::size_fheight of 0.
 
int32 width () const noexcept
 Gets the horizontal component of this xtd::drawing::size class.
 
void width (int32 value) noexcept
 Sets the horizontal component of this xtd::drawing::size class.
 

Public Methods

bool equals (const xtd::drawing::size &value) const noexcept override
 
xtd::ustring to_string () const noexcept override
 Creates a human-readable string that represents this xtd::drawing::size class.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
static size add (const size &size1, const size &size2) noexcept
 Adds the width and height of one xtd::drawing::size class to the width and height of another size class.
 
static size ceiling (const size_f &value) noexcept
 Converts the specified xtd::drawing::size_f to a xtd::drawing::size by rounding the values of the xtd::drawing::size_f to the next higher integer values.
 
static size round (const size_f &value) noexcept
 Converts the specified xtd::drawing::size_f to a xtd::drawing::size object by rounding the xtd::drawing::size_f values to the nearest integer.
 
static xtd::drawing::size subtract (const xtd::drawing::size &sz1, const xtd::drawing::size &sz2) noexcept
 Returns the result of subtracting specified xtd::drawing::size from the specified xtd::drawing::size.
 
static size truncate (const size_f &value) noexcept
 Converts the specified xtd::drawing::size_f to a xtd::drawing::size by truncating the values of the xtd::drawing::size_f.
 
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 

Operators

size operator+ (const xtd::drawing::size &size) const noexcept
 Increases a xtd::drawing::size with a given xtd::drawing::size.
 
sizeoperator+= (const xtd::drawing::size &size) noexcept
 Increases a xtd::drawing::size wuth a given xtd::drawing::size.
 
size operator- (const xtd::drawing::size &size) const noexcept
 Decreases a xtd::drawing::size with the a given xtd::drawing::size.
 
sizeoperator-= (const xtd::drawing::size &size) noexcept
 Decreases a xtd::drawing::size with the a given xtd::drawing::size.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< size >
virtual bool equals (const size &) const noexcept=0
 Indicates wheth er the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &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 xtd::drawing::size class that has a Height and Width value of 0.

◆ size() [2/3]

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

Initializes a new instance of the xtd::drawing::size class from the specified xtd::drawing::point class.

Parameters
pointThe xtd::drawing::point class from which to initialize this xtd::drawing::size class

◆ size() [3/3]

xtd::drawing::size::size ( int32  width,
int32  height 
)
noexcept

Initializes a new instance of the xtd::drawing::size class from the specified dimensions.

Parameters
widthThe width component of the new xtd::drawing::size.
heightThe height component of the new xtd::drawing::size.

Member Function Documentation

◆ add()

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

Adds the width and height of one xtd::drawing::size class to the width and height of another size class.

Parameters
size1The first xtd::drawing::size class to add.
size2The second xtd::drawing::size class to add.
Returns
xtd::drawing::size A xtd::drawing::size class that is the result of the addition operation.

◆ ceiling()

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

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

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

◆ equals() [1/2]

virtual bool xtd::object::equals ( const object obj) const
virtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
object3 = object1;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
}
// This code produces the following output:
//
// false
// false
// true
// true
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10

Reimplemented from xtd::object.

◆ equals() [2/2]

template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals ( const object_a_t &  object_a,
const object_b_t &  object_b 
)
inlinestaticnoexcept

Determines whether the specified object instances are considered equal.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
ustring s1 = "Tom";
ustring s2 = "Carol";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Tom";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Carol";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
}
// This code produces the following output:
//
// object::equals("Tom", "Carol") => false
// object::equals("Tom", "Tom") => true
// object::equals("", "Tom") => false
// object::equals("Carol", "") => false
// object::equals("", "") => true
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:52

◆ height() [1/2]

int32 xtd::drawing::size::height ( ) const
noexcept

Gets he vertical component of this xtd::drawing::size class.

Returns
The vertical component of this xtd::drawing::size class, typically measured in pixels.
Remarks
The unit for the xtd::drawing::size::height and xtd::drawing::size::width of the xtd::drawing::size class depend on the xtd::drawing::graphics:page_unit and xtd::drawing::graphics::page_scale settings for the xtd::drawing::::graphics object that is used to draw.
Examples
screen.cpp.

◆ height() [2/2]

void xtd::drawing::size::height ( int32  value)
noexcept

Sets the vertical component of this xtd::drawing::size class.

Parameters
valueThe vertical component of this xtd::drawing::size class, typically measured in pixels.
Remarks
The unit for the xtd::drawing::size::height and xtd::drawing::size::width of the xtd::drawing::size class depend on the xtd::drawing::graphics:page_unit and xtd::drawing::graphics::page_scale settings for the xtd::drawing::::graphics object that is used to draw.

◆ is_empty()

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

Tests whether this xtd::drawing::size class has xtd::drawing::size_fwidth and xtd::drawing::size_fheight of 0.

Returns
Returns true when this xtd::drawing::size class has both a xtd::drawing::size::width and xtd::drawing::size::height of 0; otherwise, false.

◆ operator+()

size xtd::drawing::size::operator+ ( const xtd::drawing::size size) const
noexcept

Increases a xtd::drawing::size with a given xtd::drawing::size.

Parameters
sizeA xtd::drawing::size that specifies the pair of numbers to add to the size of this xtd::drawing::size.
Returns
The increased xtd::drawing::size.

◆ operator+=()

size & xtd::drawing::size::operator+= ( const xtd::drawing::size size)
noexcept

Increases a xtd::drawing::size wuth a given xtd::drawing::size.

Parameters
sizeA xtd::drawing::size that specifies the pair of numbers to add to the size of this xtd::drawing::size.
Returns
The increased xtd::drawing::size.

◆ operator-()

size xtd::drawing::size::operator- ( const xtd::drawing::size size) const
noexcept

Decreases a xtd::drawing::size with the a given xtd::drawing::size.

Parameters
sizeA xtd::drawing::size that specifies the pair of numbers to subtract from the size of this xtd::drawing::size.
Returns
The decreased xtd::drawing::size.

◆ operator-=()

size & xtd::drawing::size::operator-= ( const xtd::drawing::size size)
noexcept

Decreases a xtd::drawing::size with the a given xtd::drawing::size.

Parameters
sizeA xtd::drawing::size that specifies the pair of numbers to subtract from the size of this xtd::drawing::size.
Returns
The decreased xtd::drawing::size.

◆ round()

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

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

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

◆ subtract()

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

Returns the result of subtracting specified xtd::drawing::size from the specified xtd::drawing::size.

Parameters
sz1The xtd::drawing::size to be subtracted from.
sz2The xtd::drawing::size to subtract from the xtd::drawing::size.
Returns
The xtd::drawing::size that is the result of the subtraction operation.

◆ to_string()

xtd::ustring xtd::drawing::size::to_string ( ) const
overridevirtualnoexcept

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

Returns
A xtd::ustring that represents this xtd::drawing::size.

Reimplemented from xtd::object.

◆ truncate()

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

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

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

◆ width() [1/2]

int32 xtd::drawing::size::width ( ) const
noexcept

Gets the horizontal component of this xtd::drawing::size class.

Returns
int The horizontal component of this xtd::drawing::size class, typically measured in pixels.
Remarks
The unit for the xtd::drawing::size::height and xtd::drawing::size::width of the xtd::drawing::size class depend on the xtd::drawing::graphics:page_unit and xtd::drawing::graphics::page_scale settings for the xtd::drawing::::graphics object that is used to draw.
Examples
screen.cpp.

◆ width() [2/2]

void xtd::drawing::size::width ( int32  value)
noexcept

Sets the horizontal component of this xtd::drawing::size class.

Parameters
valueThe horizontal component of this xtd::drawing::size class, typically measured in pixels.
Remarks
The unit for the xtd::drawing::size::height and xtd::drawing::size::width of the xtd::drawing::size class depend on the xtd::drawing::graphics:page_unit and xtd::drawing::graphics::page_scale settings for the xtd::drawing::::graphics object that is used to draw.

Member Data Documentation

◆ empty

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

Gets a xtd::drawing::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: