Class ShapesExtensions
- Namespace
- Icy.Rendering
- Assembly
- IcyUI.dll
Provides extension methods for shapes drawing.
public static class ShapesExtensions
- Inheritance
-
ShapesExtensions
- Inherited Members
Methods
DrawArc(IRenderContext, Vector2, float, int, Color, float, float, float)
Draws an arc.
public static void DrawArc(this IRenderContext context, Vector2 center, float radius, int sides, Color color, float startAngle, float endAngle, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
centerVector2Center of an arc.
radiusfloatRadius of the arc.
sidesintCount of sides to make polygons.
colorColorColor of the lines.
startAnglefloatAngle of the arc beginning.
endAnglefloatAngle of the arc ending.
thicknessfloatThickness of arc stroke.
DrawCircle(IRenderContext, Vector2, float, int, Color, float)
Draws a circle.
public static void DrawCircle(this IRenderContext context, Vector2 center, float radius, int sides, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
centerVector2Center of the circle.
radiusfloatRadius of the circle.
sidesintCount of sides to make polygons.
colorColorColor of the circle.
thicknessfloatThickness of circle stroke.
DrawCircle(IRenderContext, float, float, float, int, Color, float)
Draws a circle.
public static void DrawCircle(this IRenderContext context, float x, float y, float radius, int sides, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
xfloatX coordinate of the circle center.
yfloatY coordinate of the circle center.
radiusfloatCircle radius.
sidesintCount of sides to make polygon.
colorColorColor of the circle stroke.
thicknessfloatThickness of the circle stroke.
DrawLine(IRenderContext, Vector2, Vector2, Color, float)
Draws a line between two points.
public static void DrawLine(this IRenderContext context, Vector2 point1, Vector2 point2, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
point1Vector2The first point of the line.
point2Vector2The second point of the line.
colorColorColor to draw line with.
thicknessfloatThickness of the line.
DrawLine(IRenderContext, Vector2, float, float, Vector2, Color, float)
Draws a line.
public static void DrawLine(this IRenderContext context, Vector2 point, float length, float rotation, Vector2 origin, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
pointVector2Point of the line beginning.
lengthfloatLength of the line to draw.
rotationfloatAngle to rotate line.
originVector2Origin of the rotation to apply.
colorColorColor of the line.
thicknessfloatThickness of the line.
DrawLine(IRenderContext, float, float, float, float, Color, float)
Draws a line with specified edge positions.
public static void DrawLine(this IRenderContext context, float x1, float y1, float x2, float y2, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
x1floatX component of the first line edge coordinate.
y1floatY component of the first line edge coordinate.
x2floatX component of the second line edge coordinate.
y2floatY component of the second line edge coordinate.
colorColorColor to draw line with.
thicknessfloatThickness of the line stroke.
DrawPoint(IRenderContext, Vector2, Color, float)
Draws a square point at the specified position. The center of the point will be at the location.
public static void DrawPoint(this IRenderContext context, Vector2 location, Color color, float size = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
locationVector2Position to draw point at.
colorColorColor to draw point with.
sizefloatSize of the point to draw.
DrawPolygon(IRenderContext, Vector2, Vector2[], Color, float)
Draws a polygon.
public static void DrawPolygon(this IRenderContext context, Vector2 offset, Vector2[] points, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
offsetVector2Value to offset all polygon points.
pointsVector2[]Set of points to draw a polygon.
colorColorColors to draw lines with.
thicknessfloatThickness of lines to draw with.
DrawPolygon(IRenderContext, Vector2, ReadOnlySpan<Vector2>, Color, float)
Draws a polygon.
public static void DrawPolygon(this IRenderContext context, Vector2 offset, ReadOnlySpan<Vector2> points, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
offsetVector2Value to offset all polygon points.
pointsReadOnlySpan<Vector2>Pointer to the set of points to draw a polygon.
colorColorColors to draw lines with.
thicknessfloatThickness of lines to draw with.
DrawPolyline(IRenderContext, Vector2, ReadOnlySpan<Vector2>, Color, float)
Draws an open polyline: a stroke through points in order, without closing it.
public static void DrawPolyline(this IRenderContext context, Vector2 offset, ReadOnlySpan<Vector2> points, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
offsetVector2Value to offset all points.
pointsReadOnlySpan<Vector2>The points to connect, in order.
colorColorColor to draw the stroke with.
thicknessfloatThickness of the stroke.
Remarks
Unlike DrawLine(IRenderContext, Vector2, Vector2, Color, float), which grows its thickness to one side:
- each segment is centered on the line between its two points;
- the free ends stop at their points (flat ends);
- each joint gets one square, the thickness wide, centered on the shared point with a corner along the outer bisector: it fills the gap between the two segments' flat ends into a sharp (mitered) corner. Exact for right-angle joints such as Icon's glyphs; close for others.
Unrotated segments are drawn as plain integer rectangles, so the engines can snap them to whole physical pixels. Rotated segments keep their sub-pixel position: their Destination is anchored at a whole pixel and Origin (in texels) carries the fractional rest, so consecutive segments meet exactly at their shared point. A length rounded up to whole pixels is split evenly between both ends.
With partial opacity, a joint blends over the ends of its segments.
DrawRectangle(IRenderContext, Rectangle, Color, float)
Draws a rectangle.
public static void DrawRectangle(this IRenderContext context, Rectangle rectangle, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
rectangleRectangleRectangle to draw.
colorColorColor to draw rectangle with.
thicknessfloatThickness of the rectangle stroke.
DrawRectangle(IRenderContext, Vector2, Vector2, Color, float)
Draws a rectangle.
public static void DrawRectangle(this IRenderContext context, Vector2 location, Vector2 size, Color color, float thickness = 1)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
locationVector2Coordinates of the top-left rectangle corner.
sizeVector2Size of the rectangle.
colorColorColor to draw rectangle with.
thicknessfloatThickness of the rectangle stroke.
FillRectangle(IRenderContext, Rectangle, Color)
Draws a filled rectangle.
public static void FillRectangle(this IRenderContext context, Rectangle destination, Color color)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
destinationRectangleRectangle to draw.
colorColorColor of the rectangle to fill.
FillRectangle(IRenderContext, Vector2, Vector2, Color)
Draws a filled rectangle.
public static void FillRectangle(this IRenderContext context, Vector2 location, Vector2 size, Color color)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
locationVector2Coordinates of the upper-left side of the rectangle.
sizeVector2Size of the rectangle.
colorColorColor to apply.
FillRectangle(IRenderContext, float, float, float, float, Color)
Draws a filled rectangle.
public static void FillRectangle(this IRenderContext context, float x, float y, float width, float height, Color color)
Parameters
contextIRenderContextInstance of the IRenderContext to draw.
xfloatPosition of the left rectangle side.
yfloatPosition of the top rectangle side.
widthfloatWidth of the rectangle.
heightfloatHeight of the rectangle.
colorColorColor to apply for a rectangle.