Struct PointF
- Namespace
- SixLabors.ImageSharp
- Assembly
- SixLabors.ImageSharp.dll
Represents an ordered pair of single precision floating point x- and y-coordinates that defines a point in a two-dimensional plane.
public struct PointF : IEquatable<PointF>
- 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
PointF(SizeF)
public PointF(SizeF size)
Parameters
sizeSizeFThe size.
PointF(float, float)
Initializes a new instance of the PointF struct.
public PointF(float x, float y)
Parameters
Fields
Empty
Represents a PointF that has X and Y values set to zero.
public static readonly PointF Empty
Field Value
Properties
X
Gets or sets the x-coordinate of this PointF.
public float X { readonly get; set; }
Property Value
Y
Gets or sets the y-coordinate of this PointF.
public float Y { readonly get; set; }
Property Value
Methods
Add(PointF, PointF)
public static PointF Add(PointF point, PointF pointb)
Parameters
pointPointFThe point on the left hand of the operand.
pointbPointFThe point on the right hand of the operand.
Returns
Add(PointF, SizeF)
public static PointF Add(PointF point, SizeF size)
Parameters
pointPointFThe point on the left hand of the operand.
sizeSizeFThe size on the right hand of the operand.
Returns
Deconstruct(out float, out float)
Deconstructs this point into two floats.
public readonly void Deconstruct(out float x, out float y)
Parameters
Equals(PointF)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(PointF other)
Parameters
otherPointFAn 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(PointF, float)
Translates a PointF by the multiplying the X and Y by the given value.
public static PointF Multiply(PointF point, float right)
Parameters
pointPointFThe point on the left hand of the operand.
rightfloatThe value on the right hand of the operand.
Returns
Offset(PointF)
Translates this PointF by the specified amount.
public void Offset(PointF point)
Parameters
Offset(float, float)
Translates this PointF by the specified amount.
public void Offset(float dx, float dy)
Parameters
Subtract(PointF, PointF)
public static PointF Subtract(PointF point, PointF pointb)
Parameters
pointPointFThe point on the left hand of the operand.
pointbPointFThe point on the right hand of the operand.
Returns
Subtract(PointF, SizeF)
public static PointF Subtract(PointF point, SizeF size)
Parameters
pointPointFThe point on the left hand of the operand.
sizeSizeFThe 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(PointF, Matrix3x2)
Transforms a point by a specified 3x2 matrix.
public static PointF Transform(PointF point, Matrix3x2 matrix)
Parameters
Returns
Transform(PointF, Matrix4x4)
Transforms a point by a specified 4x4 matrix, applying a projective transform flattened into 2D space.
public static PointF Transform(PointF point, Matrix4x4 matrix)
Parameters
Returns
Operators
operator +(PointF, PointF)
public static PointF operator +(PointF point, PointF size)
Parameters
pointPointFThe point on the left hand of the operand.
sizePointFThe size on the right hand of the operand.
Returns
operator +(PointF, SizeF)
public static PointF operator +(PointF point, SizeF size)
Parameters
pointPointFThe point on the left hand of the operand.
sizeSizeFThe size on the right hand of the operand.
Returns
operator /(PointF, float)
public static PointF operator /(PointF left, float right)
Parameters
Returns
operator ==(PointF, PointF)
Compares two PointF objects for equality.
public static bool operator ==(PointF left, PointF right)
Parameters
leftPointFThe PointF on the left side of the operand.
rightPointFThe PointF on the right side of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
explicit operator Point(PointF)
public static explicit operator Point(PointF point)
Parameters
pointPointFThe point.
Returns
implicit operator Vector2(PointF)
public static implicit operator Vector2(PointF point)
Parameters
pointPointFThe point.
Returns
implicit operator PointF(Vector2)
public static implicit operator PointF(Vector2 vector)
Parameters
vectorVector2The vector.
Returns
operator !=(PointF, PointF)
Compares two PointF objects for inequality.
public static bool operator !=(PointF left, PointF right)
Parameters
leftPointFThe PointF on the left side of the operand.
rightPointFThe PointF on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.
operator *(PointF, float)
public static PointF operator *(PointF left, float right)
Parameters
Returns
operator *(float, PointF)
public static PointF operator *(float left, PointF right)
Parameters
Returns
operator -(PointF, PointF)
public static PointF operator -(PointF point, PointF size)
Parameters
pointPointFThe point on the left hand of the operand.
sizePointFThe size on the right hand of the operand.
Returns
operator -(PointF, SizeF)
public static PointF operator -(PointF point, SizeF size)
Parameters
pointPointFThe point on the left hand of the operand.
sizeSizeFThe size on the right hand of the operand.
Returns
operator -(PointF)
Negates the given point by multiplying all values by -1.
public static PointF operator -(PointF value)
Parameters
valuePointFThe source point.
Returns
- PointF
The negated point.