//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp
{
using System;
using System.Numerics;
using Drawing;
using Drawing.Brushes;
using ImageSharp.PixelFormats;
using SixLabors.Shapes;
///
/// Extension methods for the type.
///
public static partial class ImageExtensions
{
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The type of the color.
/// The image this method extends.
/// The brush.
/// The points.
/// The options.
/// The .
public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points, GraphicsOptions options)
where TPixel : struct, IPixel
{
return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options);
}
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The type of the color.
/// The image this method extends.
/// The brush.
/// The points.
/// The .
public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points)
where TPixel : struct, IPixel
{
return source.Fill(brush, new Polygon(new LinearLineSegment(points)));
}
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The type of the color.
/// The image this method extends.
/// The color.
/// The points.
/// The options.
/// The .
public static Image FillPolygon(this Image source, TPixel color, Vector2[] points, GraphicsOptions options)
where TPixel : struct, IPixel
{
return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options);
}
///
/// Flood fills the image in the shape of a Linear polygon described by the points
///
/// The type of the color.
/// The image this method extends.
/// The color.
/// The points.
/// The .
public static Image FillPolygon(this Image source, TPixel color, Vector2[] points)
where TPixel : struct, IPixel
{
return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)));
}
}
}