Struct
AspectRatio

Represents the aspect ratio expressed as the ratio between the width and height of an image.

Definition

Namespace:Telerik.Maui.Controls.ImageEditor

Assembly:Telerik.Maui.Controls.dll

Syntax:

cs-api-definition
[TypeConverter(typeof(AspectRatioConverter))]
public struct AspectRatio : IEquatable<AspectRatio>

Implements: IEquatable<AspectRatio>

Constructors

AspectRatio(double, double)

Initializes a new instance of an aspect ratio with the specified components.

Declaration

cs-api-definition
public AspectRatio(double width, double height)

Parameters

width

double

Specifies the width component of the aspect ratio.

height

double

Specifies the height component of the aspect ratio.

Fields

Free

Special value, indicating the aspect ratio should not be constrained.

Declaration

cs-api-definition
public static readonly AspectRatio Free

Field Value

AspectRatio

Original

Special value, indicating the aspect ratio should match the original image.

Declaration

cs-api-definition
public static readonly AspectRatio Original

Field Value

AspectRatio

Square

Special value, indicating the width and height of the image should be equal.

Declaration

cs-api-definition
public static readonly AspectRatio Square

Field Value

AspectRatio

Methods

Equals(AspectRatio)

Compares the current aspect ratio with the specified one for equality.

Declaration

cs-api-definition
public bool Equals(AspectRatio aspectRatio)

Parameters

aspectRatio

AspectRatio

Specifies the aspect ratio for comparison.

Returns

bool

True, if the two aspect ratios are equal, false otherwise.

Implements IEquatable<AspectRatio>.Equals(AspectRatio)

Equals(object)

Compares the current aspect ratio with the specified object for equality.

Declaration

cs-api-definition
public override bool Equals(object value)

Parameters

value

object

Specifies the object value for comparison.

Returns

bool

True, if the two objects are equal, false otherwise.

Overrides ValueType.Equals(object)

GetHashCode()

Computes the hash code of the current aspect ratio.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

Overrides ValueType.GetHashCode()

Parse(string)

Parses the specified string and converts it to an aspect ratio.

Declaration

cs-api-definition
public static AspectRatio Parse(string text)

Parameters

text

string

Specifies the input string to parse.

Returns

AspectRatio

The converted aspect ratio on success.

Exceptions

FormatException

If the specified string cannot be parsed.

ToDouble()

Converts the current aspect ratio to its floating-point representation.

Declaration

cs-api-definition
public double ToDouble()

Returns

double

ToString()

Converts the current aspect ratio to its string representation.

Declaration

cs-api-definition
public override string ToString()

Returns

string

Overrides ValueType.ToString()

TryParse(string, out AspectRatio)

Parses the specified string and converts it to an aspect ratio.

Declaration

cs-api-definition
public static bool TryParse(string text, out AspectRatio aspectRatio)

Parameters

text

string

Specifies the input string to parse.

aspectRatio

AspectRatio

Returns the converted aspect ratio on success.

Returns

bool

True, if the parse operation is successful, false otherwise.

Operators

explicit operator double(AspectRatio)

Converts the specified aspect ratio to its floating-point representation.

Declaration

cs-api-definition
public static explicit operator double(AspectRatio aspectRatio)

Parameters

aspectRatio

AspectRatio

Specifies the aspect ratio to convert.

Returns

double

operator !=(AspectRatio, AspectRatio)

Compares the specified two aspect ratios for inequality.

Declaration

cs-api-definition
public static bool operator !=(AspectRatio leftOperand, AspectRatio rightOperand)

Parameters

leftOperand

AspectRatio

Specifies the left operand for the comparison.

rightOperand

AspectRatio

Specifies the right operand for the comparison.

Returns

bool

True, if the two aspect ratios are not equal, false otherwise.

operator ==(AspectRatio, AspectRatio)

Compares the specified two aspect ratios for equality.

Declaration

cs-api-definition
public static bool operator ==(AspectRatio leftOperand, AspectRatio rightOperand)

Parameters

leftOperand

AspectRatio

Specifies the left operand for the comparison.

rightOperand

AspectRatio

Specifies the right operand for the comparison.

Returns

bool

True, if the two aspect ratios are equal, false otherwise.