SvgLength Class

https://svgwg.org/svg2-draft/types.html#InterfaceSVGLength

public sealed class SvgLength

Properties

NameDescription
UnitTypeGets the type of the unit of the length, one of the SVG_LENGTHTYPE_* constants.
Valuehttps://svgwg.org/svg2-draft/types.html#__svg__SVGLength__value
ValueAsStringGets or sets the serialized length, e.g. 10px; setting an invalid length throws a SyntaxError.
ValueInSpecifiedUnitsGets or sets the value of the length in its own unit.

UnitType

SvgValues.cs

Gets the type of the unit of the length, one of the SVG_LENGTHTYPE_* constants.

public ushort UnitType { get; }

https://svgwg.org/svg2-draft/types.html#__svg__SVGLength__value

public float Value { get; set; }

ValueAsString

SvgValues.cs

Gets or sets the serialized length, e.g. 10px; setting an invalid length throws a SyntaxError.

public string ValueAsString { get; set; }

ValueInSpecifiedUnits

SvgValues.cs

Gets or sets the value of the length in its own unit.

public float ValueInSpecifiedUnits { get; set; }

Methods

NameDescription
ConvertToSpecifiedUnits(ushort)https://svgwg.org/svg2-draft/types.html#__svg__SVGLength__convertToSpecifiedUnits
NewValueSpecifiedUnits(ushort, float)https://svgwg.org/svg2-draft/types.html#__svg__SVGLength__newValueSpecifiedUnits

ConvertToSpecifiedUnits(ushort)

SvgValues.cs

https://svgwg.org/svg2-draft/types.html#__svg__SVGLength__convertToSpecifiedUnits

public void ConvertToSpecifiedUnits(ushort unitType)

NewValueSpecifiedUnits(ushort, float)

SvgValues.cs

https://svgwg.org/svg2-draft/types.html#__svg__SVGLength__newValueSpecifiedUnits

public void NewValueSpecifiedUnits(ushort unitType, float valueInSpecifiedUnits)

Constants

NameDescription
SvgLengthTypeCmA length in cm.
SvgLengthTypeEmsA length in em.
SvgLengthTypeExsA length in ex.
SvgLengthTypeInA length in in.
SvgLengthTypeMmA length in mm.
SvgLengthTypeNumberA number without unit, in user units.
SvgLengthTypePcA length in pc.
SvgLengthTypePercentageA percentage.
SvgLengthTypePtA length in pt.
SvgLengthTypePxA length in px.
SvgLengthTypeUnknownThe unit is not one of the predefined units.

SvgLengthTypeCm

SvgLengthTypeEms

SvgLengthTypeExs

SvgLengthTypeIn

SvgLengthTypeMm

SvgLengthTypeNumber

A number without unit, in user units.

public const ushort SvgLengthTypeNumber = 1

SvgLengthTypePc

SvgLengthTypePercentage

SvgLengthTypePt

SvgLengthTypePx

SvgLengthTypeUnknown

The unit is not one of the predefined units.

public const ushort SvgLengthTypeUnknown = 0