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)
public Point(Size size)
Parameters
sizeSizeThe size.
Point(int)
Initializes a new instance of the Point struct.
public Point(int value)
Parameters
valueintThe 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
Fields
Empty
Represents a Point that has X and Y values set to zero.
public static readonly Point Empty
Field Value
Properties
X
Gets or sets the x-coordinate of this Point.
public int X { readonly get; set; }
Property Value
Y
Gets or sets the y-coordinate of this Point.
public int Y { readonly get; set; }
Property Value
Methods
Add(Point, Size)
public static Point Add(Point point, Size size)
Parameters
pointPointThe point on the left hand of the operand.
sizeSizeThe size on the right hand of the operand.
Returns
Ceiling(PointF)
public static Point Ceiling(PointF point)
Parameters
pointPointFThe point.
Returns
Deconstruct(out int, out int)
Deconstructs this point into two integers.
public readonly void Deconstruct(out int x, out int y)
Parameters
Equals(Point)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(Point other)
Parameters
otherPointAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Multiply(Point, int)
Translates a Point by the negative of a given value.
public static Point Multiply(Point point, int value)
Parameters
pointPointThe point on the left hand of the operand.
valueintThe value on the right hand of the operand.
Returns
Offset(Point)
Translates this Point by the specified amount.
public void Offset(Point point)
Parameters
Offset(int, int)
Translates this Point by the specified amount.
public void Offset(int dx, int dy)
Parameters
Round(PointF)
public static Point Round(PointF point)
Parameters
pointPointFThe point.
Returns
Round(Vector2)
public static Point Round(Vector2 vector)
Parameters
vectorVector2The vector.
Returns
Subtract(Point, Size)
public static Point Subtract(Point point, Size size)
Parameters
pointPointThe point on the left hand of the operand.
sizeSizeThe size on the right hand of the operand.
Returns
ToString()
Returns the fully qualified type name of this instance.
public override readonly string ToString()
Returns
- string
The fully qualified type name.
Transform(Point, Matrix3x2)
Transforms a point by a specified 3x2 matrix.
public static PointF Transform(Point point, Matrix3x2 matrix)
Parameters
Returns
Transform(Point, Matrix4x4)
Transforms a point by a specified 4x4 matrix, applying a projective transform flattened into 2D space.
public static PointF Transform(Point point, Matrix4x4 matrix)
Parameters
Returns
Truncate(PointF)
public static Point Truncate(PointF point)
Parameters
pointPointFThe point.
Returns
Operators
operator +(Point, Size)
public static Point operator +(Point point, Size size)
Parameters
pointPointThe point on the left hand of the operand.
sizeSizeThe size on the right hand of the operand.
Returns
operator /(Point, int)
public static Point operator /(Point left, int right)
Parameters
Returns
operator ==(Point, Point)
Compares two Point objects for equality.
public static bool operator ==(Point left, Point right)
Parameters
leftPointThe Point on the left side of the operand.
rightPointThe Point on the right side of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
explicit operator Size(Point)
public static explicit operator Size(Point point)
Parameters
pointPointThe point.
Returns
implicit operator PointF(Point)
public static implicit operator PointF(Point point)
Parameters
pointPointThe point.
Returns
implicit operator Vector2(Point)
public static implicit operator Vector2(Point point)
Parameters
pointPointThe point.
Returns
operator !=(Point, Point)
Compares two Point objects for inequality.
public static bool operator !=(Point left, Point right)
Parameters
leftPointThe Point on the left side of the operand.
rightPointThe Point on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.
operator *(Point, int)
public static Point operator *(Point left, int right)
Parameters
Returns
operator *(int, Point)
public static Point operator *(int left, Point right)
Parameters
Returns
operator -(Point, Size)
public static Point operator -(Point point, Size size)
Parameters
pointPointThe point on the left hand of the operand.
sizeSizeThe size on the right hand of the operand.
Returns
operator -(Point)
Negates the given point by multiplying all values by -1.
public static Point operator -(Point value)
Parameters
valuePointThe source point.
Returns
- Point
The negated point.