Struct Point
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public struct Point : IEquatable<Point>
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)
Declaration
public Point(Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | size | The size. |
Point(int)
Initializes a new instance of the Point struct.
Declaration
public Point(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | The horizontal and vertical position of the point. |
Point(int, int)
Initializes a new instance of the Point struct.
Declaration
public Point(int x, int y)
Parameters
| Type | Name | Description |
|---|---|---|
| int | x | The horizontal position of the point. |
| int | y | The vertical position of the point. |
Fields
Empty
Represents a Point that has X and Y values set to zero.
Declaration
public static readonly Point Empty
Field Value
| Type | Description |
|---|---|
| Point |
Properties
X
Gets or sets the x-coordinate of this Point.
Declaration
public int X { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Y
Gets or sets the y-coordinate of this Point.
Declaration
public int Y { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Add(Point, Size)
Declaration
public static Point Add(Point point, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point on the left hand of the operand. |
| Size | size | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
Ceiling(PointF)
Declaration
public static Point Ceiling(PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | point | The point. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
Deconstruct(out int, out int)
Deconstructs this point into two integers.
Declaration
public void Deconstruct(out int x, out int y)
Parameters
| Type | Name | Description |
|---|---|---|
| int | x | The out value for X. |
| int | y | The out value for Y. |
Equals(Point)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(Point other)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
Multiply(Point, int)
Translates a Point by the negative of a given value.
Declaration
public static Point Multiply(Point point, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point on the left hand of the operand. |
| int | value | The value on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
Offset(Point)
Translates this Point by the specified amount.
Declaration
public void Offset(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point |
Offset(int, int)
Translates this Point by the specified amount.
Declaration
public void Offset(int dx, int dy)
Parameters
| Type | Name | Description |
|---|---|---|
| int | dx | The amount to offset the x-coordinate. |
| int | dy | The amount to offset the y-coordinate. |
Round(PointF)
Declaration
public static Point Round(PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | point | The point. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
Round(Vector2)
Declaration
public static Point Round(Vector2 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | vector | The vector. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
Subtract(Point, Size)
Declaration
public static Point Subtract(Point point, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point on the left hand of the operand. |
| Size | size | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The fully qualified type name. |
Overrides
Transform(Point, Matrix3x2)
Transforms a point by a specified 3x2 matrix.
Declaration
public static Point Transform(Point point, Matrix3x2 matrix)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point to transform. |
| Matrix3x2 | matrix | The transformation matrix used. |
Returns
| Type | Description |
|---|---|
| Point | The transformed PointF. |
Truncate(PointF)
Declaration
public static Point Truncate(PointF point)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | point | The point. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
Operators
operator +(Point, Size)
Declaration
public static Point operator +(Point point, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point on the left hand of the operand. |
| Size | size | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
operator /(Point, int)
Declaration
public static Point operator /(Point left, int right)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | left | Dividend of type Point. |
| int | right | Divisor of type int. |
Returns
| Type | Description |
|---|---|
| Point | Result of type Point. |
operator ==(Point, Point)
Compares two Point objects for equality.
Declaration
public static bool operator ==(Point left, Point right)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | left | The Point on the left side of the operand. |
| Point | right | The Point on the right side of the operand. |
Returns
| Type | Description |
|---|---|
| bool | True if the current left is equal to the |
explicit operator Size(Point)
Declaration
public static explicit operator Size(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point. |
Returns
| Type | Description |
|---|---|
| Size |
implicit operator PointF(Point)
Declaration
public static implicit operator PointF(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point. |
Returns
| Type | Description |
|---|---|
| PointF |
implicit operator Vector2(Point)
Declaration
public static implicit operator Vector2(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point. |
Returns
| Type | Description |
|---|---|
| Vector2 |
operator !=(Point, Point)
Compares two Point objects for inequality.
Declaration
public static bool operator !=(Point left, Point right)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | left | The Point on the left side of the operand. |
| Point | right | The Point on the right side of the operand. |
Returns
| Type | Description |
|---|---|
| bool | True if the current left is unequal to the |
operator *(Point, int)
Declaration
public static Point operator *(Point left, int right)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | left | Multiplicand of type Point. |
| int | right | Multiplier of type int. |
Returns
| Type | Description |
|---|---|
| Point | Product of type Point. |
operator *(int, Point)
Declaration
public static Point operator *(int left, Point right)
Parameters
| Type | Name | Description |
|---|---|---|
| int | left | Multiplier of type int. |
| Point | right | Multiplicand of type Point. |
Returns
| Type | Description |
|---|---|
| Point | Product of type Point. |
operator -(Point, Size)
Declaration
public static Point operator -(Point point, Size size)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point on the left hand of the operand. |
| Size | size | The size on the right hand of the operand. |
Returns
| Type | Description |
|---|---|
| Point | The Point. |
operator -(Point)
Negates the given point by multiplying all values by -1.
Declaration
public static Point operator -(Point value)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | value | The source point. |
Returns
| Type | Description |
|---|---|
| Point | The negated point. |