// Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Drawing.Pens { /// /// Common Pen styles /// public static class Pens { private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f }; private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f }; private static readonly float[] DottedPattern = new[] { 1f, 1f }; private static readonly float[] DashedPattern = new[] { 3f, 1f }; /// /// Create a solid pen with out any drawing patterns /// /// The color. /// The width. /// The type of the color. /// The Pen public static Pen Solid(TPixel color, float width) where TPixel : struct, IPixel => new Pen(color, width); /// /// Create a solid pen with out any drawing patterns /// /// The brush. /// The width. /// The type of the color. /// The Pen public static Pen Solid(IBrush brush, float width) where TPixel : struct, IPixel => new Pen(brush, width); /// /// Create a pen with a 'Dash' drawing patterns /// /// The color. /// The width. /// The type of the color. /// The Pen public static Pen Dash(TPixel color, float width) where TPixel : struct, IPixel => new Pen(color, width, DashedPattern); /// /// Create a pen with a 'Dash' drawing patterns /// /// The brush. /// The width. /// The type of the color. /// The Pen public static Pen Dash(IBrush brush, float width) where TPixel : struct, IPixel => new Pen(brush, width, DashedPattern); /// /// Create a pen with a 'Dot' drawing patterns /// /// The color. /// The width. /// The type of the color. /// The Pen public static Pen Dot(TPixel color, float width) where TPixel : struct, IPixel => new Pen(color, width, DottedPattern); /// /// Create a pen with a 'Dot' drawing patterns /// /// The brush. /// The width. /// The type of the color. /// The Pen public static Pen Dot(IBrush brush, float width) where TPixel : struct, IPixel => new Pen(brush, width, DottedPattern); /// /// Create a pen with a 'Dash Dot' drawing patterns /// /// The color. /// The width. /// The type of the color. /// The Pen public static Pen DashDot(TPixel color, float width) where TPixel : struct, IPixel => new Pen(color, width, DashDotPattern); /// /// Create a pen with a 'Dash Dot' drawing patterns /// /// The brush. /// The width. /// The type of the color. /// The Pen public static Pen DashDot(IBrush brush, float width) where TPixel : struct, IPixel => new Pen(brush, width, DashDotPattern); /// /// Create a pen with a 'Dash Dot Dot' drawing patterns /// /// The color. /// The width. /// The type of the color. /// The Pen public static Pen DashDotDot(TPixel color, float width) where TPixel : struct, IPixel => new Pen(color, width, DashDotDotPattern); /// /// Create a pen with a 'Dash Dot Dot' drawing patterns /// /// The brush. /// The width. /// The type of the color. /// The Pen public static Pen DashDotDot(IBrush brush, float width) where TPixel : struct, IPixel => new Pen(brush, width, DashDotDotPattern); } }