Struct Point
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.
Implements
Namespace: SixLabors.ImageSharp
Assembly: SixLabors.ImageSharp.dll
Syntax
public struct 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
| Improve this Doc View SourcePoint(Size)
Declaration
public Point(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | The size. |
Point(Int32)
Initializes a new instance of the Point struct.
Declaration
public Point(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The horizontal and vertical position of the point. |
Point(Int32, Int32)
Initializes a new instance of the Point struct.
Declaration
public Point(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | The horizontal position of the point. |
Int32 | y | The vertical position of the point. |
Fields
| Improve this Doc View SourceEmpty
Represents a Point that has X and Y values set to zero.
Declaration
public static readonly Point Empty
Field Value
Type | Description |
---|---|
Point |
Properties
| Improve this Doc View SourceIsEmpty
Gets a value indicating whether this Point is empty.
Declaration
public readonly bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
X
Gets or sets the x-coordinate of this Point.
Declaration
public int X { readonly get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Y
Gets or sets the y-coordinate of this Point.
Declaration
public int Y { readonly get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAdd(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 Int32, out Int32)
Deconstructs this point into two integers.
Declaration
public void Deconstruct(out int x, out int y)
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | The out value for X. |
Int32 | y | The out value for Y. |
Equals(Point)
Declaration
public bool Equals(Point other)
Parameters
Type | Name | Description |
---|---|---|
Point | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Nullable<Object>)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
Nullable<Object> | obj |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Multiply(Point, Int32)
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. |
Int32 | 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(Int32, Int32)
Translates this Point by the specified amount.
Declaration
public void Offset(int dx, int dy)
Parameters
Type | Name | Description |
---|---|---|
Int32 | dx | The amount to offset the x-coordinate. |
Int32 | 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)
Converts a
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()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
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
| Improve this Doc View SourceAddition(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. |
Division(Point, Int32)
Declaration
public static Point operator /(Point left, int right)
Parameters
Type | Name | Description |
---|---|---|
Point | left | Dividend of type Point. |
Int32 | right | Divisor of type |
Returns
Type | Description |
---|---|
Point | Result of type Point. |
Equality(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 |
---|---|
Boolean | True if the current left is equal to the |
Explicit(Point to Size)
Declaration
public static explicit operator Size(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The point. |
Returns
Type | Description |
---|---|
Size |
Implicit(Point to PointF)
Declaration
public static implicit operator PointF(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The point. |
Returns
Type | Description |
---|---|
PointF |
Implicit(Point to Vector2)
Creates a
Declaration
public static implicit operator Vector2(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | The point. |
Returns
Type | Description |
---|---|
Vector2 |
Inequality(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 |
---|---|
Boolean | True if the current left is unequal to the |
Multiply(Point, Int32)
Declaration
public static Point operator *(Point left, int right)
Parameters
Type | Name | Description |
---|---|---|
Point | left | Multiplicand of type Point. |
Int32 | right | Multiplier of type |
Returns
Type | Description |
---|---|
Point | Product of type Point. |
Multiply(Int32, Point)
Declaration
public static Point operator *(int left, Point right)
Parameters
Type | Name | Description |
---|---|---|
Int32 | left | Multiplier of type |
Point | right | Multiplicand of type Point. |
Returns
Type | Description |
---|---|
Point | Product of type Point. |
Subtraction(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. |
UnaryNegation(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. |