mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
4.0 KiB
97 lines
4.0 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
namespace SixLabors.ImageSharp.Processing
|
|
{
|
|
/// <summary>
|
|
/// Contains a collection of common Pen styles
|
|
/// </summary>
|
|
public static class Pens
|
|
{
|
|
private static readonly float[] DashDotPattern = { 3f, 1f, 1f, 1f };
|
|
private static readonly float[] DashDotDotPattern = { 3f, 1f, 1f, 1f, 1f, 1f };
|
|
private static readonly float[] DottedPattern = { 1f, 1f };
|
|
private static readonly float[] DashedPattern = { 3f, 1f };
|
|
internal static readonly float[] EmptyPattern = new float[0];
|
|
|
|
/// <summary>
|
|
/// Create a solid pen with out any drawing patterns
|
|
/// </summary>
|
|
/// <param name="color">The color.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen Solid(Color color, float width) => new Pen(color, width);
|
|
|
|
/// <summary>
|
|
/// Create a solid pen with out any drawing patterns
|
|
/// </summary>
|
|
/// <param name="brush">The brush.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen Solid(IBrush brush, float width) => new Pen(brush, width);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dash' drawing patterns
|
|
/// </summary>
|
|
/// <param name="color">The color.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen Dash(Color color, float width) => new Pen(color, width, DashedPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dash' drawing patterns
|
|
/// </summary>
|
|
/// <param name="brush">The brush.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen Dash(IBrush brush, float width) => new Pen(brush, width, DashedPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dot' drawing patterns
|
|
/// </summary>
|
|
/// <param name="color">The color.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen Dot(Color color, float width) => new Pen(color, width, DottedPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dot' drawing patterns
|
|
/// </summary>
|
|
/// <param name="brush">The brush.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen Dot(IBrush brush, float width) => new Pen(brush, width, DottedPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dash Dot' drawing patterns
|
|
/// </summary>
|
|
/// <param name="color">The color.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen DashDot(Color color, float width) => new Pen(color, width, DashDotPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dash Dot' drawing patterns
|
|
/// </summary>
|
|
/// <param name="brush">The brush.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen DashDot(IBrush brush, float width) => new Pen(brush, width, DashDotPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dash Dot Dot' drawing patterns
|
|
/// </summary>
|
|
/// <param name="color">The color.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen DashDotDot(Color color, float width) => new Pen(color, width, DashDotDotPattern);
|
|
|
|
/// <summary>
|
|
/// Create a pen with a 'Dash Dot Dot' drawing patterns
|
|
/// </summary>
|
|
/// <param name="brush">The brush.</param>
|
|
/// <param name="width">The width.</param>
|
|
/// <returns>The Pen</returns>
|
|
public static Pen DashDotDot(IBrush brush, float width) => new Pen(brush, width, DashDotDotPattern);
|
|
}
|
|
}
|