Struct AbsoluteOrRatio
Represents a value that can be either an absolute value or a ratio.
Implements
Inherited Members
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public readonly struct AbsoluteOrRatio : IEquatable<AbsoluteOrRatio>
Constructors
| Edit this page View SourceAbsoluteOrRatio(float, bool)
Initializes a new instance of the AbsoluteOrRatio struct.
Declaration
public AbsoluteOrRatio(float value, bool isAbsolute)
Parameters
Type | Name | Description |
---|---|---|
float | value | The value of the AbsoluteOrRatio. |
bool | isAbsolute | Indicates whether the value is absolute or a ratio. |
Fields
| Edit this page View SourceIsAbsolute
Indicates whether the value is absolute or a ratio.
Declaration
public readonly bool IsAbsolute
Field Value
Type | Description |
---|---|
bool |
Value
The value of the AbsoluteOrRatio.
Declaration
public readonly float Value
Field Value
Type | Description |
---|---|
float |
Methods
| Edit this page View SourceAbsolute(float)
Creates a new AbsoluteOrRatio with an absolute value.
Declaration
public static AbsoluteOrRatio Absolute(float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | The absolute value. |
Returns
Type | Description |
---|---|
AbsoluteOrRatio | A new AbsoluteOrRatio with an absolute value. |
Equals(AbsoluteOrRatio)
Determines whether the specified AbsoluteOrRatio is equal to the current AbsoluteOrRatio.
Declaration
public bool Equals(AbsoluteOrRatio other)
Parameters
Type | Name | Description |
---|---|---|
AbsoluteOrRatio | other | The AbsoluteOrRatio to compare with the current AbsoluteOrRatio. |
Returns
Type | Description |
---|---|
bool | true if the specified AbsoluteOrRatio is equal to the current AbsoluteOrRatio; otherwise, false. |
Equals(object?)
Determines whether the specified object is equal to the current AbsoluteOrRatio.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current AbsoluteOrRatio. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current AbsoluteOrRatio; otherwise, false. |
Overrides
| Edit this page View SourceFromXmlString(string)
Declaration
public static AbsoluteOrRatio FromXmlString(string xmlString)
Parameters
Type | Name | Description |
---|---|---|
string | xmlString |
Returns
Type | Description |
---|---|
AbsoluteOrRatio |
GetHashCode()
Returns a hash code for the current AbsoluteOrRatio.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current AbsoluteOrRatio. |
Overrides
| Edit this page View SourceRatio(float)
Creates a new AbsoluteOrRatio with a ratio value.
Declaration
public static AbsoluteOrRatio Ratio(float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | The ratio value. |
Returns
Type | Description |
---|---|
AbsoluteOrRatio | A new AbsoluteOrRatio with a ratio value. |
Resolve(Func<float>)
Resolves the value of the AbsoluteOrRatio.
Declaration
public float Resolve(Func<float> GetReferenceValue)
Parameters
Type | Name | Description |
---|---|---|
Func<float> | GetReferenceValue | A function that returns the reference value for resolving the abolute value. |
Returns
Type | Description |
---|---|
float | The resolved value of the AbsoluteOrRatio. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
| Edit this page View SourceToXmlString()
Returns an XML string representation for the object.
Declaration
public string ToXmlString()
Returns
Type | Description |
---|---|
string | A string representing the object in XML format. |
Operators
| Edit this page View Sourceoperator ==(AbsoluteOrRatio, AbsoluteOrRatio)
Determines whether two AbsoluteOrRatio objects are equal.
Declaration
public static bool operator ==(AbsoluteOrRatio left, AbsoluteOrRatio right)
Parameters
Type | Name | Description |
---|---|---|
AbsoluteOrRatio | left | The first AbsoluteOrRatio to compare. |
AbsoluteOrRatio | right | The second AbsoluteOrRatio to compare. |
Returns
Type | Description |
---|---|
bool | true if the two AbsoluteOrRatio objects are equal; otherwise, false. |
implicit operator AbsoluteOrRatio(float)
Implicitly converts a float to an AbsoluteOrRatio with an absolute value.
Declaration
public static implicit operator AbsoluteOrRatio(float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | The absolute value. |
Returns
Type | Description |
---|---|
AbsoluteOrRatio | An AbsoluteOrRatio with an absolute value. |
operator !=(AbsoluteOrRatio, AbsoluteOrRatio)
Determines whether two AbsoluteOrRatio objects are not equal.
Declaration
public static bool operator !=(AbsoluteOrRatio left, AbsoluteOrRatio right)
Parameters
Type | Name | Description |
---|---|---|
AbsoluteOrRatio | left | The first AbsoluteOrRatio to compare. |
AbsoluteOrRatio | right | The second AbsoluteOrRatio to compare. |
Returns
Type | Description |
---|---|
bool | true if the two AbsoluteOrRatio objects are not equal; otherwise, false. |