xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.
xtd::drawing::point Class Reference

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

#include <point.h>

Public Member Functions

 point ()=default
 Initializes a new instance of the point class. More...
 
 point (int32_t dw)
 nitializes a new instance of the point class using coordinates specified by an integer value. More...
 
 point (int32_t x, int32_t y)
 Initializes a new instance of the point class with the specified coordinates. More...
 
 point (const size &sz)
 Initializes a new instance of the point class from a size. More...
 
bool is_empty () const
 Gets a value indicating whether this point is empty. More...
 
void offset (int dx, int dy)
 Translates this point by the specified amount. More...
 
void offset (const point &p)
 Translates this point by the specified point. More...
 
std::string to_string () const
 Converts this point to a human-readable string. More...
 
int32_t x () const
 Gets the x-coordinate of this point. More...
 
void x (int32_t x)
 Sets the x-coordinate of this point. More...
 
int32_t y () const
 Gets the y-coordinate of this point. More...
 
void y (int32_t y)
 Sets the y-coordinate of this point. More...
 

Static Public Member Functions

static point add (const point &pt, const size &sz)
 Adds the specified size to the specified point. More...
 
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. More...
 
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. More...
 
static point subtract (const point &pt, const size &sz)
 Returns the result of subtracting specified Size from the specified point. More...
 
static point truncate (const point_f &value)
 Converts the specified point_f to a point by truncating the values of the point_f. More...
 

Static Public Attributes

static const point empty
 Represents a point that has x and y values set to zero. More...
 

Detailed Description

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

Remarks
To convert a point to a point_f, use Implicit cast operator.
Examples
void create_points_and_sizes(paint_event_args& e) {
// Create the starting point.
point start_point = subtract_button.size();
// Use the addition operator to get the end point.
point end_point = start_point + size(140, 150);
// Draw a line between the points.
e.graphics().draw_line(system_pens::highlight, start_point, end_point);
// Convert the starting point to a size and compare it to the subtractButton size.
size button_size(start_point);
if (button_size == subtract_button.size()) {
// If the sizes are equal, tell the user.
e.graphics().draw_string("The sizes are equal.", font(font, font_style.italic), brushes::indigo, 10.0F, 65.0F);
}
}

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