Table of Contents

Method DrawPolygon

Namespace
LMKit.Graphics.Drawing
Assembly
LM-Kit.NET.dll

DrawPolygon(Polygon, Color32, double)

Draws the outline of the specified polygon with a solid color and thickness.

public Canvas DrawPolygon(Polygon polygon, Color32 color, double thickness = 1)

Parameters

polygon Polygon

The polygon to outline.

color Color32

The stroke color.

thickness double

The stroke thickness in pixels. Must be greater than zero. Defaults to 1.

Returns

Canvas

This Canvas instance for fluent chaining.

Examples

var pentagon = Polygon.Regular(new Point(150, 150), 60, 5);
var canvas = new Canvas(image);
canvas.DrawPolygon(pentagon, new Color32(0, 0, 0), thickness: 2);

Exceptions

ArgumentNullException

Thrown if polygon is null.

DrawPolygon(Polygon, Pen)

Draws the outline of the specified polygon using the given pen.

public Canvas DrawPolygon(Polygon polygon, Pen pen)

Parameters

polygon Polygon

The polygon to outline.

pen Pen

The pen that defines the stroke color, thickness, line join, line cap, miter limit, and alignment.

Returns

Canvas

This Canvas instance for fluent chaining.

Examples

var pentagon = Polygon.Regular(new Point(150, 150), 60, 5);
var pen = new Pen(new Color32(255, 0, 0), 3) { LineJoin = LineJoin.Round };
var canvas = new Canvas(image);
canvas.DrawPolygon(pentagon, pen);

Exceptions

ArgumentNullException

Thrown if polygon or pen is null.