Table of Contents

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

x int

The X co-ordinate.

y int

The Y co-ordinate.

Fields

Origin

A point representing 0,0.

public static readonly PixelPoint Origin

Field Value

PixelPoint

Properties

X

Gets the X co-ordinate.

public int X { get; }

Property Value

int

Y

Gets the Y co-ordinate.

public int Y { get; }

Property Value

int

Methods

Equals(PixelPoint)

Returns a boolean indicating whether the point is equal to the other given point.

public bool Equals(PixelPoint other)

Parameters

other PixelPoint

The 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 object

The 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

point Point

The point.

scale Vector

The scaling factor.

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

point Point

The point.

scale double

The scaling factor.

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

point Point

The point.

dpi Vector

The dots per inch of the device.

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

point Point

The point.

dpi double

The dots per inch of the device.

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 string

The 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 Vector

The 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 double

The 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 Vector

The 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 double

The 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 int

The 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 int

The 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 PixelPoint

The first point.

b PixelPoint

The 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 PixelPoint

The point.

b PixelVector

The 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 PixelPoint

The first point.

right PixelPoint

The second point.

Returns

bool

True if the points are equal; otherwise false.

implicit operator PixelVector(PixelPoint)

Converts the Point to a Vector.

public static implicit operator PixelVector(PixelPoint p)

Parameters

p PixelPoint

The point.

Returns

PixelVector

operator !=(PixelPoint, PixelPoint)

Checks for inequality between two PixelPoints.

public static bool operator !=(PixelPoint left, PixelPoint right)

Parameters

left PixelPoint

The first point.

right PixelPoint

The 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 PixelPoint

The first point.

b PixelPoint

The 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 PixelPoint

The point.

b PixelVector

The vector.

Returns

PixelPoint

A point that is the result of the subtraction.