Table of Contents

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

type SvgUnitType

The type.

value float

The value.

SvgUnit(float)

Initializes a new instance of the SvgUnit struct.

public SvgUnit(float value)

Parameters

value float

The value.

Fields

Empty

Gets and empty SvgUnit.

public static readonly SvgUnit Empty

Field Value

SvgUnit

None

Gets an SvgUnit with a value of none.

public static readonly SvgUnit None

Field Value

SvgUnit

Properties

IsEmpty

Gets a value to determine whether the unit is empty.

public bool IsEmpty { get; }

Property Value

bool

IsNone

Gets whether this unit is none.

public bool IsNone { get; }

Property Value

bool

Type

Gets the SvgUnitType of unit.

public SvgUnitType Type { get; }

Property Value

SvgUnitType

Value

Gets the value of the unit.

public float Value { get; }

Property Value

float

Methods

Equals(SvgUnit)

public bool Equals(SvgUnit other)

Parameters

other SvgUnit

Returns

bool

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

x SvgUnit
y SvgUnit
renderer ISvgRenderer
owner SvgElement

Returns

PointF

GetDevicePointOffset(SvgUnit, SvgUnit, ISvgRenderer, SvgElement)

public static PointF GetDevicePointOffset(SvgUnit x, SvgUnit y, ISvgRenderer renderer, SvgElement owner)

Parameters

x SvgUnit
y SvgUnit
renderer ISvgRenderer
owner SvgElement

Returns

PointF

GetDeviceSize(SvgUnit, SvgUnit, ISvgRenderer, SvgElement)

public static SizeF GetDeviceSize(SvgUnit width, SvgUnit height, ISvgRenderer renderer, SvgElement owner)

Parameters

width SvgUnit
height SvgUnit
renderer ISvgRenderer
owner SvgElement

Returns

SizeF

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

renderer ISvgRenderer
renderType UnitRenderingType
owner SvgElement

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

lhs SvgUnit
rhs SvgUnit

Returns

bool

implicit operator float(SvgUnit)

Performs an implicit conversion from SvgUnit to float.

public static implicit operator float(SvgUnit value)

Parameters

value SvgUnit

The value.

Returns

float

The result of the conversion.

implicit operator SvgUnit(float)

Performs an implicit conversion from float to SvgUnit.

public static implicit operator SvgUnit(float value)

Parameters

value float

The value.

Returns

SvgUnit

The result of the conversion.

operator !=(SvgUnit, SvgUnit)

public static bool operator !=(SvgUnit lhs, SvgUnit rhs)

Parameters

lhs SvgUnit
rhs SvgUnit

Returns

bool