diff --git a/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/Brushes.cs similarity index 74% rename from src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs rename to src/ImageSharp.Drawing/Brushes/Brushes.cs index a9b638e8b0..e39f3dd497 100644 --- a/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/Brushes.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,10 +10,8 @@ namespace ImageSharp.Drawing.Brushes /// /// A collection of methods for creating generic brushes. /// - /// The pixel format. /// A New - public class Brushes - where TPixel : struct, IPixel + public static class Brushes { /// /// Percent10 Hatch Pattern @@ -98,16 +96,20 @@ namespace ImageSharp.Drawing.Brushes /// Create as brush that will paint a solid color /// /// The color. + /// The pixel format. /// A New - public static SolidBrush Solid(TPixel color) + public static SolidBrush Solid(TPixel color) + where TPixel : struct, IPixel => new SolidBrush(color); /// /// Create as brush that will paint a Percent10 Hatch Pattern with the specified colors /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush Percent10(TPixel foreColor) + public static PatternBrush Percent10(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, Percent10Pattern); /// @@ -115,8 +117,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush Percent10(TPixel foreColor, TPixel backColor) + public static PatternBrush Percent10(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, Percent10Pattern); /// @@ -124,8 +128,10 @@ namespace ImageSharp.Drawing.Brushes /// transparent background. /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush Percent20(TPixel foreColor) + public static PatternBrush Percent20(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, Percent20Pattern); /// @@ -133,8 +139,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush Percent20(TPixel foreColor, TPixel backColor) + public static PatternBrush Percent20(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, Percent20Pattern); /// @@ -142,8 +150,10 @@ namespace ImageSharp.Drawing.Brushes /// transparent background. /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush Horizontal(TPixel foreColor) + public static PatternBrush Horizontal(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, HorizontalPattern); /// @@ -151,8 +161,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush Horizontal(TPixel foreColor, TPixel backColor) + public static PatternBrush Horizontal(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, HorizontalPattern); /// @@ -160,8 +172,10 @@ namespace ImageSharp.Drawing.Brushes /// transparent background. /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush Min(TPixel foreColor) + public static PatternBrush Min(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, MinPattern); /// @@ -169,8 +183,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush Min(TPixel foreColor, TPixel backColor) + public static PatternBrush Min(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, MinPattern); /// @@ -178,8 +194,10 @@ namespace ImageSharp.Drawing.Brushes /// transparent background. /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush Vertical(TPixel foreColor) + public static PatternBrush Vertical(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, VerticalPattern); /// @@ -187,8 +205,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush Vertical(TPixel foreColor, TPixel backColor) + public static PatternBrush Vertical(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, VerticalPattern); /// @@ -196,8 +216,10 @@ namespace ImageSharp.Drawing.Brushes /// transparent background. /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush ForwardDiagonal(TPixel foreColor) + public static PatternBrush ForwardDiagonal(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, ForwardDiagonalPattern); /// @@ -205,8 +227,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush ForwardDiagonal(TPixel foreColor, TPixel backColor) + public static PatternBrush ForwardDiagonal(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, ForwardDiagonalPattern); /// @@ -214,8 +238,10 @@ namespace ImageSharp.Drawing.Brushes /// transparent background. /// /// Color of the foreground. + /// The pixel format. /// A New - public static PatternBrush BackwardDiagonal(TPixel foreColor) + public static PatternBrush BackwardDiagonal(TPixel foreColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, NamedColors.Transparent, BackwardDiagonalPattern); /// @@ -223,8 +249,10 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// Color of the background. + /// The pixel format. /// A New - public static PatternBrush BackwardDiagonal(TPixel foreColor, TPixel backColor) + public static PatternBrush BackwardDiagonal(TPixel foreColor, TPixel backColor) + where TPixel : struct, IPixel => new PatternBrush(foreColor, backColor, BackwardDiagonalPattern); } } \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs b/src/ImageSharp.Drawing/Pens/Pens.cs similarity index 64% rename from src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs rename to src/ImageSharp.Drawing/Pens/Pens.cs index 5eb78dc444..364115cb77 100644 --- a/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs +++ b/src/ImageSharp.Drawing/Pens/Pens.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,9 +10,7 @@ namespace ImageSharp.Drawing.Pens /// /// Common Pen styles /// - /// The type of the color. - public class Pens - where TPixel : struct, IPixel + 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 }; @@ -24,8 +22,10 @@ namespace ImageSharp.Drawing.Pens /// /// The color. /// The width. + /// The type of the color. /// The Pen - public static Pen Solid(TPixel color, float width) + public static Pen Solid(TPixel color, float width) + where TPixel : struct, IPixel => new Pen(color, width); /// @@ -33,8 +33,10 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// The width. + /// The type of the color. /// The Pen - public static Pen Solid(IBrush brush, float width) + public static Pen Solid(IBrush brush, float width) + where TPixel : struct, IPixel => new Pen(brush, width); /// @@ -42,8 +44,10 @@ namespace ImageSharp.Drawing.Pens /// /// The color. /// The width. + /// The type of the color. /// The Pen - public static Pen Dash(TPixel color, float width) + public static Pen Dash(TPixel color, float width) + where TPixel : struct, IPixel => new Pen(color, width, DashedPattern); /// @@ -51,8 +55,10 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// The width. + /// The type of the color. /// The Pen - public static Pen Dash(IBrush brush, float width) + public static Pen Dash(IBrush brush, float width) + where TPixel : struct, IPixel => new Pen(brush, width, DashedPattern); /// @@ -60,8 +66,10 @@ namespace ImageSharp.Drawing.Pens /// /// The color. /// The width. + /// The type of the color. /// The Pen - public static Pen Dot(TPixel color, float width) + public static Pen Dot(TPixel color, float width) + where TPixel : struct, IPixel => new Pen(color, width, DottedPattern); /// @@ -69,8 +77,10 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// The width. + /// The type of the color. /// The Pen - public static Pen Dot(IBrush brush, float width) + public static Pen Dot(IBrush brush, float width) + where TPixel : struct, IPixel => new Pen(brush, width, DottedPattern); /// @@ -78,8 +88,10 @@ namespace ImageSharp.Drawing.Pens /// /// The color. /// The width. + /// The type of the color. /// The Pen - public static Pen DashDot(TPixel color, float width) + public static Pen DashDot(TPixel color, float width) + where TPixel : struct, IPixel => new Pen(color, width, DashDotPattern); /// @@ -87,8 +99,10 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// The width. + /// The type of the color. /// The Pen - public static Pen DashDot(IBrush brush, float width) + public static Pen DashDot(IBrush brush, float width) + where TPixel : struct, IPixel => new Pen(brush, width, DashDotPattern); /// @@ -96,8 +110,10 @@ namespace ImageSharp.Drawing.Pens /// /// The color. /// The width. + /// The type of the color. /// The Pen - public static Pen DashDotDot(TPixel color, float width) + public static Pen DashDotDot(TPixel color, float width) + where TPixel : struct, IPixel => new Pen(color, width, DashDotDotPattern); /// @@ -105,8 +121,10 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// The width. + /// The type of the color. /// The Pen - public static Pen DashDotDot(IBrush brush, float width) + public static Pen DashDotDot(IBrush brush, float width) + where TPixel : struct, IPixel => new Pen(brush, width, DashDotDotPattern); } } \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Text/DrawText.cs b/src/ImageSharp.Drawing/Text/DrawText.cs index 1e87fd0084..bd33289fa6 100644 --- a/src/ImageSharp.Drawing/Text/DrawText.cs +++ b/src/ImageSharp.Drawing/Text/DrawText.cs @@ -54,7 +54,7 @@ namespace ImageSharp public static Image DrawText(this Image source, string text, Font font, TPixel color, Vector2 location, TextGraphicsOptions options) where TPixel : struct, IPixel { - return source.DrawText(text, font, Brushes.Solid(color), null, location, options); + return source.DrawText(text, font, Brushes.Solid(color), null, location, options); } /// diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs index 6161402378..aa97efe00b 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs @@ -12,6 +12,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using ImageSharp.Drawing.Brushes; + using CoreBrushes = ImageSharp.Drawing.Brushes.Brushes; using ImageSharp.PixelFormats; public class FillWithPattern @@ -39,7 +40,7 @@ namespace ImageSharp.Benchmarks { using (Image image = new Image(800, 800)) { - image.Fill(Brushes.BackwardDiagonal(Rgba32.HotPink)); + image.Fill(CoreBrushes.BackwardDiagonal(Rgba32.HotPink)); using (MemoryStream ms = new MemoryStream()) { diff --git a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs index 1cd41b7b51..254c54ba1b 100644 --- a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs @@ -63,7 +63,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithPercent10() { - this.Test("Percent10", Rgba32.Blue, Brushes.Percent10(Rgba32.HotPink, Rgba32.LimeGreen), + this.Test("Percent10", Rgba32.Blue, Brushes.Percent10(Rgba32.HotPink, Rgba32.LimeGreen), new[,] { { Rgba32.HotPink , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, @@ -76,7 +76,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithPercent10Transparent() { - Test("Percent10_Transparent", Rgba32.Blue, Brushes.Percent10(Rgba32.HotPink), + Test("Percent10_Transparent", Rgba32.Blue, Brushes.Percent10(Rgba32.HotPink), new Rgba32[,] { { Rgba32.HotPink , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, @@ -88,7 +88,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithPercent20() { - Test("Percent20", Rgba32.Blue, Brushes.Percent20(Rgba32.HotPink, Rgba32.LimeGreen), + Test("Percent20", Rgba32.Blue, Brushes.Percent20(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[,] { { Rgba32.HotPink , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink , Rgba32.LimeGreen}, @@ -100,7 +100,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithPercent20_transparent() { - Test("Percent20_Transparent", Rgba32.Blue, Brushes.Percent20(Rgba32.HotPink), + Test("Percent20_Transparent", Rgba32.Blue, Brushes.Percent20(Rgba32.HotPink), new Rgba32[,] { { Rgba32.HotPink , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink , Rgba32.Blue}, @@ -112,7 +112,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithHorizontal() { - Test("Horizontal", Rgba32.Blue, Brushes.Horizontal(Rgba32.HotPink, Rgba32.LimeGreen), + Test("Horizontal", Rgba32.Blue, Brushes.Horizontal(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[,] { { Rgba32.LimeGreen , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, { Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink , Rgba32.HotPink}, @@ -124,7 +124,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithHorizontal_transparent() { - Test("Horizontal_Transparent", Rgba32.Blue, Brushes.Horizontal(Rgba32.HotPink), + Test("Horizontal_Transparent", Rgba32.Blue, Brushes.Horizontal(Rgba32.HotPink), new Rgba32[,] { { Rgba32.Blue , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, { Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink , Rgba32.HotPink}, @@ -138,7 +138,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithMin() { - Test("Min", Rgba32.Blue, Brushes.Min(Rgba32.HotPink, Rgba32.LimeGreen), + Test("Min", Rgba32.Blue, Brushes.Min(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[,] { { Rgba32.LimeGreen , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, { Rgba32.LimeGreen , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, @@ -150,7 +150,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithMin_transparent() { - Test("Min_Transparent", Rgba32.Blue, Brushes.Min(Rgba32.HotPink), + Test("Min_Transparent", Rgba32.Blue, Brushes.Min(Rgba32.HotPink), new Rgba32[,] { { Rgba32.Blue , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, { Rgba32.Blue , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, @@ -162,7 +162,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithVertical() { - Test("Vertical", Rgba32.Blue, Brushes.Vertical(Rgba32.HotPink, Rgba32.LimeGreen), + Test("Vertical", Rgba32.Blue, Brushes.Vertical(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[,] { { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen}, { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen}, @@ -174,7 +174,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithVertical_transparent() { - Test("Vertical_Transparent", Rgba32.Blue, Brushes.Vertical(Rgba32.HotPink), + Test("Vertical_Transparent", Rgba32.Blue, Brushes.Vertical(Rgba32.HotPink), new Rgba32[,] { { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue}, { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue}, @@ -186,7 +186,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithForwardDiagonal() { - Test("ForwardDiagonal", Rgba32.Blue, Brushes.ForwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen), + Test("ForwardDiagonal", Rgba32.Blue, Brushes.ForwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[,] { { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink}, { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen}, @@ -198,7 +198,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithForwardDiagonal_transparent() { - Test("ForwardDiagonal_Transparent", Rgba32.Blue, Brushes.ForwardDiagonal(Rgba32.HotPink), + Test("ForwardDiagonal_Transparent", Rgba32.Blue, Brushes.ForwardDiagonal(Rgba32.HotPink), new Rgba32[,] { { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink}, { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue}, @@ -210,7 +210,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithBackwardDiagonal() { - Test("BackwardDiagonal", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen), + Test("BackwardDiagonal", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink, Rgba32.LimeGreen), new Rgba32[,] { { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen}, @@ -222,7 +222,7 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent() { - Test("BackwardDiagonal_Transparent", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink), + Test("BackwardDiagonal_Transparent", Rgba32.Blue, Brushes.BackwardDiagonal(Rgba32.HotPink), new Rgba32[,] { { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue}, diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs index f3d7d1a205..1f35a37884 100644 --- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs @@ -185,7 +185,7 @@ namespace ImageSharp.Tests.Drawing { image .BackgroundColor(Rgba32.Blue) - .Draw(Pens.Dash(Rgba32.HotPink, 5), simplePath.Clip(hole1)) + .Draw(Pens.Dash(Rgba32.HotPink, 5), simplePath.Clip(hole1)) .Save(output); } } diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs index 05b102dde8..3396d89c57 100644 --- a/tests/ImageSharp.Tests/Drawing/LineTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs @@ -88,7 +88,7 @@ namespace ImageSharp.Tests.Drawing { image .BackgroundColor(Rgba32.Blue) - .DrawLines(Pens.Dash(Rgba32.HotPink, 5), + .DrawLines(Pens.Dash(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -109,7 +109,7 @@ namespace ImageSharp.Tests.Drawing { image .BackgroundColor(Rgba32.Blue) - .DrawLines(Pens.Dot(Rgba32.HotPink, 5), + .DrawLines(Pens.Dot(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -130,7 +130,7 @@ namespace ImageSharp.Tests.Drawing { image .BackgroundColor(Rgba32.Blue) - .DrawLines(Pens.DashDot(Rgba32.HotPink, 5), + .DrawLines(Pens.DashDot(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -151,7 +151,7 @@ namespace ImageSharp.Tests.Drawing { image .BackgroundColor(Rgba32.Blue) - .DrawLines(Pens.DashDotDot(Rgba32.HotPink, 5), new[] { + .DrawLines(Pens.DashDotDot(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300) diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs index 02ff92f639..a9b2284e8a 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Tests.Drawing.Paths float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Pen pen = new Pen(Rgba32.Firebrick, 99.9f); Vector2[] points = new Vector2[] { new Vector2(10,10), diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs index 4962e8d6f2..3b7ba303dc 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs @@ -17,7 +17,7 @@ namespace ImageSharp.Tests.Drawing.Paths float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Pen pen = new Pen(Rgba32.Gray, 99.9f); Vector2[] points = new Vector2[] { new Vector2(10,10), diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs index df9287bc7f..0bdcbdc082 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Tests.Drawing.Paths float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Pen pen = new Pen(Rgba32.Gray, 99.9f); IPath path = new SixLabors.Shapes.Path(new LinearLineSegment(new Vector2[] { new Vector2(10,10), diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs index 357604abf1..3474e6f62f 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Tests.Drawing.Paths float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Pen pen = new Pen(Rgba32.Gray, 99.9f); Vector2[] points = new Vector2[] { new Vector2(10,10), diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs index c588cd7055..e08e702c1d 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Tests.Drawing.Paths float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Pen pen = new Pen(Rgba32.Gray, 99.9f); ImageSharp.Rectangle rectangle = new ImageSharp.Rectangle(10, 10, 98, 324); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index 88ad3a91e8..eb0127cb10 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Tests.Drawing.Paths { GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); IPath path = new SixLabors.Shapes.Path(new LinearLineSegment(new Vector2[] { new Vector2(10,10), new Vector2(20,10), diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index 5ea1b976b1..3f912fe79f 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Tests.Drawing.Paths { GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Vector2[] path = new Vector2[] { new Vector2(10,10), new Vector2(20,10), diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs index 6f83885042..1f4774550e 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs @@ -14,7 +14,7 @@ namespace ImageSharp.Tests.Drawing.Paths { GraphicsOptions noneDefault = new GraphicsOptions(); Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); ImageSharp.Rectangle rectangle = new ImageSharp.Rectangle(10, 10, 77, 76); private ProcessorWatchingImage img; diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs index 019c4a2dd4..9e377a7405 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs @@ -60,7 +60,7 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Pattern.png")) { image - .FillPolygon(Brushes.Horizontal(Rgba32.HotPink), simplePath, new GraphicsOptions(true)) + .FillPolygon(Brushes.Horizontal(Rgba32.HotPink), simplePath, new GraphicsOptions(true)) .Save(output); } diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 3b3e894f49..1516b33d43 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs @@ -24,7 +24,7 @@ namespace ImageSharp.Tests.Drawing.Text { Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); IPath path = new SixLabors.Shapes.Path( new LinearLineSegment( @@ -54,7 +54,7 @@ namespace ImageSharp.Tests.Drawing.Text this.img.DrawText( "123", this.Font, - Brushes.Solid(Rgba32.Red), + Brushes.Solid(Rgba32.Red), null, Vector2.Zero, new TextGraphicsOptions(true)); @@ -67,7 +67,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenBrushSetAndNotPenDefaultOptions() { - this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), null, Vector2.Zero); + this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), null, Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied @@ -77,7 +77,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenBrushSet() { - this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true)); + this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true)); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied @@ -87,7 +87,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void FillsForEachACharachterWhenBrushSetDefaultOptions() { - this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero); + this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied @@ -130,7 +130,7 @@ namespace ImageSharp.Tests.Drawing.Text "123", this.Font, null, - Pens.Dash(Rgba32.Red, 1), + Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); @@ -142,7 +142,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSetAndNotBrushDefaultOptions() { - this.img.DrawText("123", this.Font, null, Pens.Dash(Rgba32.Red, 1), Vector2.Zero); + this.img.DrawText("123", this.Font, null, Pens.Dash(Rgba32.Red, 1), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied @@ -152,7 +152,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSet() { - this.img.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); + this.img.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied @@ -162,7 +162,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSetDefaultOptions() { - this.img.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero); + this.img.DrawText("123", this.Font, Pens.Dash(Rgba32.Red, 1), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied @@ -175,8 +175,8 @@ namespace ImageSharp.Tests.Drawing.Text this.img.DrawText( "123", this.Font, - Brushes.Solid(Rgba32.Red), - Pens.Dash(Rgba32.Red, 1), + Brushes.Solid(Rgba32.Red), + Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); @@ -187,7 +187,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSetDefaultOptions() { - this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), Vector2.Zero); + this.img.DrawText("123", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(6, this.img.ProcessorApplications.Count); @@ -199,8 +199,8 @@ namespace ImageSharp.Tests.Drawing.Text this.img.DrawText( "1", this.Font, - Brushes.Solid(Rgba32.Red), - Pens.Dash(Rgba32.Red, 1), + Brushes.Solid(Rgba32.Red), + Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); @@ -213,7 +213,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void BrushAppliesBeforPenDefaultOptions() { - this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), Vector2.Zero); + this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Pens.Dash(Rgba32.Red, 1), Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(2, this.img.ProcessorApplications.Count); @@ -226,11 +226,11 @@ namespace ImageSharp.Tests.Drawing.Text { this.img.MetaData.VerticalResolution = 1; this.img.MetaData.HorizontalResolution = 1; - this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true) { + this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true) { UseImageResolution = false }); - this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true) + this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true) { UseImageResolution = true });