xtd 0.2.0
Loading...
Searching...
No Matches
xtd::drawing::point_f Class Reference
Inheritance diagram for xtd::drawing::point_f:
xtd::object xtd::iequatable< point_f > xtd::interface xtd::equality_operators< type_t, equatable_t >

Definition

Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimensional plane.

Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.h:35
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
Inheritance
xtd::objectxtd::drawing::point_f
Namespace
xtd::drawing
Library
xtd.drawing
Examples
animation.cpp.

Public Fields

static const point_f empty
 Represents a xtd::drawing::point_f that has xtd::drawing::point_f::x and xtd::drawing::point_f::y values set to zero.
 

Public Constructors

 point_f () noexcept=default
 Initializes a new instance of the xtd::drawing::point_f class.
 
 point_f (float x, float y) noexcept
 Initializes a new instance of the xtd::drawing::point_f class with the specified coordinates.
 
 point_f (const size_f &sz) noexcept
 Initializes a new instance of the xtd::drawing::point_t class from a xtd::drawing::size_f.
 

Public Properties

bool is_empty () const noexcept
 Gets a value indicating whether this xtd::drawing::point_f is empty.
 
float x () const noexcept
 Gets the x-coordinate of this xtd::drawing::point_f.
 
void x (float x) noexcept
 Sets the x-coordinate of this xtd::drawing::point_f.
 
float y () const noexcept
 Gets the y-coordinate of this xtd::drawing::point_f.
 
void y (float y) noexcept
 Sets the y-coordinate of this xtd::drawing::point_f.
 

Public Methods

bool equals (const point_f &value) const noexcept override
 
void offset (float dx, float dy) noexcept
 Translates this xtd::drawing::point_f by the specified amount.
 
void offset (const point_f &pt) noexcept
 Translates this xtd::drawing::point_f by the specified xtd::drawing::point_f.
 
xtd::string to_string () const noexcept override
 Converts this point to a human-readable string.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
static point_f add (const point_f &pt, const size &sz) noexcept
 Adds the specified xtd::drawing::size to the specified xtd::drawing::point_f.
 
static point_f add (const point_f &pt, const size_f &sz) noexcept
 Adds the specified xtd::drawing::size_f to the specified xtd::drawing::point_f.
 
static point_f add (const point_f &pt1, const point &pt2) noexcept
 Adds the specified xtd::drawing::point to the specified xtd::drawing::point_f.
 
static point_f add (const point_f &pt1, const point_f &pt2) noexcept
 Adds the specified xtd::drawing::point_f to the specified xtd::drawing::point_f.
 
static point_f subtract (const point_f &pt, const size &sz) noexcept
 Returns the result of subtracting specified xtd::drawing::size from the specified xtd::drawing::point_f.
 
static point_f subtract (const point_f &pt, const size_f &sz) noexcept
 Returns the result of subtracting specified xtd::drawing::size_f from the specified xtd::drawing::point_f.
 
static point_f subtract (const point_f &pt1, const point &pt2) noexcept
 Returns the result of subtracting specified xtd::drawing::point from the specified xtd::drawing::point.
 
static point_f subtract (const point_f &pt1, const point_f &pt2) noexcept
 Returns the result of subtracting specified xtd::drawing::point from the specified xtd::drawing::point.
 
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

point_f operator+ (const size &sz) const noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::size.
 
point_f operator+ (const size_f &sz) const noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::size_f.
 
point_f operator+ (const point &pt) const noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::point.
 
point_f operator+ (const point_f &pt) const noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::point_f.
 
point_foperator+= (const size &sz) noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::size.
 
point_foperator+= (const size_f &sz) noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::size_f.
 
point_foperator+= (const point &pt) noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::point.
 
point_foperator+= (const point_f &pt) noexcept
 Translates a xtd::drawing::point_f by a given xtd::drawing::point_f.
 
point_f operator- (const size &sz) const noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size.
 
point_f operator- (const size_f &sz) const noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size_f.
 
point_f operator- (const point &pt) const noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::point.
 
point_f operator- (const point_f &pt) const noexcept
 Translates a xtd::drawing::point by the negative of a given xtd::drawing::point.
 
point_foperator-= (const size &sz) noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size.
 
point_foperator-= (const size_f &sz) noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size_f.
 
point_foperator-= (const point &pt) noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::point.
 
point_foperator-= (const point_f &pt) noexcept
 Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::point_f.
 

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< point_f >
virtual bool equals (const point_f &) const noexcept=0
 Indicates whether 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

◆ point_f() [1/3]

xtd::drawing::point_f::point_f ( )
defaultnoexcept

Initializes a new instance of the xtd::drawing::point_f class.

Remarks
xtd::drawing::point::x and xtd::drawing::point::y values are set to zero.

◆ point_f() [2/3]

xtd::drawing::point_f::point_f ( float  x,
float  y 
)
noexcept

Initializes a new instance of the xtd::drawing::point_f class with the specified coordinates.

Parameters
xThe horizontal position of the point.
yThe vertical position of the point.

◆ point_f() [3/3]

xtd::drawing::point_f::point_f ( const size_f sz)
explicitnoexcept

Initializes a new instance of the xtd::drawing::point_t class from a xtd::drawing::size_f.

Parameters
szA size that specifies the coordinates for the new point.

Member Function Documentation

◆ is_empty()

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

Gets a value indicating whether this xtd::drawing::point_f is empty.

Returns
true if both xtd::drawing::point_f::x and xtd::drawing::point_f::y are 0; otherwise, false.

◆ x() [1/2]

float xtd::drawing::point_f::x ( ) const
noexcept

Gets the x-coordinate of this xtd::drawing::point_f.

Returns
The x-coordinate of this xtd::drawing::point_f.

◆ x() [2/2]

void xtd::drawing::point_f::x ( float  x)
noexcept

Sets the x-coordinate of this xtd::drawing::point_f.

Parameters
xThe x-coordinate of this xtd::drawing::point_f.

◆ y() [1/2]

float xtd::drawing::point_f::y ( ) const
noexcept

Gets the y-coordinate of this xtd::drawing::point_f.

Returns
The y-coordinate of this xtd::drawing::point_f.

◆ y() [2/2]

void xtd::drawing::point_f::y ( float  y)
noexcept

Sets the y-coordinate of this xtd::drawing::point_f.

Parameters
yThe x-coordinate of this xtd::drawing::point_f.

◆ offset() [1/2]

void xtd::drawing::point_f::offset ( float  dx,
float  dy 
)
noexcept

Translates this xtd::drawing::point_f by the specified amount.

Parameters
dxThe amount to offset the x-coordinate.
dyThe amount to offset the y-coordinate.

◆ offset() [2/2]

void xtd::drawing::point_f::offset ( const point_f pt)
noexcept

Translates this xtd::drawing::point_f by the specified xtd::drawing::point_f.

Parameters
pThe xtd::drawing::point used offset this xtd::drawing::point_f.
Remarks
This method adjusts the xtd::drawing::point_f::x and xtd::drawing::point_f::y values of this xtd::drawing::point_f to the sum of the xtd::drawing::point_f::x and xtd::drawing::point_f::y values of this xtd::drawing::point_f and p.

◆ to_string()

xtd::string xtd::drawing::point_f::to_string ( ) const
overridevirtualnoexcept

Converts this point to a human-readable string.

Returns
An xtd::string that represents this xtd::drawing::point.

Reimplemented from xtd::object.

◆ add() [1/4]

static point_f xtd::drawing::point_f::add ( const point_f pt,
const size sz 
)
staticnoexcept

Adds the specified xtd::drawing::size to the specified xtd::drawing::point_f.

Parameters
ptThe xtd::drawing::point_f to add.
szThe xtd::drawing::size to add.
Returns
The xtd::drawing::point_f that is the result of the addition operation.
Remarks
The xtd::drawing::point::add adds the xtd::drawing::size::width and xtd::drawing::size::height of the specified size to the xtd::drawing::point_f::x and xtd::drawing::point_f::y values of the specified xtd::drawing::point_f.

◆ add() [2/4]

static point_f xtd::drawing::point_f::add ( const point_f pt,
const size_f sz 
)
staticnoexcept

Adds the specified xtd::drawing::size_f to the specified xtd::drawing::point_f.

Parameters
ptThe xtd::drawing::point_f to add.
szThe xtd::drawing::size_f to add.
Returns
The xtd::drawing::point_f that is the result of the addition operation.
Remarks
The xtd::drawing::point::add adds the xtd::drawing::size_f::width and xtd::drawing::size_f::height of the specified size to the xtd::drawing::point_f::x and xtd::drawing::point_f::y values of the specified xtd::drawing::point_f.

◆ add() [3/4]

static point_f xtd::drawing::point_f::add ( const point_f pt1,
const point pt2 
)
staticnoexcept

Adds the specified xtd::drawing::point to the specified xtd::drawing::point_f.

Parameters
pt1The xtd::drawing::point_f to add.
pt2The xtd::drawing::point to add.
Returns
The xtd::drawing::point_f that is the result of the addition operation.

◆ add() [4/4]

static point_f xtd::drawing::point_f::add ( const point_f pt1,
const point_f pt2 
)
staticnoexcept

Adds the specified xtd::drawing::point_f to the specified xtd::drawing::point_f.

Parameters
pt1The xtd::drawing::point_f to add.
pt2The xtd::drawing::point_f to add.
Returns
The xtd::drawing::point_f that is the result of the addition operation.

◆ subtract() [1/4]

static point_f xtd::drawing::point_f::subtract ( const point_f pt,
const size sz 
)
staticnoexcept

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

Parameters
ptThe xtd::drawing::point_f to be subtracted from.
szThe xtd::drawing::size to subtract from the xtd::drawing::point.
Returns
The xtd::drawing::point_f that is the result of the subtraction operation.
Remarks
The xtd::drawing::point_f::subtract subtracts the xtd::drawing::size::width and xtd::drawing::size::height of the specified xtd::drawing::size from the xtd::drawing::point_f::x and xtd::drawing::point_f::y values of the specified xtd::drawing::point_f.

◆ subtract() [2/4]

static point_f xtd::drawing::point_f::subtract ( const point_f pt,
const size_f sz 
)
staticnoexcept

Returns the result of subtracting specified xtd::drawing::size_f from the specified xtd::drawing::point_f.

Parameters
ptThe xtd::drawing::point_f to be subtracted from.
szThe xtd::drawing::size_f to subtract from the xtd::drawing::point.
Returns
The xtd::drawing::point_f that is the result of the subtraction operation.
Remarks
The xtd::drawing::point_f::subtract subtracts the xtd::drawing::size_f::width and xtd::drawing::size_F::height of the specified xtd::drawing::size_f from the xtd::drawing::point_f::x and xtd::drawing::point_f::y values of the specified xtd::drawing::poin_ft.

◆ subtract() [3/4]

static point_f xtd::drawing::point_f::subtract ( const point_f pt1,
const point pt2 
)
staticnoexcept

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

Parameters
pt1The xtd::drawing::point_f to be subtracted from.
pt2The xtd::drawing::point to subtract from the xtd::drawing::point_f.
Returns
The xtd::drawing::point_f that is the result of the subtraction operation.

◆ subtract() [4/4]

static point_f xtd::drawing::point_f::subtract ( const point_f pt1,
const point_f pt2 
)
staticnoexcept

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

Parameters
pt1The xtd::drawing::point_f to be subtracted from.
pt2The xtd::drawing::point_f to subtract from the xtd::drawing::point_f.
Returns
The xtd::drawing::point_f that is the result of the subtraction operation.

◆ operator+() [1/4]

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

Translates a xtd::drawing::point_f by a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+() [2/4]

point_f xtd::drawing::point_f::operator+ ( const size_f sz) const
noexcept

Translates a xtd::drawing::point_f by a given xtd::drawing::size_f.

Parameters
szA xtd::drawing::size_f that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+() [3/4]

point_f xtd::drawing::point_f::operator+ ( const point pt) const
noexcept

Translates a xtd::drawing::point_f by a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+() [4/4]

point_f xtd::drawing::point_f::operator+ ( const point_f pt) const
noexcept

Translates a xtd::drawing::point_f by a given xtd::drawing::point_f.

Parameters
ptA xtd::drawing::size that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+=() [1/4]

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

Translates a xtd::drawing::point_f by a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+=() [2/4]

point_f & xtd::drawing::point_f::operator+= ( const size_f sz)
noexcept

Translates a xtd::drawing::point_f by a given xtd::drawing::size_f.

Parameters
szA xtd::drawing::size_f that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+=() [3/4]

point_f & xtd::drawing::point_f::operator+= ( const point pt)
noexcept

Translates a xtd::drawing::point_f by a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator+=() [4/4]

point_f & xtd::drawing::point_f::operator+= ( const point_f pt)
noexcept

Translates a xtd::drawing::point_f by a given xtd::drawing::point_f.

Parameters
ptA xtd::drawing::point_f that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator-() [1/4]

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

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point_f.
Returns
A xtd::drawing::point_f structure that is translated by the negative of a given xtd::drawing::size structure.

◆ operator-() [2/4]

point_f xtd::drawing::point_f::operator- ( const size_f sz) const
noexcept

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size_f.

Parameters
szA xtd::drawing::size_f that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point_f.
Returns
A xtd::drawing::point_f structure that is translated by the negative of a given xtd::drawing::size_f structure.

◆ operator-() [3/4]

point_f xtd::drawing::point_f::operator- ( const point pt) const
noexcept

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point.
Returns
A xtd::drawing::point_f structure that is translated by the negative of a given xtd::drawing::point structure.

◆ operator-() [4/4]

point_f xtd::drawing::point_f::operator- ( const point_f pt) const
noexcept

Translates a xtd::drawing::point by the negative of a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point.
Returns
A xtd::drawing::point structure that is translated by the negative of a given xtd::drawing::point structure.

◆ operator-=() [1/4]

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

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point_f.
Returns
A xtd::drawing::point_f structure that is translated by the negative of a given xtd::drawing::size structure.

◆ operator-=() [2/4]

point_f & xtd::drawing::point_f::operator-= ( const size_f sz)
noexcept

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::size_f.

Parameters
szA xtd::drawing::size_f that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point_f.
Returns
A xtd::drawing::point_f structure that is translated by the negative of a given xtd::drawing::size_f structure.

◆ operator-=() [3/4]

point_f & xtd::drawing::point_f::operator-= ( const point pt)
noexcept

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ operator-=() [4/4]

point_f & xtd::drawing::point_f::operator-= ( const point_f pt)
noexcept

Translates a xtd::drawing::point_f by the negative of a given xtd::drawing::point_f.

Parameters
ptA xtd::drawing::point_f that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point_f.
Returns
The translated xtd::drawing::point_f.

◆ 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 {
string s1 = "Tom";
string 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.

Member Data Documentation

◆ empty

const point_f xtd::drawing::point_f::empty
static

Represents a xtd::drawing::point_f that has xtd::drawing::point_f::x and xtd::drawing::point_f::y values set to zero.


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