Table of Contents

Class RectanglePolygon

Namespace
SixLabors.ImageSharp.Drawing
Assembly
SixLabors.ImageSharp.Drawing.dll

A closed rectangular path defined by four straight edges.

public sealed class RectanglePolygon : ISimplePath, IPath
Inheritance
RectanglePolygon
Implements
Inherited Members
Extension Methods

Constructors

RectanglePolygon(PointF, PointF)

Initializes a new instance of the RectanglePolygon class.

public RectanglePolygon(PointF topLeft, PointF bottomRight)

Parameters

topLeft PointF

The PointF which specifies the rectangle's top-left point in a two-dimensional plane.

bottomRight PointF

The PointF which specifies the rectangle's bottom-right point in a two-dimensional plane.

RectanglePolygon(PointF, SizeF)

Initializes a new instance of the RectanglePolygon class.

public RectanglePolygon(PointF point, SizeF size)

Parameters

point PointF

The PointF which specifies the rectangle's point in a two-dimensional plane.

size SizeF

The SizeF which specifies the rectangle's height and width.

RectanglePolygon(RectangleF)

Initializes a new instance of the RectanglePolygon class.

public RectanglePolygon(RectangleF rectangle)

Parameters

rectangle RectangleF

The rectangle.

RectanglePolygon(float, float, float, float)

Initializes a new instance of the RectanglePolygon class.

public RectanglePolygon(float x, float y, float width, float height)

Parameters

x float

The horizontal position of the rectangle.

y float

The vertical position of the rectangle.

width float

The width of the rectangle.

height float

The height of the rectangle.

Properties

Bottom

Gets the y-coordinate of the bottom edge.

public float Bottom { get; }

Property Value

float

Bounds

Gets the bounds enclosing the path.

public RectangleF Bounds { get; }

Property Value

RectangleF

Center

Gets the center point.

public PointF Center { get; }

Property Value

PointF

Height

Gets the height.

public float Height { get; }

Property Value

float

IsClosed

Gets a value indicating whether this instance is a closed path.

public bool IsClosed { get; }

Property Value

bool

Left

Gets the x-coordinate of the left edge.

public float Left { get; }

Property Value

float

Location

Gets the location.

public PointF Location { get; }

Property Value

PointF

PathType

Gets a value indicating whether this instance is closed, open or a composite path with a mixture of open and closed figures.

public PathTypes PathType { get; }

Property Value

PathTypes

Points

Gets the points that make this up as a simple linear path.

public ReadOnlyMemory<PointF> Points { get; }

Property Value

ReadOnlyMemory<PointF>

Right

Gets the x-coordinate of the right edge.

public float Right { get; }

Property Value

float

Size

Gets the size.

public SizeF Size { get; }

Property Value

SizeF

Top

Gets the y-coordinate of the top edge.

public float Top { get; }

Property Value

float

Width

Gets the width.

public float Width { get; }

Property Value

float

X

Gets the x-coordinate.

public float X { get; }

Property Value

float

Y

Gets the y-coordinate.

public float Y { get; }

Property Value

float

Methods

AsClosedPath()

Returns this path with all figures closed.

public IPath AsClosedPath()

Returns

IPath

A new close IPath.

Flatten()

Converts the IPath into a simple linear path.

public IEnumerable<ISimplePath> Flatten()

Returns

IEnumerable<ISimplePath>

Returns the current IPath as simple linear path.

ToLinearGeometry(Vector2)

Converts this path into a retained LinearGeometry, flattening curves at the precision of the supplied device-space scale.

public LinearGeometry ToLinearGeometry(Vector2 scale)

Parameters

scale Vector2

The X/Y scale at which curves are flattened.

Returns

LinearGeometry

The retained linear geometry.

Transform(Matrix4x4)

Transforms the path using the specified matrix.

public IPath Transform(Matrix4x4 matrix)

Parameters

matrix Matrix4x4

The matrix.

Returns

IPath

A new path with the matrix applied to it.

Operators

explicit operator RectanglePolygon(Polygon)

Converts a polygon to a rectangle polygon from its bounds.

public static explicit operator RectanglePolygon(Polygon polygon)

Parameters

polygon Polygon

The polygon to convert.

Returns

RectanglePolygon