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
topLeftPointFThe PointF which specifies the rectangle's top-left point in a two-dimensional plane.
bottomRightPointFThe 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
pointPointFThe PointF which specifies the rectangle's point in a two-dimensional plane.
sizeSizeFThe SizeF which specifies the rectangle's height and width.
RectanglePolygon(RectangleF)
Initializes a new instance of the RectanglePolygon class.
public RectanglePolygon(RectangleF rectangle)
Parameters
rectangleRectangleFThe 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
xfloatThe horizontal position of the rectangle.
yfloatThe vertical position of the rectangle.
widthfloatThe width of the rectangle.
heightfloatThe height of the rectangle.
Properties
Bottom
Gets the y-coordinate of the bottom edge.
public float Bottom { get; }
Property Value
Bounds
Gets the bounds enclosing the path.
public RectangleF Bounds { get; }
Property Value
Center
Gets the center point.
public PointF Center { get; }
Property Value
Height
Gets the height.
public float Height { get; }
Property Value
IsClosed
Gets a value indicating whether this instance is a closed path.
public bool IsClosed { get; }
Property Value
Left
Gets the x-coordinate of the left edge.
public float Left { get; }
Property Value
Location
Gets the location.
public PointF Location { get; }
Property Value
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
Points
Gets the points that make this up as a simple linear path.
public ReadOnlyMemory<PointF> Points { get; }
Property Value
Right
Gets the x-coordinate of the right edge.
public float Right { get; }
Property Value
Size
Gets the size.
public SizeF Size { get; }
Property Value
Top
Gets the y-coordinate of the top edge.
public float Top { get; }
Property Value
Width
Gets the width.
public float Width { get; }
Property Value
X
Gets the x-coordinate.
public float X { get; }
Property Value
Y
Gets the y-coordinate.
public float Y { get; }
Property Value
Methods
AsClosedPath()
Returns this path with all figures closed.
public IPath AsClosedPath()
Returns
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
scaleVector2The 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
matrixMatrix4x4The 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
polygonPolygonThe polygon to convert.