Struct PixelPoint
- Namespace
- Avalonia
- Assembly
- Avalonia.Base.dll
Represents a point in device pixels.
public readonly struct PixelPoint : IEquatable<PixelPoint>
- Implements
- Inherited Members
Constructors
PixelPoint(int, int)
Initializes a new instance of the PixelPoint structure.
public PixelPoint(int x, int y)
Parameters
Fields
Origin
A point representing 0,0.
public static readonly PixelPoint Origin
Field Value
Properties
X
Gets the X co-ordinate.
public int X { get; }
Property Value
Y
Gets the Y co-ordinate.
public int Y { get; }
Property Value
Methods
Equals(PixelPoint)
Returns a boolean indicating whether the point is equal to the other given point.
public bool Equals(PixelPoint other)
Parameters
other
PixelPointThe other point to test equality against.
Returns
- bool
True if this point is equal to other; False otherwise.
Equals(object?)
Checks for equality between a point and an object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object.
Returns
- bool
True if
obj
is a point that equals the current point.
FromPoint(Point, Vector)
Converts a Point to device pixels using the specified scaling factor.
public static PixelPoint FromPoint(Point point, Vector scale)
Parameters
Returns
- PixelPoint
The device-independent point.
FromPoint(Point, double)
Converts a Point to device pixels using the specified scaling factor.
public static PixelPoint FromPoint(Point point, double scale)
Parameters
Returns
- PixelPoint
The device-independent point.
FromPointWithDpi(Point, Vector)
Converts a Point to device pixels using the specified dots per inch (DPI).
public static PixelPoint FromPointWithDpi(Point point, Vector dpi)
Parameters
Returns
- PixelPoint
The device-independent point.
FromPointWithDpi(Point, double)
Converts a Point to device pixels using the specified dots per inch (DPI).
public static PixelPoint FromPointWithDpi(Point point, double dpi)
Parameters
Returns
- PixelPoint
The device-independent point.
GetHashCode()
Returns a hash code for a PixelPoint.
public override int GetHashCode()
Returns
- int
The hash code.
Parse(string)
Parses a PixelPoint string.
public static PixelPoint Parse(string s)
Parameters
s
stringThe string.
Returns
- PixelPoint
The PixelPoint.
ToPoint(Vector)
Converts the PixelPoint to a device-independent Point using the specified scaling factor.
public Point ToPoint(Vector scale)
Parameters
scale
VectorThe scaling factor.
Returns
- Point
The device-independent point.
ToPoint(double)
Converts the PixelPoint to a device-independent Point using the specified scaling factor.
public Point ToPoint(double scale)
Parameters
scale
doubleThe scaling factor.
Returns
- Point
The device-independent point.
ToPointWithDpi(Vector)
Converts the PixelPoint to a device-independent Point using the specified dots per inch (DPI).
public Point ToPointWithDpi(Vector dpi)
Parameters
dpi
VectorThe dots per inch of the device.
Returns
- Point
The device-independent point.
ToPointWithDpi(double)
Converts the PixelPoint to a device-independent Point using the specified dots per inch (DPI).
public Point ToPointWithDpi(double dpi)
Parameters
dpi
doubleThe dots per inch of the device.
Returns
- Point
The device-independent point.
ToString()
Returns the string representation of the point.
public override string ToString()
Returns
- string
The string representation of the point.
WithX(int)
Returns a new PixelPoint with the same Y co-ordinate and the specified X co-ordinate.
public PixelPoint WithX(int x)
Parameters
x
intThe X co-ordinate.
Returns
- PixelPoint
The new PixelPoint.
WithY(int)
Returns a new PixelPoint with the same X co-ordinate and the specified Y co-ordinate.
public PixelPoint WithY(int y)
Parameters
y
intThe Y co-ordinate.
Returns
- PixelPoint
The new PixelPoint.
Operators
operator +(PixelPoint, PixelPoint)
Adds two points.
public static PixelPoint operator +(PixelPoint a, PixelPoint b)
Parameters
a
PixelPointThe first point.
b
PixelPointThe second point.
Returns
- PixelPoint
A point that is the result of the addition.
operator +(PixelPoint, PixelVector)
Adds a vector to a point.
public static PixelPoint operator +(PixelPoint a, PixelVector b)
Parameters
a
PixelPointThe point.
b
PixelVectorThe vector.
Returns
- PixelPoint
A point that is the result of the addition.
operator ==(PixelPoint, PixelPoint)
Checks for equality between two PixelPoints.
public static bool operator ==(PixelPoint left, PixelPoint right)
Parameters
left
PixelPointThe first point.
right
PixelPointThe second point.
Returns
- bool
True if the points are equal; otherwise false.
implicit operator PixelVector(PixelPoint)
public static implicit operator PixelVector(PixelPoint p)
Parameters
p
PixelPointThe point.
Returns
operator !=(PixelPoint, PixelPoint)
Checks for inequality between two PixelPoints.
public static bool operator !=(PixelPoint left, PixelPoint right)
Parameters
left
PixelPointThe first point.
right
PixelPointThe second point.
Returns
- bool
True if the points are unequal; otherwise false.
operator -(PixelPoint, PixelPoint)
Subtracts two points.
public static PixelPoint operator -(PixelPoint a, PixelPoint b)
Parameters
a
PixelPointThe first point.
b
PixelPointThe second point.
Returns
- PixelPoint
A point that is the result of the subtraction.
operator -(PixelPoint, PixelVector)
Subtracts a vector from a point.
public static PixelPoint operator -(PixelPoint a, PixelVector b)
Parameters
a
PixelPointThe point.
b
PixelVectorThe vector.
Returns
- PixelPoint
A point that is the result of the subtraction.