PixelSize Struct
Definition
Represents a size in device pixels.
public struct PixelSize
Constructors
| Name | Description |
|---|---|
| PixelSize | Initializes a new instance of the Avalonia.PixelSize structure. |
PixelSize Constructor
Initializes a new instance of the Avalonia.PixelSize structure.
public PixelSize(int width, int height)
Parameters
width int
The width.
height int
The height.
Methods
| Name | Description |
|---|---|
| Equals (2 overloads) | Returns a boolean indicating whether the size is equal to the other given size. |
| FromSize (2 overloads) | Converts a Avalonia.Size to device pixels using the specified scaling factor. |
| FromSizeWithDpi (2 overloads) | Converts a Avalonia.Size to device pixels using the specified dots per inch (DPI). |
| GetHashCode | Returns a hash code for a Avalonia.PixelSize. |
| Parse | Parses a Avalonia.PixelSize string. |
| ToSize (2 overloads) | Converts the Avalonia.PixelSize to a device-independent Avalonia.Size using the specified scaling factor. |
| ToSizeWithDpi (2 overloads) | Converts the Avalonia.PixelSize to a device-independent Avalonia.Size using the specified dots per inch (DPI). |
| ToString | Returns the string representation of the size. |
| TryParse | No summary available. |
| WithHeight | Returns a new Avalonia.PixelSize with the same width and the specified height. |
| WithWidth | Returns a new Avalonia.PixelSize with the same height and the specified width. |
Equals overloads
Equals Method
Returns a boolean indicating whether the size is equal to the other given size.
public bool Equals(Avalonia.PixelSize other)
Parameters
other Avalonia.PixelSize
The other size to test equality against.
Returns
bool
True if this size is equal to other; False otherwise.
Equals Method
Checks for equality between a size and an object.
public bool Equals(object obj)
Parameters
obj object
The object.
Returns
bool
True if obj is a size that equals the current size.
FromSize overloads
FromSize Method
Converts a Avalonia.Size to device pixels using the specified scaling factor.
public Avalonia.PixelSize FromSize(Avalonia.Size size, Avalonia.Vector scale)
Parameters
size Avalonia.Size
The size.
scale Avalonia.Vector
The scaling factor.
Returns
The device-independent size.
FromSize Method
Converts a Avalonia.Size to device pixels using the specified scaling factor.
public Avalonia.PixelSize FromSize(Avalonia.Size size, double scale)
Parameters
size Avalonia.Size
The size.
scale double
The scaling factor.
Returns
The device-independent size.
FromSizeWithDpi overloads
FromSizeWithDpi Method
Converts a Avalonia.Size to device pixels using the specified dots per inch (DPI).
public Avalonia.PixelSize FromSizeWithDpi(Avalonia.Size size, Avalonia.Vector dpi)
Parameters
size Avalonia.Size
The size.
dpi Avalonia.Vector
The dots per inch.
Returns
The device-independent size.
FromSizeWithDpi Method
Converts a Avalonia.Size to device pixels using the specified dots per inch (DPI).
public Avalonia.PixelSize FromSizeWithDpi(Avalonia.Size size, double dpi)
Parameters
size Avalonia.Size
The size.
dpi double
The dots per inch.
Returns
The device-independent size.
GetHashCode Method
Returns a hash code for a Avalonia.PixelSize.
public int GetHashCode()
Returns
int
The hash code.
Parse Method
Parses a Avalonia.PixelSize string.
public Avalonia.PixelSize Parse(string s)
Parameters
s string
The string.
Returns
The Avalonia.PixelSize.
Exceptions
ToSize overloads
ToSize Method
Converts the Avalonia.PixelSize to a device-independent Avalonia.Size using the specified scaling factor.
public Avalonia.Size ToSize(Avalonia.Vector scale)
Parameters
scale Avalonia.Vector
The scaling factor.
Returns
The device-independent size.
ToSize Method
Converts the Avalonia.PixelSize to a device-independent Avalonia.Size using the specified scaling factor.
public Avalonia.Size ToSize(double scale)
Parameters
scale double
The scaling factor.
Returns
The device-independent size.
ToSizeWithDpi overloads
ToSizeWithDpi Method
Converts the Avalonia.PixelSize to a device-independent Avalonia.Size using the specified dots per inch (DPI).
public Avalonia.Size ToSizeWithDpi(Avalonia.Vector dpi)
Parameters
dpi Avalonia.Vector
The dots per inch.
Returns
The device-independent size.
ToSizeWithDpi Method
Converts the Avalonia.PixelSize to a device-independent Avalonia.Size using the specified dots per inch (DPI).
public Avalonia.Size ToSizeWithDpi(double dpi)
Parameters
dpi double
The dots per inch.
Returns
The device-independent size.
ToString Method
Returns the string representation of the size.
public string ToString()
Returns
string
The string representation of the size.
TryParse Method
public bool TryParse(string source, Avalonia.PixelSize& result)
Parameters
source string
result Avalonia.PixelSize&
Returns
bool
WithHeight Method
Returns a new Avalonia.PixelSize with the same width and the specified height.
public Avalonia.PixelSize WithHeight(int height)
Parameters
height int
The height.
Returns
The new Avalonia.PixelSize.
WithWidth Method
Returns a new Avalonia.PixelSize with the same height and the specified width.
public Avalonia.PixelSize WithWidth(int width)
Parameters
width int
The width.
Returns
The new Avalonia.PixelSize.
Properties
| Name | Description |
|---|---|
| AspectRatio | Gets the aspect ratio of the size. |
| Height | Gets the height. |
| Width | Gets the width. |
AspectRatio Property
Gets the aspect ratio of the size.
public double AspectRatio { get; set; }
Height Property
Gets the height.
public int Height { get; set; }
Width Property
Gets the width.
public int Width { get; set; }
Fields
| Name | Description |
|---|---|
| Empty | A size representing zero |
Empty Field
A size representing zero
public Avalonia.PixelSize Empty