Struct AspectRatio
Represents the 'preserveAspectRatio' attribute value in SVG. Encapsulates the alignment and meet-or-slice settings.
Implements
Inherited Members
Namespace: OpenSvg.Attributes
Assembly: OpenSvg.dll
Syntax
public readonly record struct AspectRatio : IEquatable<AspectRatio>
Constructors
| Edit this page View SourceAspectRatio(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 SourceAlign
Specifies the alignment setting for the SVG content within its viewport.
Declaration
public AspectRatioAlign Align { get; init; }
Property Value
| Type | Description |
|---|---|
| AspectRatioAlign |
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 SourceFromXmlString(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. |
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()
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. |