Struct SvgUnit
- Namespace
- Svg
- Assembly
- Svg.dll
Represents a unit in an Scalable Vector Graphics document.
[TypeConverter(typeof(SvgUnitConverter))]
public struct SvgUnit
- Inherited Members
Constructors
SvgUnit(SvgUnitType, float)
Initializes a new instance of the SvgUnit struct.
public SvgUnit(SvgUnitType type, float value)
Parameters
typeSvgUnitTypeThe type.
valuefloatThe value.
SvgUnit(float)
Initializes a new instance of the SvgUnit struct.
public SvgUnit(float value)
Parameters
valuefloatThe value.
Fields
Empty
Gets and empty SvgUnit.
public static readonly SvgUnit Empty
Field Value
None
Gets an SvgUnit with a value of none.
public static readonly SvgUnit None
Field Value
Properties
IsEmpty
Gets a value to determine whether the unit is empty.
public bool IsEmpty { get; }
Property Value
IsNone
Gets whether this unit is none.
public bool IsNone { get; }
Property Value
Type
Gets the SvgUnitType of unit.
public SvgUnitType Type { get; }
Property Value
Value
Gets the value of the unit.
public float Value { get; }
Property Value
Methods
Equals(SvgUnit)
public bool Equals(SvgUnit other)
Parameters
otherSvgUnit
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetDevicePoint(SvgUnit, SvgUnit, ISvgRenderer, SvgElement)
public static PointF GetDevicePoint(SvgUnit x, SvgUnit y, ISvgRenderer renderer, SvgElement owner)
Parameters
xSvgUnitySvgUnitrendererISvgRendererownerSvgElement
Returns
GetDevicePointOffset(SvgUnit, SvgUnit, ISvgRenderer, SvgElement)
public static PointF GetDevicePointOffset(SvgUnit x, SvgUnit y, ISvgRenderer renderer, SvgElement owner)
Parameters
xSvgUnitySvgUnitrendererISvgRendererownerSvgElement
Returns
GetDeviceSize(SvgUnit, SvgUnit, ISvgRenderer, SvgElement)
public static SizeF GetDeviceSize(SvgUnit width, SvgUnit height, ISvgRenderer renderer, SvgElement owner)
Parameters
widthSvgUnitheightSvgUnitrendererISvgRendererownerSvgElement
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToDeviceValue(ISvgRenderer, UnitRenderingType, SvgElement)
Converts the current unit to one that can be used at render time.
public float ToDeviceValue(ISvgRenderer renderer, UnitRenderingType renderType, SvgElement owner)
Parameters
rendererISvgRendererrenderTypeUnitRenderingTypeownerSvgElement
Returns
- float
The representation of the current unit in a device value (usually pixels).
ToPercentage()
Converts the current unit to a percentage, if applicable.
public SvgUnit ToPercentage()
Returns
- SvgUnit
An SvgUnit of type Percentage.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator ==(SvgUnit, SvgUnit)
public static bool operator ==(SvgUnit lhs, SvgUnit rhs)
Parameters
Returns
implicit operator float(SvgUnit)
public static implicit operator float(SvgUnit value)
Parameters
valueSvgUnitThe value.
Returns
- float
The result of the conversion.
implicit operator SvgUnit(float)
public static implicit operator SvgUnit(float value)
Parameters
valuefloatThe value.
Returns
- SvgUnit
The result of the conversion.
operator !=(SvgUnit, SvgUnit)
public static bool operator !=(SvgUnit lhs, SvgUnit rhs)