Back to top OpenSVG (c) Veridict AB, www.veridict.com
Edit this page

Struct AspectRatio

Represents the 'preserveAspectRatio' attribute value in SVG. Encapsulates the alignment and meet-or-slice settings.

Implements
IEquatable<AspectRatio>
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenSvg.Attributes
Assembly: OpenSvg.dll
Syntax
public readonly record struct AspectRatio : IEquatable<AspectRatio>

Constructors

| Edit this page View Source

AspectRatio(AspectRatioAlign, AspectRatioMeetOrSlice)

Represents the 'preserveAspectRatio' attribute value in SVG. Encapsulates the alignment and meet-or-slice settings.

Declaration
public AspectRatio(AspectRatioAlign Align = AspectRatioAlign.None, AspectRatioMeetOrSlice MeetOrSlice = AspectRatioMeetOrSlice.Meet)
Parameters
Type Name Description
AspectRatioAlign Align

Specifies the alignment setting for the SVG content within its viewport.

AspectRatioMeetOrSlice MeetOrSlice

Specifies whether the SVG content should meet or slice the boundaries of its viewport.

Properties

| Edit this page View Source

Align

Specifies the alignment setting for the SVG content within its viewport.

Declaration
public AspectRatioAlign Align { get; init; }
Property Value
Type Description
AspectRatioAlign
| Edit this page View Source

MeetOrSlice

Specifies whether the SVG content should meet or slice the boundaries of its viewport.

Declaration
public AspectRatioMeetOrSlice MeetOrSlice { get; init; }
Property Value
Type Description
AspectRatioMeetOrSlice

Methods

| Edit this page View Source

FromXmlString(string)

Creates an AspectRatio object from an SVG attribute string.

Declaration
public static AspectRatio FromXmlString(string xmlString)
Parameters
Type Name Description
string xmlString

The SVG attribute string to parse.

Returns
Type Description
AspectRatio

An AspectRatio object represented by the XML string.

Exceptions
Type Condition
ArgumentException

Thrown if the XML string is not in a valid format.

| Edit this page View Source

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
ValueType.ToString()
| Edit this page View Source

ToXmlString()

Converts the AspectRatio to its equivalent SVG attribute string value.

Declaration
public string ToXmlString()
Returns
Type Description
string

A string representing the 'preserveAspectRatio' attribute value in the format required by SVG.

Implements

IEquatable<T>