//
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
namespace ImageSharp
{
using System;
using Drawing;
using Drawing.Brushes;
using Drawing.Pens;
using SixLabors.Shapes;
///
/// Extension methods for the type.
///
public static partial class ImageExtensions
{
///
/// Draws the outline of the polygon with the provided pen.
///
/// The type of the color.
/// The image this method extends.
/// The pen.
/// The path.
/// The options.
/// The .
public static Image Draw(this Image source, IPen pen, IPath path, GraphicsOptions options)
where TColor : struct, IPixel
{
return source.Draw(pen, new ShapePath(path), options);
}
///
/// Draws the outline of the polygon with the provided pen.
///
/// The type of the color.
/// The image this method extends.
/// The pen.
/// The path.
/// The .
public static Image Draw(this Image source, IPen pen, IPath path)
where TColor : struct, IPixel
{
return source.Draw(pen, path, GraphicsOptions.Default);
}
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
/// The type of the color.
/// The image this method extends.
/// The brush.
/// The thickness.
/// The shape.
/// The options.
/// The .
public static Image Draw(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options)
where TColor : struct, IPixel
{
return source.Draw(new Pen(brush, thickness), path, options);
}
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
/// The type of the color.
/// The image this method extends.
/// The brush.
/// The thickness.
/// The path.
/// The .
public static Image Draw(this Image source, IBrush brush, float thickness, IPath path)
where TColor : struct, IPixel
{
return source.Draw(new Pen(brush, thickness), path);
}
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
/// The type of the color.
/// The image this method extends.
/// The color.
/// The thickness.
/// The path.
/// The options.
/// The .
public static Image Draw(this Image source, TColor color, float thickness, IPath path, GraphicsOptions options)
where TColor : struct, IPixel
{
return source.Draw(new SolidBrush(color), thickness, path, options);
}
///
/// Draws the outline of the polygon with the provided brush at the provided thickness.
///
/// The type of the color.
/// The image this method extends.
/// The color.
/// The thickness.
/// The path.
/// The .
public static Image Draw(this Image source, TColor color, float thickness, IPath path)
where TColor : struct, IPixel
{
return source.Draw(new SolidBrush(color), thickness, path);
}
}
}