Table of Contents

Struct Point

Namespace
SixLabors.ImageSharp
Assembly
SixLabors.ImageSharp.dll

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

public struct Point : IEquatable<Point>
Implements
Inherited Members

Remarks

This struct is fully mutable. This is done (against the guidelines) for the sake of performance, as it avoids the need to create new values for modification operations.

Constructors

Point(Size)

Initializes a new instance of the Point struct from the given Size.

public Point(Size size)

Parameters

size Size

The size.

Point(int)

Initializes a new instance of the Point struct.

public Point(int value)

Parameters

value int

The horizontal and vertical position of the point.

Point(int, int)

Initializes a new instance of the Point struct.

public Point(int x, int y)

Parameters

x int

The horizontal position of the point.

y int

The vertical position of the point.

Fields

Empty

Represents a Point that has X and Y values set to zero.

public static readonly Point Empty

Field Value

Point

Properties

X

Gets or sets the x-coordinate of this Point.

public int X { readonly get; set; }

Property Value

int

Y

Gets or sets the y-coordinate of this Point.

public int Y { readonly get; set; }

Property Value

int

Methods

Add(Point, Size)

Translates a Point by the negative of a given Size.

public static Point Add(Point point, Size size)

Parameters

point Point

The point on the left hand of the operand.

size Size

The size on the right hand of the operand.

Returns

Point

The Point.

Ceiling(PointF)

Converts a PointF to a Point by performing a ceiling operation on all the coordinates.

public static Point Ceiling(PointF point)

Parameters

point PointF

The point.

Returns

Point

The Point.

Deconstruct(out int, out int)

Deconstructs this point into two integers.

public void Deconstruct(out int x, out int y)

Parameters

x int

The out value for X.

y int

The out value for Y.

Equals(Point)

public bool Equals(Point other)

Parameters

other Point

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Multiply(Point, int)

Translates a Point by the negative of a given value.

public static Point Multiply(Point point, int value)

Parameters

point Point

The point on the left hand of the operand.

value int

The value on the right hand of the operand.

Returns

Point

The Point.

Offset(Point)

Translates this Point by the specified amount.

public void Offset(Point point)

Parameters

point Point

The Point used offset this Point.

Offset(int, int)

Translates this Point by the specified amount.

public void Offset(int dx, int dy)

Parameters

dx int

The amount to offset the x-coordinate.

dy int

The amount to offset the y-coordinate.

Round(PointF)

Converts a PointF to a Point by performing a round operation on all the coordinates.

public static Point Round(PointF point)

Parameters

point PointF

The point.

Returns

Point

The Point.

Round(Vector2)

Converts a Vector2 to a Point by performing a round operation on all the coordinates.

public static Point Round(Vector2 vector)

Parameters

vector Vector2

The vector.

Returns

Point

The Point.

Subtract(Point, Size)

Translates a Point by the negative of a given Size.

public static Point Subtract(Point point, Size size)

Parameters

point Point

The point on the left hand of the operand.

size Size

The size on the right hand of the operand.

Returns

Point

The Point.

ToString()

public override string ToString()

Returns

string

Transform(Point, Matrix3x2)

Transforms a point by a specified 3x2 matrix.

public static Point Transform(Point point, Matrix3x2 matrix)

Parameters

point Point

The point to transform.

matrix Matrix3x2

The transformation matrix used.

Returns

Point

The transformed PointF.

Truncate(PointF)

Converts a PointF to a Point by performing a truncate operation on all the coordinates.

public static Point Truncate(PointF point)

Parameters

point PointF

The point.

Returns

Point

The Point.

Operators

operator +(Point, Size)

Translates a Point by a given Size.

public static Point operator +(Point point, Size size)

Parameters

point Point

The point on the left hand of the operand.

size Size

The size on the right hand of the operand.

Returns

Point

The Point.

operator /(Point, int)

Divides Point by a int producing Point.

public static Point operator /(Point left, int right)

Parameters

left Point

Dividend of type Point.

right int

Divisor of type int.

Returns

Point

Result of type Point.

operator ==(Point, Point)

Compares two Point objects for equality.

public static bool operator ==(Point left, Point right)

Parameters

left Point

The Point on the left side of the operand.

right Point

The Point on the right side of the operand.

Returns

bool

True if the current left is equal to the right parameter; otherwise, false.

explicit operator Size(Point)

Creates a Size with the coordinates of the specified Point.

public static explicit operator Size(Point point)

Parameters

point Point

The point.

Returns

Size

implicit operator PointF(Point)

Creates a PointF with the coordinates of the specified Point.

public static implicit operator PointF(Point point)

Parameters

point Point

The point.

Returns

PointF

implicit operator Vector2(Point)

Creates a Vector2 with the coordinates of the specified Point.

public static implicit operator Vector2(Point point)

Parameters

point Point

The point.

Returns

Vector2

operator !=(Point, Point)

Compares two Point objects for inequality.

public static bool operator !=(Point left, Point right)

Parameters

left Point

The Point on the left side of the operand.

right Point

The Point on the right side of the operand.

Returns

bool

True if the current left is unequal to the right parameter; otherwise, false.

operator *(Point, int)

Multiplies Point by a int producing Point.

public static Point operator *(Point left, int right)

Parameters

left Point

Multiplicand of type Point.

right int

Multiplier of type int.

Returns

Point

Product of type Point.

operator *(int, Point)

Multiplies Point by a int producing Point.

public static Point operator *(int left, Point right)

Parameters

left int

Multiplier of type int.

right Point

Multiplicand of type Point.

Returns

Point

Product of type Point.

operator -(Point, Size)

Translates a Point by the negative of a given Size.

public static Point operator -(Point point, Size size)

Parameters

point Point

The point on the left hand of the operand.

size Size

The size on the right hand of the operand.

Returns

Point

The Point.

operator -(Point)

Negates the given point by multiplying all values by -1.

public static Point operator -(Point value)

Parameters

value Point

The source point.

Returns

Point

The negated point.