Class RectangleConfig
Defining attributes of a rectangle in SVG The rectangle can be rendered either as a 'polygon' or a high-level 'rect' in SVG.
Implements
Inherited Members
Namespace: OpenSvg.Config
Assembly: OpenSvg.dll
Syntax
public record RectangleConfig : IEquatable<RectangleConfig>
Remarks
When converting to GeoJSON rectangles must be drwawn as SvgPolygon
Constructors
| Edit this page View SourceRectangleConfig(Size, DrawConfig, int, float)
Defining attributes of a rectangle in SVG The rectangle can be rendered either as a 'polygon' or a high-level 'rect' in SVG.
Declaration
public RectangleConfig(Size Size, DrawConfig DrawConfig, int NumberOfCornerPoints = 10, float CornerRadius = 0)
Parameters
Type | Name | Description |
---|---|---|
Size | Size | Size of the rectangle |
DrawConfig | DrawConfig | Styling options for the rectangle |
int | NumberOfCornerPoints | Number of points used to approximate curved corners, when the rectangle is drawn as a polygon |
float | CornerRadius | Defines the circle radius of the corners. If CornerRadius=0 there will be no rounding corners, but just normal square corners |
Remarks
When converting to GeoJSON rectangles must be drwawn as SvgPolygon
Properties
| Edit this page View SourceCornerRadius
Defines the circle radius of the corners. If CornerRadius=0 there will be no rounding corners, but just normal square corners
Declaration
public float CornerRadius { get; init; }
Property Value
Type | Description |
---|---|
float |
DrawConfig
Styling options for the rectangle
Declaration
public DrawConfig DrawConfig { get; init; }
Property Value
Type | Description |
---|---|
DrawConfig |
NumberOfCornerPoints
Number of points used to approximate curved corners, when the rectangle is drawn as a polygon
Declaration
public int NumberOfCornerPoints { get; init; }
Property Value
Type | Description |
---|---|
int |
Size
Size of the rectangle
Declaration
public Size Size { get; init; }
Property Value
Type | Description |
---|---|
Size |
Methods
| Edit this page View SourceToPolygon()
Creates a polygon from the rectangle config
Declaration
public Polygon ToPolygon()
Returns
Type | Description |
---|---|
Polygon |
ToSvgPolygon()
Creates a SvgPolygon element from this RectangleConfig"/>
Declaration
public SvgPolygon ToSvgPolygon()
Returns
Type | Description |
---|---|
SvgPolygon |
ToSvgRect()
Convert to SVG Rectangle object
Declaration
public SvgRectangleAsRect ToSvgRect()
Returns
Type | Description |
---|---|
SvgRectangleAsRect |
Transparent(Size)
Gets a transparent RectangleConfig instance. This is useful for creating invisible spaces between shapes.
Declaration
public static RectangleConfig Transparent(Size size)
Parameters
Type | Name | Description |
---|---|---|
Size | size | Size of the rectangle. |
Returns
Type | Description |
---|---|
RectangleConfig | A new instance of the RectangleConfig with transparent DrawConfig. |
WithFillColor(SKColor)
Returns a new copy of the RectangleConfig record with the specified fill color.
Declaration
public RectangleConfig WithFillColor(SKColor fillColor)
Parameters
Type | Name | Description |
---|---|---|
SKColor | fillColor | The new fill color to set. |
Returns
Type | Description |
---|---|
RectangleConfig | A new RectangleConfig with the specified fill color. |
WithStrokeColor(SKColor)
Returns a new copy of the RectangleConfig record with the specified stroke color.
Declaration
public RectangleConfig WithStrokeColor(SKColor strokeColor)
Parameters
Type | Name | Description |
---|---|---|
SKColor | strokeColor | The new stroke color to set. |
Returns
Type | Description |
---|---|
RectangleConfig | A new RectangleConfig with the specified stroke color. |