Table of Contents

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

context IRenderContext

Instance of the IRenderContext to draw.

center Vector2

Center of an arc.

radius float

Radius of the arc.

sides int

Count of sides to make polygons.

color Color

Color of the lines.

startAngle float

Angle of the arc beginning.

endAngle float

Angle of the arc ending.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

center Vector2

Center of the circle.

radius float

Radius of the circle.

sides int

Count of sides to make polygons.

color Color

Color of the circle.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

x float

X coordinate of the circle center.

y float

Y coordinate of the circle center.

radius float

Circle radius.

sides int

Count of sides to make polygon.

color Color

Color of the circle stroke.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

point1 Vector2

The first point of the line.

point2 Vector2

The second point of the line.

color Color

Color to draw line with.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

point Vector2

Point of the line beginning.

length float

Length of the line to draw.

rotation float

Angle to rotate line.

origin Vector2

Origin of the rotation to apply.

color Color

Color of the line.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

x1 float

X component of the first line edge coordinate.

y1 float

Y component of the first line edge coordinate.

x2 float

X component of the second line edge coordinate.

y2 float

Y component of the second line edge coordinate.

color Color

Color to draw line with.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

location Vector2

Position to draw point at.

color Color

Color to draw point with.

size float

Size 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

context IRenderContext

Instance of the IRenderContext to draw.

offset Vector2

Value to offset all polygon points.

points Vector2[]

Set of points to draw a polygon.

color Color

Colors to draw lines with.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

offset Vector2

Value to offset all polygon points.

points ReadOnlySpan<Vector2>

Pointer to the set of points to draw a polygon.

color Color

Colors to draw lines with.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

offset Vector2

Value to offset all points.

points ReadOnlySpan<Vector2>

The points to connect, in order.

color Color

Color to draw the stroke with.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

rectangle Rectangle

Rectangle to draw.

color Color

Color to draw rectangle with.

thickness float

Thickness 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

context IRenderContext

Instance of the IRenderContext to draw.

location Vector2

Coordinates of the top-left rectangle corner.

size Vector2

Size of the rectangle.

color Color

Color to draw rectangle with.

thickness float

Thickness of the rectangle stroke.

FillRectangle(IRenderContext, Rectangle, Color)

Draws a filled rectangle.

public static void FillRectangle(this IRenderContext context, Rectangle destination, Color color)

Parameters

context IRenderContext

Instance of the IRenderContext to draw.

destination Rectangle

Rectangle to draw.

color Color

Color 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

context IRenderContext

Instance of the IRenderContext to draw.

location Vector2

Coordinates of the upper-left side of the rectangle.

size Vector2

Size of the rectangle.

color Color

Color 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

context IRenderContext

Instance of the IRenderContext to draw.

x float

Position of the left rectangle side.

y float

Position of the top rectangle side.

width float

Width of the rectangle.

height float

Height of the rectangle.

color Color

Color to apply for a rectangle.