Skip to main content

PixelSize Structure

Represents a size in device pixels.

Definition

Namespace: Avalonia
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public readonly struct PixelSize : IEquatable<PixelSize>
View Source
InheritanceObjectValueType → PixelSize
ImplementsIEquatable(PixelSize)

Constructors

PixelSize(Int32, Int32)Initializes a new instance of the PixelSize structure.

Properties

AspectRatioGets the aspect ratio of the size.
HeightGets the height.
WidthGets the width.

Methods

Equals(Object)Checks for equality between a size and an object.
(Overrides ValueType.Equals(Object))
Equals(PixelSize)Returns a boolean indicating whether the size is equal to the other given size.
FromSize(Size, Vector)Converts a Size to device pixels using the specified scaling factor.
FromSize(Size, Double)Converts a Size to device pixels using the specified scaling factor.
FromSizeWithDpi(Size, Vector)Converts a Size to device pixels using the specified dots per inch (DPI).
FromSizeWithDpi(Size, Double)Converts a Size to device pixels using the specified dots per inch (DPI).
GetHashCode()Returns a hash code for a PixelSize.
(Overrides ValueType.GetHashCode())
GetType()Gets the Type of the current instance.
(Inherited from Object)
Parse(String)Parses a PixelSize string.
ToSize(Double)Converts the PixelSize to a device-independent Size using the specified scaling factor.
ToSize(Vector)Converts the PixelSize to a device-independent Size using the specified scaling factor.
ToSizeWithDpi(Double)Converts the PixelSize to a device-independent Size using the specified dots per inch (DPI).
ToSizeWithDpi(Vector)Converts the PixelSize to a device-independent Size using the specified dots per inch (DPI).
ToString()Returns the string representation of the size.
(Overrides ValueType.ToString())
TryParse(String, PixelSize)Try parsing source as PixelSize.
WithHeight(Int32)Returns a new PixelSize with the same width and the specified height.
WithWidth(Int32)Returns a new PixelSize with the same height and the specified width.

Operators

Equality(PixelSize, PixelSize)Checks for equality between two PixelSizes.
Inequality(PixelSize, PixelSize)Checks for inequality between two Sizes.

Fields

EmptyA size representing zero

See Also

Reference

Avalonia Namespace