Class AspectRatio
Represents the aspect ratio expressed as the ratio between the width and height of an image.
Inheritance
Namespace: Telerik.XamarinForms.ImageEditor
Assembly: Telerik.XamarinForms.ImageEditor.dll
Syntax
public sealed class AspectRatio : ValueType, IEquatable<AspectRatio>
Constructors
AspectRatio(Double, Double)
Initializes a new instance of an aspect ratio with the specified components.
Declaration
public AspectRatio(double width, double height)
Parameters
|
System.Double
width
Specifies the width component of the aspect ratio. |
|
System.Double
height
Specifies the height component of the aspect ratio. |
Fields
Free
Special value, indicating the aspect ratio should not be constrained.
Declaration
public static readonly AspectRatio Free
Field Value
|
AspectRatio
|
Original
Special value, indicating the aspect ratio should match the original image.
Declaration
public static readonly AspectRatio Original
Field Value
|
AspectRatio
|
Square
Special value, indicating the width and height of the image should be equal.
Declaration
public static readonly AspectRatio Square
Field Value
|
AspectRatio
|
Methods
Equals(Object)
Compares the current aspect ratio with the specified object for equality.
Declaration
public override bool Equals(object value)
Parameters
|
System.Object
value
Specifies the object value for comparison. |
Returns
|
System.Boolean
True, if the two objects are equal, false otherwise. |
Equals(AspectRatio)
Compares the current aspect ratio with the specified one for equality.
Declaration
public bool Equals(AspectRatio aspectRatio)
Parameters
|
AspectRatio
aspectRatio
Specifies the aspect ratio for comparison. |
Returns
|
System.Boolean
True, if the two aspect ratios are equal, false otherwise. |
GetHashCode()
Computes the hash code of the current aspect ratio.
Declaration
public override int GetHashCode()
Returns
|
System.Int32
|
Parse(String)
Parses the specified string and converts it to an aspect ratio.
Declaration
public static AspectRatio Parse(string text)
Parameters
|
System.String
text
Specifies the input string to parse. |
Returns
|
AspectRatio
The converted aspect ratio on success. |
Exceptions
|
System.FormatException
If the specified string cannot be parsed. |
ToDouble()
Converts the current aspect ratio to its floating-point representation.
Declaration
public double ToDouble()
Returns
|
System.Double
|
ToString()
Converts the current aspect ratio to its string representation.
Declaration
public override string ToString()
Returns
|
System.String
|
TryParse(String, out AspectRatio)
Parses the specified string and converts it to an aspect ratio.
Declaration
public static bool TryParse(string text, out AspectRatio aspectRatio)
Parameters
|
System.String
text
Specifies the input string to parse. |
|
AspectRatio
aspectRatio
Returns the converted aspect ratio on success. |
Returns
|
System.Boolean
True, if the parse operation is successful, false otherwise. |
Operators
Equality(AspectRatio, AspectRatio)
Compares the specified two aspect ratios for equality.
Declaration
public static bool operator ==(AspectRatio leftOperand, AspectRatio rightOperand)
Parameters
|
AspectRatio
leftOperand
Specifies the left operand for the comparison. |
|
AspectRatio
rightOperand
Specifies the right operand for the comparison. |
Returns
|
System.Boolean
True, if the two aspect ratios are equal, false otherwise. |
Explicit(AspectRatio to Double)
Converts the specified aspect ratio to its floating-point representation.
Declaration
public static explicit operator double (AspectRatio aspectRatio)
Parameters
|
AspectRatio
aspectRatio
Specifies the aspect ratio to convert. |
Returns
|
System.Double
|
Inequality(AspectRatio, AspectRatio)
Compares the specified two aspect ratios for inequality.
Declaration
public static bool operator !=(AspectRatio leftOperand, AspectRatio rightOperand)
Parameters
|
AspectRatio
leftOperand
Specifies the left operand for the comparison. |
|
AspectRatio
rightOperand
Specifies the right operand for the comparison. |
Returns
|
System.Boolean
True, if the two aspect ratios are not equal, false otherwise. |