Table of Contents

Method DrawFilledPolygon

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

DrawFilledPolygon(Polygon, Color32, Color32, double)

Fills the interior of the specified polygon and then draws its outline, using a solid fill color and a solid stroke color with the given thickness.

public Canvas DrawFilledPolygon(Polygon polygon, Color32 fillColor, Color32 strokeColor, double strokeThickness = 1)

Parameters

polygon Polygon

The polygon to fill and outline.

fillColor Color32

The interior fill color.

strokeColor Color32

The outline stroke color.

strokeThickness double

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

Returns

Canvas

This Canvas instance for fluent chaining.

Examples

var star = new Polygon(
    new Point(100, 10), new Point(120, 70), new Point(180, 70),
    new Point(130, 110), new Point(150, 170), new Point(100, 130),
    new Point(50, 170), new Point(70, 110), new Point(20, 70),
    new Point(80, 70));
var canvas = new Canvas(image);
canvas.DrawFilledPolygon(
    star,
    fillColor: new Color32(255, 220, 0),
    strokeColor: new Color32(0, 0, 0),
    strokeThickness: 2);

Exceptions

ArgumentNullException

Thrown if polygon is null.

DrawFilledPolygon(Polygon, Brush, Pen)

Fills the interior of the specified polygon and then draws its outline, using the given brush and pen.

public Canvas DrawFilledPolygon(Polygon polygon, Brush brush, Pen pen)

Parameters

polygon Polygon

The polygon to fill and outline.

brush Brush

The brush that defines the fill color.

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 hexagon = Polygon.Regular(new Point(200, 200), 80, 6);
var brush = new Brush(new Color32(200, 255, 200));
var pen = new Pen(new Color32(0, 100, 0), 2) { LineJoin = LineJoin.Bevel };
var canvas = new Canvas(image);
canvas.DrawFilledPolygon(hexagon, brush, pen);

Exceptions

ArgumentNullException

Thrown if polygon, brush, or pen is null.