#include <point.h>
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.
- Namespace
- xtd::drawing
- Library
- xtd.drawing
- Examples
void create_points_and_sizes(paint_event_args&
e) {
point start_point = subtract_button.size();
point end_point = start_point +
size(140, 150);
size button_size(start_point);
if (button_size == subtract_button.size()) {
}
}
static xtd::drawing::solid_brush indigo()
A system-defined brush object.
Defines a particular format for text, including font face, size, and style attributes....
Definition font.h:39
bool italic() const
Gets a value that indicates whether this xtd::drawing::font is italic.
Definition font.h:235
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:48
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:25
static xtd::drawing::pen highlight()
Gets a pen that is the color of the highlight.
font_style
Specifies style information applied to text. This enumeration has a flags attribute that allows a bit...
Definition font_style.h:17
- Examples
- user_control.cpp.
Inherits xtd::object.
|
static const point | empty |
| Represents a point that has x and y values set to zero.
|
|
|
| point ()=default |
| Initializes a new instance of the point class.
|
|
| point (const size &sz) |
| Initializes a new instance of the point class from a size.
|
|
| point (int32_t dw) |
| Initializes a new instance of the point class using coordinates specified by an integer value.
|
|
| point (int32_t x, int32_t y) |
| Initializes a new instance of the point class with the specified coordinates.
|
|
bool | is_empty () const |
| Gets a value indicating whether this point is empty.
|
|
void | offset (const point &p) |
| Translates this point by the specified point.
|
|
void | offset (int dx, int dy) |
| Translates this point by the specified amount.
|
|
xtd::ustring | to_string () const noexcept override |
| Converts this point to a human-readable string.
|
|
int32_t | x () const |
| Gets the x-coordinate of this point.
|
|
void | x (int32_t x) |
| Sets the x-coordinate of this point.
|
|
int32_t | y () const |
| Gets the y-coordinate of this point.
|
|
void | y (int32_t y) |
| Sets the y-coordinate of this point.
|
|
| 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 point | add (const point &pt, const size &sz) |
| Adds the specified size to the specified point.
|
|
static point | ceiling (const point_f &value) |
| Converts the specified point_f to a point by rounding the values of the point_f to the next higher integer values.
|
|
static point | round (const point_f &value) |
| Converts the specified point_f to a point object by rounding the point_f values to the nearest integer.
|
|
static point | subtract (const point &pt, const size &sz) |
| Returns the result of subtracting specified Size from the specified point.
|
|
static point | truncate (const point_f &value) |
| Converts the specified point_f to a point by truncating the values of the point_f.
|
|
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.
|
|
◆ point() [1/4]
xtd::drawing::point::point |
( |
| ) |
|
|
default |
Initializes a new instance of the point class.
◆ point() [2/4]
xtd::drawing::point::point |
( |
int32_t |
dw | ) |
|
|
inlineexplicit |
Initializes a new instance of the point class using coordinates specified by an integer value.
- Parameters
-
dx | A 32-bit integer that specifies the coordinates for the new point. |
- Examples
- The following code example demonstrates how to use the point and size. size constructors and the xtd::drawing::content_alignment enumeration. To run this example, paste this code into a Windows Form (xtd::forms) that contains a label named label1, and call the initialize_label1 method in the form's constructor.
void initialize_label1() {
label1.border_style = border_style::fixed_single;
label1.location(
point(0x280028));
label1.text_align = content_alignment::bottom_right;
label1.text = "Bottom Right Alignment";
}
point()=default
Initializes a new instance of the point class.
◆ point() [3/4]
xtd::drawing::point::point |
( |
int32_t |
x, |
|
|
int32_t |
y |
|
) |
| |
|
inline |
Initializes a new instance of the point class with the specified coordinates.
- Parameters
-
x | The horizontal position of the point. |
y | The vertical position of the point. |
- Examples
- The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(
object& sender,
const event_args&
e) {
graphics form_graphics = create_graphics();
if (point1 == point2) {
form_graphics.draw_string(
ustring::format(
"point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()),
font(),
brushes::black,
point_f(10, 70));
}
}
static xtd::drawing::solid_brush black()
A system-defined brush object.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.h:48
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.h:26
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
◆ point() [4/4]
xtd::drawing::point::point |
( |
const size & |
sz | ) |
|
Initializes a new instance of the point class from a size.
- Parameters
-
sz | A size that specifies the coordinates for the new point. |
- Examples
- The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(
object& sender,
const event_args&
e) {
graphics form_graphics = create_graphics();
if (point1 == point2) {
form_graphics.draw_string(
ustring::format(
"point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()),
font(),
brushes::black,
point_f(10, 70));
}
}
◆ add()
static point xtd::drawing::point::add |
( |
const point & |
pt, |
|
|
const size & |
sz |
|
) |
| |
|
static |
Adds the specified size to the specified point.
- Parameters
-
pt | The point to add. |
sz | The size to add. |
- Returns
- The point that is the result of the addition operation.
- Examples
- The following example shows how to use the add method. To run this example, paste it into a Windows Form (xtd::forms. Handle the form's paint event and call the add_point method from the paint event-handling method, passing e as paint_event_args.
void add_point(paint_event_args&
e) {
e.graphics().draw_line(
pens::red, point1, point2);
}
static xtd::drawing::pen red()
A system-defined pen object with a width of 1.
static point add(const point &pt, const size &sz)
Adds the specified size to the specified point.
◆ ceiling()
static point xtd::drawing::point::ceiling |
( |
const point_f & |
value | ) |
|
|
static |
Converts the specified point_f to a point by rounding the values of the point_f to the next higher integer values.
- Parameters
-
- Returns
- The point this method converts to.
◆ is_empty()
bool xtd::drawing::point::is_empty |
( |
| ) |
const |
|
inline |
Gets a value indicating whether this point is empty.
- Returns
- true if both X and Y are 0; otherwise, false.
◆ offset() [1/2]
void xtd::drawing::point::offset |
( |
const point & |
p | ) |
|
|
inline |
Translates this point by the specified point.
- Parameters
-
p | The point used offset this point. |
- Examples
- The following example shows how to use the Offset method. To run this example, paste it into a Windows Form. Handle the form's Paint event and call the Offsetpoint method from the Paint event-handling method, passing e as PaintEventArgs.
void offset_point(paint_event_args&
e) {
point1.offset(50, 0);
e.graphics().draw_line(
pens::red, point1, point2);
}
◆ offset() [2/2]
void xtd::drawing::point::offset |
( |
int |
dx, |
|
|
int |
dy |
|
) |
| |
|
inline |
Translates this point by the specified amount.
- Parameters
-
dx | The amount to offset the x-coordinate. |
dy | The amount to offset the y-coordinate. |
◆ round()
static point xtd::drawing::point::round |
( |
const point_f & |
value | ) |
|
|
static |
Converts the specified point_f to a point object by rounding the point_f values to the nearest integer.
- Parameters
-
- Returns
- The point this method converts to.
◆ subtract()
static point xtd::drawing::point::subtract |
( |
const point & |
pt, |
|
|
const size & |
sz |
|
) |
| |
|
static |
Returns the result of subtracting specified Size from the specified point.
- Parameters
-
pt | The point to be subtracted from. |
sz | The size to subtract from the point. |
- Returns
- The point that is the result of the subtraction operation.
◆ to_string()
|
inlineoverridevirtualnoexcept |
Converts this point to a human-readable string.
- Returns
- A string that represents this point.
Reimplemented from xtd::object.
◆ truncate()
static point xtd::drawing::point::truncate |
( |
const point_f & |
value | ) |
|
|
static |
Converts the specified point_f to a point by truncating the values of the point_f.
- Parameters
-
- Returns
- The point this method converts to.
◆ x() [1/2]
int32_t xtd::drawing::point::x |
( |
| ) |
const |
|
inline |
Gets the x-coordinate of this point.
- Returns
- The x-coordinate of this point.
- Examples
- The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(
object& sender,
const event_args&
e) {
graphics form_graphics = create_graphics();
if (point1 == point2) {
form_graphics.draw_string(
ustring::format(
"point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()),
font(),
brushes::black,
point_f(10, 70));
}
}
◆ x() [2/2]
void xtd::drawing::point::x |
( |
int32_t |
x | ) |
|
|
inline |
Sets the x-coordinate of this point.
- Parameters
-
x | The x-coordinate of this point. |
- Examples
- The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(
object& sender,
const event_args&
e) {
graphics form_graphics = create_graphics();
if (point1 == point2) {
form_graphics.draw_string(
ustring::format(
"point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()),
font(),
brushes::black,
point_f(10, 70));
}
}
◆ y() [1/2]
int32_t xtd::drawing::point::y |
( |
| ) |
const |
|
inline |
Gets the y-coordinate of this point.
- Returns
- The y-coordinate of this point.
- Examples
- The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_Click(
object& sender,
const event_args&
e) {
graphics form_graphics = create_graphics();
if (point1 == point2) {
form_graphics.draw_string(
ustring::format(
"point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()),
font(),
brushes::black,
point_f(10, 70));
}
}
- Examples
- screen.cpp.
◆ y() [2/2]
void xtd::drawing::point::y |
( |
int32_t |
y | ) |
|
|
inline |
Sets the y-coordinate of this point.
- Parameters
-
y | The x-coordinate of this point. |
- Examples
- The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_Click(
object& sender,
const event_args&
e) {
graphics form_graphics = create_graphics();
if (point1 == point2) {
form_graphics.draw_string(
ustring::format(
"point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()),
font(),
brushes::black,
point_f(10, 70));
}
}
◆ empty
const point xtd::drawing::point::empty |
|
static |
Represents a point that has x and y values set to zero.
The documentation for this class was generated from the following file:
- xtd.drawing/include/xtd/drawing/point.h