From fa152146dd2e8b96677a84bcf6d094e24c18fa3e Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 20 Apr 2017 19:32:35 +1000 Subject: [PATCH] Rename Color and ColorVector Color -> Rgba32 ColorVector -> RgbaVector --- src/ImageSharp.Drawing/Brushes/Brushes.cs | 60 +- src/ImageSharp.Drawing/Brushes/ImageBrush.cs | 6 +- .../Brushes/PatternBrush.cs | 8 +- .../Brushes/RecolorBrush.cs | 4 +- src/ImageSharp.Drawing/Brushes/SolidBrush.cs | 6 +- src/ImageSharp.Drawing/Pens/Pen.cs | 12 +- src/ImageSharp.Drawing/Pens/Pens.cs | 20 +- src/ImageSharp/Colors/Color.Definitions.cs | 728 ------------------ src/ImageSharp/Colors/ColorConstants.cs | 292 +++---- .../Colors/ColorVector.Definitions.cs | 728 ------------------ src/ImageSharp/Colors/ColorspaceTransforms.cs | 60 +- src/ImageSharp/Colors/ComponentOrder.cs | 8 +- src/ImageSharp/Colors/NamedColors{TColor}.cs | 2 - src/ImageSharp/Colors/PackedPixel/IPixel.cs | 8 +- .../PackedPixel/PackedPixelConverterHelper.cs | 2 +- ...Operations.cs => Rgba32.BulkOperations.cs} | 72 +- src/ImageSharp/Colors/Rgba32.Definitions.cs | 728 ++++++++++++++++++ ...lor.Transforms.cs => Rgba32.Transforms.cs} | 64 +- src/ImageSharp/Colors/{Color.cs => Rgba32.cs} | 60 +- ...ations.cs => RgbaVector.BulkOperations.cs} | 15 +- .../Colors/RgbaVector.Definitions.cs | 728 ++++++++++++++++++ ...Transforms.cs => RgbaVector.Transforms.cs} | 94 +-- .../Colors/{ColorVector.cs => RgbaVector.cs} | 50 +- src/ImageSharp/Colors/Spaces/Bgra32.cs | 6 +- src/ImageSharp/Colors/Spaces/CieLab.cs | 6 +- src/ImageSharp/Colors/Spaces/CieXyz.cs | 6 +- src/ImageSharp/Colors/Spaces/Cmyk.cs | 4 +- src/ImageSharp/Colors/Spaces/Hsl.cs | 6 +- src/ImageSharp/Colors/Spaces/Hsv.cs | 6 +- src/ImageSharp/Colors/Spaces/YCbCr.cs | 6 +- .../Common/Extensions/Vector4Extensions.cs | 2 +- src/ImageSharp/Image.Create.cs | 14 +- src/ImageSharp/Image.FromFile.cs | 2 +- src/ImageSharp/Image.FromStream.cs | 4 +- src/ImageSharp/Image.cs | 10 +- .../ColorMatrix/ColorMatrixProcessor.cs | 2 +- src/ImageSharp/Quantizers/PaletteQuantizer.cs | 2 +- .../Bulk/PackFromVector4ReferenceVsPointer.cs | 10 +- .../Color/Bulk/PackFromXyzw.cs | 4 +- .../Color/Bulk/ToVector4.cs | 2 +- .../ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs | 4 +- .../Color/Bulk/ToXyzw.cs | 4 +- .../Color/ColorEquality.cs | 2 +- .../Drawing/DrawBeziers.cs | 2 +- .../Drawing/DrawLines.cs | 2 +- .../Drawing/DrawPolygon.cs | 2 +- .../Drawing/FillPolygon.cs | 2 +- .../Drawing/FillRectangle.cs | 2 +- .../Drawing/FillWithPattern.cs | 2 +- .../General/ClearBuffer.cs | 6 +- .../ImageSharp.Benchmarks/Image/CopyPixels.cs | 2 +- .../Image/EncodeIndexedPng.cs | 10 +- .../ImageSharp.Benchmarks/Image/EncodePng.cs | 8 +- .../Image/GetSetPixel.cs | 2 +- .../ImageSharp.Benchmarks/Samplers/Resize.cs | 2 +- .../Colors/BulkPixelOperationsTests.cs | 12 +- .../Colors/ColorConversionTests.cs | 106 +-- .../Colors/ColorDefinitionTests.cs | 10 +- .../Colors/ColorEqualityTests.cs | 4 +- tests/ImageSharp.Tests/Colors/ColorTests.cs | 38 +- .../Colors/ColorTransformTests.cs | 58 +- .../Colors/ColorVectorTests.cs | 38 +- .../Colors/ColorVectorTransformTests.cs | 58 +- .../Colors/PackedPixelTests.cs | 22 +- .../Colors/UnPackedPixelTests.cs | 44 +- .../Common/BufferSpanTests.cs | 6 +- .../Common/PixelDataPoolTests.cs | 8 +- .../ImageSharp.Tests/Drawing/BeziersTests.cs | 32 +- .../ImageSharp.Tests/Drawing/DrawPathTests.cs | 22 +- .../Drawing/FillPatternTests.cs | 176 ++--- .../Drawing/FillRegionProcessorTests.cs | 4 +- .../Drawing/FillSolidBrushTests.cs | 26 +- .../Drawing/LineComplexPolygonTests.cs | 80 +- tests/ImageSharp.Tests/Drawing/LineTests.cs | 64 +- .../Drawing/Paths/DrawBeziersTests.cs | 30 +- .../Drawing/Paths/DrawLinesTests.cs | 30 +- .../Drawing/Paths/DrawPath.cs | 30 +- .../Drawing/Paths/DrawPolygon.cs | 30 +- .../Drawing/Paths/DrawRectangle.cs | 30 +- .../Drawing/Paths/FillPath.cs | 16 +- .../Drawing/Paths/FillPolygon.cs | 16 +- .../Drawing/Paths/FillRectangle.cs | 16 +- .../Drawing/Paths/ProcessorWatchingImage.cs | 8 +- .../ImageSharp.Tests/Drawing/PolygonTests.cs | 42 +- .../Drawing/RecolorImageTest.cs | 4 +- .../Drawing/SolidBezierTests.cs | 22 +- .../Drawing/SolidComplexPolygonTests.cs | 30 +- .../Drawing/SolidPolygonTests.cs | 76 +- .../ImageSharp.Tests/Drawing/Text/DrawText.cs | 86 +-- .../Drawing/Text/OutputText.cs | 4 +- .../Formats/Jpg/BadEofJpegTests.cs | 4 +- .../Formats/Jpg/JpegDecoderTests.cs | 4 +- .../Formats/Jpg/JpegEncoderTests.cs | 4 +- .../Formats/Jpg/JpegProfilingBenchmarks.cs | 6 +- .../Formats/Jpg/JpegUtilsTests.cs | 4 +- .../ImageSharp.Tests/Image/ImageLoadTests.cs | 100 +-- .../ImageSharp.Tests/Image/ImageSaveTests.cs | 24 +- .../Image/PixelAccessorTests.cs | 16 +- .../Profiles/Exif/ExifProfileTests.cs | 2 +- .../Processors/Filters/BackgroundColorTest.cs | 2 +- .../Processors/Filters/GlowTest.cs | 2 +- .../Filters/ResizeProfilingBenchmarks.cs | 6 +- .../Processors/Filters/VignetteTest.cs | 2 +- .../TestUtilities/Factories/ImageFactory.cs | 8 +- .../ImageProviders/TestPatternProvider.cs | 8 +- .../TestUtilities/PixelTypes.cs | 24 +- .../TestUtilities/TestUtilityExtensions.cs | 8 +- .../Tests/TestImageProviderTests.cs | 12 +- .../Tests/TestUtilityExtensionsTests.cs | 28 +- 109 files changed, 2718 insertions(+), 2723 deletions(-) delete mode 100644 src/ImageSharp/Colors/Color.Definitions.cs delete mode 100644 src/ImageSharp/Colors/ColorVector.Definitions.cs rename src/ImageSharp/Colors/{Color.BulkOperations.cs => Rgba32.BulkOperations.cs} (77%) create mode 100644 src/ImageSharp/Colors/Rgba32.Definitions.cs rename src/ImageSharp/Colors/{Color.Transforms.cs => Rgba32.Transforms.cs} (84%) rename src/ImageSharp/Colors/{Color.cs => Rgba32.cs} (85%) rename src/ImageSharp/Colors/{ColorVector.BulkOperations.cs => RgbaVector.BulkOperations.cs} (60%) create mode 100644 src/ImageSharp/Colors/RgbaVector.Definitions.cs rename src/ImageSharp/Colors/{ColorVector.Transforms.cs => RgbaVector.Transforms.cs} (75%) rename src/ImageSharp/Colors/{ColorVector.cs => RgbaVector.cs} (84%) diff --git a/src/ImageSharp.Drawing/Brushes/Brushes.cs b/src/ImageSharp.Drawing/Brushes/Brushes.cs index e8269848c..d7b10c32a 100644 --- a/src/ImageSharp.Drawing/Brushes/Brushes.cs +++ b/src/ImageSharp.Drawing/Brushes/Brushes.cs @@ -6,7 +6,7 @@ namespace ImageSharp.Drawing.Brushes { /// - /// A collection of methods for creating brushes. Brushes use for painting. + /// A collection of methods for creating brushes. Brushes use for painting. /// public class Brushes { @@ -15,7 +15,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The color. /// A Brush - public static SolidBrush Solid(Color color) + public static SolidBrush Solid(Rgba32 color) => new SolidBrush(color); /// @@ -24,8 +24,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush Percent10(Color foreColor) - => new PatternBrush(Brushes.Percent10(foreColor, Color.Transparent)); + public static PatternBrush Percent10(Rgba32 foreColor) + => new PatternBrush(Brushes.Percent10(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Percent10 Hatch Pattern with @@ -34,8 +34,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Percent10(Color foreColor, Color backColor) - => new PatternBrush(Brushes.Percent10(foreColor, backColor)); + public static PatternBrush Percent10(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.Percent10(foreColor, backColor)); /// /// Create as brush that will paint a Percent20 Hatch Pattern with @@ -43,8 +43,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush Percent20(Color foreColor) - => new PatternBrush(Brushes.Percent20(foreColor, Color.Transparent)); + public static PatternBrush Percent20(Rgba32 foreColor) + => new PatternBrush(Brushes.Percent20(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Percent20 Hatch Pattern with @@ -53,8 +53,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Percent20(Color foreColor, Color backColor) - => new PatternBrush(Brushes.Percent20(foreColor, backColor)); + public static PatternBrush Percent20(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.Percent20(foreColor, backColor)); /// /// Create as brush that will paint a Horizontal Hatch Pattern with @@ -62,8 +62,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush Horizontal(Color foreColor) - => new PatternBrush(Brushes.Horizontal(foreColor, Color.Transparent)); + public static PatternBrush Horizontal(Rgba32 foreColor) + => new PatternBrush(Brushes.Horizontal(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Horizontal Hatch Pattern with @@ -72,8 +72,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Horizontal(Color foreColor, Color backColor) - => new PatternBrush(Brushes.Horizontal(foreColor, backColor)); + public static PatternBrush Horizontal(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.Horizontal(foreColor, backColor)); /// /// Create as brush that will paint a Min Hatch Pattern with @@ -81,8 +81,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush Min(Color foreColor) - => new PatternBrush(Brushes.Min(foreColor, Color.Transparent)); + public static PatternBrush Min(Rgba32 foreColor) + => new PatternBrush(Brushes.Min(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Min Hatch Pattern with @@ -91,8 +91,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Min(Color foreColor, Color backColor) - => new PatternBrush(Brushes.Min(foreColor, backColor)); + public static PatternBrush Min(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.Min(foreColor, backColor)); /// /// Create as brush that will paint a Vertical Hatch Pattern with @@ -100,8 +100,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush Vertical(Color foreColor) - => new PatternBrush(Brushes.Vertical(foreColor, Color.Transparent)); + public static PatternBrush Vertical(Rgba32 foreColor) + => new PatternBrush(Brushes.Vertical(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Vertical Hatch Pattern with @@ -110,8 +110,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Vertical(Color foreColor, Color backColor) - => new PatternBrush(Brushes.Vertical(foreColor, backColor)); + public static PatternBrush Vertical(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.Vertical(foreColor, backColor)); /// /// Create as brush that will paint a Forward Diagonal Hatch Pattern with @@ -119,8 +119,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush ForwardDiagonal(Color foreColor) - => new PatternBrush(Brushes.ForwardDiagonal(foreColor, Color.Transparent)); + public static PatternBrush ForwardDiagonal(Rgba32 foreColor) + => new PatternBrush(Brushes.ForwardDiagonal(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Forward Diagonal Hatch Pattern with @@ -129,8 +129,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush ForwardDiagonal(Color foreColor, Color backColor) - => new PatternBrush(Brushes.ForwardDiagonal(foreColor, backColor)); + public static PatternBrush ForwardDiagonal(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.ForwardDiagonal(foreColor, backColor)); /// /// Create as brush that will paint a Backward Diagonal Hatch Pattern with @@ -138,8 +138,8 @@ namespace ImageSharp.Drawing.Brushes /// /// Color of the foreground. /// A Brush - public static PatternBrush BackwardDiagonal(Color foreColor) - => new PatternBrush(Brushes.BackwardDiagonal(foreColor, Color.Transparent)); + public static PatternBrush BackwardDiagonal(Rgba32 foreColor) + => new PatternBrush(Brushes.BackwardDiagonal(foreColor, Rgba32.Transparent)); /// /// Create as brush that will paint a Backward Diagonal Hatch Pattern with @@ -148,7 +148,7 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush BackwardDiagonal(Color foreColor, Color backColor) - => new PatternBrush(Brushes.BackwardDiagonal(foreColor, backColor)); + public static PatternBrush BackwardDiagonal(Rgba32 foreColor, Rgba32 backColor) + => new PatternBrush(Brushes.BackwardDiagonal(foreColor, backColor)); } } \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs index a7124bfe8..84004a48d 100644 --- a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs @@ -6,15 +6,15 @@ namespace ImageSharp.Drawing.Brushes { /// - /// Provides an implementation of a solid brush for painting with repeating images. The brush uses for painting. + /// Provides an implementation of a solid brush for painting with repeating images. The brush uses for painting. /// - public class ImageBrush : ImageBrush + public class ImageBrush : ImageBrush { /// /// Initializes a new instance of the class. /// /// The image to paint. - public ImageBrush(IImageBase image) + public ImageBrush(IImageBase image) : base(image) { } diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs index 5093a7df0..8884d1e02 100644 --- a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs @@ -6,9 +6,9 @@ namespace ImageSharp.Drawing.Brushes { /// - /// Provides an implementation of a pattern brush for painting patterns. The brush use for painting. + /// Provides an implementation of a pattern brush for painting patterns. The brush use for painting. /// - public class PatternBrush : PatternBrush + public class PatternBrush : PatternBrush { /// /// Initializes a new instance of the class. @@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Brushes /// Color of the fore. /// Color of the back. /// The pattern. - public PatternBrush(Color foreColor, Color backColor, bool[,] pattern) + public PatternBrush(Rgba32 foreColor, Rgba32 backColor, bool[,] pattern) : base(foreColor, backColor, pattern) { } @@ -25,7 +25,7 @@ namespace ImageSharp.Drawing.Brushes /// Initializes a new instance of the class. /// /// The brush. - internal PatternBrush(PatternBrush brush) + internal PatternBrush(PatternBrush brush) : base(brush) { } diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs index 0452a3f01..b18800371 100644 --- a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Drawing.Brushes /// /// Provides an implementation of a recolor brush for painting color changes. /// - public class RecolorBrush : RecolorBrush + public class RecolorBrush : RecolorBrush { /// /// Initializes a new instance of the class. @@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Brushes /// Color of the source. /// Color of the target. /// The threshold. - public RecolorBrush(Color sourceColor, Color targetColor, float threshold) + public RecolorBrush(Rgba32 sourceColor, Rgba32 targetColor, float threshold) : base(sourceColor, targetColor, threshold) { } diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs index 123d8a7e3..7c65d782a 100644 --- a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs @@ -6,15 +6,15 @@ namespace ImageSharp.Drawing.Brushes { /// - /// Provides an implementation of a solid brush for painting solid color areas. The brush uses for painting. + /// Provides an implementation of a solid brush for painting solid color areas. The brush uses for painting. /// - public class SolidBrush : SolidBrush + public class SolidBrush : SolidBrush { /// /// Initializes a new instance of the class. /// /// The color. - public SolidBrush(Color color) + public SolidBrush(Rgba32 color) : base(color) { } diff --git a/src/ImageSharp.Drawing/Pens/Pen.cs b/src/ImageSharp.Drawing/Pens/Pen.cs index 09fe89419..991ee14de 100644 --- a/src/ImageSharp.Drawing/Pens/Pen.cs +++ b/src/ImageSharp.Drawing/Pens/Pen.cs @@ -6,16 +6,16 @@ namespace ImageSharp.Drawing.Pens { /// - /// Represents a in the color space. + /// Represents a in the color space. /// - public class Pen : Pen + public class Pen : Pen { /// /// Initializes a new instance of the class. /// /// The color. /// The width. - public Pen(Color color, float width) + public Pen(Rgba32 color, float width) : base(color, width) { } @@ -25,7 +25,7 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// The width. - public Pen(IBrush brush, float width) + public Pen(IBrush brush, float width) : base(brush, width) { } @@ -36,7 +36,7 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The pattern. - public Pen(IBrush brush, float width, float[] pattern) + public Pen(IBrush brush, float width, float[] pattern) : base(brush, width, pattern) { } @@ -45,7 +45,7 @@ namespace ImageSharp.Drawing.Pens /// Initializes a new instance of the class. /// /// The pen. - internal Pen(Pen pen) + internal Pen(Pen pen) : base(pen) { } diff --git a/src/ImageSharp.Drawing/Pens/Pens.cs b/src/ImageSharp.Drawing/Pens/Pens.cs index 039b7113f..532774f22 100644 --- a/src/ImageSharp.Drawing/Pens/Pens.cs +++ b/src/ImageSharp.Drawing/Pens/Pens.cs @@ -16,7 +16,7 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen Solid(Color color, float width) => new Pen(color, width); + public static Pen Solid(Rgba32 color, float width) => new Pen(color, width); /// /// Create a solid pen with out any drawing patterns @@ -24,7 +24,7 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen Solid(IBrush brush, float width) => new Pen(brush, width); + public static Pen Solid(IBrush brush, float width) => new Pen(brush, width); /// /// Create a pen with a 'Dash' drawing patterns @@ -32,7 +32,7 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen Dash(Color color, float width) => new Pen(Pens.Dash(color, width)); + public static Pen Dash(Rgba32 color, float width) => new Pen(Pens.Dash(color, width)); /// /// Create a pen with a 'Dash' drawing patterns @@ -40,7 +40,7 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen Dash(IBrush brush, float width) => new Pen(Pens.Dash(brush, width)); + public static Pen Dash(IBrush brush, float width) => new Pen(Pens.Dash(brush, width)); /// /// Create a pen with a 'Dot' drawing patterns @@ -48,7 +48,7 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen Dot(Color color, float width) => new Pen(Pens.Dot(color, width)); + public static Pen Dot(Rgba32 color, float width) => new Pen(Pens.Dot(color, width)); /// /// Create a pen with a 'Dot' drawing patterns @@ -56,7 +56,7 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen Dot(IBrush brush, float width) => new Pen(Pens.Dot(brush, width)); + public static Pen Dot(IBrush brush, float width) => new Pen(Pens.Dot(brush, width)); /// /// Create a pen with a 'Dash Dot' drawing patterns @@ -64,7 +64,7 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen DashDot(Color color, float width) => new Pen(Pens.DashDot(color, width)); + public static Pen DashDot(Rgba32 color, float width) => new Pen(Pens.DashDot(color, width)); /// /// Create a pen with a 'Dash Dot' drawing patterns @@ -72,7 +72,7 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen DashDot(IBrush brush, float width) => new Pen(Pens.DashDot(brush, width)); + public static Pen DashDot(IBrush brush, float width) => new Pen(Pens.DashDot(brush, width)); /// /// Create a pen with a 'Dash Dot Dot' drawing patterns @@ -80,7 +80,7 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen DashDotDot(Color color, float width) => new Pen(Pens.DashDotDot(color, width)); + public static Pen DashDotDot(Rgba32 color, float width) => new Pen(Pens.DashDotDot(color, width)); /// /// Create a pen with a 'Dash Dot Dot' drawing patterns @@ -88,6 +88,6 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen DashDotDot(IBrush brush, float width) => new Pen(Pens.DashDotDot(brush, width)); + public static Pen DashDotDot(IBrush brush, float width) => new Pen(Pens.DashDotDot(brush, width)); } } \ No newline at end of file diff --git a/src/ImageSharp/Colors/Color.Definitions.cs b/src/ImageSharp/Colors/Color.Definitions.cs deleted file mode 100644 index 4bc0d486a..000000000 --- a/src/ImageSharp/Colors/Color.Definitions.cs +++ /dev/null @@ -1,728 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp -{ - /// - /// Packed vector type containing four 8-bit unsigned normalized values ranging from 0 to 255. - /// The color components are stored in red, green, blue, and alpha order. - /// - /// - /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, - /// as it avoids the need to create new values for modification operations. - /// - public partial struct Color - { - /// - /// Represents a matching the W3C definition that has an hex value of #F0F8FF. - /// - public static readonly Color AliceBlue = NamedColors.AliceBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #FAEBD7. - /// - public static readonly Color AntiqueWhite = NamedColors.AntiqueWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FFFF. - /// - public static readonly Color Aqua = NamedColors.Aqua; - - /// - /// Represents a matching the W3C definition that has an hex value of #7FFFD4. - /// - public static readonly Color Aquamarine = NamedColors.Aquamarine; - - /// - /// Represents a matching the W3C definition that has an hex value of #F0FFFF. - /// - public static readonly Color Azure = NamedColors.Azure; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5F5DC. - /// - public static readonly Color Beige = NamedColors.Beige; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4C4. - /// - public static readonly Color Bisque = NamedColors.Bisque; - - /// - /// Represents a matching the W3C definition that has an hex value of #000000. - /// - public static readonly Color Black = NamedColors.Black; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFEBCD. - /// - public static readonly Color BlanchedAlmond = NamedColors.BlanchedAlmond; - - /// - /// Represents a matching the W3C definition that has an hex value of #0000FF. - /// - public static readonly Color Blue = NamedColors.Blue; - - /// - /// Represents a matching the W3C definition that has an hex value of #8A2BE2. - /// - public static readonly Color BlueViolet = NamedColors.BlueViolet; - - /// - /// Represents a matching the W3C definition that has an hex value of #A52A2A. - /// - public static readonly Color Brown = NamedColors.Brown; - - /// - /// Represents a matching the W3C definition that has an hex value of #DEB887. - /// - public static readonly Color BurlyWood = NamedColors.BurlyWood; - - /// - /// Represents a matching the W3C definition that has an hex value of #5F9EA0. - /// - public static readonly Color CadetBlue = NamedColors.CadetBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #7FFF00. - /// - public static readonly Color Chartreuse = NamedColors.Chartreuse; - - /// - /// Represents a matching the W3C definition that has an hex value of #D2691E. - /// - public static readonly Color Chocolate = NamedColors.Chocolate; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF7F50. - /// - public static readonly Color Coral = NamedColors.Coral; - - /// - /// Represents a matching the W3C definition that has an hex value of #6495ED. - /// - public static readonly Color CornflowerBlue = NamedColors.CornflowerBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF8DC. - /// - public static readonly Color Cornsilk = NamedColors.Cornsilk; - - /// - /// Represents a matching the W3C definition that has an hex value of #DC143C. - /// - public static readonly Color Crimson = NamedColors.Crimson; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FFFF. - /// - public static readonly Color Cyan = NamedColors.Cyan; - - /// - /// Represents a matching the W3C definition that has an hex value of #00008B. - /// - public static readonly Color DarkBlue = NamedColors.DarkBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #008B8B. - /// - public static readonly Color DarkCyan = NamedColors.DarkCyan; - - /// - /// Represents a matching the W3C definition that has an hex value of #B8860B. - /// - public static readonly Color DarkGoldenrod = NamedColors.DarkGoldenrod; - - /// - /// Represents a matching the W3C definition that has an hex value of #A9A9A9. - /// - public static readonly Color DarkGray = NamedColors.DarkGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #006400. - /// - public static readonly Color DarkGreen = NamedColors.DarkGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #BDB76B. - /// - public static readonly Color DarkKhaki = NamedColors.DarkKhaki; - - /// - /// Represents a matching the W3C definition that has an hex value of #8B008B. - /// - public static readonly Color DarkMagenta = NamedColors.DarkMagenta; - - /// - /// Represents a matching the W3C definition that has an hex value of #556B2F. - /// - public static readonly Color DarkOliveGreen = NamedColors.DarkOliveGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF8C00. - /// - public static readonly Color DarkOrange = NamedColors.DarkOrange; - - /// - /// Represents a matching the W3C definition that has an hex value of #9932CC. - /// - public static readonly Color DarkOrchid = NamedColors.DarkOrchid; - - /// - /// Represents a matching the W3C definition that has an hex value of #8B0000. - /// - public static readonly Color DarkRed = NamedColors.DarkRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #E9967A. - /// - public static readonly Color DarkSalmon = NamedColors.DarkSalmon; - - /// - /// Represents a matching the W3C definition that has an hex value of #8FBC8B. - /// - public static readonly Color DarkSeaGreen = NamedColors.DarkSeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #483D8B. - /// - public static readonly Color DarkSlateBlue = NamedColors.DarkSlateBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #2F4F4F. - /// - public static readonly Color DarkSlateGray = NamedColors.DarkSlateGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #00CED1. - /// - public static readonly Color DarkTurquoise = NamedColors.DarkTurquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #9400D3. - /// - public static readonly Color DarkViolet = NamedColors.DarkViolet; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF1493. - /// - public static readonly Color DeepPink = NamedColors.DeepPink; - - /// - /// Represents a matching the W3C definition that has an hex value of #00BFFF. - /// - public static readonly Color DeepSkyBlue = NamedColors.DeepSkyBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #696969. - /// - public static readonly Color DimGray = NamedColors.DimGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #1E90FF. - /// - public static readonly Color DodgerBlue = NamedColors.DodgerBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #B22222. - /// - public static readonly Color Firebrick = NamedColors.Firebrick; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFAF0. - /// - public static readonly Color FloralWhite = NamedColors.FloralWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #228B22. - /// - public static readonly Color ForestGreen = NamedColors.ForestGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF00FF. - /// - public static readonly Color Fuchsia = NamedColors.Fuchsia; - - /// - /// Represents a matching the W3C definition that has an hex value of #DCDCDC. - /// - public static readonly Color Gainsboro = NamedColors.Gainsboro; - - /// - /// Represents a matching the W3C definition that has an hex value of #F8F8FF. - /// - public static readonly Color GhostWhite = NamedColors.GhostWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFD700. - /// - public static readonly Color Gold = NamedColors.Gold; - - /// - /// Represents a matching the W3C definition that has an hex value of #DAA520. - /// - public static readonly Color Goldenrod = NamedColors.Goldenrod; - - /// - /// Represents a matching the W3C definition that has an hex value of #808080. - /// - public static readonly Color Gray = NamedColors.Gray; - - /// - /// Represents a matching the W3C definition that has an hex value of #008000. - /// - public static readonly Color Green = NamedColors.Green; - - /// - /// Represents a matching the W3C definition that has an hex value of #ADFF2F. - /// - public static readonly Color GreenYellow = NamedColors.GreenYellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #F0FFF0. - /// - public static readonly Color Honeydew = NamedColors.Honeydew; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF69B4. - /// - public static readonly Color HotPink = NamedColors.HotPink; - - /// - /// Represents a matching the W3C definition that has an hex value of #CD5C5C. - /// - public static readonly Color IndianRed = NamedColors.IndianRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #4B0082. - /// - public static readonly Color Indigo = NamedColors.Indigo; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFF0. - /// - public static readonly Color Ivory = NamedColors.Ivory; - - /// - /// Represents a matching the W3C definition that has an hex value of #F0E68C. - /// - public static readonly Color Khaki = NamedColors.Khaki; - - /// - /// Represents a matching the W3C definition that has an hex value of #E6E6FA. - /// - public static readonly Color Lavender = NamedColors.Lavender; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF0F5. - /// - public static readonly Color LavenderBlush = NamedColors.LavenderBlush; - - /// - /// Represents a matching the W3C definition that has an hex value of #7CFC00. - /// - public static readonly Color LawnGreen = NamedColors.LawnGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFACD. - /// - public static readonly Color LemonChiffon = NamedColors.LemonChiffon; - - /// - /// Represents a matching the W3C definition that has an hex value of #ADD8E6. - /// - public static readonly Color LightBlue = NamedColors.LightBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #F08080. - /// - public static readonly Color LightCoral = NamedColors.LightCoral; - - /// - /// Represents a matching the W3C definition that has an hex value of #E0FFFF. - /// - public static readonly Color LightCyan = NamedColors.LightCyan; - - /// - /// Represents a matching the W3C definition that has an hex value of #FAFAD2. - /// - public static readonly Color LightGoldenrodYellow = NamedColors.LightGoldenrodYellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #D3D3D3. - /// - public static readonly Color LightGray = NamedColors.LightGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #90EE90. - /// - public static readonly Color LightGreen = NamedColors.LightGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFB6C1. - /// - public static readonly Color LightPink = NamedColors.LightPink; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFA07A. - /// - public static readonly Color LightSalmon = NamedColors.LightSalmon; - - /// - /// Represents a matching the W3C definition that has an hex value of #20B2AA. - /// - public static readonly Color LightSeaGreen = NamedColors.LightSeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #87CEFA. - /// - public static readonly Color LightSkyBlue = NamedColors.LightSkyBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #778899. - /// - public static readonly Color LightSlateGray = NamedColors.LightSlateGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #B0C4DE. - /// - public static readonly Color LightSteelBlue = NamedColors.LightSteelBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFE0. - /// - public static readonly Color LightYellow = NamedColors.LightYellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FF00. - /// - public static readonly Color Lime = NamedColors.Lime; - - /// - /// Represents a matching the W3C definition that has an hex value of #32CD32. - /// - public static readonly Color LimeGreen = NamedColors.LimeGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FAF0E6. - /// - public static readonly Color Linen = NamedColors.Linen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF00FF. - /// - public static readonly Color Magenta = NamedColors.Magenta; - - /// - /// Represents a matching the W3C definition that has an hex value of #800000. - /// - public static readonly Color Maroon = NamedColors.Maroon; - - /// - /// Represents a matching the W3C definition that has an hex value of #66CDAA. - /// - public static readonly Color MediumAquamarine = NamedColors.MediumAquamarine; - - /// - /// Represents a matching the W3C definition that has an hex value of #0000CD. - /// - public static readonly Color MediumBlue = NamedColors.MediumBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #BA55D3. - /// - public static readonly Color MediumOrchid = NamedColors.MediumOrchid; - - /// - /// Represents a matching the W3C definition that has an hex value of #9370DB. - /// - public static readonly Color MediumPurple = NamedColors.MediumPurple; - - /// - /// Represents a matching the W3C definition that has an hex value of #3CB371. - /// - public static readonly Color MediumSeaGreen = NamedColors.MediumSeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #7B68EE. - /// - public static readonly Color MediumSlateBlue = NamedColors.MediumSlateBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FA9A. - /// - public static readonly Color MediumSpringGreen = NamedColors.MediumSpringGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #48D1CC. - /// - public static readonly Color MediumTurquoise = NamedColors.MediumTurquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #C71585. - /// - public static readonly Color MediumVioletRed = NamedColors.MediumVioletRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #191970. - /// - public static readonly Color MidnightBlue = NamedColors.MidnightBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5FFFA. - /// - public static readonly Color MintCream = NamedColors.MintCream; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4E1. - /// - public static readonly Color MistyRose = NamedColors.MistyRose; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4B5. - /// - public static readonly Color Moccasin = NamedColors.Moccasin; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFDEAD. - /// - public static readonly Color NavajoWhite = NamedColors.NavajoWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #000080. - /// - public static readonly Color Navy = NamedColors.Navy; - - /// - /// Represents a matching the W3C definition that has an hex value of #FDF5E6. - /// - public static readonly Color OldLace = NamedColors.OldLace; - - /// - /// Represents a matching the W3C definition that has an hex value of #808000. - /// - public static readonly Color Olive = NamedColors.Olive; - - /// - /// Represents a matching the W3C definition that has an hex value of #6B8E23. - /// - public static readonly Color OliveDrab = NamedColors.OliveDrab; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFA500. - /// - public static readonly Color Orange = NamedColors.Orange; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF4500. - /// - public static readonly Color OrangeRed = NamedColors.OrangeRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #DA70D6. - /// - public static readonly Color Orchid = NamedColors.Orchid; - - /// - /// Represents a matching the W3C definition that has an hex value of #EEE8AA. - /// - public static readonly Color PaleGoldenrod = NamedColors.PaleGoldenrod; - - /// - /// Represents a matching the W3C definition that has an hex value of #98FB98. - /// - public static readonly Color PaleGreen = NamedColors.PaleGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #AFEEEE. - /// - public static readonly Color PaleTurquoise = NamedColors.PaleTurquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #DB7093. - /// - public static readonly Color PaleVioletRed = NamedColors.PaleVioletRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFEFD5. - /// - public static readonly Color PapayaWhip = NamedColors.PapayaWhip; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFDAB9. - /// - public static readonly Color PeachPuff = NamedColors.PeachPuff; - - /// - /// Represents a matching the W3C definition that has an hex value of #CD853F. - /// - public static readonly Color Peru = NamedColors.Peru; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFC0CB. - /// - public static readonly Color Pink = NamedColors.Pink; - - /// - /// Represents a matching the W3C definition that has an hex value of #DDA0DD. - /// - public static readonly Color Plum = NamedColors.Plum; - - /// - /// Represents a matching the W3C definition that has an hex value of #B0E0E6. - /// - public static readonly Color PowderBlue = NamedColors.PowderBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #800080. - /// - public static readonly Color Purple = NamedColors.Purple; - - /// - /// Represents a matching the W3C definition that has an hex value of #663399. - /// - public static readonly Color RebeccaPurple = NamedColors.RebeccaPurple; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF0000. - /// - public static readonly Color Red = NamedColors.Red; - - /// - /// Represents a matching the W3C definition that has an hex value of #BC8F8F. - /// - public static readonly Color RosyBrown = NamedColors.RosyBrown; - - /// - /// Represents a matching the W3C definition that has an hex value of #4169E1. - /// - public static readonly Color RoyalBlue = NamedColors.RoyalBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #8B4513. - /// - public static readonly Color SaddleBrown = NamedColors.SaddleBrown; - - /// - /// Represents a matching the W3C definition that has an hex value of #FA8072. - /// - public static readonly Color Salmon = NamedColors.Salmon; - - /// - /// Represents a matching the W3C definition that has an hex value of #F4A460. - /// - public static readonly Color SandyBrown = NamedColors.SandyBrown; - - /// - /// Represents a matching the W3C definition that has an hex value of #2E8B57. - /// - public static readonly Color SeaGreen = NamedColors.SeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF5EE. - /// - public static readonly Color SeaShell = NamedColors.SeaShell; - - /// - /// Represents a matching the W3C definition that has an hex value of #A0522D. - /// - public static readonly Color Sienna = NamedColors.Sienna; - - /// - /// Represents a matching the W3C definition that has an hex value of #C0C0C0. - /// - public static readonly Color Silver = NamedColors.Silver; - - /// - /// Represents a matching the W3C definition that has an hex value of #87CEEB. - /// - public static readonly Color SkyBlue = NamedColors.SkyBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #6A5ACD. - /// - public static readonly Color SlateBlue = NamedColors.SlateBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #708090. - /// - public static readonly Color SlateGray = NamedColors.SlateGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFAFA. - /// - public static readonly Color Snow = NamedColors.Snow; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FF7F. - /// - public static readonly Color SpringGreen = NamedColors.SpringGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #4682B4. - /// - public static readonly Color SteelBlue = NamedColors.SteelBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #D2B48C. - /// - public static readonly Color Tan = NamedColors.Tan; - - /// - /// Represents a matching the W3C definition that has an hex value of #008080. - /// - public static readonly Color Teal = NamedColors.Teal; - - /// - /// Represents a matching the W3C definition that has an hex value of #D8BFD8. - /// - public static readonly Color Thistle = NamedColors.Thistle; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF6347. - /// - public static readonly Color Tomato = NamedColors.Tomato; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFFF. - /// - public static readonly Color Transparent = NamedColors.Transparent; - - /// - /// Represents a matching the W3C definition that has an hex value of #40E0D0. - /// - public static readonly Color Turquoise = NamedColors.Turquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #EE82EE. - /// - public static readonly Color Violet = NamedColors.Violet; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5DEB3. - /// - public static readonly Color Wheat = NamedColors.Wheat; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFFF. - /// - public static readonly Color White = NamedColors.White; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5F5F5. - /// - public static readonly Color WhiteSmoke = NamedColors.WhiteSmoke; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFF00. - /// - public static readonly Color Yellow = NamedColors.Yellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #9ACD32. - /// - public static readonly Color YellowGreen = NamedColors.YellowGreen; - } -} \ No newline at end of file diff --git a/src/ImageSharp/Colors/ColorConstants.cs b/src/ImageSharp/Colors/ColorConstants.cs index 1397b6da6..3dba721aa 100644 --- a/src/ImageSharp/Colors/ColorConstants.cs +++ b/src/ImageSharp/Colors/ColorConstants.cs @@ -16,163 +16,163 @@ namespace ImageSharp /// /// Provides a lazy, one time method of returning the colors. /// - private static readonly Lazy SafeColors = new Lazy(GetWebSafeColors); + private static readonly Lazy SafeColors = new Lazy(GetWebSafeColors); /// /// Gets a collection of named, web safe, colors as defined in the CSS Color Module Level 4. /// - public static Color[] WebSafeColors => SafeColors.Value; + public static Rgba32[] WebSafeColors => SafeColors.Value; /// /// Returns an array of web safe colors. /// /// The - private static Color[] GetWebSafeColors() + private static Rgba32[] GetWebSafeColors() { - return new List + return new List { - Color.AliceBlue, - Color.AntiqueWhite, - Color.Aqua, - Color.Aquamarine, - Color.Azure, - Color.Beige, - Color.Bisque, - Color.Black, - Color.BlanchedAlmond, - Color.Blue, - Color.BlueViolet, - Color.Brown, - Color.BurlyWood, - Color.CadetBlue, - Color.Chartreuse, - Color.Chocolate, - Color.Coral, - Color.CornflowerBlue, - Color.Cornsilk, - Color.Crimson, - Color.Cyan, - Color.DarkBlue, - Color.DarkCyan, - Color.DarkGoldenrod, - Color.DarkGray, - Color.DarkGreen, - Color.DarkKhaki, - Color.DarkMagenta, - Color.DarkOliveGreen, - Color.DarkOrange, - Color.DarkOrchid, - Color.DarkRed, - Color.DarkSalmon, - Color.DarkSeaGreen, - Color.DarkSlateBlue, - Color.DarkSlateGray, - Color.DarkTurquoise, - Color.DarkViolet, - Color.DeepPink, - Color.DeepSkyBlue, - Color.DimGray, - Color.DodgerBlue, - Color.Firebrick, - Color.FloralWhite, - Color.ForestGreen, - Color.Fuchsia, - Color.Gainsboro, - Color.GhostWhite, - Color.Gold, - Color.Goldenrod, - Color.Gray, - Color.Green, - Color.GreenYellow, - Color.Honeydew, - Color.HotPink, - Color.IndianRed, - Color.Indigo, - Color.Ivory, - Color.Khaki, - Color.Lavender, - Color.LavenderBlush, - Color.LawnGreen, - Color.LemonChiffon, - Color.LightBlue, - Color.LightCoral, - Color.LightCyan, - Color.LightGoldenrodYellow, - Color.LightGray, - Color.LightGreen, - Color.LightPink, - Color.LightSalmon, - Color.LightSeaGreen, - Color.LightSkyBlue, - Color.LightSlateGray, - Color.LightSteelBlue, - Color.LightYellow, - Color.Lime, - Color.LimeGreen, - Color.Linen, - Color.Magenta, - Color.Maroon, - Color.MediumAquamarine, - Color.MediumBlue, - Color.MediumOrchid, - Color.MediumPurple, - Color.MediumSeaGreen, - Color.MediumSlateBlue, - Color.MediumSpringGreen, - Color.MediumTurquoise, - Color.MediumVioletRed, - Color.MidnightBlue, - Color.MintCream, - Color.MistyRose, - Color.Moccasin, - Color.NavajoWhite, - Color.Navy, - Color.OldLace, - Color.Olive, - Color.OliveDrab, - Color.Orange, - Color.OrangeRed, - Color.Orchid, - Color.PaleGoldenrod, - Color.PaleGreen, - Color.PaleTurquoise, - Color.PaleVioletRed, - Color.PapayaWhip, - Color.PeachPuff, - Color.Peru, - Color.Pink, - Color.Plum, - Color.PowderBlue, - Color.Purple, - Color.RebeccaPurple, - Color.Red, - Color.RosyBrown, - Color.RoyalBlue, - Color.SaddleBrown, - Color.Salmon, - Color.SandyBrown, - Color.SeaGreen, - Color.SeaShell, - Color.Sienna, - Color.Silver, - Color.SkyBlue, - Color.SlateBlue, - Color.SlateGray, - Color.Snow, - Color.SpringGreen, - Color.SteelBlue, - Color.Tan, - Color.Teal, - Color.Thistle, - Color.Tomato, - Color.Transparent, - Color.Turquoise, - Color.Violet, - Color.Wheat, - Color.White, - Color.WhiteSmoke, - Color.Yellow, - Color.YellowGreen + Rgba32.AliceBlue, + Rgba32.AntiqueWhite, + Rgba32.Aqua, + Rgba32.Aquamarine, + Rgba32.Azure, + Rgba32.Beige, + Rgba32.Bisque, + Rgba32.Black, + Rgba32.BlanchedAlmond, + Rgba32.Blue, + Rgba32.BlueViolet, + Rgba32.Brown, + Rgba32.BurlyWood, + Rgba32.CadetBlue, + Rgba32.Chartreuse, + Rgba32.Chocolate, + Rgba32.Coral, + Rgba32.CornflowerBlue, + Rgba32.Cornsilk, + Rgba32.Crimson, + Rgba32.Cyan, + Rgba32.DarkBlue, + Rgba32.DarkCyan, + Rgba32.DarkGoldenrod, + Rgba32.DarkGray, + Rgba32.DarkGreen, + Rgba32.DarkKhaki, + Rgba32.DarkMagenta, + Rgba32.DarkOliveGreen, + Rgba32.DarkOrange, + Rgba32.DarkOrchid, + Rgba32.DarkRed, + Rgba32.DarkSalmon, + Rgba32.DarkSeaGreen, + Rgba32.DarkSlateBlue, + Rgba32.DarkSlateGray, + Rgba32.DarkTurquoise, + Rgba32.DarkViolet, + Rgba32.DeepPink, + Rgba32.DeepSkyBlue, + Rgba32.DimGray, + Rgba32.DodgerBlue, + Rgba32.Firebrick, + Rgba32.FloralWhite, + Rgba32.ForestGreen, + Rgba32.Fuchsia, + Rgba32.Gainsboro, + Rgba32.GhostWhite, + Rgba32.Gold, + Rgba32.Goldenrod, + Rgba32.Gray, + Rgba32.Green, + Rgba32.GreenYellow, + Rgba32.Honeydew, + Rgba32.HotPink, + Rgba32.IndianRed, + Rgba32.Indigo, + Rgba32.Ivory, + Rgba32.Khaki, + Rgba32.Lavender, + Rgba32.LavenderBlush, + Rgba32.LawnGreen, + Rgba32.LemonChiffon, + Rgba32.LightBlue, + Rgba32.LightCoral, + Rgba32.LightCyan, + Rgba32.LightGoldenrodYellow, + Rgba32.LightGray, + Rgba32.LightGreen, + Rgba32.LightPink, + Rgba32.LightSalmon, + Rgba32.LightSeaGreen, + Rgba32.LightSkyBlue, + Rgba32.LightSlateGray, + Rgba32.LightSteelBlue, + Rgba32.LightYellow, + Rgba32.Lime, + Rgba32.LimeGreen, + Rgba32.Linen, + Rgba32.Magenta, + Rgba32.Maroon, + Rgba32.MediumAquamarine, + Rgba32.MediumBlue, + Rgba32.MediumOrchid, + Rgba32.MediumPurple, + Rgba32.MediumSeaGreen, + Rgba32.MediumSlateBlue, + Rgba32.MediumSpringGreen, + Rgba32.MediumTurquoise, + Rgba32.MediumVioletRed, + Rgba32.MidnightBlue, + Rgba32.MintCream, + Rgba32.MistyRose, + Rgba32.Moccasin, + Rgba32.NavajoWhite, + Rgba32.Navy, + Rgba32.OldLace, + Rgba32.Olive, + Rgba32.OliveDrab, + Rgba32.Orange, + Rgba32.OrangeRed, + Rgba32.Orchid, + Rgba32.PaleGoldenrod, + Rgba32.PaleGreen, + Rgba32.PaleTurquoise, + Rgba32.PaleVioletRed, + Rgba32.PapayaWhip, + Rgba32.PeachPuff, + Rgba32.Peru, + Rgba32.Pink, + Rgba32.Plum, + Rgba32.PowderBlue, + Rgba32.Purple, + Rgba32.RebeccaPurple, + Rgba32.Red, + Rgba32.RosyBrown, + Rgba32.RoyalBlue, + Rgba32.SaddleBrown, + Rgba32.Salmon, + Rgba32.SandyBrown, + Rgba32.SeaGreen, + Rgba32.SeaShell, + Rgba32.Sienna, + Rgba32.Silver, + Rgba32.SkyBlue, + Rgba32.SlateBlue, + Rgba32.SlateGray, + Rgba32.Snow, + Rgba32.SpringGreen, + Rgba32.SteelBlue, + Rgba32.Tan, + Rgba32.Teal, + Rgba32.Thistle, + Rgba32.Tomato, + Rgba32.Transparent, + Rgba32.Turquoise, + Rgba32.Violet, + Rgba32.Wheat, + Rgba32.White, + Rgba32.WhiteSmoke, + Rgba32.Yellow, + Rgba32.YellowGreen }.ToArray(); } } diff --git a/src/ImageSharp/Colors/ColorVector.Definitions.cs b/src/ImageSharp/Colors/ColorVector.Definitions.cs deleted file mode 100644 index 150b7209c..000000000 --- a/src/ImageSharp/Colors/ColorVector.Definitions.cs +++ /dev/null @@ -1,728 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp -{ - /// - /// Unpacked pixel type containing four 16-bit floating-point values typically ranging from 0 to 1. - /// The color components are stored in red, green, blue, and alpha order. - /// - /// - /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, - /// as it avoids the need to create new values for modification operations. - /// - public partial struct ColorVector - { - /// - /// Represents a matching the W3C definition that has an hex value of #F0F8FF. - /// - public static readonly ColorVector AliceBlue = NamedColors.AliceBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #FAEBD7. - /// - public static readonly ColorVector AntiqueWhite = NamedColors.AntiqueWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FFFF. - /// - public static readonly ColorVector Aqua = NamedColors.Aqua; - - /// - /// Represents a matching the W3C definition that has an hex value of #7FFFD4. - /// - public static readonly ColorVector Aquamarine = NamedColors.Aquamarine; - - /// - /// Represents a matching the W3C definition that has an hex value of #F0FFFF. - /// - public static readonly ColorVector Azure = NamedColors.Azure; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5F5DC. - /// - public static readonly ColorVector Beige = NamedColors.Beige; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4C4. - /// - public static readonly ColorVector Bisque = NamedColors.Bisque; - - /// - /// Represents a matching the W3C definition that has an hex value of #000000. - /// - public static readonly ColorVector Black = NamedColors.Black; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFEBCD. - /// - public static readonly ColorVector BlanchedAlmond = NamedColors.BlanchedAlmond; - - /// - /// Represents a matching the W3C definition that has an hex value of #0000FF. - /// - public static readonly ColorVector Blue = NamedColors.Blue; - - /// - /// Represents a matching the W3C definition that has an hex value of #8A2BE2. - /// - public static readonly ColorVector BlueViolet = NamedColors.BlueViolet; - - /// - /// Represents a matching the W3C definition that has an hex value of #A52A2A. - /// - public static readonly ColorVector Brown = NamedColors.Brown; - - /// - /// Represents a matching the W3C definition that has an hex value of #DEB887. - /// - public static readonly ColorVector BurlyWood = NamedColors.BurlyWood; - - /// - /// Represents a matching the W3C definition that has an hex value of #5F9EA0. - /// - public static readonly ColorVector CadetBlue = NamedColors.CadetBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #7FFF00. - /// - public static readonly ColorVector Chartreuse = NamedColors.Chartreuse; - - /// - /// Represents a matching the W3C definition that has an hex value of #D2691E. - /// - public static readonly ColorVector Chocolate = NamedColors.Chocolate; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF7F50. - /// - public static readonly ColorVector Coral = NamedColors.Coral; - - /// - /// Represents a matching the W3C definition that has an hex value of #6495ED. - /// - public static readonly ColorVector CornflowerBlue = NamedColors.CornflowerBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF8DC. - /// - public static readonly ColorVector Cornsilk = NamedColors.Cornsilk; - - /// - /// Represents a matching the W3C definition that has an hex value of #DC143C. - /// - public static readonly ColorVector Crimson = NamedColors.Crimson; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FFFF. - /// - public static readonly ColorVector Cyan = NamedColors.Cyan; - - /// - /// Represents a matching the W3C definition that has an hex value of #00008B. - /// - public static readonly ColorVector DarkBlue = NamedColors.DarkBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #008B8B. - /// - public static readonly ColorVector DarkCyan = NamedColors.DarkCyan; - - /// - /// Represents a matching the W3C definition that has an hex value of #B8860B. - /// - public static readonly ColorVector DarkGoldenrod = NamedColors.DarkGoldenrod; - - /// - /// Represents a matching the W3C definition that has an hex value of #A9A9A9. - /// - public static readonly ColorVector DarkGray = NamedColors.DarkGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #006400. - /// - public static readonly ColorVector DarkGreen = NamedColors.DarkGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #BDB76B. - /// - public static readonly ColorVector DarkKhaki = NamedColors.DarkKhaki; - - /// - /// Represents a matching the W3C definition that has an hex value of #8B008B. - /// - public static readonly ColorVector DarkMagenta = NamedColors.DarkMagenta; - - /// - /// Represents a matching the W3C definition that has an hex value of #556B2F. - /// - public static readonly ColorVector DarkOliveGreen = NamedColors.DarkOliveGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF8C00. - /// - public static readonly ColorVector DarkOrange = NamedColors.DarkOrange; - - /// - /// Represents a matching the W3C definition that has an hex value of #9932CC. - /// - public static readonly ColorVector DarkOrchid = NamedColors.DarkOrchid; - - /// - /// Represents a matching the W3C definition that has an hex value of #8B0000. - /// - public static readonly ColorVector DarkRed = NamedColors.DarkRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #E9967A. - /// - public static readonly ColorVector DarkSalmon = NamedColors.DarkSalmon; - - /// - /// Represents a matching the W3C definition that has an hex value of #8FBC8B. - /// - public static readonly ColorVector DarkSeaGreen = NamedColors.DarkSeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #483D8B. - /// - public static readonly ColorVector DarkSlateBlue = NamedColors.DarkSlateBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #2F4F4F. - /// - public static readonly ColorVector DarkSlateGray = NamedColors.DarkSlateGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #00CED1. - /// - public static readonly ColorVector DarkTurquoise = NamedColors.DarkTurquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #9400D3. - /// - public static readonly ColorVector DarkViolet = NamedColors.DarkViolet; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF1493. - /// - public static readonly ColorVector DeepPink = NamedColors.DeepPink; - - /// - /// Represents a matching the W3C definition that has an hex value of #00BFFF. - /// - public static readonly ColorVector DeepSkyBlue = NamedColors.DeepSkyBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #696969. - /// - public static readonly ColorVector DimGray = NamedColors.DimGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #1E90FF. - /// - public static readonly ColorVector DodgerBlue = NamedColors.DodgerBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #B22222. - /// - public static readonly ColorVector Firebrick = NamedColors.Firebrick; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFAF0. - /// - public static readonly ColorVector FloralWhite = NamedColors.FloralWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #228B22. - /// - public static readonly ColorVector ForestGreen = NamedColors.ForestGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF00FF. - /// - public static readonly ColorVector Fuchsia = NamedColors.Fuchsia; - - /// - /// Represents a matching the W3C definition that has an hex value of #DCDCDC. - /// - public static readonly ColorVector Gainsboro = NamedColors.Gainsboro; - - /// - /// Represents a matching the W3C definition that has an hex value of #F8F8FF. - /// - public static readonly ColorVector GhostWhite = NamedColors.GhostWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFD700. - /// - public static readonly ColorVector Gold = NamedColors.Gold; - - /// - /// Represents a matching the W3C definition that has an hex value of #DAA520. - /// - public static readonly ColorVector Goldenrod = NamedColors.Goldenrod; - - /// - /// Represents a matching the W3C definition that has an hex value of #808080. - /// - public static readonly ColorVector Gray = NamedColors.Gray; - - /// - /// Represents a matching the W3C definition that has an hex value of #008000. - /// - public static readonly ColorVector Green = NamedColors.Green; - - /// - /// Represents a matching the W3C definition that has an hex value of #ADFF2F. - /// - public static readonly ColorVector GreenYellow = NamedColors.GreenYellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #F0FFF0. - /// - public static readonly ColorVector Honeydew = NamedColors.Honeydew; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF69B4. - /// - public static readonly ColorVector HotPink = NamedColors.HotPink; - - /// - /// Represents a matching the W3C definition that has an hex value of #CD5C5C. - /// - public static readonly ColorVector IndianRed = NamedColors.IndianRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #4B0082. - /// - public static readonly ColorVector Indigo = NamedColors.Indigo; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFF0. - /// - public static readonly ColorVector Ivory = NamedColors.Ivory; - - /// - /// Represents a matching the W3C definition that has an hex value of #F0E68C. - /// - public static readonly ColorVector Khaki = NamedColors.Khaki; - - /// - /// Represents a matching the W3C definition that has an hex value of #E6E6FA. - /// - public static readonly ColorVector Lavender = NamedColors.Lavender; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF0F5. - /// - public static readonly ColorVector LavenderBlush = NamedColors.LavenderBlush; - - /// - /// Represents a matching the W3C definition that has an hex value of #7CFC00. - /// - public static readonly ColorVector LawnGreen = NamedColors.LawnGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFACD. - /// - public static readonly ColorVector LemonChiffon = NamedColors.LemonChiffon; - - /// - /// Represents a matching the W3C definition that has an hex value of #ADD8E6. - /// - public static readonly ColorVector LightBlue = NamedColors.LightBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #F08080. - /// - public static readonly ColorVector LightCoral = NamedColors.LightCoral; - - /// - /// Represents a matching the W3C definition that has an hex value of #E0FFFF. - /// - public static readonly ColorVector LightCyan = NamedColors.LightCyan; - - /// - /// Represents a matching the W3C definition that has an hex value of #FAFAD2. - /// - public static readonly ColorVector LightGoldenrodYellow = NamedColors.LightGoldenrodYellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #D3D3D3. - /// - public static readonly ColorVector LightGray = NamedColors.LightGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #90EE90. - /// - public static readonly ColorVector LightGreen = NamedColors.LightGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFB6C1. - /// - public static readonly ColorVector LightPink = NamedColors.LightPink; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFA07A. - /// - public static readonly ColorVector LightSalmon = NamedColors.LightSalmon; - - /// - /// Represents a matching the W3C definition that has an hex value of #20B2AA. - /// - public static readonly ColorVector LightSeaGreen = NamedColors.LightSeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #87CEFA. - /// - public static readonly ColorVector LightSkyBlue = NamedColors.LightSkyBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #778899. - /// - public static readonly ColorVector LightSlateGray = NamedColors.LightSlateGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #B0C4DE. - /// - public static readonly ColorVector LightSteelBlue = NamedColors.LightSteelBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFE0. - /// - public static readonly ColorVector LightYellow = NamedColors.LightYellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FF00. - /// - public static readonly ColorVector Lime = NamedColors.Lime; - - /// - /// Represents a matching the W3C definition that has an hex value of #32CD32. - /// - public static readonly ColorVector LimeGreen = NamedColors.LimeGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FAF0E6. - /// - public static readonly ColorVector Linen = NamedColors.Linen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF00FF. - /// - public static readonly ColorVector Magenta = NamedColors.Magenta; - - /// - /// Represents a matching the W3C definition that has an hex value of #800000. - /// - public static readonly ColorVector Maroon = NamedColors.Maroon; - - /// - /// Represents a matching the W3C definition that has an hex value of #66CDAA. - /// - public static readonly ColorVector MediumAquamarine = NamedColors.MediumAquamarine; - - /// - /// Represents a matching the W3C definition that has an hex value of #0000CD. - /// - public static readonly ColorVector MediumBlue = NamedColors.MediumBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #BA55D3. - /// - public static readonly ColorVector MediumOrchid = NamedColors.MediumOrchid; - - /// - /// Represents a matching the W3C definition that has an hex value of #9370DB. - /// - public static readonly ColorVector MediumPurple = NamedColors.MediumPurple; - - /// - /// Represents a matching the W3C definition that has an hex value of #3CB371. - /// - public static readonly ColorVector MediumSeaGreen = NamedColors.MediumSeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #7B68EE. - /// - public static readonly ColorVector MediumSlateBlue = NamedColors.MediumSlateBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FA9A. - /// - public static readonly ColorVector MediumSpringGreen = NamedColors.MediumSpringGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #48D1CC. - /// - public static readonly ColorVector MediumTurquoise = NamedColors.MediumTurquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #C71585. - /// - public static readonly ColorVector MediumVioletRed = NamedColors.MediumVioletRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #191970. - /// - public static readonly ColorVector MidnightBlue = NamedColors.MidnightBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5FFFA. - /// - public static readonly ColorVector MintCream = NamedColors.MintCream; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4E1. - /// - public static readonly ColorVector MistyRose = NamedColors.MistyRose; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4B5. - /// - public static readonly ColorVector Moccasin = NamedColors.Moccasin; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFDEAD. - /// - public static readonly ColorVector NavajoWhite = NamedColors.NavajoWhite; - - /// - /// Represents a matching the W3C definition that has an hex value of #000080. - /// - public static readonly ColorVector Navy = NamedColors.Navy; - - /// - /// Represents a matching the W3C definition that has an hex value of #FDF5E6. - /// - public static readonly ColorVector OldLace = NamedColors.OldLace; - - /// - /// Represents a matching the W3C definition that has an hex value of #808000. - /// - public static readonly ColorVector Olive = NamedColors.Olive; - - /// - /// Represents a matching the W3C definition that has an hex value of #6B8E23. - /// - public static readonly ColorVector OliveDrab = NamedColors.OliveDrab; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFA500. - /// - public static readonly ColorVector Orange = NamedColors.Orange; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF4500. - /// - public static readonly ColorVector OrangeRed = NamedColors.OrangeRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #DA70D6. - /// - public static readonly ColorVector Orchid = NamedColors.Orchid; - - /// - /// Represents a matching the W3C definition that has an hex value of #EEE8AA. - /// - public static readonly ColorVector PaleGoldenrod = NamedColors.PaleGoldenrod; - - /// - /// Represents a matching the W3C definition that has an hex value of #98FB98. - /// - public static readonly ColorVector PaleGreen = NamedColors.PaleGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #AFEEEE. - /// - public static readonly ColorVector PaleTurquoise = NamedColors.PaleTurquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #DB7093. - /// - public static readonly ColorVector PaleVioletRed = NamedColors.PaleVioletRed; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFEFD5. - /// - public static readonly ColorVector PapayaWhip = NamedColors.PapayaWhip; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFDAB9. - /// - public static readonly ColorVector PeachPuff = NamedColors.PeachPuff; - - /// - /// Represents a matching the W3C definition that has an hex value of #CD853F. - /// - public static readonly ColorVector Peru = NamedColors.Peru; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFC0CB. - /// - public static readonly ColorVector Pink = NamedColors.Pink; - - /// - /// Represents a matching the W3C definition that has an hex value of #DDA0DD. - /// - public static readonly ColorVector Plum = NamedColors.Plum; - - /// - /// Represents a matching the W3C definition that has an hex value of #B0E0E6. - /// - public static readonly ColorVector PowderBlue = NamedColors.PowderBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #800080. - /// - public static readonly ColorVector Purple = NamedColors.Purple; - - /// - /// Represents a matching the W3C definition that has an hex value of #663399. - /// - public static readonly ColorVector RebeccaPurple = NamedColors.RebeccaPurple; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF0000. - /// - public static readonly ColorVector Red = NamedColors.Red; - - /// - /// Represents a matching the W3C definition that has an hex value of #BC8F8F. - /// - public static readonly ColorVector RosyBrown = NamedColors.RosyBrown; - - /// - /// Represents a matching the W3C definition that has an hex value of #4169E1. - /// - public static readonly ColorVector RoyalBlue = NamedColors.RoyalBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #8B4513. - /// - public static readonly ColorVector SaddleBrown = NamedColors.SaddleBrown; - - /// - /// Represents a matching the W3C definition that has an hex value of #FA8072. - /// - public static readonly ColorVector Salmon = NamedColors.Salmon; - - /// - /// Represents a matching the W3C definition that has an hex value of #F4A460. - /// - public static readonly ColorVector SandyBrown = NamedColors.SandyBrown; - - /// - /// Represents a matching the W3C definition that has an hex value of #2E8B57. - /// - public static readonly ColorVector SeaGreen = NamedColors.SeaGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF5EE. - /// - public static readonly ColorVector SeaShell = NamedColors.SeaShell; - - /// - /// Represents a matching the W3C definition that has an hex value of #A0522D. - /// - public static readonly ColorVector Sienna = NamedColors.Sienna; - - /// - /// Represents a matching the W3C definition that has an hex value of #C0C0C0. - /// - public static readonly ColorVector Silver = NamedColors.Silver; - - /// - /// Represents a matching the W3C definition that has an hex value of #87CEEB. - /// - public static readonly ColorVector SkyBlue = NamedColors.SkyBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #6A5ACD. - /// - public static readonly ColorVector SlateBlue = NamedColors.SlateBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #708090. - /// - public static readonly ColorVector SlateGray = NamedColors.SlateGray; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFAFA. - /// - public static readonly ColorVector Snow = NamedColors.Snow; - - /// - /// Represents a matching the W3C definition that has an hex value of #00FF7F. - /// - public static readonly ColorVector SpringGreen = NamedColors.SpringGreen; - - /// - /// Represents a matching the W3C definition that has an hex value of #4682B4. - /// - public static readonly ColorVector SteelBlue = NamedColors.SteelBlue; - - /// - /// Represents a matching the W3C definition that has an hex value of #D2B48C. - /// - public static readonly ColorVector Tan = NamedColors.Tan; - - /// - /// Represents a matching the W3C definition that has an hex value of #008080. - /// - public static readonly ColorVector Teal = NamedColors.Teal; - - /// - /// Represents a matching the W3C definition that has an hex value of #D8BFD8. - /// - public static readonly ColorVector Thistle = NamedColors.Thistle; - - /// - /// Represents a matching the W3C definition that has an hex value of #FF6347. - /// - public static readonly ColorVector Tomato = NamedColors.Tomato; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFFF. - /// - public static readonly ColorVector Transparent = NamedColors.Transparent; - - /// - /// Represents a matching the W3C definition that has an hex value of #40E0D0. - /// - public static readonly ColorVector Turquoise = NamedColors.Turquoise; - - /// - /// Represents a matching the W3C definition that has an hex value of #EE82EE. - /// - public static readonly ColorVector Violet = NamedColors.Violet; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5DEB3. - /// - public static readonly ColorVector Wheat = NamedColors.Wheat; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFFF. - /// - public static readonly ColorVector White = NamedColors.White; - - /// - /// Represents a matching the W3C definition that has an hex value of #F5F5F5. - /// - public static readonly ColorVector WhiteSmoke = NamedColors.WhiteSmoke; - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFF00. - /// - public static readonly ColorVector Yellow = NamedColors.Yellow; - - /// - /// Represents a matching the W3C definition that has an hex value of #9ACD32. - /// - public static readonly ColorVector YellowGreen = NamedColors.YellowGreen; - } -} \ No newline at end of file diff --git a/src/ImageSharp/Colors/ColorspaceTransforms.cs b/src/ImageSharp/Colors/ColorspaceTransforms.cs index 480caab33..a08ad9355 100644 --- a/src/ImageSharp/Colors/ColorspaceTransforms.cs +++ b/src/ImageSharp/Colors/ColorspaceTransforms.cs @@ -17,46 +17,46 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct Color + public partial struct Rgba32 { /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// - /// The instance of to convert. + /// The instance of to convert. /// /// An instance of . /// - public static implicit operator Color(Bgra32 color) + public static implicit operator Rgba32(Bgra32 color) { - return new Color(color.R, color.G, color.B, color.A); + return new Rgba32(color.R, color.G, color.B, color.A); } /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// The instance of to convert. /// - /// An instance of . + /// An instance of . /// - public static implicit operator Color(Cmyk cmykColor) + public static implicit operator Rgba32(Cmyk cmykColor) { float r = (1 - cmykColor.C) * (1 - cmykColor.K); float g = (1 - cmykColor.M) * (1 - cmykColor.K); float b = (1 - cmykColor.Y) * (1 - cmykColor.K); - return new Color(r, g, b, 1); + return new Rgba32(r, g, b, 1); } /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// The instance of to convert. /// - /// An instance of . + /// An instance of . /// - public static implicit operator Color(YCbCr color) + public static implicit operator Rgba32(YCbCr color) { float y = color.Y; float cb = color.Cb - 128; @@ -66,18 +66,18 @@ namespace ImageSharp byte g = (byte)(y - (0.34414F * cb) - (0.71414F * cr)).Clamp(0, 255); byte b = (byte)(y + (1.772F * cb)).Clamp(0, 255); - return new Color(r, g, b); + return new Rgba32(r, g, b); } /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// The instance of to convert. /// - /// An instance of . + /// An instance of . /// - public static implicit operator Color(CieXyz color) + public static implicit operator Rgba32(CieXyz color) { float x = color.X / 100F; float y = color.Y / 100F; @@ -89,25 +89,25 @@ namespace ImageSharp float b = (x * 0.0557F) + (y * -0.2040F) + (z * 1.0570F); Vector4 vector = new Vector4(r, g, b, 1).Compress(); - return new Color(vector); + return new Rgba32(vector); } /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// The instance of to convert. /// - /// An instance of . + /// An instance of . /// - public static implicit operator Color(Hsv color) + public static implicit operator Rgba32(Hsv color) { float s = color.S; float v = color.V; if (MathF.Abs(s) < Constants.Epsilon) { - return new Color(v, v, v, 1); + return new Rgba32(v, v, v, 1); } float h = (MathF.Abs(color.H - 360) < Constants.Epsilon) ? 0 : color.H / 60; @@ -158,18 +158,18 @@ namespace ImageSharp break; } - return new Color(r, g, b, 1); + return new Rgba32(r, g, b, 1); } /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// The instance of to convert. /// - /// An instance of . + /// An instance of . /// - public static implicit operator Color(Hsl color) + public static implicit operator Rgba32(Hsl color) { float rangedH = color.H / 360F; float r = 0; @@ -195,18 +195,18 @@ namespace ImageSharp } } - return new Color(r, g, b, 1); + return new Rgba32(r, g, b, 1); } /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// The instance of to convert. /// - /// An instance of . + /// An instance of . /// - public static implicit operator Color(CieLab cieLabColor) + public static implicit operator Rgba32(CieLab cieLabColor) { // First convert back to XYZ... float y = (cieLabColor.L + 16F) / 116F; @@ -229,7 +229,7 @@ namespace ImageSharp float g = (x * -0.9689F) + (y * 1.8758F) + (z * 0.0415F); float b = (x * 0.0557F) + (y * -0.2040F) + (z * 1.0570F); - return new Color(new Vector4(r, g, b, 1F).Compress()); + return new Rgba32(new Vector4(r, g, b, 1F).Compress()); } /// diff --git a/src/ImageSharp/Colors/ComponentOrder.cs b/src/ImageSharp/Colors/ComponentOrder.cs index 03fa3bbf8..c3e70b957 100644 --- a/src/ImageSharp/Colors/ComponentOrder.cs +++ b/src/ImageSharp/Colors/ComponentOrder.cs @@ -11,22 +11,22 @@ namespace ImageSharp public enum ComponentOrder { /// - /// Z-> Y-> X order. Equivalent to B-> G-> R in + /// Z-> Y-> X order. Equivalent to B-> G-> R in /// Zyx, /// - /// Z-> Y-> X-> W order. Equivalent to B-> G-> R-> A in + /// Z-> Y-> X-> W order. Equivalent to B-> G-> R-> A in /// Zyxw, /// - /// X-> Y-> Z order. Equivalent to R-> G-> B in + /// X-> Y-> Z order. Equivalent to R-> G-> B in /// Xyz, /// - /// X-> Y-> Z-> W order. Equivalent to R-> G-> B-> A in + /// X-> Y-> Z-> W order. Equivalent to R-> G-> B-> A in /// Xyzw, } diff --git a/src/ImageSharp/Colors/NamedColors{TColor}.cs b/src/ImageSharp/Colors/NamedColors{TColor}.cs index f8080195d..274ab0562 100644 --- a/src/ImageSharp/Colors/NamedColors{TColor}.cs +++ b/src/ImageSharp/Colors/NamedColors{TColor}.cs @@ -5,8 +5,6 @@ namespace ImageSharp { - using System; - /// /// A set of named colors mapped to the provided color space. /// diff --git a/src/ImageSharp/Colors/PackedPixel/IPixel.cs b/src/ImageSharp/Colors/PackedPixel/IPixel.cs index 67e013a42..024ceafb3 100644 --- a/src/ImageSharp/Colors/PackedPixel/IPixel.cs +++ b/src/ImageSharp/Colors/PackedPixel/IPixel.cs @@ -52,7 +52,7 @@ namespace ImageSharp /// /// Expands the packed representation into a given byte array. - /// Output is expanded to X-> Y-> Z order. Equivalent to R-> G-> B in + /// Output is expanded to X-> Y-> Z order. Equivalent to R-> G-> B in /// /// The bytes to set the color in. /// The starting index of the . @@ -60,7 +60,7 @@ namespace ImageSharp /// /// Expands the packed representation into a given byte array. - /// Output is expanded to X-> Y-> Z-> W order. Equivalent to R-> G-> B-> A in + /// Output is expanded to X-> Y-> Z-> W order. Equivalent to R-> G-> B-> A in /// /// The bytes to set the color in. /// The starting index of the . @@ -68,7 +68,7 @@ namespace ImageSharp /// /// Expands the packed representation into a given byte array. - /// Output is expanded to Z-> Y-> X order. Equivalent to B-> G-> R in + /// Output is expanded to Z-> Y-> X order. Equivalent to B-> G-> R in /// /// The bytes to set the color in. /// The starting index of the . @@ -76,7 +76,7 @@ namespace ImageSharp /// /// Expands the packed representation into a given byte array. - /// Output is expanded to Z-> Y-> X-> W order. Equivalent to B-> G-> R-> A in + /// Output is expanded to Z-> Y-> X-> W order. Equivalent to B-> G-> R-> A in /// /// The bytes to set the color in. /// The starting index of the . diff --git a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs b/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs index 13727870c..5e8ad66fe 100644 --- a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs +++ b/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs @@ -299,7 +299,7 @@ namespace ImageSharp /// The private static bool IsStandardNormalizedType(Type type) { - return type == typeof(Color) + return type == typeof(Rgba32) || type == typeof(Argb32) || type == typeof(Alpha8) || type == typeof(Bgr565) diff --git a/src/ImageSharp/Colors/Color.BulkOperations.cs b/src/ImageSharp/Colors/Rgba32.BulkOperations.cs similarity index 77% rename from src/ImageSharp/Colors/Color.BulkOperations.cs rename to src/ImageSharp/Colors/Rgba32.BulkOperations.cs index 2de8222d6..4dc8bb051 100644 --- a/src/ImageSharp/Colors/Color.BulkOperations.cs +++ b/src/ImageSharp/Colors/Rgba32.BulkOperations.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -18,12 +18,12 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct Color + public partial struct Rgba32 { /// - /// implementation optimized for . + /// implementation optimized for . /// - internal class BulkOperations : BulkPixelOperations + internal class BulkOperations : BulkPixelOperations { /// /// SIMD optimized bulk implementation of @@ -42,12 +42,12 @@ namespace ImageSharp /// https://github.com/dotnet/corefx/issues/15957 /// /// - internal static unsafe void ToVector4SimdAligned(BufferSpan sourceColors, BufferSpan destVectors, int count) + internal static unsafe void ToVector4SimdAligned(BufferSpan sourceColors, BufferSpan destVectors, int count) { if (!Vector.IsHardwareAccelerated) { throw new InvalidOperationException( - "Color32.BulkOperations.ToVector4SimdAligned() should not be called when Vector.IsHardwareAccelerated == false!"); + "Rgba32.BulkOperations.ToVector4SimdAligned() should not be called when Vector.IsHardwareAccelerated == false!"); } int vecSize = Vector.Count; @@ -64,7 +64,7 @@ namespace ImageSharp int unpackedRawCount = count * 4; - ref uint src = ref Unsafe.As(ref sourceColors.DangerousGetPinnableReference()); + ref uint src = ref Unsafe.As(ref sourceColors.DangerousGetPinnableReference()); using (Buffer tempBuf = new Buffer( unpackedRawCount + Vector.Count)) @@ -100,7 +100,7 @@ namespace ImageSharp } /// - internal override void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count) + internal override void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count) { if (count < 256 || !Vector.IsHardwareAccelerated) { @@ -127,103 +127,103 @@ namespace ImageSharp } /// - internal override void PackFromXyzBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal override void PackFromXyzBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref RGB24 sourceRef = ref Unsafe.As(ref sourceBytes.DangerousGetPinnableReference()); - ref Color destRef = ref destColors.DangerousGetPinnableReference(); + ref Rgba32 destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { ref RGB24 sp = ref Unsafe.Add(ref sourceRef, i); - ref Color dp = ref Unsafe.Add(ref destRef, i); + ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); - Unsafe.As(ref dp) = sp; + Unsafe.As(ref dp) = sp; dp.A = 255; } } /// - internal override void ToXyzBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal override void ToXyzBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref Color sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref Rgba32 sourceRef = ref sourceColors.DangerousGetPinnableReference(); ref RGB24 destRef = ref Unsafe.As(ref destBytes.DangerousGetPinnableReference()); for (int i = 0; i < count; i++) { - ref Color sp = ref Unsafe.Add(ref sourceRef, i); + ref Rgba32 sp = ref Unsafe.Add(ref sourceRef, i); ref RGB24 dp = ref Unsafe.Add(ref destRef, i); - dp = Unsafe.As(ref sp); + dp = Unsafe.As(ref sp); } } /// - internal override unsafe void PackFromXyzwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal override unsafe void PackFromXyzwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { - BufferSpan.Copy(sourceBytes, destColors.AsBytes(), count * sizeof(Color)); + BufferSpan.Copy(sourceBytes, destColors.AsBytes(), count * sizeof(Rgba32)); } /// - internal override unsafe void ToXyzwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal override unsafe void ToXyzwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - BufferSpan.Copy(sourceColors.AsBytes(), destBytes, count * sizeof(Color)); + BufferSpan.Copy(sourceColors.AsBytes(), destBytes, count * sizeof(Rgba32)); } /// - internal override void PackFromZyxBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal override void PackFromZyxBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref RGB24 sourceRef = ref Unsafe.As(ref sourceBytes.DangerousGetPinnableReference()); - ref Color destRef = ref destColors.DangerousGetPinnableReference(); + ref Rgba32 destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { ref RGB24 sp = ref Unsafe.Add(ref sourceRef, i); - ref Color dp = ref Unsafe.Add(ref destRef, i); + ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); - Unsafe.As(ref dp) = sp.ToZyx(); + Unsafe.As(ref dp) = sp.ToZyx(); dp.A = 255; } } /// - internal override void ToZyxBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal override void ToZyxBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref Color sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref Rgba32 sourceRef = ref sourceColors.DangerousGetPinnableReference(); ref RGB24 destRef = ref Unsafe.As(ref destBytes.DangerousGetPinnableReference()); for (int i = 0; i < count; i++) { - ref Color sp = ref Unsafe.Add(ref sourceRef, i); + ref Rgba32 sp = ref Unsafe.Add(ref sourceRef, i); ref RGB24 dp = ref Unsafe.Add(ref destRef, i); - dp = Unsafe.As(ref sp).ToZyx(); + dp = Unsafe.As(ref sp).ToZyx(); } } /// - internal override void PackFromZyxwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal override void PackFromZyxwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref RGBA32 sourceRef = ref Unsafe.As(ref sourceBytes.DangerousGetPinnableReference()); - ref Color destRef = ref destColors.DangerousGetPinnableReference(); + ref Rgba32 destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { ref RGBA32 sp = ref Unsafe.Add(ref sourceRef, i); - ref Color dp = ref Unsafe.Add(ref destRef, i); + ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); RGBA32 zyxw = sp.ToZyxw(); - dp = Unsafe.As(ref zyxw); + dp = Unsafe.As(ref zyxw); } } /// - internal override void ToZyxwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal override void ToZyxwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref Color sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref Rgba32 sourceRef = ref sourceColors.DangerousGetPinnableReference(); ref RGBA32 destRef = ref Unsafe.As(ref destBytes.DangerousGetPinnableReference()); for (int i = 0; i < count; i++) { - ref RGBA32 sp = ref Unsafe.As(ref Unsafe.Add(ref sourceRef, i)); + ref RGBA32 sp = ref Unsafe.As(ref Unsafe.Add(ref sourceRef, i)); ref RGBA32 dp = ref Unsafe.Add(ref destRef, i); dp = sp.ToZyxw(); } @@ -264,7 +264,7 @@ namespace ImageSharp } /// - /// Value type to store -s unpacked into multiple -s. + /// Value type to store -s unpacked into multiple -s. /// [StructLayout(LayoutKind.Sequential)] private struct UnpackedRGBA diff --git a/src/ImageSharp/Colors/Rgba32.Definitions.cs b/src/ImageSharp/Colors/Rgba32.Definitions.cs new file mode 100644 index 000000000..28eb9fa0c --- /dev/null +++ b/src/ImageSharp/Colors/Rgba32.Definitions.cs @@ -0,0 +1,728 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + /// + /// Packed vector type containing four 8-bit unsigned normalized values ranging from 0 to 255. + /// The color components are stored in red, green, blue, and alpha order. + /// + /// + /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, + /// as it avoids the need to create new values for modification operations. + /// + public partial struct Rgba32 + { + /// + /// Represents a matching the W3C definition that has an hex value of #F0F8FF. + /// + public static readonly Rgba32 AliceBlue = NamedColors.AliceBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #FAEBD7. + /// + public static readonly Rgba32 AntiqueWhite = NamedColors.AntiqueWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FFFF. + /// + public static readonly Rgba32 Aqua = NamedColors.Aqua; + + /// + /// Represents a matching the W3C definition that has an hex value of #7FFFD4. + /// + public static readonly Rgba32 Aquamarine = NamedColors.Aquamarine; + + /// + /// Represents a matching the W3C definition that has an hex value of #F0FFFF. + /// + public static readonly Rgba32 Azure = NamedColors.Azure; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5F5DC. + /// + public static readonly Rgba32 Beige = NamedColors.Beige; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4C4. + /// + public static readonly Rgba32 Bisque = NamedColors.Bisque; + + /// + /// Represents a matching the W3C definition that has an hex value of #000000. + /// + public static readonly Rgba32 Black = NamedColors.Black; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFEBCD. + /// + public static readonly Rgba32 BlanchedAlmond = NamedColors.BlanchedAlmond; + + /// + /// Represents a matching the W3C definition that has an hex value of #0000FF. + /// + public static readonly Rgba32 Blue = NamedColors.Blue; + + /// + /// Represents a matching the W3C definition that has an hex value of #8A2BE2. + /// + public static readonly Rgba32 BlueViolet = NamedColors.BlueViolet; + + /// + /// Represents a matching the W3C definition that has an hex value of #A52A2A. + /// + public static readonly Rgba32 Brown = NamedColors.Brown; + + /// + /// Represents a matching the W3C definition that has an hex value of #DEB887. + /// + public static readonly Rgba32 BurlyWood = NamedColors.BurlyWood; + + /// + /// Represents a matching the W3C definition that has an hex value of #5F9EA0. + /// + public static readonly Rgba32 CadetBlue = NamedColors.CadetBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #7FFF00. + /// + public static readonly Rgba32 Chartreuse = NamedColors.Chartreuse; + + /// + /// Represents a matching the W3C definition that has an hex value of #D2691E. + /// + public static readonly Rgba32 Chocolate = NamedColors.Chocolate; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF7F50. + /// + public static readonly Rgba32 Coral = NamedColors.Coral; + + /// + /// Represents a matching the W3C definition that has an hex value of #6495ED. + /// + public static readonly Rgba32 CornflowerBlue = NamedColors.CornflowerBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF8DC. + /// + public static readonly Rgba32 Cornsilk = NamedColors.Cornsilk; + + /// + /// Represents a matching the W3C definition that has an hex value of #DC143C. + /// + public static readonly Rgba32 Crimson = NamedColors.Crimson; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FFFF. + /// + public static readonly Rgba32 Cyan = NamedColors.Cyan; + + /// + /// Represents a matching the W3C definition that has an hex value of #00008B. + /// + public static readonly Rgba32 DarkBlue = NamedColors.DarkBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #008B8B. + /// + public static readonly Rgba32 DarkCyan = NamedColors.DarkCyan; + + /// + /// Represents a matching the W3C definition that has an hex value of #B8860B. + /// + public static readonly Rgba32 DarkGoldenrod = NamedColors.DarkGoldenrod; + + /// + /// Represents a matching the W3C definition that has an hex value of #A9A9A9. + /// + public static readonly Rgba32 DarkGray = NamedColors.DarkGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #006400. + /// + public static readonly Rgba32 DarkGreen = NamedColors.DarkGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #BDB76B. + /// + public static readonly Rgba32 DarkKhaki = NamedColors.DarkKhaki; + + /// + /// Represents a matching the W3C definition that has an hex value of #8B008B. + /// + public static readonly Rgba32 DarkMagenta = NamedColors.DarkMagenta; + + /// + /// Represents a matching the W3C definition that has an hex value of #556B2F. + /// + public static readonly Rgba32 DarkOliveGreen = NamedColors.DarkOliveGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF8C00. + /// + public static readonly Rgba32 DarkOrange = NamedColors.DarkOrange; + + /// + /// Represents a matching the W3C definition that has an hex value of #9932CC. + /// + public static readonly Rgba32 DarkOrchid = NamedColors.DarkOrchid; + + /// + /// Represents a matching the W3C definition that has an hex value of #8B0000. + /// + public static readonly Rgba32 DarkRed = NamedColors.DarkRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #E9967A. + /// + public static readonly Rgba32 DarkSalmon = NamedColors.DarkSalmon; + + /// + /// Represents a matching the W3C definition that has an hex value of #8FBC8B. + /// + public static readonly Rgba32 DarkSeaGreen = NamedColors.DarkSeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #483D8B. + /// + public static readonly Rgba32 DarkSlateBlue = NamedColors.DarkSlateBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #2F4F4F. + /// + public static readonly Rgba32 DarkSlateGray = NamedColors.DarkSlateGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #00CED1. + /// + public static readonly Rgba32 DarkTurquoise = NamedColors.DarkTurquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #9400D3. + /// + public static readonly Rgba32 DarkViolet = NamedColors.DarkViolet; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF1493. + /// + public static readonly Rgba32 DeepPink = NamedColors.DeepPink; + + /// + /// Represents a matching the W3C definition that has an hex value of #00BFFF. + /// + public static readonly Rgba32 DeepSkyBlue = NamedColors.DeepSkyBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #696969. + /// + public static readonly Rgba32 DimGray = NamedColors.DimGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #1E90FF. + /// + public static readonly Rgba32 DodgerBlue = NamedColors.DodgerBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #B22222. + /// + public static readonly Rgba32 Firebrick = NamedColors.Firebrick; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFAF0. + /// + public static readonly Rgba32 FloralWhite = NamedColors.FloralWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #228B22. + /// + public static readonly Rgba32 ForestGreen = NamedColors.ForestGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF00FF. + /// + public static readonly Rgba32 Fuchsia = NamedColors.Fuchsia; + + /// + /// Represents a matching the W3C definition that has an hex value of #DCDCDC. + /// + public static readonly Rgba32 Gainsboro = NamedColors.Gainsboro; + + /// + /// Represents a matching the W3C definition that has an hex value of #F8F8FF. + /// + public static readonly Rgba32 GhostWhite = NamedColors.GhostWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFD700. + /// + public static readonly Rgba32 Gold = NamedColors.Gold; + + /// + /// Represents a matching the W3C definition that has an hex value of #DAA520. + /// + public static readonly Rgba32 Goldenrod = NamedColors.Goldenrod; + + /// + /// Represents a matching the W3C definition that has an hex value of #808080. + /// + public static readonly Rgba32 Gray = NamedColors.Gray; + + /// + /// Represents a matching the W3C definition that has an hex value of #008000. + /// + public static readonly Rgba32 Green = NamedColors.Green; + + /// + /// Represents a matching the W3C definition that has an hex value of #ADFF2F. + /// + public static readonly Rgba32 GreenYellow = NamedColors.GreenYellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #F0FFF0. + /// + public static readonly Rgba32 Honeydew = NamedColors.Honeydew; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF69B4. + /// + public static readonly Rgba32 HotPink = NamedColors.HotPink; + + /// + /// Represents a matching the W3C definition that has an hex value of #CD5C5C. + /// + public static readonly Rgba32 IndianRed = NamedColors.IndianRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #4B0082. + /// + public static readonly Rgba32 Indigo = NamedColors.Indigo; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFF0. + /// + public static readonly Rgba32 Ivory = NamedColors.Ivory; + + /// + /// Represents a matching the W3C definition that has an hex value of #F0E68C. + /// + public static readonly Rgba32 Khaki = NamedColors.Khaki; + + /// + /// Represents a matching the W3C definition that has an hex value of #E6E6FA. + /// + public static readonly Rgba32 Lavender = NamedColors.Lavender; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF0F5. + /// + public static readonly Rgba32 LavenderBlush = NamedColors.LavenderBlush; + + /// + /// Represents a matching the W3C definition that has an hex value of #7CFC00. + /// + public static readonly Rgba32 LawnGreen = NamedColors.LawnGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFACD. + /// + public static readonly Rgba32 LemonChiffon = NamedColors.LemonChiffon; + + /// + /// Represents a matching the W3C definition that has an hex value of #ADD8E6. + /// + public static readonly Rgba32 LightBlue = NamedColors.LightBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #F08080. + /// + public static readonly Rgba32 LightCoral = NamedColors.LightCoral; + + /// + /// Represents a matching the W3C definition that has an hex value of #E0FFFF. + /// + public static readonly Rgba32 LightCyan = NamedColors.LightCyan; + + /// + /// Represents a matching the W3C definition that has an hex value of #FAFAD2. + /// + public static readonly Rgba32 LightGoldenrodYellow = NamedColors.LightGoldenrodYellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #D3D3D3. + /// + public static readonly Rgba32 LightGray = NamedColors.LightGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #90EE90. + /// + public static readonly Rgba32 LightGreen = NamedColors.LightGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFB6C1. + /// + public static readonly Rgba32 LightPink = NamedColors.LightPink; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFA07A. + /// + public static readonly Rgba32 LightSalmon = NamedColors.LightSalmon; + + /// + /// Represents a matching the W3C definition that has an hex value of #20B2AA. + /// + public static readonly Rgba32 LightSeaGreen = NamedColors.LightSeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #87CEFA. + /// + public static readonly Rgba32 LightSkyBlue = NamedColors.LightSkyBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #778899. + /// + public static readonly Rgba32 LightSlateGray = NamedColors.LightSlateGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #B0C4DE. + /// + public static readonly Rgba32 LightSteelBlue = NamedColors.LightSteelBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFE0. + /// + public static readonly Rgba32 LightYellow = NamedColors.LightYellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FF00. + /// + public static readonly Rgba32 Lime = NamedColors.Lime; + + /// + /// Represents a matching the W3C definition that has an hex value of #32CD32. + /// + public static readonly Rgba32 LimeGreen = NamedColors.LimeGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FAF0E6. + /// + public static readonly Rgba32 Linen = NamedColors.Linen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF00FF. + /// + public static readonly Rgba32 Magenta = NamedColors.Magenta; + + /// + /// Represents a matching the W3C definition that has an hex value of #800000. + /// + public static readonly Rgba32 Maroon = NamedColors.Maroon; + + /// + /// Represents a matching the W3C definition that has an hex value of #66CDAA. + /// + public static readonly Rgba32 MediumAquamarine = NamedColors.MediumAquamarine; + + /// + /// Represents a matching the W3C definition that has an hex value of #0000CD. + /// + public static readonly Rgba32 MediumBlue = NamedColors.MediumBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #BA55D3. + /// + public static readonly Rgba32 MediumOrchid = NamedColors.MediumOrchid; + + /// + /// Represents a matching the W3C definition that has an hex value of #9370DB. + /// + public static readonly Rgba32 MediumPurple = NamedColors.MediumPurple; + + /// + /// Represents a matching the W3C definition that has an hex value of #3CB371. + /// + public static readonly Rgba32 MediumSeaGreen = NamedColors.MediumSeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #7B68EE. + /// + public static readonly Rgba32 MediumSlateBlue = NamedColors.MediumSlateBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FA9A. + /// + public static readonly Rgba32 MediumSpringGreen = NamedColors.MediumSpringGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #48D1CC. + /// + public static readonly Rgba32 MediumTurquoise = NamedColors.MediumTurquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #C71585. + /// + public static readonly Rgba32 MediumVioletRed = NamedColors.MediumVioletRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #191970. + /// + public static readonly Rgba32 MidnightBlue = NamedColors.MidnightBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5FFFA. + /// + public static readonly Rgba32 MintCream = NamedColors.MintCream; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4E1. + /// + public static readonly Rgba32 MistyRose = NamedColors.MistyRose; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4B5. + /// + public static readonly Rgba32 Moccasin = NamedColors.Moccasin; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFDEAD. + /// + public static readonly Rgba32 NavajoWhite = NamedColors.NavajoWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #000080. + /// + public static readonly Rgba32 Navy = NamedColors.Navy; + + /// + /// Represents a matching the W3C definition that has an hex value of #FDF5E6. + /// + public static readonly Rgba32 OldLace = NamedColors.OldLace; + + /// + /// Represents a matching the W3C definition that has an hex value of #808000. + /// + public static readonly Rgba32 Olive = NamedColors.Olive; + + /// + /// Represents a matching the W3C definition that has an hex value of #6B8E23. + /// + public static readonly Rgba32 OliveDrab = NamedColors.OliveDrab; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFA500. + /// + public static readonly Rgba32 Orange = NamedColors.Orange; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF4500. + /// + public static readonly Rgba32 OrangeRed = NamedColors.OrangeRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #DA70D6. + /// + public static readonly Rgba32 Orchid = NamedColors.Orchid; + + /// + /// Represents a matching the W3C definition that has an hex value of #EEE8AA. + /// + public static readonly Rgba32 PaleGoldenrod = NamedColors.PaleGoldenrod; + + /// + /// Represents a matching the W3C definition that has an hex value of #98FB98. + /// + public static readonly Rgba32 PaleGreen = NamedColors.PaleGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #AFEEEE. + /// + public static readonly Rgba32 PaleTurquoise = NamedColors.PaleTurquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #DB7093. + /// + public static readonly Rgba32 PaleVioletRed = NamedColors.PaleVioletRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFEFD5. + /// + public static readonly Rgba32 PapayaWhip = NamedColors.PapayaWhip; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFDAB9. + /// + public static readonly Rgba32 PeachPuff = NamedColors.PeachPuff; + + /// + /// Represents a matching the W3C definition that has an hex value of #CD853F. + /// + public static readonly Rgba32 Peru = NamedColors.Peru; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFC0CB. + /// + public static readonly Rgba32 Pink = NamedColors.Pink; + + /// + /// Represents a matching the W3C definition that has an hex value of #DDA0DD. + /// + public static readonly Rgba32 Plum = NamedColors.Plum; + + /// + /// Represents a matching the W3C definition that has an hex value of #B0E0E6. + /// + public static readonly Rgba32 PowderBlue = NamedColors.PowderBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #800080. + /// + public static readonly Rgba32 Purple = NamedColors.Purple; + + /// + /// Represents a matching the W3C definition that has an hex value of #663399. + /// + public static readonly Rgba32 RebeccaPurple = NamedColors.RebeccaPurple; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF0000. + /// + public static readonly Rgba32 Red = NamedColors.Red; + + /// + /// Represents a matching the W3C definition that has an hex value of #BC8F8F. + /// + public static readonly Rgba32 RosyBrown = NamedColors.RosyBrown; + + /// + /// Represents a matching the W3C definition that has an hex value of #4169E1. + /// + public static readonly Rgba32 RoyalBlue = NamedColors.RoyalBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #8B4513. + /// + public static readonly Rgba32 SaddleBrown = NamedColors.SaddleBrown; + + /// + /// Represents a matching the W3C definition that has an hex value of #FA8072. + /// + public static readonly Rgba32 Salmon = NamedColors.Salmon; + + /// + /// Represents a matching the W3C definition that has an hex value of #F4A460. + /// + public static readonly Rgba32 SandyBrown = NamedColors.SandyBrown; + + /// + /// Represents a matching the W3C definition that has an hex value of #2E8B57. + /// + public static readonly Rgba32 SeaGreen = NamedColors.SeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF5EE. + /// + public static readonly Rgba32 SeaShell = NamedColors.SeaShell; + + /// + /// Represents a matching the W3C definition that has an hex value of #A0522D. + /// + public static readonly Rgba32 Sienna = NamedColors.Sienna; + + /// + /// Represents a matching the W3C definition that has an hex value of #C0C0C0. + /// + public static readonly Rgba32 Silver = NamedColors.Silver; + + /// + /// Represents a matching the W3C definition that has an hex value of #87CEEB. + /// + public static readonly Rgba32 SkyBlue = NamedColors.SkyBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #6A5ACD. + /// + public static readonly Rgba32 SlateBlue = NamedColors.SlateBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #708090. + /// + public static readonly Rgba32 SlateGray = NamedColors.SlateGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFAFA. + /// + public static readonly Rgba32 Snow = NamedColors.Snow; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FF7F. + /// + public static readonly Rgba32 SpringGreen = NamedColors.SpringGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #4682B4. + /// + public static readonly Rgba32 SteelBlue = NamedColors.SteelBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #D2B48C. + /// + public static readonly Rgba32 Tan = NamedColors.Tan; + + /// + /// Represents a matching the W3C definition that has an hex value of #008080. + /// + public static readonly Rgba32 Teal = NamedColors.Teal; + + /// + /// Represents a matching the W3C definition that has an hex value of #D8BFD8. + /// + public static readonly Rgba32 Thistle = NamedColors.Thistle; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF6347. + /// + public static readonly Rgba32 Tomato = NamedColors.Tomato; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFFF. + /// + public static readonly Rgba32 Transparent = NamedColors.Transparent; + + /// + /// Represents a matching the W3C definition that has an hex value of #40E0D0. + /// + public static readonly Rgba32 Turquoise = NamedColors.Turquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #EE82EE. + /// + public static readonly Rgba32 Violet = NamedColors.Violet; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5DEB3. + /// + public static readonly Rgba32 Wheat = NamedColors.Wheat; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFFF. + /// + public static readonly Rgba32 White = NamedColors.White; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5F5F5. + /// + public static readonly Rgba32 WhiteSmoke = NamedColors.WhiteSmoke; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFF00. + /// + public static readonly Rgba32 Yellow = NamedColors.Yellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #9ACD32. + /// + public static readonly Rgba32 YellowGreen = NamedColors.YellowGreen; + } +} \ No newline at end of file diff --git a/src/ImageSharp/Colors/Color.Transforms.cs b/src/ImageSharp/Colors/Rgba32.Transforms.cs similarity index 84% rename from src/ImageSharp/Colors/Color.Transforms.cs rename to src/ImageSharp/Colors/Rgba32.Transforms.cs index 15935afc4..51c130a6c 100644 --- a/src/ImageSharp/Colors/Color.Transforms.cs +++ b/src/ImageSharp/Colors/Rgba32.Transforms.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -16,7 +16,7 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct Color + public partial struct Rgba32 { /// /// Adds the second color to the first. @@ -24,10 +24,10 @@ namespace ImageSharp /// The first source color. /// The second source color. /// - /// The . + /// The . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Color operator +(Color left, Color right) + public static Rgba32 operator +(Rgba32 left, Rgba32 right) { Vector4 add = left.ToVector4() + right.ToVector4(); return PackNew(ref add); @@ -39,10 +39,10 @@ namespace ImageSharp /// The first source color. /// The second source color. /// - /// The . + /// The . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Color operator -(Color left, Color right) + public static Rgba32 operator -(Rgba32 left, Rgba32 right) { Vector4 sub = left.ToVector4() - right.ToVector4(); return PackNew(ref sub); @@ -54,9 +54,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Normal(Color backdrop, Color source) + public static Rgba32 Normal(Rgba32 backdrop, Rgba32 source) { Vector4 normal = Vector4BlendTransforms.Normal(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref normal); @@ -74,9 +74,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Multiply(Color backdrop, Color source) + public static Rgba32 Multiply(Rgba32 backdrop, Rgba32 source) { Vector4 multiply = Vector4BlendTransforms.Multiply(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref multiply); @@ -93,9 +93,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Screen(Color backdrop, Color source) + public static Rgba32 Screen(Rgba32 backdrop, Rgba32 source) { Vector4 subtract = Vector4BlendTransforms.Screen(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref subtract); @@ -108,9 +108,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color HardLight(Color backdrop, Color source) + public static Rgba32 HardLight(Rgba32 backdrop, Rgba32 source) { Vector4 hardlight = Vector4BlendTransforms.HardLight(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref hardlight); @@ -127,9 +127,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Overlay(Color backdrop, Color source) + public static Rgba32 Overlay(Rgba32 backdrop, Rgba32 source) { Vector4 overlay = Vector4BlendTransforms.Overlay(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref overlay); @@ -142,9 +142,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Darken(Color backdrop, Color source) + public static Rgba32 Darken(Rgba32 backdrop, Rgba32 source) { Vector4 darken = Vector4BlendTransforms.Darken(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref darken); @@ -157,9 +157,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Lighten(Color backdrop, Color source) + public static Rgba32 Lighten(Rgba32 backdrop, Rgba32 source) { Vector4 lighten = Vector4BlendTransforms.Lighten(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref lighten); @@ -172,9 +172,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color SoftLight(Color backdrop, Color source) + public static Rgba32 SoftLight(Rgba32 backdrop, Rgba32 source) { Vector4 softlight = Vector4BlendTransforms.SoftLight(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref softlight); @@ -186,9 +186,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color ColorDodge(Color backdrop, Color source) + public static Rgba32 ColorDodge(Rgba32 backdrop, Rgba32 source) { Vector4 dodge = Vector4BlendTransforms.Dodge(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref dodge); @@ -200,9 +200,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color ColorBurn(Color backdrop, Color source) + public static Rgba32 ColorBurn(Rgba32 backdrop, Rgba32 source) { Vector4 burn = Vector4BlendTransforms.Burn(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref burn); @@ -215,9 +215,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Difference(Color backdrop, Color source) + public static Rgba32 Difference(Rgba32 backdrop, Rgba32 source) { Vector4 difference = Vector4BlendTransforms.Difference(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref difference); @@ -230,9 +230,9 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static Color Exclusion(Color backdrop, Color source) + public static Rgba32 Exclusion(Rgba32 backdrop, Rgba32 source) { Vector4 exclusion = Vector4BlendTransforms.Exclusion(backdrop.ToVector4(), source.ToVector4()); return PackNew(ref exclusion); @@ -248,9 +248,9 @@ namespace ImageSharp /// At amount = 0, "from" is returned, at amount = 1, "to" is returned. /// /// - /// The + /// The /// - public static Color Lerp(Color from, Color to, float amount) + public static Rgba32 Lerp(Rgba32 from, Rgba32 to, float amount) { Vector4 lerp = Vector4.Lerp(from.ToVector4(), to.ToVector4(), amount); return PackNew(ref lerp); diff --git a/src/ImageSharp/Colors/Color.cs b/src/ImageSharp/Colors/Rgba32.cs similarity index 85% rename from src/ImageSharp/Colors/Color.cs rename to src/ImageSharp/Colors/Rgba32.cs index fa83429df..f04fe2560 100644 --- a/src/ImageSharp/Colors/Color.cs +++ b/src/ImageSharp/Colors/Rgba32.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -18,7 +18,7 @@ namespace ImageSharp /// as it avoids the need to create new values for modification operations. /// [StructLayout(LayoutKind.Explicit)] - public partial struct Color : IPixel, IPackedVector + public partial struct Rgba32 : IPixel, IPackedVector { /// /// Gets or sets the red component. @@ -81,14 +81,14 @@ namespace ImageSharp private static readonly Vector4 Half = new Vector4(0.5F); /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The red component. /// The green component. /// The blue component. /// The alpha component. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Color(byte r, byte g, byte b, byte a = 255) + public Rgba32(byte r, byte g, byte b, byte a = 255) : this() { this.R = r; @@ -98,53 +98,53 @@ namespace ImageSharp } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The red component. /// The green component. /// The blue component. /// The alpha component. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Color(float r, float g, float b, float a = 1) + public Rgba32(float r, float g, float b, float a = 1) : this() { this.Pack(r, g, b, a); } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// The vector containing the components for the packed vector. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Color(Vector3 vector) + public Rgba32(Vector3 vector) : this() { this.Pack(ref vector); } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// The vector containing the components for the packed vector. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Color(Vector4 vector) + public Rgba32(Vector4 vector) : this() { this = PackNew(ref vector); } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// The packed value. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Color(uint packed) + public Rgba32(uint packed) : this() { this.Rgba = packed; @@ -154,54 +154,54 @@ namespace ImageSharp public uint PackedValue { get => this.Rgba; set => this.Rgba = value; } /// - /// Compares two objects for equality. + /// Compares two objects for equality. /// /// - /// The on the left side of the operand. + /// The on the left side of the operand. /// /// - /// The on the right side of the operand. + /// The on the right side of the operand. /// /// /// True if the parameter is equal to the parameter; otherwise, false. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(Color left, Color right) + public static bool operator ==(Rgba32 left, Rgba32 right) { return left.Rgba == right.Rgba; } /// - /// Compares two objects for equality. + /// Compares two objects for equality. /// - /// The on the left side of the operand. - /// The on the right side of the operand. + /// The on the left side of the operand. + /// The on the right side of the operand. /// /// True if the parameter is not equal to the parameter; otherwise, false. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(Color left, Color right) + public static bool operator !=(Rgba32 left, Rgba32 right) { return left.Rgba != right.Rgba; } /// - /// Creates a new instance of the struct. + /// Creates a new instance of the struct. /// /// /// The hexadecimal representation of the combined color components arranged /// in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. /// /// - /// The . + /// The . /// - public static Color FromHex(string hex) + public static Rgba32 FromHex(string hex) { - return ColorBuilder.FromHex(hex); + return ColorBuilder.FromHex(hex); } /// - public BulkPixelOperations CreateBulkOperations() => new BulkOperations(); + public BulkPixelOperations CreateBulkOperations() => new BulkOperations(); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -278,12 +278,12 @@ namespace ImageSharp /// public override bool Equals(object obj) { - return (obj is Color) && this.Equals((Color)obj); + return (obj is Rgba32) && this.Equals((Rgba32)obj); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool Equals(Color other) + public bool Equals(Rgba32 other) { return this.Rgba == other.Rgba; } @@ -328,15 +328,15 @@ namespace ImageSharp /// Packs a into a color returning a new instance as a result. /// /// The vector containing the values to pack. - /// The + /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static Color PackNew(ref Vector4 vector) + private static Rgba32 PackNew(ref Vector4 vector) { vector *= MaxBytes; vector += Half; vector = Vector4.Clamp(vector, Vector4.Zero, MaxBytes); - return new Color((byte)vector.X, (byte)vector.Y, (byte)vector.Z, (byte)vector.W); + return new Rgba32((byte)vector.X, (byte)vector.Y, (byte)vector.Z, (byte)vector.W); } /// diff --git a/src/ImageSharp/Colors/ColorVector.BulkOperations.cs b/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs similarity index 60% rename from src/ImageSharp/Colors/ColorVector.BulkOperations.cs rename to src/ImageSharp/Colors/RgbaVector.BulkOperations.cs index ab32313c0..1a3357c51 100644 --- a/src/ImageSharp/Colors/ColorVector.BulkOperations.cs +++ b/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs @@ -1,4 +1,9 @@ -namespace ImageSharp +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp { using System.Numerics; @@ -10,15 +15,15 @@ /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct ColorVector + public partial struct RgbaVector { /// - /// implementation optimized for . + /// implementation optimized for . /// - internal class BulkOperations : BulkPixelOperations + internal class BulkOperations : BulkPixelOperations { /// - internal override unsafe void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count) + internal override unsafe void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count) { BufferSpan.Copy(sourceColors.AsBytes(), destVectors.AsBytes(), count * sizeof(Vector4)); } diff --git a/src/ImageSharp/Colors/RgbaVector.Definitions.cs b/src/ImageSharp/Colors/RgbaVector.Definitions.cs new file mode 100644 index 000000000..b0fe0faf0 --- /dev/null +++ b/src/ImageSharp/Colors/RgbaVector.Definitions.cs @@ -0,0 +1,728 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + /// + /// Unpacked pixel type containing four 16-bit floating-point values typically ranging from 0 to 1. + /// The color components are stored in red, green, blue, and alpha order. + /// + /// + /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, + /// as it avoids the need to create new values for modification operations. + /// + public partial struct RgbaVector + { + /// + /// Represents a matching the W3C definition that has an hex value of #F0F8FF. + /// + public static readonly RgbaVector AliceBlue = NamedColors.AliceBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #FAEBD7. + /// + public static readonly RgbaVector AntiqueWhite = NamedColors.AntiqueWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FFFF. + /// + public static readonly RgbaVector Aqua = NamedColors.Aqua; + + /// + /// Represents a matching the W3C definition that has an hex value of #7FFFD4. + /// + public static readonly RgbaVector Aquamarine = NamedColors.Aquamarine; + + /// + /// Represents a matching the W3C definition that has an hex value of #F0FFFF. + /// + public static readonly RgbaVector Azure = NamedColors.Azure; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5F5DC. + /// + public static readonly RgbaVector Beige = NamedColors.Beige; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4C4. + /// + public static readonly RgbaVector Bisque = NamedColors.Bisque; + + /// + /// Represents a matching the W3C definition that has an hex value of #000000. + /// + public static readonly RgbaVector Black = NamedColors.Black; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFEBCD. + /// + public static readonly RgbaVector BlanchedAlmond = NamedColors.BlanchedAlmond; + + /// + /// Represents a matching the W3C definition that has an hex value of #0000FF. + /// + public static readonly RgbaVector Blue = NamedColors.Blue; + + /// + /// Represents a matching the W3C definition that has an hex value of #8A2BE2. + /// + public static readonly RgbaVector BlueViolet = NamedColors.BlueViolet; + + /// + /// Represents a matching the W3C definition that has an hex value of #A52A2A. + /// + public static readonly RgbaVector Brown = NamedColors.Brown; + + /// + /// Represents a matching the W3C definition that has an hex value of #DEB887. + /// + public static readonly RgbaVector BurlyWood = NamedColors.BurlyWood; + + /// + /// Represents a matching the W3C definition that has an hex value of #5F9EA0. + /// + public static readonly RgbaVector CadetBlue = NamedColors.CadetBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #7FFF00. + /// + public static readonly RgbaVector Chartreuse = NamedColors.Chartreuse; + + /// + /// Represents a matching the W3C definition that has an hex value of #D2691E. + /// + public static readonly RgbaVector Chocolate = NamedColors.Chocolate; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF7F50. + /// + public static readonly RgbaVector Coral = NamedColors.Coral; + + /// + /// Represents a matching the W3C definition that has an hex value of #6495ED. + /// + public static readonly RgbaVector CornflowerBlue = NamedColors.CornflowerBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF8DC. + /// + public static readonly RgbaVector Cornsilk = NamedColors.Cornsilk; + + /// + /// Represents a matching the W3C definition that has an hex value of #DC143C. + /// + public static readonly RgbaVector Crimson = NamedColors.Crimson; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FFFF. + /// + public static readonly RgbaVector Cyan = NamedColors.Cyan; + + /// + /// Represents a matching the W3C definition that has an hex value of #00008B. + /// + public static readonly RgbaVector DarkBlue = NamedColors.DarkBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #008B8B. + /// + public static readonly RgbaVector DarkCyan = NamedColors.DarkCyan; + + /// + /// Represents a matching the W3C definition that has an hex value of #B8860B. + /// + public static readonly RgbaVector DarkGoldenrod = NamedColors.DarkGoldenrod; + + /// + /// Represents a matching the W3C definition that has an hex value of #A9A9A9. + /// + public static readonly RgbaVector DarkGray = NamedColors.DarkGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #006400. + /// + public static readonly RgbaVector DarkGreen = NamedColors.DarkGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #BDB76B. + /// + public static readonly RgbaVector DarkKhaki = NamedColors.DarkKhaki; + + /// + /// Represents a matching the W3C definition that has an hex value of #8B008B. + /// + public static readonly RgbaVector DarkMagenta = NamedColors.DarkMagenta; + + /// + /// Represents a matching the W3C definition that has an hex value of #556B2F. + /// + public static readonly RgbaVector DarkOliveGreen = NamedColors.DarkOliveGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF8C00. + /// + public static readonly RgbaVector DarkOrange = NamedColors.DarkOrange; + + /// + /// Represents a matching the W3C definition that has an hex value of #9932CC. + /// + public static readonly RgbaVector DarkOrchid = NamedColors.DarkOrchid; + + /// + /// Represents a matching the W3C definition that has an hex value of #8B0000. + /// + public static readonly RgbaVector DarkRed = NamedColors.DarkRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #E9967A. + /// + public static readonly RgbaVector DarkSalmon = NamedColors.DarkSalmon; + + /// + /// Represents a matching the W3C definition that has an hex value of #8FBC8B. + /// + public static readonly RgbaVector DarkSeaGreen = NamedColors.DarkSeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #483D8B. + /// + public static readonly RgbaVector DarkSlateBlue = NamedColors.DarkSlateBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #2F4F4F. + /// + public static readonly RgbaVector DarkSlateGray = NamedColors.DarkSlateGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #00CED1. + /// + public static readonly RgbaVector DarkTurquoise = NamedColors.DarkTurquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #9400D3. + /// + public static readonly RgbaVector DarkViolet = NamedColors.DarkViolet; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF1493. + /// + public static readonly RgbaVector DeepPink = NamedColors.DeepPink; + + /// + /// Represents a matching the W3C definition that has an hex value of #00BFFF. + /// + public static readonly RgbaVector DeepSkyBlue = NamedColors.DeepSkyBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #696969. + /// + public static readonly RgbaVector DimGray = NamedColors.DimGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #1E90FF. + /// + public static readonly RgbaVector DodgerBlue = NamedColors.DodgerBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #B22222. + /// + public static readonly RgbaVector Firebrick = NamedColors.Firebrick; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFAF0. + /// + public static readonly RgbaVector FloralWhite = NamedColors.FloralWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #228B22. + /// + public static readonly RgbaVector ForestGreen = NamedColors.ForestGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF00FF. + /// + public static readonly RgbaVector Fuchsia = NamedColors.Fuchsia; + + /// + /// Represents a matching the W3C definition that has an hex value of #DCDCDC. + /// + public static readonly RgbaVector Gainsboro = NamedColors.Gainsboro; + + /// + /// Represents a matching the W3C definition that has an hex value of #F8F8FF. + /// + public static readonly RgbaVector GhostWhite = NamedColors.GhostWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFD700. + /// + public static readonly RgbaVector Gold = NamedColors.Gold; + + /// + /// Represents a matching the W3C definition that has an hex value of #DAA520. + /// + public static readonly RgbaVector Goldenrod = NamedColors.Goldenrod; + + /// + /// Represents a matching the W3C definition that has an hex value of #808080. + /// + public static readonly RgbaVector Gray = NamedColors.Gray; + + /// + /// Represents a matching the W3C definition that has an hex value of #008000. + /// + public static readonly RgbaVector Green = NamedColors.Green; + + /// + /// Represents a matching the W3C definition that has an hex value of #ADFF2F. + /// + public static readonly RgbaVector GreenYellow = NamedColors.GreenYellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #F0FFF0. + /// + public static readonly RgbaVector Honeydew = NamedColors.Honeydew; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF69B4. + /// + public static readonly RgbaVector HotPink = NamedColors.HotPink; + + /// + /// Represents a matching the W3C definition that has an hex value of #CD5C5C. + /// + public static readonly RgbaVector IndianRed = NamedColors.IndianRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #4B0082. + /// + public static readonly RgbaVector Indigo = NamedColors.Indigo; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFF0. + /// + public static readonly RgbaVector Ivory = NamedColors.Ivory; + + /// + /// Represents a matching the W3C definition that has an hex value of #F0E68C. + /// + public static readonly RgbaVector Khaki = NamedColors.Khaki; + + /// + /// Represents a matching the W3C definition that has an hex value of #E6E6FA. + /// + public static readonly RgbaVector Lavender = NamedColors.Lavender; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF0F5. + /// + public static readonly RgbaVector LavenderBlush = NamedColors.LavenderBlush; + + /// + /// Represents a matching the W3C definition that has an hex value of #7CFC00. + /// + public static readonly RgbaVector LawnGreen = NamedColors.LawnGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFACD. + /// + public static readonly RgbaVector LemonChiffon = NamedColors.LemonChiffon; + + /// + /// Represents a matching the W3C definition that has an hex value of #ADD8E6. + /// + public static readonly RgbaVector LightBlue = NamedColors.LightBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #F08080. + /// + public static readonly RgbaVector LightCoral = NamedColors.LightCoral; + + /// + /// Represents a matching the W3C definition that has an hex value of #E0FFFF. + /// + public static readonly RgbaVector LightCyan = NamedColors.LightCyan; + + /// + /// Represents a matching the W3C definition that has an hex value of #FAFAD2. + /// + public static readonly RgbaVector LightGoldenrodYellow = NamedColors.LightGoldenrodYellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #D3D3D3. + /// + public static readonly RgbaVector LightGray = NamedColors.LightGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #90EE90. + /// + public static readonly RgbaVector LightGreen = NamedColors.LightGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFB6C1. + /// + public static readonly RgbaVector LightPink = NamedColors.LightPink; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFA07A. + /// + public static readonly RgbaVector LightSalmon = NamedColors.LightSalmon; + + /// + /// Represents a matching the W3C definition that has an hex value of #20B2AA. + /// + public static readonly RgbaVector LightSeaGreen = NamedColors.LightSeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #87CEFA. + /// + public static readonly RgbaVector LightSkyBlue = NamedColors.LightSkyBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #778899. + /// + public static readonly RgbaVector LightSlateGray = NamedColors.LightSlateGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #B0C4DE. + /// + public static readonly RgbaVector LightSteelBlue = NamedColors.LightSteelBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFE0. + /// + public static readonly RgbaVector LightYellow = NamedColors.LightYellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FF00. + /// + public static readonly RgbaVector Lime = NamedColors.Lime; + + /// + /// Represents a matching the W3C definition that has an hex value of #32CD32. + /// + public static readonly RgbaVector LimeGreen = NamedColors.LimeGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FAF0E6. + /// + public static readonly RgbaVector Linen = NamedColors.Linen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF00FF. + /// + public static readonly RgbaVector Magenta = NamedColors.Magenta; + + /// + /// Represents a matching the W3C definition that has an hex value of #800000. + /// + public static readonly RgbaVector Maroon = NamedColors.Maroon; + + /// + /// Represents a matching the W3C definition that has an hex value of #66CDAA. + /// + public static readonly RgbaVector MediumAquamarine = NamedColors.MediumAquamarine; + + /// + /// Represents a matching the W3C definition that has an hex value of #0000CD. + /// + public static readonly RgbaVector MediumBlue = NamedColors.MediumBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #BA55D3. + /// + public static readonly RgbaVector MediumOrchid = NamedColors.MediumOrchid; + + /// + /// Represents a matching the W3C definition that has an hex value of #9370DB. + /// + public static readonly RgbaVector MediumPurple = NamedColors.MediumPurple; + + /// + /// Represents a matching the W3C definition that has an hex value of #3CB371. + /// + public static readonly RgbaVector MediumSeaGreen = NamedColors.MediumSeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #7B68EE. + /// + public static readonly RgbaVector MediumSlateBlue = NamedColors.MediumSlateBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FA9A. + /// + public static readonly RgbaVector MediumSpringGreen = NamedColors.MediumSpringGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #48D1CC. + /// + public static readonly RgbaVector MediumTurquoise = NamedColors.MediumTurquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #C71585. + /// + public static readonly RgbaVector MediumVioletRed = NamedColors.MediumVioletRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #191970. + /// + public static readonly RgbaVector MidnightBlue = NamedColors.MidnightBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5FFFA. + /// + public static readonly RgbaVector MintCream = NamedColors.MintCream; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4E1. + /// + public static readonly RgbaVector MistyRose = NamedColors.MistyRose; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4B5. + /// + public static readonly RgbaVector Moccasin = NamedColors.Moccasin; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFDEAD. + /// + public static readonly RgbaVector NavajoWhite = NamedColors.NavajoWhite; + + /// + /// Represents a matching the W3C definition that has an hex value of #000080. + /// + public static readonly RgbaVector Navy = NamedColors.Navy; + + /// + /// Represents a matching the W3C definition that has an hex value of #FDF5E6. + /// + public static readonly RgbaVector OldLace = NamedColors.OldLace; + + /// + /// Represents a matching the W3C definition that has an hex value of #808000. + /// + public static readonly RgbaVector Olive = NamedColors.Olive; + + /// + /// Represents a matching the W3C definition that has an hex value of #6B8E23. + /// + public static readonly RgbaVector OliveDrab = NamedColors.OliveDrab; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFA500. + /// + public static readonly RgbaVector Orange = NamedColors.Orange; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF4500. + /// + public static readonly RgbaVector OrangeRed = NamedColors.OrangeRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #DA70D6. + /// + public static readonly RgbaVector Orchid = NamedColors.Orchid; + + /// + /// Represents a matching the W3C definition that has an hex value of #EEE8AA. + /// + public static readonly RgbaVector PaleGoldenrod = NamedColors.PaleGoldenrod; + + /// + /// Represents a matching the W3C definition that has an hex value of #98FB98. + /// + public static readonly RgbaVector PaleGreen = NamedColors.PaleGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #AFEEEE. + /// + public static readonly RgbaVector PaleTurquoise = NamedColors.PaleTurquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #DB7093. + /// + public static readonly RgbaVector PaleVioletRed = NamedColors.PaleVioletRed; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFEFD5. + /// + public static readonly RgbaVector PapayaWhip = NamedColors.PapayaWhip; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFDAB9. + /// + public static readonly RgbaVector PeachPuff = NamedColors.PeachPuff; + + /// + /// Represents a matching the W3C definition that has an hex value of #CD853F. + /// + public static readonly RgbaVector Peru = NamedColors.Peru; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFC0CB. + /// + public static readonly RgbaVector Pink = NamedColors.Pink; + + /// + /// Represents a matching the W3C definition that has an hex value of #DDA0DD. + /// + public static readonly RgbaVector Plum = NamedColors.Plum; + + /// + /// Represents a matching the W3C definition that has an hex value of #B0E0E6. + /// + public static readonly RgbaVector PowderBlue = NamedColors.PowderBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #800080. + /// + public static readonly RgbaVector Purple = NamedColors.Purple; + + /// + /// Represents a matching the W3C definition that has an hex value of #663399. + /// + public static readonly RgbaVector RebeccaPurple = NamedColors.RebeccaPurple; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF0000. + /// + public static readonly RgbaVector Red = NamedColors.Red; + + /// + /// Represents a matching the W3C definition that has an hex value of #BC8F8F. + /// + public static readonly RgbaVector RosyBrown = NamedColors.RosyBrown; + + /// + /// Represents a matching the W3C definition that has an hex value of #4169E1. + /// + public static readonly RgbaVector RoyalBlue = NamedColors.RoyalBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #8B4513. + /// + public static readonly RgbaVector SaddleBrown = NamedColors.SaddleBrown; + + /// + /// Represents a matching the W3C definition that has an hex value of #FA8072. + /// + public static readonly RgbaVector Salmon = NamedColors.Salmon; + + /// + /// Represents a matching the W3C definition that has an hex value of #F4A460. + /// + public static readonly RgbaVector SandyBrown = NamedColors.SandyBrown; + + /// + /// Represents a matching the W3C definition that has an hex value of #2E8B57. + /// + public static readonly RgbaVector SeaGreen = NamedColors.SeaGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF5EE. + /// + public static readonly RgbaVector SeaShell = NamedColors.SeaShell; + + /// + /// Represents a matching the W3C definition that has an hex value of #A0522D. + /// + public static readonly RgbaVector Sienna = NamedColors.Sienna; + + /// + /// Represents a matching the W3C definition that has an hex value of #C0C0C0. + /// + public static readonly RgbaVector Silver = NamedColors.Silver; + + /// + /// Represents a matching the W3C definition that has an hex value of #87CEEB. + /// + public static readonly RgbaVector SkyBlue = NamedColors.SkyBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #6A5ACD. + /// + public static readonly RgbaVector SlateBlue = NamedColors.SlateBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #708090. + /// + public static readonly RgbaVector SlateGray = NamedColors.SlateGray; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFAFA. + /// + public static readonly RgbaVector Snow = NamedColors.Snow; + + /// + /// Represents a matching the W3C definition that has an hex value of #00FF7F. + /// + public static readonly RgbaVector SpringGreen = NamedColors.SpringGreen; + + /// + /// Represents a matching the W3C definition that has an hex value of #4682B4. + /// + public static readonly RgbaVector SteelBlue = NamedColors.SteelBlue; + + /// + /// Represents a matching the W3C definition that has an hex value of #D2B48C. + /// + public static readonly RgbaVector Tan = NamedColors.Tan; + + /// + /// Represents a matching the W3C definition that has an hex value of #008080. + /// + public static readonly RgbaVector Teal = NamedColors.Teal; + + /// + /// Represents a matching the W3C definition that has an hex value of #D8BFD8. + /// + public static readonly RgbaVector Thistle = NamedColors.Thistle; + + /// + /// Represents a matching the W3C definition that has an hex value of #FF6347. + /// + public static readonly RgbaVector Tomato = NamedColors.Tomato; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFFF. + /// + public static readonly RgbaVector Transparent = NamedColors.Transparent; + + /// + /// Represents a matching the W3C definition that has an hex value of #40E0D0. + /// + public static readonly RgbaVector Turquoise = NamedColors.Turquoise; + + /// + /// Represents a matching the W3C definition that has an hex value of #EE82EE. + /// + public static readonly RgbaVector Violet = NamedColors.Violet; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5DEB3. + /// + public static readonly RgbaVector Wheat = NamedColors.Wheat; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFFF. + /// + public static readonly RgbaVector White = NamedColors.White; + + /// + /// Represents a matching the W3C definition that has an hex value of #F5F5F5. + /// + public static readonly RgbaVector WhiteSmoke = NamedColors.WhiteSmoke; + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFF00. + /// + public static readonly RgbaVector Yellow = NamedColors.Yellow; + + /// + /// Represents a matching the W3C definition that has an hex value of #9ACD32. + /// + public static readonly RgbaVector YellowGreen = NamedColors.YellowGreen; + } +} \ No newline at end of file diff --git a/src/ImageSharp/Colors/ColorVector.Transforms.cs b/src/ImageSharp/Colors/RgbaVector.Transforms.cs similarity index 75% rename from src/ImageSharp/Colors/ColorVector.Transforms.cs rename to src/ImageSharp/Colors/RgbaVector.Transforms.cs index a884f2618..a2408dcc8 100644 --- a/src/ImageSharp/Colors/ColorVector.Transforms.cs +++ b/src/ImageSharp/Colors/RgbaVector.Transforms.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -16,7 +16,7 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct ColorVector + public partial struct RgbaVector { /// /// Adds the second color to the first. @@ -24,12 +24,12 @@ namespace ImageSharp /// The first source color. /// The second source color. /// - /// The . + /// The . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ColorVector operator +(ColorVector left, ColorVector right) + public static RgbaVector operator +(RgbaVector left, RgbaVector right) { - return new ColorVector(left.backingVector + right.backingVector); + return new RgbaVector(left.backingVector + right.backingVector); } /// @@ -38,12 +38,12 @@ namespace ImageSharp /// The first source color. /// The second source color. /// - /// The . + /// The . /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ColorVector operator -(ColorVector left, ColorVector right) + public static RgbaVector operator -(RgbaVector left, RgbaVector right) { - return new ColorVector(left.backingVector - right.backingVector); + return new RgbaVector(left.backingVector - right.backingVector); } /// @@ -52,12 +52,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Normal(ColorVector backdrop, ColorVector source) + public static RgbaVector Normal(RgbaVector backdrop, RgbaVector source) { Vector4 normal = Vector4BlendTransforms.Normal(backdrop.backingVector, source.backingVector); - return new ColorVector(normal); + return new RgbaVector(normal); } /// @@ -72,12 +72,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Multiply(ColorVector backdrop, ColorVector source) + public static RgbaVector Multiply(RgbaVector backdrop, RgbaVector source) { Vector4 multiply = Vector4BlendTransforms.Multiply(backdrop.backingVector, source.backingVector); - return new ColorVector(multiply); + return new RgbaVector(multiply); } /// @@ -91,12 +91,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Screen(ColorVector backdrop, ColorVector source) + public static RgbaVector Screen(RgbaVector backdrop, RgbaVector source) { Vector4 subtract = Vector4BlendTransforms.Screen(backdrop.backingVector, source.backingVector); - return new ColorVector(subtract); + return new RgbaVector(subtract); } /// @@ -106,12 +106,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector HardLight(ColorVector backdrop, ColorVector source) + public static RgbaVector HardLight(RgbaVector backdrop, RgbaVector source) { Vector4 hardlight = Vector4BlendTransforms.HardLight(backdrop.backingVector, source.backingVector); - return new ColorVector(hardlight); + return new RgbaVector(hardlight); } /// @@ -125,12 +125,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Overlay(ColorVector backdrop, ColorVector source) + public static RgbaVector Overlay(RgbaVector backdrop, RgbaVector source) { Vector4 overlay = Vector4BlendTransforms.Overlay(backdrop.backingVector, source.backingVector); - return new ColorVector(overlay); + return new RgbaVector(overlay); } /// @@ -140,12 +140,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Darken(ColorVector backdrop, ColorVector source) + public static RgbaVector Darken(RgbaVector backdrop, RgbaVector source) { Vector4 darken = Vector4BlendTransforms.Darken(backdrop.backingVector, source.backingVector); - return new ColorVector(darken); + return new RgbaVector(darken); } /// @@ -155,12 +155,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Lighten(ColorVector backdrop, ColorVector source) + public static RgbaVector Lighten(RgbaVector backdrop, RgbaVector source) { Vector4 lighten = Vector4BlendTransforms.Lighten(backdrop.backingVector, source.backingVector); - return new ColorVector(lighten); + return new RgbaVector(lighten); } /// @@ -170,12 +170,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector SoftLight(ColorVector backdrop, ColorVector source) + public static RgbaVector SoftLight(RgbaVector backdrop, RgbaVector source) { Vector4 softlight = Vector4BlendTransforms.SoftLight(backdrop.backingVector, source.backingVector); - return new ColorVector(softlight); + return new RgbaVector(softlight); } /// @@ -184,12 +184,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector ColorDodge(ColorVector backdrop, ColorVector source) + public static RgbaVector ColorDodge(RgbaVector backdrop, RgbaVector source) { Vector4 dodge = Vector4BlendTransforms.Dodge(backdrop.backingVector, source.backingVector); - return new ColorVector(dodge); + return new RgbaVector(dodge); } /// @@ -198,12 +198,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector ColorBurn(ColorVector backdrop, ColorVector source) + public static RgbaVector ColorBurn(RgbaVector backdrop, RgbaVector source) { Vector4 burn = Vector4BlendTransforms.Burn(backdrop.backingVector, source.backingVector); - return new ColorVector(burn); + return new RgbaVector(burn); } /// @@ -213,12 +213,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Difference(ColorVector backdrop, ColorVector source) + public static RgbaVector Difference(RgbaVector backdrop, RgbaVector source) { Vector4 difference = Vector4BlendTransforms.Difference(backdrop.backingVector, source.backingVector); - return new ColorVector(difference); + return new RgbaVector(difference); } /// @@ -228,12 +228,12 @@ namespace ImageSharp /// The backdrop color. /// The source color. /// - /// The . + /// The . /// - public static ColorVector Exclusion(ColorVector backdrop, ColorVector source) + public static RgbaVector Exclusion(RgbaVector backdrop, RgbaVector source) { Vector4 exclusion = Vector4BlendTransforms.Exclusion(backdrop.backingVector, source.backingVector); - return new ColorVector(exclusion); + return new RgbaVector(exclusion); } /// @@ -246,11 +246,11 @@ namespace ImageSharp /// At amount = 0, "from" is returned, at amount = 1, "to" is returned. /// /// - /// The + /// The /// - public static ColorVector Lerp(ColorVector from, ColorVector to, float amount) + public static RgbaVector Lerp(RgbaVector from, RgbaVector to, float amount) { - return new ColorVector(Vector4.Lerp(from.backingVector, to.backingVector, amount)); + return new RgbaVector(Vector4.Lerp(from.backingVector, to.backingVector, amount)); } } } \ No newline at end of file diff --git a/src/ImageSharp/Colors/ColorVector.cs b/src/ImageSharp/Colors/RgbaVector.cs similarity index 84% rename from src/ImageSharp/Colors/ColorVector.cs rename to src/ImageSharp/Colors/RgbaVector.cs index 06ee5b805..03fd25ded 100644 --- a/src/ImageSharp/Colors/ColorVector.cs +++ b/src/ImageSharp/Colors/RgbaVector.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -16,7 +16,7 @@ namespace ImageSharp /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, /// as it avoids the need to create new values for modification operations. /// - public partial struct ColorVector : IPixel + public partial struct RgbaVector : IPixel { /// /// The maximum byte value. @@ -34,54 +34,54 @@ namespace ImageSharp private Vector4 backingVector; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The red component. /// The green component. /// The blue component. /// The alpha component. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ColorVector(byte r, byte g, byte b, byte a = 255) + public RgbaVector(byte r, byte g, byte b, byte a = 255) : this() { this.backingVector = new Vector4(r, g, b, a) / MaxBytes; } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The red component. /// The green component. /// The blue component. /// The alpha component. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ColorVector(float r, float g, float b, float a = 1) + public RgbaVector(float r, float g, float b, float a = 1) : this() { this.backingVector = new Vector4(r, g, b, a); } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// The vector containing the components for the packed vector. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ColorVector(Vector3 vector) + public RgbaVector(Vector3 vector) : this() { this.backingVector = new Vector4(vector, 1); } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// /// The vector containing the components for the packed vector. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ColorVector(Vector4 vector) + public RgbaVector(Vector4 vector) : this() { this.backingVector = vector; @@ -160,54 +160,54 @@ namespace ImageSharp } /// - /// Compares two objects for equality. + /// Compares two objects for equality. /// /// - /// The on the left side of the operand. + /// The on the left side of the operand. /// /// - /// The on the right side of the operand. + /// The on the right side of the operand. /// /// /// True if the parameter is equal to the parameter; otherwise, false. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(ColorVector left, ColorVector right) + public static bool operator ==(RgbaVector left, RgbaVector right) { return left.backingVector == right.backingVector; } /// - /// Compares two objects for equality. + /// Compares two objects for equality. /// - /// The on the left side of the operand. - /// The on the right side of the operand. + /// The on the left side of the operand. + /// The on the right side of the operand. /// /// True if the parameter is not equal to the parameter; otherwise, false. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(ColorVector left, ColorVector right) + public static bool operator !=(RgbaVector left, RgbaVector right) { return left.backingVector != right.backingVector; } /// - /// Creates a new instance of the struct. + /// Creates a new instance of the struct. /// /// /// The hexadecimal representation of the combined color components arranged /// in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. /// /// - /// The . + /// The . /// - public static ColorVector FromHex(string hex) + public static RgbaVector FromHex(string hex) { - return ColorBuilder.FromHex(hex); + return ColorBuilder.FromHex(hex); } /// - public BulkPixelOperations CreateBulkOperations() => new ColorVector.BulkOperations(); + public BulkPixelOperations CreateBulkOperations() => new RgbaVector.BulkOperations(); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -292,12 +292,12 @@ namespace ImageSharp /// public override bool Equals(object obj) { - return (obj is ColorVector) && this.Equals((ColorVector)obj); + return (obj is RgbaVector) && this.Equals((RgbaVector)obj); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool Equals(ColorVector other) + public bool Equals(RgbaVector other) { return this.backingVector == other.backingVector; } diff --git a/src/ImageSharp/Colors/Spaces/Bgra32.cs b/src/ImageSharp/Colors/Spaces/Bgra32.cs index cbd1d6119..e498bd792 100644 --- a/src/ImageSharp/Colors/Spaces/Bgra32.cs +++ b/src/ImageSharp/Colors/Spaces/Bgra32.cs @@ -79,16 +79,16 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// /// - /// The instance of to convert. + /// The instance of to convert. /// /// /// An instance of . /// - public static implicit operator Bgra32(Color color) + public static implicit operator Bgra32(Rgba32 color) { return new Bgra32(color.B, color.G, color.R, color.A); } diff --git a/src/ImageSharp/Colors/Spaces/CieLab.cs b/src/ImageSharp/Colors/Spaces/CieLab.cs index 921158174..dda211a2c 100644 --- a/src/ImageSharp/Colors/Spaces/CieLab.cs +++ b/src/ImageSharp/Colors/Spaces/CieLab.cs @@ -72,16 +72,16 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// /// - /// The instance of to convert. + /// The instance of to convert. /// /// /// An instance of . /// - public static implicit operator CieLab(Color color) + public static implicit operator CieLab(Rgba32 color) { // First convert to CIE XYZ Vector4 vector = color.ToVector4().Expand(); diff --git a/src/ImageSharp/Colors/Spaces/CieXyz.cs b/src/ImageSharp/Colors/Spaces/CieXyz.cs index 5bd1eac63..6b73d82f9 100644 --- a/src/ImageSharp/Colors/Spaces/CieXyz.cs +++ b/src/ImageSharp/Colors/Spaces/CieXyz.cs @@ -63,16 +63,16 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// /// - /// The instance of to convert. + /// The instance of to convert. /// /// /// An instance of . /// - public static implicit operator CieXyz(Color color) + public static implicit operator CieXyz(Rgba32 color) { Vector4 vector = color.ToVector4().Expand(); diff --git a/src/ImageSharp/Colors/Spaces/Cmyk.cs b/src/ImageSharp/Colors/Spaces/Cmyk.cs index c81a55c0b..1d6e83142 100644 --- a/src/ImageSharp/Colors/Spaces/Cmyk.cs +++ b/src/ImageSharp/Colors/Spaces/Cmyk.cs @@ -78,7 +78,7 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// /// @@ -87,7 +87,7 @@ namespace ImageSharp.Colors.Spaces /// /// An instance of . /// - public static implicit operator Cmyk(Color color) + public static implicit operator Cmyk(Rgba32 color) { float c = 1f - (color.R / 255F); float m = 1f - (color.G / 255F); diff --git a/src/ImageSharp/Colors/Spaces/Hsl.cs b/src/ImageSharp/Colors/Spaces/Hsl.cs index 1d655ec32..220234537 100644 --- a/src/ImageSharp/Colors/Spaces/Hsl.cs +++ b/src/ImageSharp/Colors/Spaces/Hsl.cs @@ -70,14 +70,14 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// - /// The instance of to convert. + /// The instance of to convert. /// /// An instance of . /// - public static implicit operator Hsl(Color color) + public static implicit operator Hsl(Rgba32 color) { float r = color.R / 255F; float g = color.G / 255F; diff --git a/src/ImageSharp/Colors/Spaces/Hsv.cs b/src/ImageSharp/Colors/Spaces/Hsv.cs index e171c9528..1b9aa4777 100644 --- a/src/ImageSharp/Colors/Spaces/Hsv.cs +++ b/src/ImageSharp/Colors/Spaces/Hsv.cs @@ -70,14 +70,14 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// - /// The instance of to convert. + /// The instance of to convert. /// /// An instance of . /// - public static implicit operator Hsv(Color color) + public static implicit operator Hsv(Rgba32 color) { float r = color.R / 255F; float g = color.G / 255F; diff --git a/src/ImageSharp/Colors/Spaces/YCbCr.cs b/src/ImageSharp/Colors/Spaces/YCbCr.cs index ef9f4462b..f483c0827 100644 --- a/src/ImageSharp/Colors/Spaces/YCbCr.cs +++ b/src/ImageSharp/Colors/Spaces/YCbCr.cs @@ -72,16 +72,16 @@ namespace ImageSharp.Colors.Spaces public bool IsEmpty => this.Equals(Empty); /// - /// Allows the implicit conversion of an instance of to a + /// Allows the implicit conversion of an instance of to a /// . /// /// - /// The instance of to convert. + /// The instance of to convert. /// /// /// An instance of . /// - public static implicit operator YCbCr(Color color) + public static implicit operator YCbCr(Rgba32 color) { byte r = color.R; byte g = color.G; diff --git a/src/ImageSharp/Common/Extensions/Vector4Extensions.cs b/src/ImageSharp/Common/Extensions/Vector4Extensions.cs index 9f3aa405e..d9e30e654 100644 --- a/src/ImageSharp/Common/Extensions/Vector4Extensions.cs +++ b/src/ImageSharp/Common/Extensions/Vector4Extensions.cs @@ -32,7 +32,7 @@ namespace ImageSharp /// /// /// - /// The whose signal to expand. + /// The whose signal to expand. /// The . public static Vector4 Expand(this Vector4 gamma) { diff --git a/src/ImageSharp/Image.Create.cs b/src/ImageSharp/Image.Create.cs index fcecefd7b..fe3247049 100644 --- a/src/ImageSharp/Image.Create.cs +++ b/src/ImageSharp/Image.Create.cs @@ -5,12 +5,6 @@ namespace ImageSharp { - using System; - using System.Diagnostics; - using System.IO; - - using Formats; - /// /// Represents an image. Each pixel is a made up four 8-bit components red, green, blue, and alpha /// packed into a single unsigned integer value. @@ -29,12 +23,12 @@ namespace ImageSharp /// The configuration providing initialization code which allows extending the library. /// /// - /// A new unless is in which case it returns + /// A new unless is in which case it returns /// internal static Image Create(int width, int height, ImageMetaData metadata, Configuration configuration) where TColor : struct, IPixel { - if (typeof(TColor) == typeof(Color)) + if (typeof(TColor) == typeof(Rgba32)) { return new Image(width, height, metadata, configuration) as Image; } @@ -55,7 +49,7 @@ namespace ImageSharp /// The configuration providing initialization code which allows extending the library. /// /// - /// A new unless is in which case it returns + /// A new unless is in which case it returns /// internal static Image Create(int width, int height, Configuration configuration) where TColor : struct, IPixel @@ -63,4 +57,4 @@ namespace ImageSharp return Image.Create(width, height, null, configuration); } } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Image.FromFile.cs b/src/ImageSharp/Image.FromFile.cs index 40cdfe3ef..5a2cfc86d 100644 --- a/src/ImageSharp/Image.FromFile.cs +++ b/src/ImageSharp/Image.FromFile.cs @@ -83,7 +83,7 @@ namespace ImageSharp /// The image public static Image Load(string path, IImageDecoder decoder, IDecoderOptions options) { - return new Image(Load(path, decoder, options)); + return new Image(Load(path, decoder, options)); } /// diff --git a/src/ImageSharp/Image.FromStream.cs b/src/ImageSharp/Image.FromStream.cs index 112b8a109..edff0d620 100644 --- a/src/ImageSharp/Image.FromStream.cs +++ b/src/ImageSharp/Image.FromStream.cs @@ -83,7 +83,7 @@ namespace ImageSharp /// The image public static Image Load(Configuration config, Stream stream, IDecoderOptions options) { - Image image = Load(config, stream, options); + Image image = Load(config, stream, options); return image as Image ?? new Image(image); } @@ -100,7 +100,7 @@ namespace ImageSharp /// The image public static Image Load(Stream stream, IImageDecoder decoder, IDecoderOptions options) { - Image image = new Image(Load(stream, decoder, options)); + Image image = new Image(Load(stream, decoder, options)); return image as Image ?? new Image(image); } diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs index 00688afc9..2562246a9 100644 --- a/src/ImageSharp/Image.cs +++ b/src/ImageSharp/Image.cs @@ -5,18 +5,14 @@ namespace ImageSharp { - using System; using System.Diagnostics; - using System.IO; - - using Formats; /// /// Represents an image. Each pixel is a made up four 8-bit components red, green, blue, and alpha /// packed into a single unsigned integer value. /// [DebuggerDisplay("Image: {Width}x{Height}")] - public sealed partial class Image : Image + public sealed partial class Image : Image { /// /// Initializes a new instance of the class @@ -49,7 +45,7 @@ namespace ImageSharp /// /// The other image, where the clone should be made from. /// is null. - public Image(Image other) + public Image(Image other) : base(other) { } @@ -69,4 +65,4 @@ namespace ImageSharp { } } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs index c75da0003..55ea50869 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs @@ -75,7 +75,7 @@ namespace ImageSharp.Processing.Processors /// The matrix. /// Whether to compand the color during processing. /// - /// The . + /// The . /// private TColor ApplyMatrix(TColor color, Matrix4x4 matrix, bool compand) { diff --git a/src/ImageSharp/Quantizers/PaletteQuantizer.cs b/src/ImageSharp/Quantizers/PaletteQuantizer.cs index f039fe0c5..f48c9ddd8 100644 --- a/src/ImageSharp/Quantizers/PaletteQuantizer.cs +++ b/src/ImageSharp/Quantizers/PaletteQuantizer.cs @@ -44,7 +44,7 @@ namespace ImageSharp.Quantizers { if (palette == null) { - Color[] constants = ColorConstants.WebSafeColors; + Rgba32[] constants = ColorConstants.WebSafeColors; TColor[] safe = new TColor[constants.Length + 1]; for (int i = 0; i < constants.Length; i++) diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs index befff61d5..2f3f61cce 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs @@ -14,7 +14,7 @@ /// public unsafe class PackFromVector4ReferenceVsPointer { - private Buffer destination; + private Buffer destination; private Buffer source; @@ -24,7 +24,7 @@ [Setup] public void Setup() { - this.destination = new Buffer(this.Count); + this.destination = new Buffer(this.Count); this.source = new Buffer(this.Count * 4); this.source.Pin(); this.destination.Pin(); @@ -43,12 +43,12 @@ Vector4* sp = (Vector4*)this.source.Pin(); byte* dp = (byte*)this.destination.Pin(); int count = this.Count; - int size = sizeof(ImageSharp.Color); + int size = sizeof(ImageSharp.Rgba32); for (int i = 0; i < count; i++) { Vector4 v = Unsafe.Read(sp); - ImageSharp.Color c = default(ImageSharp.Color); + ImageSharp.Rgba32 c = default(ImageSharp.Rgba32); c.PackFromVector4(v); Unsafe.Write(dp, c); @@ -61,7 +61,7 @@ public void PackUsingReferences() { ref Vector4 sp = ref this.source.Array[0]; - ref ImageSharp.Color dp = ref this.destination.Array[0]; + ref ImageSharp.Rgba32 dp = ref this.destination.Array[0]; int count = this.Count; for (int i = 0; i < count; i++) diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs index 33969b8fb..c0d50bf5b 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs @@ -3,7 +3,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk { using BenchmarkDotNet.Attributes; - using Color = ImageSharp.Color; + using Rgba32 = ImageSharp.Rgba32; public abstract class PackFromXyzw where TColor : struct, IPixel @@ -57,7 +57,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk } } - public class PackFromXyzw_Color : PackFromXyzw + public class PackFromXyzw_Color : PackFromXyzw { } } \ No newline at end of file diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs index 4cabfc01f..bd1b0e11d 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs @@ -55,7 +55,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk } } - public class ToVector4_Color : ToVector4 + public class ToVector4_Color : ToVector4 { } } \ No newline at end of file diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs index f6ae4256d..c90f78d16 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs @@ -3,7 +3,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk { using BenchmarkDotNet.Attributes; - using Color = ImageSharp.Color; + using Rgba32 = ImageSharp.Rgba32; public abstract class ToXyz where TColor : struct, IPixel @@ -55,7 +55,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk } } - public class ToXyz_Color : ToXyz + public class ToXyz_Color : ToXyz { } } \ No newline at end of file diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs index f23ca3e5c..9ec8adc79 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk { using BenchmarkDotNet.Attributes; - using Color = ImageSharp.Color; + using Rgba32 = ImageSharp.Rgba32; public abstract class ToXyzw where TColor : struct, IPixel @@ -60,7 +60,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk } } - public class ToXyzw_Color : ToXyzw + public class ToXyzw_Color : ToXyzw { } diff --git a/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs b/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs index 3ee28d06b..efc7c130f 100644 --- a/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs +++ b/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs @@ -7,7 +7,7 @@ namespace ImageSharp.Benchmarks { using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using SystemColor = System.Drawing.Color; public class ColorEquality diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs index 3e60cae4d..10c5584aa 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreImage = ImageSharp.Image; using CorePoint = ImageSharp.Point; diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs index ee97866e2..3561661b6 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreImage = ImageSharp.Image; using CorePoint = ImageSharp.Point; diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs index 047cacb42..8f7255e80 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using CoreImage = ImageSharp.Image; using CorePoint = ImageSharp.Point; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using System.IO; using System.Numerics; diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs index 782306deb..dfcc6db0a 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreImage = ImageSharp.Image; public class FillPolygon : BenchmarkBase diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs index 691955e8e..161923178 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using CoreImage = ImageSharp.Image; using CoreRectangle = ImageSharp.Rectangle; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreSize = ImageSharp.Size; using System.Numerics; diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs index dcd22d6fb..bc2330848 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs @@ -12,7 +12,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using CoreBrushes = ImageSharp.Drawing.Brushes.Brushes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreImage = ImageSharp.Image; public class FillWithPattern diff --git a/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs b/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs index c7a2021de..99640fe58 100644 --- a/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs +++ b/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs @@ -7,11 +7,11 @@ namespace ImageSharp.Benchmarks.General using BenchmarkDotNet.Attributes; - using Color = ImageSharp.Color; + using Rgba32 = ImageSharp.Rgba32; public unsafe class ClearBuffer { - private Buffer buffer; + private Buffer buffer; [Params(32, 128, 512)] public int Count { get; set; } @@ -19,7 +19,7 @@ namespace ImageSharp.Benchmarks.General [Setup] public void Setup() { - this.buffer = new Buffer(this.Count); + this.buffer = new Buffer(this.Count); } [Cleanup] diff --git a/tests/ImageSharp.Benchmarks/Image/CopyPixels.cs b/tests/ImageSharp.Benchmarks/Image/CopyPixels.cs index 335d8247d..1e7745de1 100644 --- a/tests/ImageSharp.Benchmarks/Image/CopyPixels.cs +++ b/tests/ImageSharp.Benchmarks/Image/CopyPixels.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Benchmarks.Image using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreImage = ImageSharp.Image; public class CopyPixels : BenchmarkBase diff --git a/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs b/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs index 1318c1674..1d18498c8 100644 --- a/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs +++ b/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs @@ -51,7 +51,7 @@ namespace ImageSharp.Benchmarks.Image { using (MemoryStream memoryStream = new MemoryStream()) { - PngEncoderOptions options = new PngEncoderOptions() { Quantizer = new OctreeQuantizer(), Quality = 256 }; + PngEncoderOptions options = new PngEncoderOptions() { Quantizer = new OctreeQuantizer(), Quality = 256 }; this.bmpCore.SaveAsPng(memoryStream, options); } @@ -62,7 +62,7 @@ namespace ImageSharp.Benchmarks.Image { using (MemoryStream memoryStream = new MemoryStream()) { - PngEncoderOptions options = new PngEncoderOptions { Quantizer = new OctreeQuantizer { Dither = false }, Quality = 256 }; + PngEncoderOptions options = new PngEncoderOptions { Quantizer = new OctreeQuantizer { Dither = false }, Quality = 256 }; this.bmpCore.SaveAsPng(memoryStream, options); } @@ -73,7 +73,7 @@ namespace ImageSharp.Benchmarks.Image { using (MemoryStream memoryStream = new MemoryStream()) { - PngEncoderOptions options = new PngEncoderOptions { Quantizer = new PaletteQuantizer(), Quality = 256 }; + PngEncoderOptions options = new PngEncoderOptions { Quantizer = new PaletteQuantizer(), Quality = 256 }; this.bmpCore.SaveAsPng(memoryStream, options); } @@ -84,7 +84,7 @@ namespace ImageSharp.Benchmarks.Image { using (MemoryStream memoryStream = new MemoryStream()) { - PngEncoderOptions options = new PngEncoderOptions { Quantizer = new PaletteQuantizer { Dither = false }, Quality = 256 }; + PngEncoderOptions options = new PngEncoderOptions { Quantizer = new PaletteQuantizer { Dither = false }, Quality = 256 }; this.bmpCore.SaveAsPng(memoryStream, options); } @@ -95,7 +95,7 @@ namespace ImageSharp.Benchmarks.Image { using (MemoryStream memoryStream = new MemoryStream()) { - PngEncoderOptions options = new PngEncoderOptions() { Quantizer = new WuQuantizer(), Quality = 256 }; + PngEncoderOptions options = new PngEncoderOptions() { Quantizer = new WuQuantizer(), Quality = 256 }; this.bmpCore.SaveAsPng(memoryStream, options); } diff --git a/tests/ImageSharp.Benchmarks/Image/EncodePng.cs b/tests/ImageSharp.Benchmarks/Image/EncodePng.cs index 4c1feb6c2..2bf2c0fef 100644 --- a/tests/ImageSharp.Benchmarks/Image/EncodePng.cs +++ b/tests/ImageSharp.Benchmarks/Image/EncodePng.cs @@ -66,10 +66,10 @@ namespace ImageSharp.Benchmarks.Image { using (MemoryStream memoryStream = new MemoryStream()) { - Quantizer quantizer = this.UseOctreeQuantizer - ? (Quantizer) - new OctreeQuantizer() - : new PaletteQuantizer(); + Quantizer quantizer = this.UseOctreeQuantizer + ? (Quantizer) + new OctreeQuantizer() + : new PaletteQuantizer(); PngEncoderOptions options = new PngEncoderOptions() { Quantizer = quantizer }; this.bmpCore.SaveAsPng(memoryStream, options); diff --git a/tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs b/tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs index 78295e27d..31cd7c232 100644 --- a/tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs +++ b/tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Benchmarks.Image using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Color; + using CoreColor = ImageSharp.Rgba32; using CoreImage = ImageSharp.Image; using SystemColor = System.Drawing.Color; diff --git a/tests/ImageSharp.Benchmarks/Samplers/Resize.cs b/tests/ImageSharp.Benchmarks/Samplers/Resize.cs index 569070af2..a51dcc45a 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/Resize.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/Resize.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using CoreSize = ImageSharp.Size; using CoreImage = ImageSharp.Image; - using CoreVectorImage = ImageSharp.Image; + using CoreVectorImage = ImageSharp.Image; public class Resize : BenchmarkBase { diff --git a/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs b/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs index d4b9f6f3a..c34a63ad6 100644 --- a/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs @@ -10,7 +10,7 @@ namespace ImageSharp.Tests.Colors public class BulkPixelOperationsTests { - public class Color32 : BulkPixelOperationsTests + public class Color32 : BulkPixelOperationsTests { public Color32(ITestOutputHelper output) : base(output) @@ -23,19 +23,19 @@ namespace ImageSharp.Tests.Colors [Fact] public void IsSpecialImplementation() { - Assert.IsType(BulkPixelOperations.Instance); + Assert.IsType(BulkPixelOperations.Instance); } [Fact] public void ToVector4SimdAligned() { - ImageSharp.Color[] source = CreatePixelTestData(64); + ImageSharp.Rgba32[] source = CreatePixelTestData(64); Vector4[] expected = CreateExpectedVector4Data(source); TestOperation( source, expected, - (s, d) => ImageSharp.Color.BulkOperations.ToVector4SimdAligned(s, d, 64) + (s, d) => ImageSharp.Rgba32.BulkOperations.ToVector4SimdAligned(s, d, 64) ); } @@ -45,14 +45,14 @@ namespace ImageSharp.Tests.Colors int times = 200000; int count = 1024; - using (Buffer source = new Buffer(count)) + using (Buffer source = new Buffer(count)) using (Buffer dest = new Buffer(count)) { this.Measure( times, () => { - BulkPixelOperations.Instance.ToVector4(source, dest, count); + BulkPixelOperations.Instance.ToVector4(source, dest, count); }); } } diff --git a/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs b/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs index 9ed1c67a7..09a150ab2 100644 --- a/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs @@ -20,7 +20,7 @@ namespace ImageSharp.Tests public class ColorConversionTests { /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", @@ -28,7 +28,7 @@ namespace ImageSharp.Tests public void ColorToYCbCr() { // White - Color color = Color.White; + Rgba32 color = Rgba32.White; YCbCr yCbCr = color; Assert.Equal(255, yCbCr.Y); @@ -36,14 +36,14 @@ namespace ImageSharp.Tests Assert.Equal(128, yCbCr.Cr); // Black - Color color2 = Color.Black; + Rgba32 color2 = Rgba32.Black; YCbCr yCbCr2 = color2; Assert.Equal(0, yCbCr2.Y); Assert.Equal(128, yCbCr2.Cb); Assert.Equal(128, yCbCr2.Cr); // Gray - Color color3 = Color.Gray; + Rgba32 color3 = Rgba32.Gray; YCbCr yCbCr3 = color3; Assert.Equal(128, yCbCr3.Y); Assert.Equal(128, yCbCr3.Cb); @@ -51,7 +51,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", @@ -60,7 +60,7 @@ namespace ImageSharp.Tests { // White YCbCr yCbCr = new YCbCr(255, 128, 128); - Color color = yCbCr; + Rgba32 color = yCbCr; Assert.Equal(255, color.R); Assert.Equal(255, color.G); @@ -69,7 +69,7 @@ namespace ImageSharp.Tests // Black YCbCr yCbCr2 = new YCbCr(0, 128, 128); - Color color2 = yCbCr2; + Rgba32 color2 = yCbCr2; Assert.Equal(0, color2.R); Assert.Equal(0, color2.G); @@ -78,7 +78,7 @@ namespace ImageSharp.Tests // Gray YCbCr yCbCr3 = new YCbCr(128, 128, 128); - Color color3 = yCbCr3; + Rgba32 color3 = yCbCr3; Assert.Equal(128, color3.R); Assert.Equal(128, color3.G); @@ -87,7 +87,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// Comparison values obtained from /// http://colormine.org/convert/rgb-to-xyz /// @@ -95,7 +95,7 @@ namespace ImageSharp.Tests public void ColorToCieXyz() { // White - Color color = Color.White; + Rgba32 color = Rgba32.White; CieXyz ciexyz = color; Assert.Equal(95.05f, ciexyz.X, 3); @@ -103,21 +103,21 @@ namespace ImageSharp.Tests Assert.Equal(108.900f, ciexyz.Z, 3); // Black - Color color2 = Color.Black; + Rgba32 color2 = Rgba32.Black; CieXyz ciexyz2 = color2; Assert.Equal(0, ciexyz2.X, 3); Assert.Equal(0, ciexyz2.Y, 3); Assert.Equal(0, ciexyz2.Z, 3); // Gray - Color color3 = Color.Gray; + Rgba32 color3 = Rgba32.Gray; CieXyz ciexyz3 = color3; Assert.Equal(20.518, ciexyz3.X, 3); Assert.Equal(21.586, ciexyz3.Y, 3); Assert.Equal(23.507, ciexyz3.Z, 3); // Cyan - Color color4 = Color.Cyan; + Rgba32 color4 = Rgba32.Cyan; CieXyz ciexyz4 = color4; Assert.Equal(53.810f, ciexyz4.X, 3); Assert.Equal(78.740f, ciexyz4.Y, 3); @@ -125,7 +125,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// Comparison values obtained from /// http://colormine.org/convert/rgb-to-xyz /// @@ -134,7 +134,7 @@ namespace ImageSharp.Tests { // Dark moderate pink. CieXyz ciexyz = new CieXyz(13.337f, 9.297f, 14.727f); - Color color = ciexyz; + Rgba32 color = ciexyz; Assert.Equal(128, color.R); Assert.Equal(64, color.G); @@ -142,7 +142,7 @@ namespace ImageSharp.Tests // Ochre CieXyz ciexyz2 = new CieXyz(31.787f, 26.147f, 4.885f); - Color color2 = ciexyz2; + Rgba32 color2 = ciexyz2; Assert.Equal(204, color2.R); Assert.Equal(119, color2.G); @@ -150,7 +150,7 @@ namespace ImageSharp.Tests // Black CieXyz ciexyz3 = new CieXyz(0, 0, 0); - Color color3 = ciexyz3; + Rgba32 color3 = ciexyz3; Assert.Equal(0, color3.R); Assert.Equal(0, color3.G); @@ -167,7 +167,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", @@ -175,7 +175,7 @@ namespace ImageSharp.Tests public void ColorToHsv() { // Black - Color b = Color.Black; + Rgba32 b = Rgba32.Black; Hsv h = b; Assert.Equal(0, h.H, 1); @@ -183,7 +183,7 @@ namespace ImageSharp.Tests Assert.Equal(0, h.V, 1); // White - Color color = Color.White; + Rgba32 color = Rgba32.White; Hsv hsv = color; Assert.Equal(0f, hsv.H, 1); @@ -191,7 +191,7 @@ namespace ImageSharp.Tests Assert.Equal(1f, hsv.V, 1); // Dark moderate pink. - Color color2 = new Color(128, 64, 106); + Rgba32 color2 = new Rgba32(128, 64, 106); Hsv hsv2 = color2; Assert.Equal(320.6f, hsv2.H, 1); @@ -199,7 +199,7 @@ namespace ImageSharp.Tests Assert.Equal(0.502f, hsv2.V, 2); // Ochre. - Color color3 = new Color(204, 119, 34); + Rgba32 color3 = new Rgba32(204, 119, 34); Hsv hsv3 = color3; Assert.Equal(30f, hsv3.H, 1); @@ -208,14 +208,14 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] public void HsvToColor() { // Dark moderate pink. Hsv hsv = new Hsv(320.6f, 0.5f, 0.502f); - Color color = hsv; + Rgba32 color = hsv; Assert.Equal(color.R, 128); Assert.Equal(color.G, 64); @@ -223,7 +223,7 @@ namespace ImageSharp.Tests // Ochre Hsv hsv2 = new Hsv(30, 0.833f, 0.8f); - Color color2 = hsv2; + Rgba32 color2 = hsv2; Assert.Equal(color2.R, 204); Assert.Equal(color2.G, 119); @@ -231,7 +231,7 @@ namespace ImageSharp.Tests // White Hsv hsv3 = new Hsv(0, 0, 1); - Color color3 = hsv3; + Rgba32 color3 = hsv3; Assert.Equal(color3.B, 255); Assert.Equal(color3.G, 255); @@ -248,7 +248,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", @@ -256,7 +256,7 @@ namespace ImageSharp.Tests public void ColorToHsl() { // Black - Color b = Color.Black; + Rgba32 b = Rgba32.Black; Hsl h = b; Assert.Equal(0, h.H, 1); @@ -264,7 +264,7 @@ namespace ImageSharp.Tests Assert.Equal(0, h.L, 1); // White - Color color = Color.White; + Rgba32 color = Rgba32.White; Hsl hsl = color; Assert.Equal(0f, hsl.H, 1); @@ -272,7 +272,7 @@ namespace ImageSharp.Tests Assert.Equal(1f, hsl.L, 1); // Dark moderate pink. - Color color2 = new Color(128, 64, 106); + Rgba32 color2 = new Rgba32(128, 64, 106); Hsl hsl2 = color2; Assert.Equal(320.6f, hsl2.H, 1); @@ -280,7 +280,7 @@ namespace ImageSharp.Tests Assert.Equal(0.376f, hsl2.L, 2); // Ochre. - Color color3 = new Color(204, 119, 34); + Rgba32 color3 = new Rgba32(204, 119, 34); Hsl hsl3 = color3; Assert.Equal(30f, hsl3.H, 1); @@ -289,14 +289,14 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] public void HslToColor() { // Dark moderate pink. Hsl hsl = new Hsl(320.6f, 0.33f, 0.376f); - Color color = hsl; + Rgba32 color = hsl; Assert.Equal(color.R, 128); Assert.Equal(color.G, 64); @@ -304,7 +304,7 @@ namespace ImageSharp.Tests // Ochre Hsl hsl2 = new Hsl(30, 0.714f, 0.467f); - Color color2 = hsl2; + Rgba32 color2 = hsl2; Assert.Equal(color2.R, 204); Assert.Equal(color2.G, 119); @@ -312,7 +312,7 @@ namespace ImageSharp.Tests // White Hsl hsl3 = new Hsl(0, 0, 1); - Color color3 = hsl3; + Rgba32 color3 = hsl3; Assert.Equal(color3.R, 255); Assert.Equal(color3.G, 255); @@ -329,7 +329,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", @@ -337,7 +337,7 @@ namespace ImageSharp.Tests public void ColorToCmyk() { // White - Color color = Color.White; + Rgba32 color = Rgba32.White; Cmyk cmyk = color; Assert.Equal(0, cmyk.C, 1); @@ -346,7 +346,7 @@ namespace ImageSharp.Tests Assert.Equal(0, cmyk.K, 1); // Black - Color color2 = Color.Black; + Rgba32 color2 = Rgba32.Black; Cmyk cmyk2 = color2; Assert.Equal(0, cmyk2.C, 1); Assert.Equal(0, cmyk2.M, 1); @@ -354,7 +354,7 @@ namespace ImageSharp.Tests Assert.Equal(1, cmyk2.K, 1); // Gray - Color color3 = Color.Gray; + Rgba32 color3 = Rgba32.Gray; Cmyk cmyk3 = color3; Assert.Equal(0f, cmyk3.C, 1); Assert.Equal(0f, cmyk3.M, 1); @@ -362,7 +362,7 @@ namespace ImageSharp.Tests Assert.Equal(0.498, cmyk3.K, 2); // Checked with other online converters. // Cyan - Color color4 = Color.Cyan; + Rgba32 color4 = Rgba32.Cyan; Cmyk cmyk4 = color4; Assert.Equal(1, cmyk4.C, 1); Assert.Equal(0f, cmyk4.M, 1); @@ -371,14 +371,14 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// [Fact] public void CmykToColor() { // Dark moderate pink. Cmyk cmyk = new Cmyk(0f, .5f, .171f, .498f); - Color color = cmyk; + Rgba32 color = cmyk; Assert.Equal(color.R, 128); Assert.Equal(color.G, 64); @@ -386,7 +386,7 @@ namespace ImageSharp.Tests // Ochre Cmyk cmyk2 = new Cmyk(0, .416f, .833f, .199f); - Color color2 = cmyk2; + Rgba32 color2 = cmyk2; Assert.Equal(color2.R, 204); Assert.Equal(color2.G, 119); @@ -394,7 +394,7 @@ namespace ImageSharp.Tests // White Cmyk cmyk3 = new Cmyk(0, 0, 0, 0); - Color color3 = cmyk3; + Rgba32 color3 = cmyk3; Assert.Equal(color3.R, 255); Assert.Equal(color3.G, 255); @@ -411,7 +411,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// Comparison values obtained from /// http://colormine.org/convert/rgb-to-lab /// @@ -419,7 +419,7 @@ namespace ImageSharp.Tests public void ColorToCieLab() { // White - Color color = Color.White; + Rgba32 color = Rgba32.White; CieLab cielab = color; Assert.Equal(100, cielab.L, 3); @@ -427,21 +427,21 @@ namespace ImageSharp.Tests Assert.Equal(-0.010, cielab.B, 3); // Black - Color color2 = Color.Black; + Rgba32 color2 = Rgba32.Black; CieLab cielab2 = color2; Assert.Equal(0, cielab2.L, 3); Assert.Equal(0, cielab2.A, 3); Assert.Equal(0, cielab2.B, 3); // Gray - Color color3 = Color.Gray; + Rgba32 color3 = Rgba32.Gray; CieLab cielab3 = color3; Assert.Equal(53.585, cielab3.L, 3); Assert.Equal(0.003, cielab3.A, 3); Assert.Equal(-0.006, cielab3.B, 3); // Cyan - Color color4 = Color.Cyan; + Rgba32 color4 = Rgba32.Cyan; CieLab cielab4 = color4; Assert.Equal(91.117, cielab4.L, 3); Assert.Equal(-48.080, cielab4.A, 3); @@ -449,7 +449,7 @@ namespace ImageSharp.Tests } /// - /// Tests the implicit conversion from to . + /// Tests the implicit conversion from to . /// /// Comparison values obtained from /// http://colormine.org/convert/rgb-to-lab @@ -458,7 +458,7 @@ namespace ImageSharp.Tests { // Dark moderate pink. CieLab cielab = new CieLab(36.5492f, 33.3173f, -12.0615f); - Color color = cielab; + Rgba32 color = cielab; Assert.Equal(color.R, 128); Assert.Equal(color.G, 64); @@ -466,7 +466,7 @@ namespace ImageSharp.Tests // Ochre CieLab cielab2 = new CieLab(58.1758f, 27.3399f, 56.8240f); - Color color2 = cielab2; + Rgba32 color2 = cielab2; Assert.Equal(color2.R, 204); Assert.Equal(color2.G, 119); @@ -474,7 +474,7 @@ namespace ImageSharp.Tests // Black CieLab cielab3 = new CieLab(0, 0, 0); - Color color3 = cielab3; + Rgba32 color3 = cielab3; Assert.Equal(color3.R, 0); Assert.Equal(color3.G, 0); diff --git a/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs b/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs index 899ce4f77..1f80aa7d5 100644 --- a/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs @@ -15,14 +15,14 @@ namespace ImageSharp.Tests using Xunit; public class ColorDefinitionTests { - public static IEnumerable ColorNames => typeof(NamedColors).GetTypeInfo().GetFields().Select(x => new[] { x.Name }); + public static IEnumerable ColorNames => typeof(NamedColors).GetTypeInfo().GetFields().Select(x => new[] { x.Name }); [Theory] [MemberData(nameof(ColorNames))] public void AllColorsAreOnGenericAndBaseColor(string name) { - FieldInfo generic = typeof(NamedColors).GetTypeInfo().GetField(name); - FieldInfo specific = typeof(Color).GetTypeInfo().GetField(name); + FieldInfo generic = typeof(NamedColors).GetTypeInfo().GetField(name); + FieldInfo specific = typeof(Rgba32).GetTypeInfo().GetField(name); Assert.NotNull(specific); Assert.NotNull(generic); @@ -30,8 +30,8 @@ namespace ImageSharp.Tests Assert.True(specific.Attributes.HasFlag(FieldAttributes.Static), "specific must be static"); Assert.True(generic.Attributes.HasFlag(FieldAttributes.Public), "generic must be public"); Assert.True(generic.Attributes.HasFlag(FieldAttributes.Static), "generic must be static"); - Color expected = (Color)generic.GetValue(null); - Color actual = (Color)specific.GetValue(null); + Rgba32 expected = (Rgba32)generic.GetValue(null); + Rgba32 actual = (Rgba32)specific.GetValue(null); Assert.Equal(expected, actual); } } diff --git a/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs b/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs index ffb04e8b2..18d6d6e71 100644 --- a/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs @@ -33,7 +33,7 @@ namespace ImageSharp.Tests.Colors { new NormalizedShort4(Vector4.One), new NormalizedShort4(Vector4.One), typeof(NormalizedShort4) }, { new Rg32(Vector2.One), new Rg32(Vector2.One), typeof(Rg32) }, { new Rgba1010102(Vector4.One), new Rgba1010102(Vector4.One), typeof(Rgba1010102) }, - { new Color(Vector4.One), new Color(Vector4.One), typeof(Color) }, + { new Rgba32(Vector4.One), new Rgba32(Vector4.One), typeof(Rgba32) }, { new Rgba64(Vector4.One), new Rgba64(Vector4.One), typeof(Rgba64) }, { new Short2(Vector2.One * 0x7FFF), new Short2(Vector2.One * 0x7FFF), typeof(Short2) }, { new Short4(Vector4.One * 0x7FFF), new Short4(Vector4.One * 0x7FFF), typeof(Short4) }, @@ -145,7 +145,7 @@ namespace ImageSharp.Tests.Colors { new NormalizedShort4(Vector4.One), new NormalizedShort4(Vector4.Zero), typeof(NormalizedShort4) }, { new Rg32(Vector2.One), new Rg32(Vector2.Zero), typeof(Rg32) }, { new Rgba1010102(Vector4.One), new Rgba1010102(Vector4.Zero), typeof(Rgba1010102) }, - { new Color(Vector4.One), new Color(Vector4.Zero), typeof(Color) }, + { new Rgba32(Vector4.One), new Rgba32(Vector4.Zero), typeof(Rgba32) }, { new Rgba64(Vector4.One), new Rgba64(Vector4.Zero), typeof(Rgba64) }, { new Short2(Vector2.One * 0x7FFF), new Short2(Vector2.Zero), typeof(Short2) }, { new Short4(Vector4.One * 0x7FFF), new Short4(Vector4.Zero), typeof(Short4) }, diff --git a/tests/ImageSharp.Tests/Colors/ColorTests.cs b/tests/ImageSharp.Tests/Colors/ColorTests.cs index e2c62b507..4bfdc883f 100644 --- a/tests/ImageSharp.Tests/Colors/ColorTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorTests.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Tests using Xunit; /// - /// Tests the struct. + /// Tests the struct. /// public class ColorTests { @@ -21,12 +21,12 @@ namespace ImageSharp.Tests [Fact] public void AreEqual() { - Color color1 = new Color(0, 0, 0); - Color color2 = new Color(0, 0, 0, 1F); - Color color3 = Color.FromHex("#000"); - Color color4 = Color.FromHex("#000F"); - Color color5 = Color.FromHex("#000000"); - Color color6 = Color.FromHex("#000000FF"); + Rgba32 color1 = new Rgba32(0, 0, 0); + Rgba32 color2 = new Rgba32(0, 0, 0, 1F); + Rgba32 color3 = Rgba32.FromHex("#000"); + Rgba32 color4 = Rgba32.FromHex("#000F"); + Rgba32 color5 = Rgba32.FromHex("#000000"); + Rgba32 color6 = Rgba32.FromHex("#000000FF"); Assert.Equal(color1, color2); Assert.Equal(color1, color3); @@ -41,11 +41,11 @@ namespace ImageSharp.Tests [Fact] public void AreNotEqual() { - Color color1 = new Color(255, 0, 0, 255); - Color color2 = new Color(0, 0, 0, 255); - Color color3 = Color.FromHex("#000"); - Color color4 = Color.FromHex("#000000"); - Color color5 = Color.FromHex("#FF000000"); + Rgba32 color1 = new Rgba32(255, 0, 0, 255); + Rgba32 color2 = new Rgba32(0, 0, 0, 255); + Rgba32 color3 = Rgba32.FromHex("#000"); + Rgba32 color4 = Rgba32.FromHex("#000000"); + Rgba32 color5 = Rgba32.FromHex("#FF000000"); Assert.NotEqual(color1, color2); Assert.NotEqual(color1, color3); @@ -59,25 +59,25 @@ namespace ImageSharp.Tests [Fact] public void ConstructorAssignsProperties() { - Color color1 = new Color(1, .1f, .133f, .864f); + Rgba32 color1 = new Rgba32(1, .1f, .133f, .864f); Assert.Equal(255, color1.R); Assert.Equal((byte)Math.Round(.1f * 255), color1.G); Assert.Equal((byte)Math.Round(.133f * 255), color1.B); Assert.Equal((byte)Math.Round(.864f * 255), color1.A); - Color color2 = new Color(1, .1f, .133f); + Rgba32 color2 = new Rgba32(1, .1f, .133f); Assert.Equal(255, color2.R); Assert.Equal(Math.Round(.1f * 255), color2.G); Assert.Equal(Math.Round(.133f * 255), color2.B); Assert.Equal(255, color2.A); - Color color4 = new Color(new Vector3(1, .1f, .133f)); + Rgba32 color4 = new Rgba32(new Vector3(1, .1f, .133f)); Assert.Equal(255, color4.R); Assert.Equal(Math.Round(.1f * 255), color4.G); Assert.Equal(Math.Round(.133f * 255), color4.B); Assert.Equal(255, color4.A); - Color color5 = new Color(new Vector4(1, .1f, .133f, .5f)); + Rgba32 color5 = new Rgba32(new Vector4(1, .1f, .133f, .5f)); Assert.Equal(255, color5.R); Assert.Equal(Math.Round(.1f * 255), color5.G); Assert.Equal(Math.Round(.133f * 255), color5.B); @@ -90,7 +90,7 @@ namespace ImageSharp.Tests [Fact] public void FromAndToHex() { - Color color = Color.FromHex("#AABBCCDD"); + Rgba32 color = Rgba32.FromHex("#AABBCCDD"); Assert.Equal(170, color.R); Assert.Equal(187, color.G); Assert.Equal(204, color.B); @@ -118,14 +118,14 @@ namespace ImageSharp.Tests [Fact] public unsafe void ByteLayout() { - Color color = new Color(1, 2, 3, 4); + Rgba32 color = new Rgba32(1, 2, 3, 4); byte* colorBase = (byte*)&color; Assert.Equal(1, colorBase[0]); Assert.Equal(2, colorBase[1]); Assert.Equal(3, colorBase[2]); Assert.Equal(4, colorBase[3]); - Assert.Equal(4, sizeof(Color)); + Assert.Equal(4, sizeof(Rgba32)); } } } \ No newline at end of file diff --git a/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs b/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs index 064bdf2d0..7a6f2bdf4 100644 --- a/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs @@ -16,101 +16,101 @@ namespace ImageSharp.Tests.Colors /// /// Orange backdrop /// - private static readonly Color Backdrop = new Color(204, 102, 0); + private static readonly Rgba32 Backdrop = new Rgba32(204, 102, 0); /// /// Blue source /// - private static readonly Color Source = new Color(0, 102, 153); + private static readonly Rgba32 Source = new Rgba32(0, 102, 153); [Fact] public void Normal() { - Color normal = Color.Normal(Backdrop, Source); + Rgba32 normal = Rgba32.Normal(Backdrop, Source); Assert.True(normal == Source); } [Fact] public void Multiply() { - Assert.True(Color.Multiply(Backdrop, Color.Black) == Color.Black); - Assert.True(Color.Multiply(Backdrop, Color.White) == Backdrop); + Assert.True(Rgba32.Multiply(Backdrop, Rgba32.Black) == Rgba32.Black); + Assert.True(Rgba32.Multiply(Backdrop, Rgba32.White) == Backdrop); - Color multiply = Color.Multiply(Backdrop, Source); - Assert.True(multiply == new Color(0, 41, 0)); + Rgba32 multiply = Rgba32.Multiply(Backdrop, Source); + Assert.True(multiply == new Rgba32(0, 41, 0)); } [Fact] public void Screen() { - Assert.True(Color.Screen(Backdrop, Color.Black) == Backdrop); - Assert.True(Color.Screen(Backdrop, Color.White) == Color.White); + Assert.True(Rgba32.Screen(Backdrop, Rgba32.Black) == Backdrop); + Assert.True(Rgba32.Screen(Backdrop, Rgba32.White) == Rgba32.White); - Color screen = Color.Screen(Backdrop, Source); - Assert.True(screen == new Color(204, 163, 153)); + Rgba32 screen = Rgba32.Screen(Backdrop, Source); + Assert.True(screen == new Rgba32(204, 163, 153)); } [Fact] public void HardLight() { - Color hardLight = Color.HardLight(Backdrop, Source); - Assert.True(hardLight == new Color(0, 82, 51)); + Rgba32 hardLight = Rgba32.HardLight(Backdrop, Source); + Assert.True(hardLight == new Rgba32(0, 82, 51)); } [Fact] public void Overlay() { - Color overlay = Color.Overlay(Backdrop, Source); - Assert.True(overlay == new Color(153, 82, 0)); + Rgba32 overlay = Rgba32.Overlay(Backdrop, Source); + Assert.True(overlay == new Rgba32(153, 82, 0)); } [Fact] public void Darken() { - Color darken = Color.Darken(Backdrop, Source); - Assert.True(darken == new Color(0, 102, 0)); + Rgba32 darken = Rgba32.Darken(Backdrop, Source); + Assert.True(darken == new Rgba32(0, 102, 0)); } [Fact] public void Lighten() { - Color lighten = Color.Lighten(Backdrop, Source); - Assert.True(lighten == new Color(204, 102, 153)); + Rgba32 lighten = Rgba32.Lighten(Backdrop, Source); + Assert.True(lighten == new Rgba32(204, 102, 153)); } [Fact] public void SoftLight() { - Color softLight = Color.SoftLight(Backdrop, Source); - Assert.True(softLight == new Color(163, 90, 0)); + Rgba32 softLight = Rgba32.SoftLight(Backdrop, Source); + Assert.True(softLight == new Rgba32(163, 90, 0)); } [Fact] public void ColorDodge() { - Color colorDodge = Color.ColorDodge(Backdrop, Source); - Assert.True(colorDodge == new Color(204, 170, 0)); + Rgba32 colorDodge = Rgba32.ColorDodge(Backdrop, Source); + Assert.True(colorDodge == new Rgba32(204, 170, 0)); } [Fact] public void ColorBurn() { - Color colorBurn = Color.ColorBurn(Backdrop, Source); - Assert.True(colorBurn == new Color(0, 0, 0)); + Rgba32 colorBurn = Rgba32.ColorBurn(Backdrop, Source); + Assert.True(colorBurn == new Rgba32(0, 0, 0)); } [Fact] public void Difference() { - Color difference = Color.Difference(Backdrop, Source); - Assert.True(difference == new Color(204, 0, 153)); + Rgba32 difference = Rgba32.Difference(Backdrop, Source); + Assert.True(difference == new Rgba32(204, 0, 153)); } [Fact] public void Exclusion() { - Color exclusion = Color.Exclusion(Backdrop, Source); - Assert.True(exclusion == new Color(204, 122, 153)); + Rgba32 exclusion = Rgba32.Exclusion(Backdrop, Source); + Assert.True(exclusion == new Rgba32(204, 122, 153)); } } } diff --git a/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs b/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs index 4300b1b38..135490f40 100644 --- a/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs @@ -11,7 +11,7 @@ namespace ImageSharp.Tests using Xunit; /// - /// Tests the struct. + /// Tests the struct. /// public class ColorVectorTests { @@ -21,12 +21,12 @@ namespace ImageSharp.Tests [Fact] public void AreEqual() { - ColorVector color1 = new ColorVector(0, 0, 0F); - ColorVector color2 = new ColorVector(0, 0, 0, 1F); - ColorVector color3 = ColorVector.FromHex("#000"); - ColorVector color4 = ColorVector.FromHex("#000F"); - ColorVector color5 = ColorVector.FromHex("#000000"); - ColorVector color6 = ColorVector.FromHex("#000000FF"); + RgbaVector color1 = new RgbaVector(0, 0, 0F); + RgbaVector color2 = new RgbaVector(0, 0, 0, 1F); + RgbaVector color3 = RgbaVector.FromHex("#000"); + RgbaVector color4 = RgbaVector.FromHex("#000F"); + RgbaVector color5 = RgbaVector.FromHex("#000000"); + RgbaVector color6 = RgbaVector.FromHex("#000000FF"); Assert.Equal(color1, color2); Assert.Equal(color1, color3); @@ -41,11 +41,11 @@ namespace ImageSharp.Tests [Fact] public void AreNotEqual() { - ColorVector color1 = new ColorVector(1, 0, 0, 1); - ColorVector color2 = new ColorVector(0, 0, 0, 1); - ColorVector color3 = ColorVector.FromHex("#000"); - ColorVector color4 = ColorVector.FromHex("#000000"); - ColorVector color5 = ColorVector.FromHex("#FF000000"); + RgbaVector color1 = new RgbaVector(1, 0, 0, 1); + RgbaVector color2 = new RgbaVector(0, 0, 0, 1); + RgbaVector color3 = RgbaVector.FromHex("#000"); + RgbaVector color4 = RgbaVector.FromHex("#000000"); + RgbaVector color5 = RgbaVector.FromHex("#FF000000"); Assert.NotEqual(color1, color2); Assert.NotEqual(color1, color3); @@ -59,25 +59,25 @@ namespace ImageSharp.Tests [Fact] public void ConstructorAssignsProperties() { - ColorVector color1 = new ColorVector(1, .1F, .133F, .864F); + RgbaVector color1 = new RgbaVector(1, .1F, .133F, .864F); Assert.Equal(1F, color1.R); Assert.Equal(.1F, color1.G); Assert.Equal(.133F, color1.B); Assert.Equal(.864F, color1.A); - ColorVector color2 = new ColorVector(1, .1f, .133f); + RgbaVector color2 = new RgbaVector(1, .1f, .133f); Assert.Equal(1F, color2.R); Assert.Equal(.1F, color2.G); Assert.Equal(.133F, color2.B); Assert.Equal(1F, color2.A); - ColorVector color4 = new ColorVector(new Vector3(1, .1f, .133f)); + RgbaVector color4 = new RgbaVector(new Vector3(1, .1f, .133f)); Assert.Equal(1F, color4.R); Assert.Equal(.1F, color4.G); Assert.Equal(.133F, color4.B); Assert.Equal(1F, color4.A); - ColorVector color5 = new ColorVector(new Vector4(1, .1f, .133f, .5f)); + RgbaVector color5 = new RgbaVector(new Vector4(1, .1f, .133f, .5f)); Assert.Equal(1F, color5.R); Assert.Equal(.1F, color5.G); Assert.Equal(.133F, color5.B); @@ -90,7 +90,7 @@ namespace ImageSharp.Tests [Fact] public void FromAndToHex() { - ColorVector color = ColorVector.FromHex("#AABBCCDD"); + RgbaVector color = RgbaVector.FromHex("#AABBCCDD"); Assert.Equal(170 / 255F, color.R); Assert.Equal(187 / 255F, color.G); Assert.Equal(204 / 255F, color.B); @@ -118,8 +118,8 @@ namespace ImageSharp.Tests [Fact] public void FloatLayout() { - ColorVector color = new ColorVector(1F, 2, 3, 4); - Vector4 colorBase = Unsafe.As(ref Unsafe.Add(ref color, 0)); + RgbaVector color = new RgbaVector(1F, 2, 3, 4); + Vector4 colorBase = Unsafe.As(ref Unsafe.Add(ref color, 0)); float[] ordered = new float[4]; colorBase.CopyTo(ordered); diff --git a/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs b/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs index c2e27d231..3b4db9cc5 100644 --- a/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs @@ -18,101 +18,101 @@ namespace ImageSharp.Tests.Colors /// /// Orange backdrop /// - private static readonly ColorVector Backdrop = new ColorVector(204, 102, 0); + private static readonly RgbaVector Backdrop = new RgbaVector(204, 102, 0); /// /// Blue source /// - private static readonly ColorVector Source = new ColorVector(0, 102, 153); + private static readonly RgbaVector Source = new RgbaVector(0, 102, 153); [Fact] public void Normal() { - ColorVector normal = ColorVector.Normal(Backdrop, Source); + RgbaVector normal = RgbaVector.Normal(Backdrop, Source); Assert.True(normal == Source); } [Fact] public void Multiply() { - Assert.Equal(ColorVector.Multiply(Backdrop, ColorVector.Black).ToVector4(), Color.Black.ToVector4(), FloatComparer); - Assert.Equal(ColorVector.Multiply(Backdrop, ColorVector.White).ToVector4(), Backdrop.ToVector4(), FloatComparer); + Assert.Equal(RgbaVector.Multiply(Backdrop, RgbaVector.Black).ToVector4(), Rgba32.Black.ToVector4(), FloatComparer); + Assert.Equal(RgbaVector.Multiply(Backdrop, RgbaVector.White).ToVector4(), Backdrop.ToVector4(), FloatComparer); - ColorVector multiply = ColorVector.Multiply(Backdrop, Source); - Assert.Equal(multiply.ToVector4(), new ColorVector(0, 41, 0).ToVector4(), FloatComparer); + RgbaVector multiply = RgbaVector.Multiply(Backdrop, Source); + Assert.Equal(multiply.ToVector4(), new RgbaVector(0, 41, 0).ToVector4(), FloatComparer); } [Fact] public void Screen() { - Assert.Equal(ColorVector.Screen(Backdrop, ColorVector.Black).ToVector4(), Backdrop.ToVector4(), FloatComparer); - Assert.Equal(ColorVector.Screen(Backdrop, ColorVector.White).ToVector4(), ColorVector.White.ToVector4(), FloatComparer); + Assert.Equal(RgbaVector.Screen(Backdrop, RgbaVector.Black).ToVector4(), Backdrop.ToVector4(), FloatComparer); + Assert.Equal(RgbaVector.Screen(Backdrop, RgbaVector.White).ToVector4(), RgbaVector.White.ToVector4(), FloatComparer); - ColorVector screen = ColorVector.Screen(Backdrop, Source); - Assert.Equal(screen.ToVector4(), new ColorVector(204, 163, 153).ToVector4(), FloatComparer); + RgbaVector screen = RgbaVector.Screen(Backdrop, Source); + Assert.Equal(screen.ToVector4(), new RgbaVector(204, 163, 153).ToVector4(), FloatComparer); } [Fact] public void HardLight() { - ColorVector hardLight = ColorVector.HardLight(Backdrop, Source); - Assert.Equal(hardLight.ToVector4(), new ColorVector(0, 82, 51).ToVector4(), FloatComparer); + RgbaVector hardLight = RgbaVector.HardLight(Backdrop, Source); + Assert.Equal(hardLight.ToVector4(), new RgbaVector(0, 82, 51).ToVector4(), FloatComparer); } [Fact] public void Overlay() { - ColorVector overlay = ColorVector.Overlay(Backdrop, Source); - Assert.Equal(overlay.ToVector4(), new ColorVector(153, 82, 0).ToVector4(), FloatComparer); + RgbaVector overlay = RgbaVector.Overlay(Backdrop, Source); + Assert.Equal(overlay.ToVector4(), new RgbaVector(153, 82, 0).ToVector4(), FloatComparer); } [Fact] public void Darken() { - ColorVector darken = ColorVector.Darken(Backdrop, Source); - Assert.Equal(darken.ToVector4(), new ColorVector(0, 102, 0).ToVector4(), FloatComparer); + RgbaVector darken = RgbaVector.Darken(Backdrop, Source); + Assert.Equal(darken.ToVector4(), new RgbaVector(0, 102, 0).ToVector4(), FloatComparer); } [Fact] public void Lighten() { - ColorVector lighten = ColorVector.Lighten(Backdrop, Source); - Assert.Equal(lighten.ToVector4(), new ColorVector(204, 102, 153).ToVector4(), FloatComparer); + RgbaVector lighten = RgbaVector.Lighten(Backdrop, Source); + Assert.Equal(lighten.ToVector4(), new RgbaVector(204, 102, 153).ToVector4(), FloatComparer); } [Fact] public void SoftLight() { - ColorVector softLight = ColorVector.SoftLight(Backdrop, Source); - Assert.Equal(softLight.ToVector4(), new ColorVector(163, 90, 0).ToVector4(), FloatComparer); + RgbaVector softLight = RgbaVector.SoftLight(Backdrop, Source); + Assert.Equal(softLight.ToVector4(), new RgbaVector(163, 90, 0).ToVector4(), FloatComparer); } [Fact] public void ColorDodge() { - ColorVector colorDodge = ColorVector.ColorDodge(Backdrop, Source); - Assert.Equal(colorDodge.ToVector4(), new ColorVector(204, 170, 0).ToVector4(), FloatComparer); + RgbaVector colorDodge = RgbaVector.ColorDodge(Backdrop, Source); + Assert.Equal(colorDodge.ToVector4(), new RgbaVector(204, 170, 0).ToVector4(), FloatComparer); } [Fact] public void ColorBurn() { - ColorVector colorBurn = ColorVector.ColorBurn(Backdrop, Source); - Assert.Equal(colorBurn.ToVector4(), new ColorVector(0, 0, 0).ToVector4(), FloatComparer); + RgbaVector colorBurn = RgbaVector.ColorBurn(Backdrop, Source); + Assert.Equal(colorBurn.ToVector4(), new RgbaVector(0, 0, 0).ToVector4(), FloatComparer); } [Fact] public void Difference() { - ColorVector difference = ColorVector.Difference(Backdrop, Source); - Assert.Equal(difference.ToVector4(), new ColorVector(204, 0, 153).ToVector4(), FloatComparer); + RgbaVector difference = RgbaVector.Difference(Backdrop, Source); + Assert.Equal(difference.ToVector4(), new RgbaVector(204, 0, 153).ToVector4(), FloatComparer); } [Fact] public void Exclusion() { - ColorVector exclusion = ColorVector.Exclusion(Backdrop, Source); - Assert.Equal(exclusion.ToVector4(), new ColorVector(204, 122, 153).ToVector4(), FloatComparer); + RgbaVector exclusion = RgbaVector.Exclusion(Backdrop, Source); + Assert.Equal(exclusion.ToVector4(), new RgbaVector(204, 122, 153).ToVector4(), FloatComparer); } } } diff --git a/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs b/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs index 52ca86cae..14bd38063 100644 --- a/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs +++ b/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs @@ -715,26 +715,26 @@ namespace ImageSharp.Tests.Colors public void Color() { // Test the limits. - Assert.Equal((uint)0x0, new Color(Vector4.Zero).PackedValue); - Assert.Equal(0xFFFFFFFF, new Color(Vector4.One).PackedValue); + Assert.Equal((uint)0x0, new Rgba32(Vector4.Zero).PackedValue); + Assert.Equal(0xFFFFFFFF, new Rgba32(Vector4.One).PackedValue); // Test ToVector4. - Assert.True(Equal(Vector4.One, new Color(Vector4.One).ToVector4())); - Assert.True(Equal(Vector4.Zero, new Color(Vector4.Zero).ToVector4())); - Assert.True(Equal(Vector4.UnitX, new Color(Vector4.UnitX).ToVector4())); - Assert.True(Equal(Vector4.UnitY, new Color(Vector4.UnitY).ToVector4())); - Assert.True(Equal(Vector4.UnitZ, new Color(Vector4.UnitZ).ToVector4())); - Assert.True(Equal(Vector4.UnitW, new Color(Vector4.UnitW).ToVector4())); + Assert.True(Equal(Vector4.One, new Rgba32(Vector4.One).ToVector4())); + Assert.True(Equal(Vector4.Zero, new Rgba32(Vector4.Zero).ToVector4())); + Assert.True(Equal(Vector4.UnitX, new Rgba32(Vector4.UnitX).ToVector4())); + Assert.True(Equal(Vector4.UnitY, new Rgba32(Vector4.UnitY).ToVector4())); + Assert.True(Equal(Vector4.UnitZ, new Rgba32(Vector4.UnitZ).ToVector4())); + Assert.True(Equal(Vector4.UnitW, new Rgba32(Vector4.UnitW).ToVector4())); // Test clamping. - Assert.True(Equal(Vector4.Zero, new Color(Vector4.One * -1234.0f).ToVector4())); - Assert.True(Equal(Vector4.One, new Color(Vector4.One * +1234.0f).ToVector4())); + Assert.True(Equal(Vector4.Zero, new Rgba32(Vector4.One * -1234.0f).ToVector4())); + Assert.True(Equal(Vector4.One, new Rgba32(Vector4.One * +1234.0f).ToVector4())); float x = +0.1f; float y = -0.3f; float z = +0.5f; float w = -0.7f; - Color rgba32 = new Color(x, y, z, w); + Rgba32 rgba32 = new Rgba32(x, y, z, w); Assert.Equal(0x80001Au, rgba32.PackedValue); // Test ordering diff --git a/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs b/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs index 4fb189ca8..e130d7399 100644 --- a/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs +++ b/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs @@ -9,8 +9,8 @@ [Fact] public void Color_Types_From_Bytes_Produce_Equal_Scaled_Component_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); Assert.Equal(color.R, (byte)(colorVector.R * 255)); Assert.Equal(color.G, (byte)(colorVector.G * 255)); @@ -21,8 +21,8 @@ [Fact] public void Color_Types_From_Floats_Produce_Equal_Scaled_Component_OutPut() { - Color color = new Color(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F); - ColorVector colorVector = new ColorVector(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F); + Rgba32 color = new Rgba32(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F); + RgbaVector colorVector = new RgbaVector(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F); Assert.Equal(color.R, (byte)(colorVector.R * 255)); Assert.Equal(color.G, (byte)(colorVector.G * 255)); @@ -33,8 +33,8 @@ [Fact] public void Color_Types_From_Vector4_Produce_Equal_Scaled_Component_OutPut() { - Color color = new Color(new Vector4(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F)); - ColorVector colorVector = new ColorVector(new Vector4(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F)); + Rgba32 color = new Rgba32(new Vector4(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F)); + RgbaVector colorVector = new RgbaVector(new Vector4(24 / 255F, 48 / 255F, 96 / 255F, 192 / 255F)); Assert.Equal(color.R, (byte)(colorVector.R * 255)); Assert.Equal(color.G, (byte)(colorVector.G * 255)); @@ -45,8 +45,8 @@ [Fact] public void Color_Types_From_Vector3_Produce_Equal_Scaled_Component_OutPut() { - Color color = new Color(new Vector3(24 / 255F, 48 / 255F, 96 / 255F)); - ColorVector colorVector = new ColorVector(new Vector3(24 / 255F, 48 / 255F, 96 / 255F)); + Rgba32 color = new Rgba32(new Vector3(24 / 255F, 48 / 255F, 96 / 255F)); + RgbaVector colorVector = new RgbaVector(new Vector3(24 / 255F, 48 / 255F, 96 / 255F)); Assert.Equal(color.R, (byte)(colorVector.R * 255)); Assert.Equal(color.G, (byte)(colorVector.G * 255)); @@ -57,8 +57,8 @@ [Fact] public void Color_Types_From_Hex_Produce_Equal_Scaled_Component_OutPut() { - Color color = Color.FromHex("183060C0"); - ColorVector colorVector = ColorVector.FromHex("183060C0"); + Rgba32 color = Rgba32.FromHex("183060C0"); + RgbaVector colorVector = RgbaVector.FromHex("183060C0"); Assert.Equal(color.R, (byte)(colorVector.R * 255)); Assert.Equal(color.G, (byte)(colorVector.G * 255)); @@ -69,8 +69,8 @@ [Fact] public void Color_Types_To_Vector4_Produce_Equal_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); Assert.Equal(color.ToVector4(), colorVector.ToVector4()); } @@ -78,8 +78,8 @@ [Fact] public void Color_Types_To_RgbBytes_Produce_Equal_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); byte[] rgb = new byte[3]; byte[] rgbVector = new byte[3]; @@ -93,8 +93,8 @@ [Fact] public void Color_Types_To_RgbaBytes_Produce_Equal_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); byte[] rgba = new byte[4]; byte[] rgbaVector = new byte[4]; @@ -108,8 +108,8 @@ [Fact] public void Color_Types_To_BgrBytes_Produce_Equal_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); byte[] bgr = new byte[3]; byte[] bgrVector = new byte[3]; @@ -123,8 +123,8 @@ [Fact] public void Color_Types_To_BgraBytes_Produce_Equal_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); byte[] bgra = new byte[4]; byte[] bgraVector = new byte[4]; @@ -138,8 +138,8 @@ [Fact] public void Color_Types_To_Hex_Produce_Equal_OutPut() { - Color color = new Color(24, 48, 96, 192); - ColorVector colorVector = new ColorVector(24, 48, 96, 192); + Rgba32 color = new Rgba32(24, 48, 96, 192); + RgbaVector colorVector = new RgbaVector(24, 48, 96, 192); // 183060C0 Assert.Equal(color.ToHex(), colorVector.ToHex()); diff --git a/tests/ImageSharp.Tests/Common/BufferSpanTests.cs b/tests/ImageSharp.Tests/Common/BufferSpanTests.cs index ebf3a866a..094b440ee 100644 --- a/tests/ImageSharp.Tests/Common/BufferSpanTests.cs +++ b/tests/ImageSharp.Tests/Common/BufferSpanTests.cs @@ -412,12 +412,12 @@ namespace ImageSharp.Tests.Common [Fact] public void Color32ToBytes() { - Color[] colors = { new Color(0, 1, 2, 3), new Color(4, 5, 6, 7), new Color(8, 9, 10, 11), }; + Rgba32[] colors = { new Rgba32(0, 1, 2, 3), new Rgba32(4, 5, 6, 7), new Rgba32(8, 9, 10, 11), }; - using (Buffer colorBuf = new Buffer(colors)) + using (Buffer colorBuf = new Buffer(colors)) using (Buffer byteBuf = new Buffer(colors.Length * 4)) { - BufferSpan.Copy(colorBuf.Span.AsBytes(), byteBuf, colorBuf.Length * sizeof(Color)); + BufferSpan.Copy(colorBuf.Span.AsBytes(), byteBuf, colorBuf.Length * sizeof(Rgba32)); byte[] a = byteBuf.Array; diff --git a/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs b/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs index 403dffba9..077c011bb 100644 --- a/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs +++ b/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Tests [Fact] public void PixelDataPoolRentsMinimumSize() { - Color[] pixels = PixelDataPool.Rent(1024); + Rgba32[] pixels = PixelDataPool.Rent(1024); Assert.True(pixels.Length >= 1024); } @@ -26,9 +26,9 @@ namespace ImageSharp.Tests [Fact] public void PixelDataPoolDoesNotThrowWhenReturningNonPooled() { - Color[] pixels = new Color[1024]; + Rgba32[] pixels = new Rgba32[1024]; - PixelDataPool.Return(pixels); + PixelDataPool.Return(pixels); Assert.True(pixels.Length >= 1024); } @@ -39,7 +39,7 @@ namespace ImageSharp.Tests public void CalculateMaxArrayLength(bool isRawData) { int max = isRawData ? PixelDataPool.CalculateMaxArrayLength() - : PixelDataPool.CalculateMaxArrayLength(); + : PixelDataPool.CalculateMaxArrayLength(); Assert.Equal(max < int.MaxValue, !isRawData); } diff --git a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs index a1d4d3fd5..9c7a76738 100644 --- a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs @@ -23,8 +23,8 @@ namespace ImageSharp.Tests.Drawing { using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { - image.BackgroundColor(Color.Blue) - .DrawBeziers(Color.HotPink, 5, + image.BackgroundColor(Rgba32.Blue) + .DrawBeziers(Rgba32.HotPink, 5, new[] { new Vector2(10, 400), new Vector2(30, 10), @@ -34,21 +34,21 @@ namespace ImageSharp.Tests.Drawing .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { //top of curve - Assert.Equal(Color.HotPink, sourcePixels[138, 115]); + Assert.Equal(Rgba32.HotPink, sourcePixels[138, 115]); //start points - Assert.Equal(Color.HotPink, sourcePixels[10, 400]); - Assert.Equal(Color.HotPink, sourcePixels[300, 400]); + Assert.Equal(Rgba32.HotPink, sourcePixels[10, 400]); + Assert.Equal(Rgba32.HotPink, sourcePixels[300, 400]); //curve points should not be never be set - Assert.Equal(Color.Blue, sourcePixels[30, 10]); - Assert.Equal(Color.Blue, sourcePixels[240, 30]); + Assert.Equal(Rgba32.Blue, sourcePixels[30, 10]); + Assert.Equal(Rgba32.Blue, sourcePixels[240, 30]); // inside shape should be empty - Assert.Equal(Color.Blue, sourcePixels[200, 250]); + Assert.Equal(Rgba32.Blue, sourcePixels[200, 250]); } } } @@ -59,13 +59,13 @@ namespace ImageSharp.Tests.Drawing { string path = this.CreateOutputDirectory("Drawing", "BezierLine"); - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { - image.BackgroundColor(Color.Blue) + image.BackgroundColor(Rgba32.Blue) .DrawBeziers(color, 10, new[] { @@ -78,9 +78,9 @@ namespace ImageSharp.Tests.Drawing } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { //top of curve Assert.Equal(mergedColor, sourcePixels[138, 115]); @@ -90,11 +90,11 @@ namespace ImageSharp.Tests.Drawing Assert.Equal(mergedColor, sourcePixels[300, 400]); //curve points should not be never be set - Assert.Equal(Color.Blue, sourcePixels[30, 10]); - Assert.Equal(Color.Blue, sourcePixels[240, 30]); + Assert.Equal(Rgba32.Blue, sourcePixels[30, 10]); + Assert.Equal(Rgba32.Blue, sourcePixels[240, 30]); // inside shape should be empty - Assert.Equal(Color.Blue, sourcePixels[200, 250]); + Assert.Equal(Rgba32.Blue, sourcePixels[200, 250]); } } } diff --git a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs index fc231a89d..0588c69ed 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs @@ -38,18 +38,18 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .Draw(Color.HotPink, 5, p) + .BackgroundColor(Rgba32.Blue) + .Draw(Rgba32.HotPink, 5, p) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[9, 9]); + Assert.Equal(Rgba32.HotPink, sourcePixels[9, 9]); - Assert.Equal(Color.HotPink, sourcePixels[199, 149]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); } } } @@ -60,7 +60,7 @@ namespace ImageSharp.Tests.Drawing { string path = this.CreateOutputDirectory("Drawing", "Path"); - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); LinearLineSegment linerSegemnt = new LinearLineSegment( @@ -81,21 +81,21 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .Draw(color, 10, p) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[9, 9]); Assert.Equal(mergedColor, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); } } } diff --git a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs index 8162bc531..130719ed7 100644 --- a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs @@ -15,7 +15,7 @@ namespace ImageSharp.Tests.Drawing public class FillPatternBrushTests : FileTestBase { - private void Test(string name, Color background, IBrush brush, Color[,] expectedPattern) + private void Test(string name, Rgba32 background, IBrush brush, Rgba32[,] expectedPattern) { string path = this.CreateOutputDirectory("Fill", "PatternBrush"); using (Image image = new Image(20, 20)) @@ -29,11 +29,11 @@ namespace ImageSharp.Tests.Drawing image.Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { // lets pick random spots to start checking Random r = new Random(); - Fast2DArray expectedPatternFast = new Fast2DArray(expectedPattern); + Fast2DArray expectedPatternFast = new Fast2DArray(expectedPattern); int xStride = expectedPatternFast.Width; int yStride = expectedPatternFast.Height; int offsetX = r.Next(image.Width / xStride) * xStride; @@ -44,8 +44,8 @@ namespace ImageSharp.Tests.Drawing { int actualX = x + offsetX; int actualY = y + offsetY; - Color expected = expectedPatternFast[y, x]; // inverted pattern - Color actual = sourcePixels[actualX, actualY]; + Rgba32 expected = expectedPatternFast[y, x]; // inverted pattern + Rgba32 actual = sourcePixels[actualX, actualY]; if (expected != actual) { Assert.True(false, $"Expected {expected} but found {actual} at ({actualX},{actualY})"); @@ -63,73 +63,73 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithPercent10() { - this.Test("Percent10", Color.Blue, Brushes.Percent10(Color.HotPink, Color.LimeGreen), + this.Test("Percent10", Rgba32.Blue, Brushes.Percent10(Rgba32.HotPink, Rgba32.LimeGreen), new[,] { - { Color.HotPink , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.HotPink , Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen} + { Rgba32.HotPink , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink , Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen} }); } [Fact] public void ImageShouldBeFloodFilledWithPercent10Transparent() { - Test("Percent10_Transparent", Color.Blue, Brushes.Percent10(Color.HotPink), - new Color[,] { - { Color.HotPink , Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.HotPink , Color.Blue}, - { Color.Blue, Color.Blue, Color.Blue, Color.Blue} + 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}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink , Rgba32.Blue}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue} }); } [Fact] public void ImageShouldBeFloodFilledWithPercent20() { - Test("Percent20", Color.Blue, Brushes.Percent20(Color.HotPink, Color.LimeGreen), - new Color[,] { - { Color.HotPink , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.HotPink , Color.LimeGreen}, - { Color.HotPink , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.HotPink , Color.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}, + { Rgba32.HotPink , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink , Rgba32.LimeGreen} }); } [Fact] public void ImageShouldBeFloodFilledWithPercent20_transparent() { - Test("Percent20_Transparent", Color.Blue, Brushes.Percent20(Color.HotPink), - new Color[,] { - { Color.HotPink , Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.HotPink , Color.Blue}, - { Color.HotPink , Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.HotPink , Color.Blue} + 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}, + { Rgba32.HotPink , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink , Rgba32.Blue} }); } [Fact] public void ImageShouldBeFloodFilledWithHorizontal() { - Test("Horizontal", Color.Blue, Brushes.Horizontal(Color.HotPink, Color.LimeGreen), - new Color[,] { - { Color.LimeGreen , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.HotPink, Color.HotPink, Color.HotPink , Color.HotPink}, - { Color.LimeGreen , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen , Color.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}, + { Rgba32.LimeGreen , Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen , Rgba32.LimeGreen} }); } [Fact] public void ImageShouldBeFloodFilledWithHorizontal_transparent() { - Test("Horizontal_Transparent", Color.Blue, Brushes.Horizontal(Color.HotPink), - new Color[,] { - { Color.Blue , Color.Blue, Color.Blue, Color.Blue}, - { Color.HotPink, Color.HotPink, Color.HotPink , Color.HotPink}, - { Color.Blue , Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.Blue , Color.Blue} + 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}, + { Rgba32.Blue , Rgba32.Blue, Rgba32.Blue, Rgba32.Blue}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue , Rgba32.Blue} }); } @@ -138,96 +138,96 @@ namespace ImageSharp.Tests.Drawing [Fact] public void ImageShouldBeFloodFilledWithMin() { - Test("Min", Color.Blue, Brushes.Min(Color.HotPink, Color.LimeGreen), - new Color[,] { - { Color.LimeGreen , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen , Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen , Color.LimeGreen}, - { Color.HotPink, Color.HotPink, Color.HotPink , Color.HotPink} + 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}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen , Rgba32.LimeGreen}, + { Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink , Rgba32.HotPink} }); } [Fact] public void ImageShouldBeFloodFilledWithMin_transparent() { - Test("Min_Transparent", Color.Blue, Brushes.Min(Color.HotPink), - new Color[,] { - { Color.Blue , Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue , Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.Blue , Color.Blue}, - { Color.HotPink, Color.HotPink, Color.HotPink , Color.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}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue , Rgba32.Blue}, + { Rgba32.HotPink, Rgba32.HotPink, Rgba32.HotPink , Rgba32.HotPink}, }); } [Fact] public void ImageShouldBeFloodFilledWithVertical() { - Test("Vertical", Color.Blue, Brushes.Vertical(Color.HotPink, Color.LimeGreen), - new Color[,] { - { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.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}, + { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen} }); } [Fact] public void ImageShouldBeFloodFilledWithVertical_transparent() { - Test("Vertical_Transparent", Color.Blue, Brushes.Vertical(Color.HotPink), - new Color[,] { - { Color.Blue, Color.HotPink, Color.Blue, Color.Blue}, - { Color.Blue, Color.HotPink, Color.Blue, Color.Blue}, - { Color.Blue, Color.HotPink, Color.Blue, Color.Blue}, - { Color.Blue, Color.HotPink, Color.Blue, Color.Blue} + 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}, + { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue}, + { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue} }); } [Fact] public void ImageShouldBeFloodFilledWithForwardDiagonal() { - Test("ForwardDiagonal", Color.Blue, Brushes.ForwardDiagonal(Color.HotPink, Color.LimeGreen), - new Color[,] { - { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.HotPink}, - { Color.LimeGreen, Color.LimeGreen, Color.HotPink, Color.LimeGreen}, - { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen}, - { Color.HotPink, Color.LimeGreen, Color.LimeGreen, Color.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}, + { Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen}, + { Rgba32.HotPink, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen} }); } [Fact] public void ImageShouldBeFloodFilledWithForwardDiagonal_transparent() { - Test("ForwardDiagonal_Transparent", Color.Blue, Brushes.ForwardDiagonal(Color.HotPink), - new Color[,] { - { Color.Blue, Color.Blue, Color.Blue, Color.HotPink}, - { Color.Blue, Color.Blue, Color.HotPink, Color.Blue}, - { Color.Blue, Color.HotPink, Color.Blue, Color.Blue}, - { Color.HotPink, Color.Blue, Color.Blue, Color.Blue} + 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}, + { Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue}, + { Rgba32.HotPink, Rgba32.Blue, Rgba32.Blue, Rgba32.Blue} }); } [Fact] public void ImageShouldBeFloodFilledWithBackwardDiagonal() { - Test("BackwardDiagonal", Color.Blue, Brushes.BackwardDiagonal(Color.HotPink, Color.LimeGreen), - new Color[,] { - { Color.HotPink, Color.LimeGreen, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.HotPink, Color.LimeGreen, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.HotPink, Color.LimeGreen}, - { Color.LimeGreen, Color.LimeGreen, Color.LimeGreen, Color.HotPink} + 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}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink, Rgba32.LimeGreen}, + { Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.LimeGreen, Rgba32.HotPink} }); } [Fact] public void ImageShouldBeFloodFilledWithBackwardDiagonal_transparent() { - Test("BackwardDiagonal_Transparent", Color.Blue, Brushes.BackwardDiagonal(Color.HotPink), - new Color[,] { - { Color.HotPink, Color.Blue, Color.Blue, Color.Blue}, - { Color.Blue, Color.HotPink, Color.Blue, Color.Blue}, - { Color.Blue, Color.Blue, Color.HotPink, Color.Blue}, - { Color.Blue, Color.Blue, Color.Blue, Color.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}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink, Rgba32.Blue}, + { Rgba32.Blue, Rgba32.Blue, Rgba32.Blue, Rgba32.HotPink} }); } } diff --git a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs index 03994bc94..7ec9925a2 100644 --- a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs @@ -29,14 +29,14 @@ namespace ImageSharp.Tests.Drawing { ImageSharp.Rectangle bounds = new ImageSharp.Rectangle(0, 0, 1, 1); - Mock> brush = new Mock>(); + Mock> brush = new Mock>(); Mock region = new Mock(); region.Setup(x => x.Bounds).Returns(bounds); GraphicsOptions options = new GraphicsOptions(antialias) { AntialiasSubpixelDepth = 1 }; - FillRegionProcessor processor = new FillRegionProcessor(brush.Object, region.Object, options); + FillRegionProcessor processor = new FillRegionProcessor(brush.Object, region.Object, options); Image img = new Image(1, 1); processor.Apply(img, bounds); diff --git a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs index bafc84b69..cfcc10738 100644 --- a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs @@ -24,15 +24,15 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/DefaultBack.png")) { image - .Fill(Color.HotPink) + .Fill(Rgba32.HotPink) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[9, 9]); + Assert.Equal(Rgba32.HotPink, sourcePixels[9, 9]); - Assert.Equal(Color.HotPink, sourcePixels[199, 149]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 149]); } } } @@ -46,16 +46,16 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[9, 9]); + Assert.Equal(Rgba32.HotPink, sourcePixels[9, 9]); - Assert.Equal(Color.HotPink, sourcePixels[199, 149]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 149]); } } } @@ -66,20 +66,20 @@ namespace ImageSharp.Tests.Drawing string path = this.CreateOutputDirectory("Fill", "SolidBrush"); using (Image image = new Image(500, 500)) { - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .Fill(color) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[9, 9]); Assert.Equal(mergedColor, sourcePixels[199, 149]); diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs index d7a4bde95..0d8b85729 100644 --- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs @@ -36,33 +36,33 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .Draw(Color.HotPink, 5, simplePath.Clip(hole1)) + .BackgroundColor(Rgba32.Blue) + .Draw(Rgba32.HotPink, 5, simplePath.Clip(hole1)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[10, 10]); + Assert.Equal(Rgba32.HotPink, sourcePixels[10, 10]); - Assert.Equal(Color.HotPink, sourcePixels[200, 150]); + Assert.Equal(Rgba32.HotPink, sourcePixels[200, 150]); - Assert.Equal(Color.HotPink, sourcePixels[50, 300]); + Assert.Equal(Rgba32.HotPink, sourcePixels[50, 300]); - Assert.Equal(Color.HotPink, sourcePixels[37, 85]); + Assert.Equal(Rgba32.HotPink, sourcePixels[37, 85]); - Assert.Equal(Color.HotPink, sourcePixels[93, 85]); + Assert.Equal(Rgba32.HotPink, sourcePixels[93, 85]); - Assert.Equal(Color.HotPink, sourcePixels[65, 137]); + Assert.Equal(Rgba32.HotPink, sourcePixels[65, 137]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[57, 99]); + Assert.Equal(Rgba32.Blue, sourcePixels[57, 99]); //inside shape - Assert.Equal(Color.Blue, sourcePixels[100, 192]); + Assert.Equal(Rgba32.Blue, sourcePixels[100, 192]); } } } @@ -86,18 +86,18 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/SimpleVanishHole.png")) { image - .BackgroundColor(Color.Blue) - .Draw(Color.HotPink, 5, simplePath.Clip(hole1)) + .BackgroundColor(Rgba32.Blue) + .Draw(Rgba32.HotPink, 5, simplePath.Clip(hole1)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[10, 10]); + Assert.Equal(Rgba32.HotPink, sourcePixels[10, 10]); - Assert.Equal(Color.HotPink, sourcePixels[200, 150]); + Assert.Equal(Rgba32.HotPink, sourcePixels[200, 150]); - Assert.Equal(Color.HotPink, sourcePixels[50, 300]); + Assert.Equal(Rgba32.HotPink, sourcePixels[50, 300]); //Assert.Equal(Color.HotPink, sourcePixels[37, 85]); @@ -106,13 +106,13 @@ namespace ImageSharp.Tests.Drawing //Assert.Equal(Color.HotPink, sourcePixels[65, 137]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[57, 99]); + Assert.Equal(Rgba32.Blue, sourcePixels[57, 99]); //inside shape - Assert.Equal(Color.Blue, sourcePixels[100, 192]); + Assert.Equal(Rgba32.Blue, sourcePixels[100, 192]); } } } @@ -137,28 +137,28 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/SimpleOverlapping.png")) { image - .BackgroundColor(Color.Blue) - .Draw(Color.HotPink, 5, simplePath.Clip(hole1)) + .BackgroundColor(Rgba32.Blue) + .Draw(Rgba32.HotPink, 5, simplePath.Clip(hole1)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[10, 10]); + Assert.Equal(Rgba32.HotPink, sourcePixels[10, 10]); - Assert.Equal(Color.HotPink, sourcePixels[200, 150]); + Assert.Equal(Rgba32.HotPink, sourcePixels[200, 150]); - Assert.Equal(Color.HotPink, sourcePixels[50, 300]); + Assert.Equal(Rgba32.HotPink, sourcePixels[50, 300]); - Assert.Equal(Color.Blue, sourcePixels[130, 41]); + Assert.Equal(Rgba32.Blue, sourcePixels[130, 41]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[57, 99]); + Assert.Equal(Rgba32.Blue, sourcePixels[57, 99]); //inside shape - Assert.Equal(Color.Blue, sourcePixels[100, 192]); + Assert.Equal(Rgba32.Blue, sourcePixels[100, 192]); } } } @@ -183,8 +183,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Dashed.png")) { image - .BackgroundColor(Color.Blue) - .Draw(Pens.Dash(Color.HotPink, 5), simplePath.Clip(hole1)) + .BackgroundColor(Rgba32.Blue) + .Draw(Pens.Dash(Rgba32.HotPink, 5), simplePath.Clip(hole1)) .Save(output); } } @@ -204,22 +204,22 @@ namespace ImageSharp.Tests.Drawing new Vector2(37, 85), new Vector2(93, 85), new Vector2(65, 137))); - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .Draw(color, 5, simplePath.Clip(hole1)) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[10, 10]); @@ -234,14 +234,14 @@ namespace ImageSharp.Tests.Drawing Assert.Equal(mergedColor, sourcePixels[65, 137]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[57, 99]); + Assert.Equal(Rgba32.Blue, sourcePixels[57, 99]); //inside shape - Assert.Equal(Color.Blue, sourcePixels[100, 192]); + Assert.Equal(Rgba32.Blue, sourcePixels[100, 192]); } } } diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs index 81efd933b..0671ee00a 100644 --- a/tests/ImageSharp.Tests/Drawing/LineTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs @@ -23,8 +23,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Color.HotPink, 5, + .BackgroundColor(Rgba32.Blue) + .DrawLines(Rgba32.HotPink, 5, new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -33,13 +33,13 @@ namespace ImageSharp.Tests.Drawing .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[9, 9]); + Assert.Equal(Rgba32.HotPink, sourcePixels[9, 9]); - Assert.Equal(Color.HotPink, sourcePixels[199, 149]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); } } } @@ -53,8 +53,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple_noantialias.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Color.HotPink, 5, + .BackgroundColor(Rgba32.Blue) + .DrawLines(Rgba32.HotPink, 5, new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -64,13 +64,13 @@ namespace ImageSharp.Tests.Drawing .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[9, 9]); + Assert.Equal(Rgba32.HotPink, sourcePixels[9, 9]); - Assert.Equal(Color.HotPink, sourcePixels[199, 149]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); } } } @@ -84,8 +84,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Dashed.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Pens.Dash(Color.HotPink, 5), + .BackgroundColor(Rgba32.Blue) + .DrawLines(Pens.Dash(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -105,8 +105,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Dot.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Pens.Dot(Color.HotPink, 5), + .BackgroundColor(Rgba32.Blue) + .DrawLines(Pens.Dot(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -126,8 +126,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/DashDot.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Pens.DashDot(Color.HotPink, 5), + .BackgroundColor(Rgba32.Blue) + .DrawLines(Pens.DashDot(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -147,8 +147,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/DashDotDot.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Pens.DashDotDot(Color.HotPink, 5), new[] { + .BackgroundColor(Rgba32.Blue) + .DrawLines(Pens.DashDotDot(Rgba32.HotPink, 5), new[] { new Vector2(10, 10), new Vector2(200, 150), new Vector2(50, 300) @@ -162,7 +162,7 @@ namespace ImageSharp.Tests.Drawing { string path = this.CreateOutputDirectory("Drawing", "Lines"); - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); Image image = new Image(500, 500); @@ -170,7 +170,7 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .DrawLines(color, 10, new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -180,15 +180,15 @@ namespace ImageSharp.Tests.Drawing } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f/255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f/255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[9, 9]); Assert.Equal(mergedColor, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); } } @@ -202,8 +202,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Rectangle.png")) { image - .BackgroundColor(Color.Blue) - .DrawLines(Color.HotPink, 10, new[] { + .BackgroundColor(Rgba32.Blue) + .DrawLines(Rgba32.HotPink, 10, new[] { new Vector2(10, 10), new Vector2(200, 10), new Vector2(200, 150), @@ -212,15 +212,15 @@ namespace ImageSharp.Tests.Drawing .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[8, 8]); + Assert.Equal(Rgba32.HotPink, sourcePixels[8, 8]); - Assert.Equal(Color.HotPink, sourcePixels[198, 10]); + Assert.Equal(Rgba32.HotPink, sourcePixels[198, 10]); - Assert.Equal(Color.Blue, sourcePixels[10, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[10, 50]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs index 82e2f72a2..7c32c344d 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs @@ -18,9 +18,9 @@ namespace ImageSharp.Tests.Drawing.Paths { float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); - Pen pen = new Pen(Color.Firebrick, 99.9f); + Rgba32 color = Rgba32.HotPink; + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + Pen pen = new Pen(Rgba32.Firebrick, 99.9f); Vector2[] points = new Vector2[] { new Vector2(10,10), new Vector2(20,10), @@ -45,7 +45,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawBeziers(brush, thickness, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -56,7 +56,7 @@ namespace ImageSharp.Tests.Drawing.Paths BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -67,7 +67,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawBeziers(brush, thickness, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -76,7 +76,7 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -87,7 +87,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawBeziers(color, thickness, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -96,10 +96,10 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -109,7 +109,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawBeziers(color, thickness, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -118,10 +118,10 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); BezierLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -131,7 +131,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawBeziers(pen, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -149,7 +149,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawBeziers(pen, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs index cc126614f..61ef16805 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs @@ -18,9 +18,9 @@ namespace ImageSharp.Tests.Drawing.Paths { float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); - Pen pen = new Pen(Color.Gray, 99.9f); + Rgba32 color = Rgba32.HotPink; + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + Pen pen = new Pen(Rgba32.Gray, 99.9f); Vector2[] points = new Vector2[] { new Vector2(10,10), new Vector2(20,10), @@ -45,7 +45,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawLines(brush, thickness, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -54,7 +54,7 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -65,7 +65,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawLines(brush, thickness, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -74,7 +74,7 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -85,7 +85,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawLines(color, thickness, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -94,10 +94,10 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -107,7 +107,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawLines(color, thickness, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -116,10 +116,10 @@ namespace ImageSharp.Tests.Drawing.Paths SixLabors.Shapes.Path vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -129,7 +129,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawLines(pen, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -147,7 +147,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawLines(pen, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs index 6c1c06813..75486cb66 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs @@ -18,9 +18,9 @@ namespace ImageSharp.Tests.Drawing.Paths { float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); - Pen pen = new Pen(Color.Gray, 99.9f); + Rgba32 color = 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), new Vector2(20,10), @@ -45,14 +45,14 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(brush, thickness, path); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); ShapePath shapepath = Assert.IsType(processor.Path); Assert.Equal(path, shapepath.Path); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -63,14 +63,14 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(brush, thickness, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); ShapePath shapepath = Assert.IsType(processor.Path); Assert.Equal(path, shapepath.Path); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -81,17 +81,17 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(color, thickness, path); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); ShapePath shapepath = Assert.IsType(processor.Path); Assert.Equal(path, shapepath.Path); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -101,17 +101,17 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(color, thickness, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); ShapePath shapepath = Assert.IsType(processor.Path); Assert.Equal(path, shapepath.Path); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -121,7 +121,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(pen, path); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -137,7 +137,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(pen, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs index 9de052331..995e2ff1f 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs @@ -18,9 +18,9 @@ namespace ImageSharp.Tests.Drawing.Paths { float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); - Pen pen = new Pen(Color.Gray, 99.9f); + Rgba32 color = Rgba32.HotPink; + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); + Pen pen = new Pen(Rgba32.Gray, 99.9f); Vector2[] points = new Vector2[] { new Vector2(10,10), new Vector2(20,10), @@ -45,7 +45,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawPolygon(brush, thickness, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -54,7 +54,7 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -65,7 +65,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawPolygon(brush, thickness, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -74,7 +74,7 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -85,7 +85,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawPolygon(color, thickness, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -94,10 +94,10 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -107,7 +107,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawPolygon(color, thickness, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -116,10 +116,10 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon vector = Assert.IsType(path.Path); LinearLineSegment segment = Assert.IsType(vector.LineSegments[0]); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -129,7 +129,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawPolygon(pen, points); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -147,7 +147,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.DrawPolygon(pen, points, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs index 215d5a7c7..a6d978d80 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs @@ -18,9 +18,9 @@ namespace ImageSharp.Tests.Drawing.Paths { float thickness = 7.2f; GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); - Pen pen = new Pen(Color.Gray, 99.9f); + Rgba32 color = 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); private ProcessorWatchingImage img; @@ -41,7 +41,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(brush, thickness, rectangle); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -53,7 +53,7 @@ namespace ImageSharp.Tests.Drawing.Paths Assert.Equal(rect.Size.Width, rectangle.Width); Assert.Equal(rect.Size.Height, rectangle.Height); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -64,7 +64,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(brush, thickness, rectangle, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -77,7 +77,7 @@ namespace ImageSharp.Tests.Drawing.Paths Assert.Equal(rect.Size.Width, rectangle.Width); Assert.Equal(rect.Size.Height, rectangle.Height); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(brush, pen.Brush); Assert.Equal(thickness, pen.Width); } @@ -88,7 +88,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(color, thickness, rectangle); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -101,10 +101,10 @@ namespace ImageSharp.Tests.Drawing.Paths Assert.Equal(rect.Size.Width, rectangle.Width); Assert.Equal(rect.Size.Height, rectangle.Height); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -114,7 +114,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(color, thickness, rectangle, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -127,10 +127,10 @@ namespace ImageSharp.Tests.Drawing.Paths Assert.Equal(rect.Size.Width, rectangle.Width); Assert.Equal(rect.Size.Height, rectangle.Height); - Pen pen = Assert.IsType>(processor.Pen); + Pen pen = Assert.IsType>(processor.Pen); Assert.Equal(thickness, pen.Width); - SolidBrush brush = Assert.IsType>(pen.Brush); + SolidBrush brush = Assert.IsType>(pen.Brush); Assert.Equal(color, brush.Color); } @@ -140,7 +140,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(pen, rectangle); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -162,7 +162,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Draw(pen, rectangle, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + DrawPathProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index 5ba6580bd..e55e78739 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs @@ -17,8 +17,8 @@ namespace ImageSharp.Tests.Drawing.Paths public class FillPath : IDisposable { GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); + Rgba32 color = 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), @@ -43,7 +43,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(brush, path); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -62,7 +62,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(brush, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -79,7 +79,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(color, path); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -87,7 +87,7 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon polygon = Assert.IsType(region.Shape); LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); - SolidBrush brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } @@ -97,7 +97,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(color, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -105,7 +105,7 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon polygon = Assert.IsType(region.Shape); LinearLineSegment segments = Assert.IsType(polygon.LineSegments[0]); - SolidBrush brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index ad72d4c4e..6145f9c01 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs @@ -17,8 +17,8 @@ namespace ImageSharp.Tests.Drawing.Paths public class FillPolygon : IDisposable { GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); + Rgba32 color = Rgba32.HotPink; + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); Vector2[] path = new Vector2[] { new Vector2(10,10), new Vector2(20,10), @@ -43,7 +43,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.FillPolygon(brush, path); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -60,7 +60,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.FillPolygon(brush, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -77,7 +77,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.FillPolygon(color, path); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -85,7 +85,7 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon polygon = Assert.IsType(region.Shape); LinearLineSegment segemnt = Assert.IsType(polygon.LineSegments[0]); - SolidBrush brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } @@ -95,7 +95,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.FillPolygon(color, path, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -103,7 +103,7 @@ namespace ImageSharp.Tests.Drawing.Paths Polygon polygon = Assert.IsType(region.Shape); LinearLineSegment segemnt = Assert.IsType(polygon.LineSegments[0]); - SolidBrush brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs index f6b1c4ade..3204a0a2a 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs @@ -17,8 +17,8 @@ namespace ImageSharp.Tests.Drawing.Paths public class FillRectangle : IDisposable { GraphicsOptions noneDefault = new GraphicsOptions(); - Color color = Color.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); + Rgba32 color = Rgba32.HotPink; + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); ImageSharp.Rectangle rectangle = new ImageSharp.Rectangle(10, 10, 77, 76); private ProcessorWatchingImage img; @@ -39,7 +39,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(brush, rectangle); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -59,7 +59,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(brush, rectangle, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -79,7 +79,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(color, rectangle); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(GraphicsOptions.Default, processor.Options); @@ -90,7 +90,7 @@ namespace ImageSharp.Tests.Drawing.Paths Assert.Equal(rect.Size.Width, rectangle.Width); Assert.Equal(rect.Size.Height, rectangle.Height); - SolidBrush brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } @@ -100,7 +100,7 @@ namespace ImageSharp.Tests.Drawing.Paths img.Fill(color, rectangle, noneDefault); Assert.NotEmpty(img.ProcessorApplications); - FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); + FillRegionProcessor processor = Assert.IsType>(img.ProcessorApplications[0].processor); Assert.Equal(noneDefault, processor.Options); @@ -111,7 +111,7 @@ namespace ImageSharp.Tests.Drawing.Paths Assert.Equal(rect.Size.Width, rectangle.Width); Assert.Equal(rect.Size.Height, rectangle.Height); - SolidBrush brush = Assert.IsType>(processor.Brush); + SolidBrush brush = Assert.IsType>(processor.Brush); Assert.Equal(color, brush.Color); } } diff --git a/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs b/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs index 2d3d2cc2b..b53811073 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs @@ -11,8 +11,8 @@ namespace ImageSharp.Tests.Drawing.Paths /// /// Watches but does not actually run the processors against the image. /// - /// - public class ProcessorWatchingImage : Image + /// + public class ProcessorWatchingImage : Image { public List ProcessorApplications { get; } = new List(); @@ -21,7 +21,7 @@ namespace ImageSharp.Tests.Drawing.Paths { } - public override void ApplyProcessor(IImageProcessor processor, Rectangle rectangle) + public override void ApplyProcessor(IImageProcessor processor, Rectangle rectangle) { this.ProcessorApplications.Add(new ProcessorDetails { @@ -32,7 +32,7 @@ namespace ImageSharp.Tests.Drawing.Paths public struct ProcessorDetails { - public IImageProcessor processor; + public IImageProcessor processor; public Rectangle rectangle; } } diff --git a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs index 3e06ca918..81b31a9c3 100644 --- a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs @@ -25,8 +25,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .DrawPolygon(Color.HotPink, 5, + .BackgroundColor(Rgba32.Blue) + .DrawPolygon(Rgba32.HotPink, 5, new[] { new Vector2(10, 10), new Vector2(200, 150), @@ -35,15 +35,15 @@ namespace ImageSharp.Tests.Drawing .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[9, 9]); + Assert.Equal(Rgba32.HotPink, sourcePixels[9, 9]); - Assert.Equal(Color.HotPink, sourcePixels[199, 149]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); } } } @@ -58,30 +58,30 @@ namespace ImageSharp.Tests.Drawing new Vector2(50, 300) }; - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .DrawPolygon(color, 10, simplePath) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[9, 9]); Assert.Equal(mergedColor, sourcePixels[199, 149]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); } } } @@ -96,22 +96,22 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Rectangle.png")) { image - .BackgroundColor(Color.Blue) - .Draw(Color.HotPink, 10, new Rectangle(10, 10, 190, 140)) + .BackgroundColor(Rgba32.Blue) + .Draw(Rgba32.HotPink, 10, new Rectangle(10, 10, 190, 140)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[8, 8]); + Assert.Equal(Rgba32.HotPink, sourcePixels[8, 8]); - Assert.Equal(Color.HotPink, sourcePixels[198, 10]); + Assert.Equal(Rgba32.HotPink, sourcePixels[198, 10]); - Assert.Equal(Color.HotPink, sourcePixels[10, 50]); + Assert.Equal(Rgba32.HotPink, sourcePixels[10, 50]); - Assert.Equal(Color.Blue, sourcePixels[50, 50]); + Assert.Equal(Rgba32.Blue, sourcePixels[50, 50]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); } } } diff --git a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs index 0b450d166..ef6d321ec 100644 --- a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs +++ b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Tests { string path = this.CreateOutputDirectory("Drawing", "RecolorImage"); - RecolorBrush brush = new RecolorBrush(Color.Yellow, Color.HotPink, 0.2f); + RecolorBrush brush = new RecolorBrush(Rgba32.Yellow, Rgba32.HotPink, 0.2f); foreach (TestFile file in Files) { @@ -38,7 +38,7 @@ namespace ImageSharp.Tests { string path = this.CreateOutputDirectory("Drawing", "RecolorImage"); - RecolorBrush brush = new RecolorBrush(Color.Yellow, Color.HotPink, 0.2f); + RecolorBrush brush = new RecolorBrush(Rgba32.Yellow, Rgba32.HotPink, 0.2f); foreach (TestFile file in Files) { diff --git a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs index 1a7e98a12..3b9411fe3 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs @@ -29,20 +29,20 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, new Polygon(new BezierLineSegment(simplePath))) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, new Polygon(new BezierLineSegment(simplePath))) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[150, 300]); + Assert.Equal(Rgba32.HotPink, sourcePixels[150, 300]); //curve points should not be never be set - Assert.Equal(Color.Blue, sourcePixels[240, 30]); + Assert.Equal(Rgba32.Blue, sourcePixels[240, 30]); // inside shape should not be empty - Assert.Equal(Color.HotPink, sourcePixels[200, 250]); + Assert.Equal(Rgba32.HotPink, sourcePixels[200, 250]); } } } @@ -57,28 +57,28 @@ namespace ImageSharp.Tests.Drawing new Vector2(240, 30), new Vector2(300, 400) }; - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .Fill(color, new Polygon(new BezierLineSegment(simplePath))) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { //top of curve Assert.Equal(mergedColor, sourcePixels[138, 116]); //curve points should not be never be set - Assert.Equal(Color.Blue, sourcePixels[240, 30]); + Assert.Equal(Rgba32.Blue, sourcePixels[240, 30]); // inside shape should not be empty Assert.Equal(mergedColor, sourcePixels[200, 250]); diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs index 4ff250a93..864e96099 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs @@ -35,17 +35,17 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, clipped) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, clipped) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[20, 35]); + Assert.Equal(Rgba32.HotPink, sourcePixels[20, 35]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[60, 100]); + Assert.Equal(Rgba32.Blue, sourcePixels[60, 100]); } } } @@ -70,17 +70,17 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/SimpleOverlapping.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, simplePath.Clip(hole1)) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, simplePath.Clip(hole1)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[20, 35]); + Assert.Equal(Rgba32.HotPink, sourcePixels[20, 35]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[60, 100]); + Assert.Equal(Rgba32.Blue, sourcePixels[60, 100]); } } } @@ -98,27 +98,27 @@ namespace ImageSharp.Tests.Drawing new Vector2(37, 85), new Vector2(93, 85), new Vector2(65, 137))); - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .Fill(color, simplePath.Clip(hole1)) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { Assert.Equal(mergedColor, sourcePixels[20, 35]); //inside hole - Assert.Equal(Color.Blue, sourcePixels[60, 100]); + Assert.Equal(Rgba32.Blue, sourcePixels[60, 100]); } } } diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs index 79363480f..3bd25050a 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs @@ -32,13 +32,13 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple.png")) { image - .FillPolygon(Color.HotPink, simplePath, new GraphicsOptions(true)) + .FillPolygon(Rgba32.HotPink, simplePath, new GraphicsOptions(true)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[81, 145]); + Assert.Equal(Rgba32.HotPink, sourcePixels[81, 145]); } } } @@ -58,13 +58,13 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Pattern.png")) { image - .FillPolygon(Brushes.Horizontal(Color.HotPink), simplePath, new GraphicsOptions(true)) + .FillPolygon(Brushes.Horizontal(Rgba32.HotPink), simplePath, new GraphicsOptions(true)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[81, 145]); + Assert.Equal(Rgba32.HotPink, sourcePixels[81, 145]); } } } @@ -83,19 +83,19 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Simple_NoAntialias.png")) { image - .BackgroundColor(Color.Blue) - .FillPolygon(Color.HotPink, simplePath, new GraphicsOptions(false)) + .BackgroundColor(Rgba32.Blue) + .FillPolygon(Rgba32.HotPink, simplePath, new GraphicsOptions(false)) .Save(output); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[11, 11]); + Assert.Equal(Rgba32.HotPink, sourcePixels[11, 11]); - Assert.Equal(Color.HotPink, sourcePixels[199, 150]); + Assert.Equal(Rgba32.HotPink, sourcePixels[199, 150]); - Assert.Equal(Color.HotPink, sourcePixels[50, 50]); + Assert.Equal(Rgba32.HotPink, sourcePixels[50, 50]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); } } } @@ -117,7 +117,7 @@ namespace ImageSharp.Tests.Drawing ImageBrush brush = new ImageBrush(brushImage); image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .FillPolygon(brush, simplePath) .Save(output); } @@ -132,24 +132,24 @@ namespace ImageSharp.Tests.Drawing new Vector2(200, 150), new Vector2(50, 300) }; - Color color = new Color(Color.HotPink.R, Color.HotPink.G, Color.HotPink.B, 150); + Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150); using (Image image = new Image(500, 500)) { using (FileStream output = File.OpenWrite($"{path}/Opacity.png")) { image - .BackgroundColor(Color.Blue) + .BackgroundColor(Rgba32.Blue) .FillPolygon(color, simplePath) .Save(output); } //shift background color towards forground color by the opacity amount - Color mergedColor = new Color(Vector4.Lerp(Color.Blue.ToVector4(), Color.HotPink.ToVector4(), 150f / 255f)); + Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f)); - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); } } } @@ -164,22 +164,22 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Rectangle.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, new SixLabors.Shapes.Rectangle(10, 10, 190, 140)) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, new SixLabors.Shapes.Rectangle(10, 10, 190, 140)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.HotPink, sourcePixels[11, 11]); + Assert.Equal(Rgba32.HotPink, sourcePixels[11, 11]); - Assert.Equal(Color.HotPink, sourcePixels[198, 10]); + Assert.Equal(Rgba32.HotPink, sourcePixels[198, 10]); - Assert.Equal(Color.HotPink, sourcePixels[10, 50]); + Assert.Equal(Rgba32.HotPink, sourcePixels[10, 50]); - Assert.Equal(Color.HotPink, sourcePixels[50, 50]); + Assert.Equal(Rgba32.HotPink, sourcePixels[50, 50]); - Assert.Equal(Color.Blue, sourcePixels[2, 2]); + Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]); } } } @@ -194,16 +194,16 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Triangle.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, new RegularPolygon(50, 50, 3, 30)) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, new RegularPolygon(50, 50, 3, 30)) .Save(output); } - using (PixelAccessor sourcePixels = image.Lock()) + using (PixelAccessor sourcePixels = image.Lock()) { - Assert.Equal(Color.Blue, sourcePixels[30, 65]); + Assert.Equal(Rgba32.Blue, sourcePixels[30, 65]); - Assert.Equal(Color.HotPink, sourcePixels[50, 50]); + Assert.Equal(Rgba32.HotPink, sourcePixels[50, 50]); } } } @@ -220,8 +220,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/Septagon.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, new RegularPolygon(50, 50, 7, 30, -(float)Math.PI)) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, new RegularPolygon(50, 50, 7, 30, -(float)Math.PI)) .Save(output); } } @@ -239,8 +239,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/ellipse.png")) { image - .BackgroundColor(Color.Blue) - .Fill(Color.HotPink, new Ellipse(50, 50, 30, 50) + .BackgroundColor(Rgba32.Blue) + .Fill(Rgba32.HotPink, new Ellipse(50, 50, 30, 50) .Rotate((float)(Math.PI / 3))) .Save(output); } @@ -259,8 +259,8 @@ namespace ImageSharp.Tests.Drawing using (FileStream output = File.OpenWrite($"{path}/clipped-corner.png")) { image - .Fill(Color.Blue) - .FillPolygon(Color.HotPink, new[] + .Fill(Rgba32.Blue) + .FillPolygon(Rgba32.HotPink, new[] { new Vector2( 8, 8 ), new Vector2( 64, 8 ), diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 52b7fcbb6..6618c3fb7 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs @@ -21,9 +21,9 @@ namespace ImageSharp.Tests.Drawing.Text public class DrawText : IDisposable { - Color color = Color.HotPink; + Rgba32 color = Rgba32.HotPink; - SolidBrush brush = Brushes.Solid(Color.HotPink); + SolidBrush brush = Brushes.Solid(Rgba32.HotPink); IPath path = new SixLabors.Shapes.Path( new LinearLineSegment( @@ -53,73 +53,73 @@ namespace ImageSharp.Tests.Drawing.Text this.img.DrawText( "123", this.Font, - Brushes.Solid(Color.Red), + Brushes.Solid(Rgba32.Red), null, Vector2.Zero, new TextGraphicsOptions(true)); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); // 3 fills where applied - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void FillsForEachACharachterWhenBrushSetAndNotPenDefaultOptions() { - this.img.DrawText("123", this.Font, Brushes.Solid(Color.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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void FillsForEachACharachterWhenBrushSet() { - this.img.DrawText("123", this.Font, Brushes.Solid(Color.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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void FillsForEachACharachterWhenBrushSetDefaultOptions() { - this.img.DrawText("123", this.Font, Brushes.Solid(Color.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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void FillsForEachACharachterWhenColorSet() { - this.img.DrawText("123", this.Font, Color.Red, Vector2.Zero, new TextGraphicsOptions(true)); + this.img.DrawText("123", this.Font, Rgba32.Red, Vector2.Zero, new TextGraphicsOptions(true)); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); - FillRegionProcessor processor = - Assert.IsType>(this.img.ProcessorApplications[0].processor); + FillRegionProcessor processor = + Assert.IsType>(this.img.ProcessorApplications[0].processor); - SolidBrush brush = Assert.IsType>(processor.Brush); - Assert.Equal(Color.Red, brush.Color); + SolidBrush brush = Assert.IsType>(processor.Brush); + Assert.Equal(Rgba32.Red, brush.Color); } [Fact] public void FillsForEachACharachterWhenColorSetDefaultOptions() { - this.img.DrawText("123", this.Font, Color.Red, Vector2.Zero); + this.img.DrawText("123", this.Font, Rgba32.Red, Vector2.Zero); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(3, this.img.ProcessorApplications.Count); - Assert.IsType>(this.img.ProcessorApplications[0].processor); - FillRegionProcessor processor = - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); + FillRegionProcessor processor = + Assert.IsType>(this.img.ProcessorApplications[0].processor); - SolidBrush brush = Assert.IsType>(processor.Brush); - Assert.Equal(Color.Red, brush.Color); + SolidBrush brush = Assert.IsType>(processor.Brush); + Assert.Equal(Rgba32.Red, brush.Color); } [Fact] @@ -129,43 +129,43 @@ namespace ImageSharp.Tests.Drawing.Text "123", this.Font, null, - Pens.Dash(Color.Red, 1), + 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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void DrawForEachACharachterWhenPenSetAndNotBrushDefaultOptions() { - this.img.DrawText("123", this.Font, null, Pens.Dash(Color.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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void DrawForEachACharachterWhenPenSet() { - this.img.DrawText("123", this.Font, Pens.Dash(Color.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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] public void DrawForEachACharachterWhenPenSetDefaultOptions() { - this.img.DrawText("123", this.Font, Pens.Dash(Color.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 - Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); } [Fact] @@ -174,8 +174,8 @@ namespace ImageSharp.Tests.Drawing.Text this.img.DrawText( "123", this.Font, - Brushes.Solid(Color.Red), - Pens.Dash(Color.Red, 1), + Brushes.Solid(Rgba32.Red), + Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); @@ -186,7 +186,7 @@ namespace ImageSharp.Tests.Drawing.Text [Fact] public void DrawForEachACharachterWhenPenSetAndFillFroEachWhenBrushSetDefaultOptions() { - this.img.DrawText("123", this.Font, Brushes.Solid(Color.Red), Pens.Dash(Color.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); @@ -198,26 +198,26 @@ namespace ImageSharp.Tests.Drawing.Text this.img.DrawText( "1", this.Font, - Brushes.Solid(Color.Red), - Pens.Dash(Color.Red, 1), + Brushes.Solid(Rgba32.Red), + Pens.Dash(Rgba32.Red, 1), Vector2.Zero, new TextGraphicsOptions(true)); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(2, this.img.ProcessorApplications.Count); - Assert.IsType>(this.img.ProcessorApplications[0].processor); - Assert.IsType>(this.img.ProcessorApplications[1].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[1].processor); } [Fact] public void BrushAppliesBeforPenDefaultOptions() { - this.img.DrawText("1", this.Font, Brushes.Solid(Color.Red), Pens.Dash(Color.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); - Assert.IsType>(this.img.ProcessorApplications[0].processor); - Assert.IsType>(this.img.ProcessorApplications[1].processor); + Assert.IsType>(this.img.ProcessorApplications[0].processor); + Assert.IsType>(this.img.ProcessorApplications[1].processor); } [Fact] @@ -225,19 +225,19 @@ namespace ImageSharp.Tests.Drawing.Text { this.img.MetaData.VerticalResolution = 1; this.img.MetaData.HorizontalResolution = 1; - this.img.DrawText("1", this.Font, Brushes.Solid(Color.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(Color.Red), Vector2.Zero, new TextGraphicsOptions(true) + this.img.DrawText("1", this.Font, Brushes.Solid(Rgba32.Red), Vector2.Zero, new TextGraphicsOptions(true) { UseImageResolution = true }); Assert.NotEmpty(this.img.ProcessorApplications); Assert.Equal(2, this.img.ProcessorApplications.Count); - FillRegionProcessor ownResolution = Assert.IsType>(this.img.ProcessorApplications[0].processor); - FillRegionProcessor imgResolution = Assert.IsType>(this.img.ProcessorApplications[1].processor); + FillRegionProcessor ownResolution = Assert.IsType>(this.img.ProcessorApplications[0].processor); + FillRegionProcessor imgResolution = Assert.IsType>(this.img.ProcessorApplications[1].processor); ShapeRegion ownRegion = Assert.IsType(ownResolution.Region); ShapeRegion imgRegion = Assert.IsType(imgResolution.Region); diff --git a/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs b/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs index 0bb3afccd..d3c34ce8f 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs @@ -32,8 +32,8 @@ namespace ImageSharp.Tests.Drawing.Text //draws 2 overlapping triangle glyphs twice 1 set on each line using (Image img = new Image(100, 200)) { - img.Fill(Color.DarkBlue) - .DrawText("AB\nAB", new Font(this.Font, 50), Color.Red, new Vector2(0, 0)); + img.Fill(Rgba32.DarkBlue) + .DrawText("AB\nAB", new Font(this.Font, 50), Rgba32.Red, new Vector2(0, 0)); img.Save($"{this.CreateOutputDirectory("Drawing", "Text")}/AB.png"); } } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs index 8dbdb998c..47b114393 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs @@ -27,7 +27,7 @@ namespace ImageSharp.Tests } [Theory] - [WithFile(TestImages.Jpeg.Baseline.Bad.MissingEOF, PixelTypes.Color)] + [WithFile(TestImages.Jpeg.Baseline.Bad.MissingEOF, PixelTypes.Rgba32)] public void LoadBaselineImage(TestImageProvider provider) where TColor : struct, IPixel { @@ -39,7 +39,7 @@ namespace ImageSharp.Tests } [Theory] // TODO: #18 - [WithFile(TestImages.Jpeg.Progressive.Bad.BadEOF, PixelTypes.Color)] + [WithFile(TestImages.Jpeg.Progressive.Bad.BadEOF, PixelTypes.Rgba32)] public void LoadProgressiveImage(TestImageProvider provider) where TColor : struct, IPixel { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index d83424b24..316430dfc 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Tests public static string[] ProgressiveTestJpegs = TestImages.Jpeg.Progressive.All; [Theory] - [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb32)] + [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Rgba32 | PixelTypes.StandardImageClass | PixelTypes.Argb32)] public void OpenBaselineJpeg_SaveBmp(TestImageProvider provider) where TColor : struct, IPixel { @@ -36,7 +36,7 @@ namespace ImageSharp.Tests } [Theory] - [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb32)] + [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Rgba32 | PixelTypes.StandardImageClass | PixelTypes.Argb32)] public void OpenProgressiveJpeg_SaveBmp(TestImageProvider provider) where TColor : struct, IPixel { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index f900fe782..3d2e9f310 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -48,8 +48,8 @@ namespace ImageSharp.Tests } [Theory] - [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb32, JpegSubsample.Ratio420, 75)] - [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb32, JpegSubsample.Ratio444, 75)] + [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Rgba32 | PixelTypes.StandardImageClass | PixelTypes.Argb32, JpegSubsample.Ratio420, 75)] + [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Rgba32 | PixelTypes.StandardImageClass | PixelTypes.Argb32, JpegSubsample.Ratio444, 75)] public void OpenBmp_SaveJpeg(TestImageProvider provider, JpegSubsample subSample, int quality) where TColor : struct, IPixel { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs index 28a64a765..dfe132485 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs @@ -69,9 +69,9 @@ namespace ImageSharp.Tests .Concat(new[] { TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk }) .ToArray(); - Image[] testImages = + Image[] testImages = testFiles.Select( - tf => TestImageProvider.File(tf, pixelTypeOverride: PixelTypes.StandardImageClass).GetImage()) + tf => TestImageProvider.File(tf, pixelTypeOverride: PixelTypes.StandardImageClass).GetImage()) .ToArray(); using (MemoryStream ms = new MemoryStream()) @@ -79,7 +79,7 @@ namespace ImageSharp.Tests this.Measure(executionCount, () => { - foreach (Image img in testImages) + foreach (Image img in testImages) { JpegEncoder encoder = new JpegEncoder(); JpegEncoderOptions options = new JpegEncoderOptions { Quality = quality, Subsample = subsample }; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs index 25fe46aa2..ea1a46f2f 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs @@ -39,7 +39,7 @@ namespace ImageSharp.Tests } [Theory] - [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb32)] + [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Rgba32| PixelTypes.StandardImageClass | PixelTypes.Argb32)] public void CopyStretchedRGBTo_FromOrigo(TestImageProvider provider) where TColor : struct, IPixel { @@ -61,7 +61,7 @@ namespace ImageSharp.Tests } [Theory] - [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb32)] + [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Rgba32| PixelTypes.StandardImageClass | PixelTypes.Argb32)] public void CopyStretchedRGBTo_WithOffset(TestImageProvider provider) where TColor : struct, IPixel { diff --git a/tests/ImageSharp.Tests/Image/ImageLoadTests.cs b/tests/ImageSharp.Tests/Image/ImageLoadTests.cs index 10b0cbb94..bcec99573 100644 --- a/tests/ImageSharp.Tests/Image/ImageLoadTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageLoadTests.cs @@ -20,7 +20,7 @@ namespace ImageSharp.Tests { private readonly Mock fileSystem; private readonly IDecoderOptions decoderOptions; - private Image returnImage; + private Image returnImage; private Mock localDecoder; private Mock localFormat; private readonly string FilePath; @@ -44,7 +44,7 @@ namespace ImageSharp.Tests this.localFormat.Setup(x => x.IsSupportedFileFormat(It.IsAny())).Returns(true); this.localFormat.Setup(x => x.SupportedExtensions).Returns(new string[] { "png", "jpg" }); - this.localDecoder.Setup(x => x.Decode(It.IsAny(), It.IsAny(), It.IsAny())) + this.localDecoder.Setup(x => x.Decode(It.IsAny(), It.IsAny(), It.IsAny())) .Callback((c, s, o) => { using (var ms = new MemoryStream()) @@ -103,10 +103,10 @@ namespace ImageSharp.Tests [Fact] public void LoadFromStreamWithType() { - Image img = Image.Load(this.DataStream); + Image img = Image.Load(this.DataStream); Assert.NotNull(img); - Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); + Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); Assert.Equal(TestFormat.GlobalTestFormat, img.CurrentImageFormat); TestFormat.GlobalTestFormat.VerifyDecodeCall(this.Marker, null, Configuration.Default); @@ -128,10 +128,10 @@ namespace ImageSharp.Tests [Fact] public void LoadFromStreamWithTypeAndOptions() { - Image img = Image.Load(this.DataStream, this.decoderOptions); + Image img = Image.Load(this.DataStream, this.decoderOptions); Assert.NotNull(img); - Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); + Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); Assert.Equal(TestFormat.GlobalTestFormat, img.CurrentImageFormat); TestFormat.GlobalTestFormat.VerifyDecodeCall(this.Marker, this.decoderOptions, Configuration.Default); @@ -147,7 +147,7 @@ namespace ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, null)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, null)); } @@ -155,13 +155,13 @@ namespace ImageSharp.Tests public void LoadFromStreamWithTypeAndConfig() { Stream stream = new MemoryStream(); - Image img = Image.Load(this.LocalConfiguration, stream); + Image img = Image.Load(this.LocalConfiguration, stream); Assert.NotNull(img); Assert.Equal(this.returnImage, img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, null)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, null)); } @@ -174,7 +174,7 @@ namespace ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, this.decoderOptions)); } @@ -182,13 +182,13 @@ namespace ImageSharp.Tests public void LoadFromStreamWithTypeAndConfigAndOptions() { Stream stream = new MemoryStream(); - Image img = Image.Load(this.LocalConfiguration, stream, this.decoderOptions); + Image img = Image.Load(this.LocalConfiguration, stream, this.decoderOptions); Assert.NotNull(img); Assert.Equal(this.returnImage, img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, stream, this.decoderOptions)); } @@ -201,18 +201,18 @@ namespace ImageSharp.Tests Image img = Image.Load(stream, this.localDecoder.Object); Assert.NotNull(img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, null)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, null)); } [Fact] public void LoadFromStreamWithTypeAndDecoder() { Stream stream = new MemoryStream(); - Image img = Image.Load(stream, this.localDecoder.Object); + Image img = Image.Load(stream, this.localDecoder.Object); Assert.NotNull(img); Assert.Equal(this.returnImage, img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, null)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, null)); } [Fact] @@ -222,18 +222,18 @@ namespace ImageSharp.Tests Image img = Image.Load(stream, this.localDecoder.Object, this.decoderOptions); Assert.NotNull(img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, this.decoderOptions)); } [Fact] public void LoadFromStreamWithTypeAndDecoderAndOptions() { Stream stream = new MemoryStream(); - Image img = Image.Load(stream, this.localDecoder.Object, this.decoderOptions); + Image img = Image.Load(stream, this.localDecoder.Object, this.decoderOptions); Assert.NotNull(img); Assert.Equal(this.returnImage, img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, stream, this.decoderOptions)); } [Fact] @@ -252,10 +252,10 @@ namespace ImageSharp.Tests [Fact] public void LoadFromBytesWithType() { - Image img = Image.Load(this.DataStream.ToArray()); + Image img = Image.Load(this.DataStream.ToArray()); Assert.NotNull(img); - Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); + Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); Assert.Equal(TestFormat.GlobalTestFormat, img.CurrentImageFormat); TestFormat.GlobalTestFormat.VerifyDecodeCall(this.Marker, null, Configuration.Default); @@ -277,10 +277,10 @@ namespace ImageSharp.Tests [Fact] public void LoadFromBytesWithTypeAndOptions() { - Image img = Image.Load(this.DataStream.ToArray(), this.decoderOptions); + Image img = Image.Load(this.DataStream.ToArray(), this.decoderOptions); Assert.NotNull(img); - Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); + Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); Assert.Equal(TestFormat.GlobalTestFormat, img.CurrentImageFormat); TestFormat.GlobalTestFormat.VerifyDecodeCall(this.Marker, this.decoderOptions, Configuration.Default); @@ -295,7 +295,7 @@ namespace ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), null)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), null)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } @@ -303,14 +303,14 @@ namespace ImageSharp.Tests [Fact] public void LoadFromBytesWithTypeAndConfig() { - Image img = Image.Load(this.LocalConfiguration, this.DataStream.ToArray()); + Image img = Image.Load(this.LocalConfiguration, this.DataStream.ToArray()); Assert.NotNull(img); Assert.Equal(this.returnImage, img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), null)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), null)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } @@ -323,7 +323,7 @@ namespace ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), this.decoderOptions)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } @@ -331,13 +331,13 @@ namespace ImageSharp.Tests [Fact] public void LoadFromBytesWithTypeAndConfigAndOptions() { - Image img = Image.Load(this.LocalConfiguration, this.DataStream.ToArray(), this.decoderOptions); + Image img = Image.Load(this.LocalConfiguration, this.DataStream.ToArray(), this.decoderOptions); Assert.NotNull(img); Assert.Equal(this.returnImage, img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, It.IsAny(), this.decoderOptions)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } @@ -349,18 +349,18 @@ namespace ImageSharp.Tests Image img = Image.Load(this.DataStream.ToArray(), this.localDecoder.Object); Assert.NotNull(img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), null)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), null)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } [Fact] public void LoadFromBytesWithTypeAndDecoder() { - Image img = Image.Load(this.DataStream.ToArray(), this.localDecoder.Object); + Image img = Image.Load(this.DataStream.ToArray(), this.localDecoder.Object); Assert.NotNull(img); Assert.Equal(this.returnImage, img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), null)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), null)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } @@ -370,18 +370,18 @@ namespace ImageSharp.Tests Image img = Image.Load(this.DataStream.ToArray(), this.localDecoder.Object, this.decoderOptions); Assert.NotNull(img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), this.decoderOptions)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } [Fact] public void LoadFromBytesWithTypeAndDecoderAndOptions() { - Image img = Image.Load(this.DataStream.ToArray(), this.localDecoder.Object, this.decoderOptions); + Image img = Image.Load(this.DataStream.ToArray(), this.localDecoder.Object, this.decoderOptions); Assert.NotNull(img); Assert.Equal(this.returnImage, img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, It.IsAny(), this.decoderOptions)); Assert.Equal(this.DataStream.ToArray(), this.DecodedData); } @@ -401,10 +401,10 @@ namespace ImageSharp.Tests [Fact] public void LoadFromFileWithType() { - Image img = Image.Load(this.DataStream); + Image img = Image.Load(this.DataStream); Assert.NotNull(img); - Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); + Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); Assert.Equal(TestFormat.GlobalTestFormat, img.CurrentImageFormat); TestFormat.GlobalTestFormat.VerifyDecodeCall(this.Marker, null, Configuration.Default); @@ -426,10 +426,10 @@ namespace ImageSharp.Tests [Fact] public void LoadFromFileWithTypeAndOptions() { - Image img = Image.Load(this.DataStream, this.decoderOptions); + Image img = Image.Load(this.DataStream, this.decoderOptions); Assert.NotNull(img); - Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); + Assert.Equal(TestFormat.GlobalTestFormat.Sample(), img); Assert.Equal(TestFormat.GlobalTestFormat, img.CurrentImageFormat); TestFormat.GlobalTestFormat.VerifyDecodeCall(this.Marker, this.decoderOptions, Configuration.Default); @@ -444,20 +444,20 @@ namespace ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, null)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, null)); } [Fact] public void LoadFromFileWithTypeAndConfig() { - Image img = Image.Load(this.LocalConfiguration, this.FilePath); + Image img = Image.Load(this.LocalConfiguration, this.FilePath); Assert.NotNull(img); Assert.Equal(this.returnImage, img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, null)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, null)); } @@ -469,20 +469,20 @@ namespace ImageSharp.Tests Assert.NotNull(img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, this.decoderOptions)); } [Fact] public void LoadFromFileWithTypeAndConfigAndOptions() { - Image img = Image.Load(this.LocalConfiguration, this.FilePath, this.decoderOptions); + Image img = Image.Load(this.LocalConfiguration, this.FilePath, this.decoderOptions); Assert.NotNull(img); Assert.Equal(this.returnImage, img); Assert.Equal(this.localFormat.Object, img.CurrentImageFormat); - this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(this.LocalConfiguration, this.DataStream, this.decoderOptions)); } @@ -493,17 +493,17 @@ namespace ImageSharp.Tests Image img = Image.Load(this.FilePath, this.localDecoder.Object); Assert.NotNull(img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, null)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, null)); } [Fact] public void LoadFromFileWithTypeAndDecoder() { - Image img = Image.Load(this.FilePath, this.localDecoder.Object); + Image img = Image.Load(this.FilePath, this.localDecoder.Object); Assert.NotNull(img); Assert.Equal(this.returnImage, img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, null)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, null)); } [Fact] @@ -512,17 +512,17 @@ namespace ImageSharp.Tests Image img = Image.Load(this.FilePath, this.localDecoder.Object, this.decoderOptions); Assert.NotNull(img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, this.decoderOptions)); } [Fact] public void LoadFromFileWithTypeAndDecoderAndOptions() { - Image img = Image.Load(this.FilePath, this.localDecoder.Object, this.decoderOptions); + Image img = Image.Load(this.FilePath, this.localDecoder.Object, this.decoderOptions); Assert.NotNull(img); Assert.Equal(this.returnImage, img); - this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, this.decoderOptions)); + this.localDecoder.Verify(x => x.Decode(Configuration.Default, this.DataStream, this.decoderOptions)); } public void Dispose() diff --git a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs index 0d1c3e09b..9f2a6f8c2 100644 --- a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs @@ -59,7 +59,7 @@ namespace ImageSharp.Tests this.fileSystem.Setup(x => x.Create("path.png")).Returns(stream); this.Image.Save("path.png"); - this.encoder.Verify(x => x.Encode(this.Image, stream, null)); + this.encoder.Verify(x => x.Encode(this.Image, stream, null)); } [Fact] @@ -70,7 +70,7 @@ namespace ImageSharp.Tests this.Image.Save("path.jpg", this.encoderOptions); - this.encoder.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); + this.encoder.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); } [Fact] @@ -81,7 +81,7 @@ namespace ImageSharp.Tests this.Image.Save("path.jpg", this.encoderNotInFormat.Object); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); } [Fact] @@ -92,7 +92,7 @@ namespace ImageSharp.Tests this.Image.Save("path.jpg", this.encoderNotInFormat.Object, this.encoderOptions); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); } @@ -105,7 +105,7 @@ namespace ImageSharp.Tests this.Image.Save("path.jpg", this.encoderNotInFormat.Object); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); } [Fact] @@ -116,7 +116,7 @@ namespace ImageSharp.Tests this.Image.Save("path.jpg", this.encoderNotInFormat.Object, this.encoderOptions); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); } [Fact] @@ -125,7 +125,7 @@ namespace ImageSharp.Tests Stream stream = new MemoryStream(); this.Image.Save(stream); - this.encoder.Verify(x => x.Encode(this.Image, stream, null)); + this.encoder.Verify(x => x.Encode(this.Image, stream, null)); } [Fact] @@ -135,7 +135,7 @@ namespace ImageSharp.Tests this.Image.Save(stream, this.encoderOptions); - this.encoder.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); + this.encoder.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); } [Fact] @@ -145,7 +145,7 @@ namespace ImageSharp.Tests this.Image.Save(stream, this.encoderNotInFormat.Object); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); } [Fact] @@ -155,7 +155,7 @@ namespace ImageSharp.Tests this.Image.Save(stream, this.encoderNotInFormat.Object, this.encoderOptions); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); } [Fact] @@ -165,7 +165,7 @@ namespace ImageSharp.Tests this.Image.Save(stream, this.formatNotRegistered.Object); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, null)); } [Fact] @@ -175,7 +175,7 @@ namespace ImageSharp.Tests this.Image.Save(stream, this.formatNotRegistered.Object, this.encoderOptions); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream, this.encoderOptions)); } public void Dispose() diff --git a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs index cd9cd04b7..858b968d6 100644 --- a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs +++ b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs @@ -125,7 +125,7 @@ namespace ImageSharp.Tests [Fact] public void CopyFromZYX() { - using (Image image = new Image(1, 1)) + using (Image image = new Image(1, 1)) { CopyFromZYX(image); } @@ -134,7 +134,7 @@ namespace ImageSharp.Tests [Fact] public void CopyFromZYXW() { - using (Image image = new Image(1, 1)) + using (Image image = new Image(1, 1)) { CopyFromZYXW(image); } @@ -143,7 +143,7 @@ namespace ImageSharp.Tests [Fact] public void CopyToZYX() { - using (Image image = new Image(1, 1)) + using (Image image = new Image(1, 1)) { CopyToZYX(image); } @@ -152,7 +152,7 @@ namespace ImageSharp.Tests [Fact] public void CopyToZYXW() { - using (Image image = new Image(1, 1)) + using (Image image = new Image(1, 1)) { CopyToZYXW(image); } @@ -176,7 +176,7 @@ namespace ImageSharp.Tests pixels.CopyFrom(row, 0); - Color color = (Color)(object)pixels[0, 0]; + Rgba32 color = (Rgba32)(object)pixels[0, 0]; Assert.Equal(red, color.R); Assert.Equal(green, color.G); Assert.Equal(blue, color.B); @@ -204,7 +204,7 @@ namespace ImageSharp.Tests pixels.CopyFrom(row, 0); - Color color = (Color)(object)pixels[0, 0]; + Rgba32 color = (Rgba32)(object)pixels[0, 0]; Assert.Equal(red, color.R); Assert.Equal(green, color.G); Assert.Equal(blue, color.B); @@ -224,7 +224,7 @@ namespace ImageSharp.Tests using (PixelArea row = new PixelArea(1, ComponentOrder.Zyx)) { - pixels[0, 0] = (TColor)(object)new Color(red, green, blue); + pixels[0, 0] = (TColor)(object)new Rgba32(red, green, blue); pixels.CopyTo(row, 0); @@ -247,7 +247,7 @@ namespace ImageSharp.Tests using (PixelArea row = new PixelArea(1, ComponentOrder.Zyxw)) { - pixels[0, 0] = (TColor)(object)new Color(red, green, blue, alpha); + pixels[0, 0] = (TColor)(object)new Rgba32(red, green, blue, alpha); pixels.CopyTo(row, 0); diff --git a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs index f380724df..f7490473d 100644 --- a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs +++ b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs @@ -243,7 +243,7 @@ namespace ImageSharp.Tests TestProfile(profile); - Image thumbnail = profile.CreateThumbnail(); + Image thumbnail = profile.CreateThumbnail(); Assert.NotNull(thumbnail); Assert.Equal(256, thumbnail.Width); Assert.Equal(170, thumbnail.Height); diff --git a/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs index fd08b87a4..e4f348203 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs @@ -21,7 +21,7 @@ namespace ImageSharp.Tests using (Image image = file.CreateImage()) using (FileStream output = File.OpenWrite($"{path}/{file.FileName}")) { - image.BackgroundColor(Color.HotPink).Save(output); + image.BackgroundColor(Rgba32.HotPink).Save(output); } } } diff --git a/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs b/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs index 1afb1300a..4fee996e6 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs @@ -37,7 +37,7 @@ namespace ImageSharp.Tests using (Image image = file.CreateImage()) using (FileStream output = File.OpenWrite($"{path}/{filename}")) { - image.Glow(Color.HotPink).Save(output); + image.Glow(Rgba32.HotPink).Save(output); } } } diff --git a/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs b/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs index da09aa85e..f5c627d92 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs @@ -36,13 +36,13 @@ namespace ImageSharp.Tests // [Fact] public void PrintWeightsData() { - ResizeProcessor proc = new ResizeProcessor(new BicubicResampler(), 200, 200); + ResizeProcessor proc = new ResizeProcessor(new BicubicResampler(), 200, 200); - ResamplingWeightedProcessor.WeightsBuffer weights = proc.PrecomputeWeights(200, 500); + ResamplingWeightedProcessor.WeightsBuffer weights = proc.PrecomputeWeights(200, 500); StringBuilder bld = new StringBuilder(); - foreach (ResamplingWeightedProcessor.WeightsWindow window in weights.Weights) + foreach (ResamplingWeightedProcessor.WeightsWindow window in weights.Weights) { for (int i = 0; i < window.Length; i++) { diff --git a/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs b/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs index 7f40ef1d2..1519678ac 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs @@ -37,7 +37,7 @@ namespace ImageSharp.Tests using (Image image = file.CreateImage()) using (FileStream output = File.OpenWrite($"{path}/{filename}")) { - image.Vignette(Color.HotPink).Save(output); + image.Vignette(Rgba32.HotPink).Save(output); } } } diff --git a/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs b/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs index 2361bc01c..6e82e628c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs @@ -5,13 +5,13 @@ namespace ImageSharp.Tests { - public class ImageFactory : GenericFactory + public class ImageFactory : GenericFactory { - public override Image CreateImage(byte[] bytes) => Image.Load(bytes); + public override Image CreateImage(byte[] bytes) => Image.Load(bytes); - public override Image CreateImage(int width, int height) => new Image(width, height); + public override Image CreateImage(int width, int height) => new Image(width, height); - public override Image CreateImage(Image other) + public override Image CreateImage(Image other) { Image img = (Image)other; return new Image(img); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs index c40abd934..518c45a45 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs @@ -147,9 +147,9 @@ namespace ImageSharp.Tests int bottom = pixels.Height; int height = (int)Math.Ceiling(pixels.Height / 6f); - Vector4 red = Color.Red.ToVector4(); // use real color so we can see har it translates in the test pattern - Vector4 green = Color.Green.ToVector4(); // use real color so we can see har it translates in the test pattern - Vector4 blue = Color.Blue.ToVector4(); // use real color so we can see har it translates in the test pattern + Vector4 red = Rgba32.Red.ToVector4(); // use real color so we can see har it translates in the test pattern + Vector4 green = Rgba32.Green.ToVector4(); // use real color so we can see har it translates in the test pattern + Vector4 blue = Rgba32.Blue.ToVector4(); // use real color so we can see har it translates in the test pattern TColor c = default(TColor); @@ -193,7 +193,7 @@ namespace ImageSharp.Tests int pixelCount = left * top; uint stepsPerPixel = (uint)(uint.MaxValue / pixelCount); TColor c = default(TColor); - Color t = new Color(0); + Rgba32 t = new Rgba32(0); for (int x = left; x < right; x++) for (int y = top; y < bottom; y++) diff --git a/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs b/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs index 92a16563a..88d67f66a 100644 --- a/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs +++ b/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs @@ -26,29 +26,31 @@ namespace ImageSharp.Tests Byte4 = 1 << 4, - Color = 1 << 5, + HalfSingle = 1 << 5, - HalfSingle = 1 << 6, + HalfVector2 = 1 << 6, - HalfVector2 = 1 << 7, + HalfVector4 = 1 << 7, - HalfVector4 = 1 << 8, + NormalizedByte2 = 1 << 8, - NormalizedByte2 = 1 << 9, + NormalizedByte4 = 1 << 9, - NormalizedByte4 = 1 << 10, + NormalizedShort4 = 1 << 10, - NormalizedShort4 = 1 << 11, + Rg32 = 1 << 11, - Rg32 = 1 << 12, + Rgba1010102 = 1 << 12, - Rgba1010102 = 1 << 13, + Rgba32 = 1 << 13, Rgba64 = 1 << 14, - Short2 = 1 << 15, + RgbaVector = 1 << 15, - Short4 = 1 << 16, + Short2 = 1 << 16, + + Short4 = 1 << 17, /// /// Triggers instantiating the subclass of diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs index 260a677d3..a0e92cf8f 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs @@ -18,7 +18,7 @@ namespace ImageSharp.Tests { private static readonly Dictionary ClrTypes2PixelTypes = new Dictionary(); - private static readonly Assembly ImageSharpAssembly = typeof(Color).GetTypeInfo().Assembly; + private static readonly Assembly ImageSharpAssembly = typeof(Rgba32).GetTypeInfo().Assembly; private static readonly Dictionary PixelTypes2ClrTypes = new Dictionary(); @@ -28,8 +28,8 @@ namespace ImageSharp.Tests static TestUtilityExtensions() { - string nameSpace = typeof(Color).FullName; - nameSpace = nameSpace.Substring(0, nameSpace.Length - typeof(Color).Name.Length - 1); + string nameSpace = typeof(Rgba32).FullName; + nameSpace = nameSpace.Substring(0, nameSpace.Length - typeof(Rgba32).Name.Length - 1); foreach (PixelTypes pt in AllConcretePixelTypes.Where(pt => pt != PixelTypes.StandardImageClass)) { string typeName = $"{nameSpace}.{pt.ToString()}"; @@ -42,7 +42,7 @@ namespace ImageSharp.Tests PixelTypes2ClrTypes[pt] = t; ClrTypes2PixelTypes[t] = pt; } - PixelTypes2ClrTypes[PixelTypes.StandardImageClass] = typeof(Color); + PixelTypes2ClrTypes[PixelTypes.StandardImageClass] = typeof(Rgba32); } public static bool HasFlag(this PixelTypes pixelTypes, PixelTypes flag) => (pixelTypes & flag) == flag; diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index cea9cfea0..815d46ffc 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -20,7 +20,7 @@ namespace ImageSharp.Tests private ITestOutputHelper Output { get; } [Theory] - [WithBlankImages(42, 666, PixelTypes.Color | PixelTypes.Argb32 | PixelTypes.HalfSingle, "hello")] + [WithBlankImages(42, 666, PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.HalfSingle, "hello")] public void Use_WithEmptyImageAttribute(TestImageProvider provider, string message) where TColor : struct, IPixel { @@ -46,7 +46,7 @@ namespace ImageSharp.Tests } [Theory] - [WithBlankImages(1, 1, PixelTypes.Color, PixelTypes.Color)] + [WithBlankImages(1, 1, PixelTypes.Rgba32, PixelTypes.Rgba32)] [WithBlankImages(1, 1, PixelTypes.Alpha8, PixelTypes.Alpha8)] [WithBlankImages(1, 1, PixelTypes.StandardImageClass, PixelTypes.StandardImageClass)] public void PixelType_PropertyValueIsCorrect(TestImageProvider provider, PixelTypes expected) @@ -86,7 +86,7 @@ namespace ImageSharp.Tests public static string[] AllBmpFiles => TestImages.Bmp.All; [Theory] - [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.Argb32)] + [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Rgba32 | PixelTypes.Argb32)] public void Use_WithFileCollection(TestImageProvider provider) where TColor : struct, IPixel { @@ -96,7 +96,7 @@ namespace ImageSharp.Tests } [Theory] - [WithSolidFilledImages(10, 20, 255, 100, 50, 200, PixelTypes.Color | PixelTypes.Argb32)] + [WithSolidFilledImages(10, 20, 255, 100, 50, 200, PixelTypes.Rgba32 | PixelTypes.Argb32)] public void Use_WithSolidFilledImagesAttribute(TestImageProvider provider) where TColor : struct, IPixel { @@ -151,7 +151,7 @@ namespace ImageSharp.Tests public static readonly TheoryData BasicData = new TheoryData() { - TestImageProvider.Blank(10, 20), + TestImageProvider.Blank(10, 20), TestImageProvider.Blank( 10, 20), @@ -169,7 +169,7 @@ namespace ImageSharp.Tests public static readonly TheoryData FileData = new TheoryData() { - TestImageProvider.File( + TestImageProvider.File( TestImages.Bmp.Car), TestImageProvider.File( TestImages.Bmp.F) diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs index 0d24410ac..3ad4507df 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs @@ -51,16 +51,16 @@ namespace ImageSharp.Tests [Fact] public void Baz() { - Type type = typeof(Color).GetTypeInfo().Assembly.GetType("ImageSharp.Color"); + Type type = typeof(Rgba32).GetTypeInfo().Assembly.GetType("ImageSharp.Rgba32"); this.Output.WriteLine(type.ToString()); - Type fake = typeof(Color).GetTypeInfo().Assembly.GetType("ImageSharp.dsaada_DASqewrr"); + Type fake = typeof(Rgba32).GetTypeInfo().Assembly.GetType("ImageSharp.dsaada_DASqewrr"); Assert.Null(fake); } [Theory] - [WithFile(TestImages.Bmp.Car, PixelTypes.Color, true)] - [WithFile(TestImages.Bmp.Car, PixelTypes.Color, false)] + [WithFile(TestImages.Bmp.Car, PixelTypes.Rgba32, true)] + [WithFile(TestImages.Bmp.Car, PixelTypes.Rgba32, false)] public void IsEquivalentTo_WhenFalse(TestImageProvider provider, bool compareAlpha) where TColor : struct, IPixel { @@ -72,8 +72,8 @@ namespace ImageSharp.Tests } [Theory] - [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.Bgr565, true)] - [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Color | PixelTypes.Bgr565, false)] + [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Rgba32 | PixelTypes.Bgr565, true)] + [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Rgba32 | PixelTypes.Bgr565, false)] public void IsEquivalentTo_WhenTrue(TestImageProvider provider, bool compareAlpha) where TColor : struct, IPixel { @@ -84,17 +84,17 @@ namespace ImageSharp.Tests } [Theory] - [InlineData(PixelTypes.Color, typeof(Color))] + [InlineData(PixelTypes.Rgba32, typeof(Rgba32))] [InlineData(PixelTypes.Argb32, typeof(Argb32))] [InlineData(PixelTypes.HalfVector4, typeof(HalfVector4))] - [InlineData(PixelTypes.StandardImageClass, typeof(Color))] + [InlineData(PixelTypes.StandardImageClass, typeof(Rgba32))] public void ToType(PixelTypes pt, Type expectedType) { Assert.Equal(pt.ToType(), expectedType); } [Theory] - [InlineData(typeof(Color), PixelTypes.Color)] + [InlineData(typeof(Rgba32), PixelTypes.Rgba32)] [InlineData(typeof(Argb32), PixelTypes.Argb32)] public void GetPixelType(Type clrType, PixelTypes expectedPixelType) { @@ -112,7 +112,7 @@ namespace ImageSharp.Tests [Fact] public void ToTypes() { - PixelTypes pixelTypes = PixelTypes.Alpha8 | PixelTypes.Bgr565 | PixelTypes.Color | PixelTypes.HalfVector2 | PixelTypes.StandardImageClass; + PixelTypes pixelTypes = PixelTypes.Alpha8 | PixelTypes.Bgr565 | PixelTypes.Rgba32 | PixelTypes.HalfVector2 | PixelTypes.StandardImageClass; IEnumerable> expanded = pixelTypes.ExpandAllTypes(); @@ -120,9 +120,9 @@ namespace ImageSharp.Tests AssertContainsPixelType(PixelTypes.Alpha8, expanded); AssertContainsPixelType(PixelTypes.Bgr565, expanded); - AssertContainsPixelType(PixelTypes.Color, expanded); + AssertContainsPixelType(PixelTypes.Rgba32, expanded); AssertContainsPixelType(PixelTypes.HalfVector2, expanded); - AssertContainsPixelType(PixelTypes.StandardImageClass, expanded); + AssertContainsPixelType(PixelTypes.StandardImageClass, expanded); } [Fact] @@ -131,8 +131,8 @@ namespace ImageSharp.Tests KeyValuePair[] expanded = PixelTypes.All.ExpandAllTypes().ToArray(); Assert.True(expanded.Length >= TestUtilityExtensions.GetAllPixelTypes().Length - 2); - AssertContainsPixelType(PixelTypes.Color, expanded); - AssertContainsPixelType(PixelTypes.StandardImageClass, expanded); + AssertContainsPixelType(PixelTypes.Rgba32, expanded); + AssertContainsPixelType(PixelTypes.StandardImageClass, expanded); } } } \ No newline at end of file