From fa152146dd2e8b96677a84bcf6d094e24c18fa3e Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 20 Apr 2017 19:32:35 +1000 Subject: [PATCH 1/9] 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 From df7e64ca3a7f5b455b9bbe0f8e34d421ed206298 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 20 Apr 2017 19:37:21 +1000 Subject: [PATCH 2/9] Rename ColorspaceTransforms --- ...aceTransforms.cs => Rgba32.ColorspaceTransforms.cs} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename src/ImageSharp/Colors/{ColorspaceTransforms.cs => Rgba32.ColorspaceTransforms.cs} (96%) diff --git a/src/ImageSharp/Colors/ColorspaceTransforms.cs b/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs similarity index 96% rename from src/ImageSharp/Colors/ColorspaceTransforms.cs rename to src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs index a08ad9355..aa83c31d9 100644 --- a/src/ImageSharp/Colors/ColorspaceTransforms.cs +++ b/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -189,9 +189,9 @@ namespace ImageSharp float temp2 = (l < 0.5f) ? l * (1f + s) : l + s - (l * s); float temp1 = (2f * l) - temp2; - r = GetColorComponent(temp1, temp2, rangedH + 0.3333333F); - g = GetColorComponent(temp1, temp2, rangedH); - b = GetColorComponent(temp1, temp2, rangedH - 0.3333333F); + r = GeTPixelComponent(temp1, temp2, rangedH + 0.3333333F); + g = GeTPixelComponent(temp1, temp2, rangedH); + b = GeTPixelComponent(temp1, temp2, rangedH - 0.3333333F); } } @@ -241,7 +241,7 @@ namespace ImageSharp /// /// The . /// - private static float GetColorComponent(float first, float second, float third) + private static float GeTPixelComponent(float first, float second, float third) { third = MoveIntoRange(third); if (third < 0.1666667F) From fff223ef07de55412edf7daf05cc551703db041e Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 20 Apr 2017 20:15:18 +1000 Subject: [PATCH 3/9] Rename TColor to TPixel --- README.md | 2 +- ...{Brushes{TColor}.cs => Brushes{TPixel}.cs} | 40 +- src/ImageSharp.Drawing/Brushes/IBrush.cs | 12 +- ...Brush{TColor}.cs => ImageBrush{TPixel}.cs} | 27 +- ...ush{TColor}.cs => PatternBrush{TPixel}.cs} | 36 +- .../Brushes/Processors/BrushApplicator.cs | 18 +- .../Brushes/RecolorBrush.cs | 6 +- ...ush{TColor}.cs => RecolorBrush{TPixel}.cs} | 48 +- ...Brush{TColor}.cs => SolidBrush{TPixel}.cs} | 28 +- src/ImageSharp.Drawing/DrawImage.cs | 18 +- src/ImageSharp.Drawing/DrawPath.cs | 60 +- src/ImageSharp.Drawing/FillRegion.cs | 60 +- src/ImageSharp.Drawing/Paths/DrawBeziers.cs | 58 +- src/ImageSharp.Drawing/Paths/DrawLines.cs | 58 +- src/ImageSharp.Drawing/Paths/DrawPath.cs | 58 +- src/ImageSharp.Drawing/Paths/DrawPolygon.cs | 58 +- src/ImageSharp.Drawing/Paths/DrawRectangle.cs | 58 +- src/ImageSharp.Drawing/Paths/FillPaths.cs | 38 +- src/ImageSharp.Drawing/Paths/FillPolygon.cs | 38 +- src/ImageSharp.Drawing/Paths/FillRectangle.cs | 38 +- src/ImageSharp.Drawing/Pens/IPen.cs | 8 +- src/ImageSharp.Drawing/Pens/Pen.cs | 2 +- .../Pens/{Pens{TColor}.cs => Pens{TPixel}.cs} | 50 +- .../Pens/{Pen{TColor}.cs => Pen{TPixel}.cs} | 58 +- .../Pens/Processors/ColoredPointInfo.cs | 8 +- .../Pens/Processors/PenApplicator.cs | 10 +- .../Processors/DrawImageProcessor.cs | 20 +- .../Processors/DrawPathProcessor.cs | 24 +- .../Processors/FillProcessor.cs | 24 +- .../Processors/FillRegionProcessor.cs | 20 +- src/ImageSharp.Drawing/Text/DrawText.cs | 68 +- ...der{TColor}.cs => ColorBuilder{TPixel}.cs} | 32 +- src/ImageSharp/Colors/NamedColors{TColor}.cs | 725 ------------------ src/ImageSharp/Colors/NamedColors{TPixel}.cs | 725 ++++++++++++++++++ ...lor}.cs => BulkPixelOperations{TPixel}.cs} | 74 +- src/ImageSharp/Colors/PackedPixel/IPixel.cs | 6 +- .../PackedPixel/PackedPixelConverterHelper.cs | 10 +- .../Colors/Rgba32.BulkOperations.cs | 2 +- .../Colors/Rgba32.ColorspaceTransforms.cs | 8 +- .../Colors/RgbaVector.BulkOperations.cs | 2 +- .../Colors/Spaces/IAlmostEquatable.cs | 6 +- src/ImageSharp/Common/Helpers/ImageMaths.cs | 18 +- .../Common/Memory/PixelDataPool{T}.cs | 2 +- .../Dithering/ErrorDiffusion/ErrorDiffuser.cs | 10 +- .../ErrorDiffusion/IErrorDiffuser.cs | 12 +- .../Dithering/Ordered/IOrderedDither.cs | 6 +- .../Dithering/Ordered/OrderedDither4x4.cs | 4 +- src/ImageSharp/Formats/Bmp/BmpDecoder.cs | 6 +- src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 56 +- src/ImageSharp/Formats/Bmp/BmpEncoder.cs | 14 +- src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs | 40 +- src/ImageSharp/Formats/Bmp/ImageExtensions.cs | 10 +- src/ImageSharp/Formats/Gif/GifDecoder.cs | 16 +- src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 38 +- src/ImageSharp/Formats/Gif/GifEncoder.cs | 14 +- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 86 +-- src/ImageSharp/Formats/Gif/ImageExtensions.cs | 18 +- src/ImageSharp/Formats/IImageDecoder.cs | 8 +- src/ImageSharp/Formats/IImageEncoder.cs | 10 +- .../Formats/Jpeg/ImageExtensions.cs | 18 +- src/ImageSharp/Formats/Jpeg/JpegDecoder.cs | 6 +- .../Formats/Jpeg/JpegDecoderCore.cs | 104 +-- src/ImageSharp/Formats/Jpeg/JpegEncoder.cs | 14 +- .../Formats/Jpeg/JpegEncoderCore.cs | 54 +- .../Formats/Jpeg/Utils/JpegUtils.cs | 24 +- src/ImageSharp/Formats/Png/ImageExtensions.cs | 18 +- src/ImageSharp/Formats/Png/PngDecoder.cs | 16 +- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 48 +- src/ImageSharp/Formats/Png/PngEncoder.cs | 14 +- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 68 +- src/ImageSharp/Image.Create.cs | 28 +- src/ImageSharp/Image.Decode.cs | 8 +- src/ImageSharp/Image.FromBytes.cs | 48 +- src/ImageSharp/Image.FromFile.cs | 48 +- src/ImageSharp/Image.FromStream.cs | 48 +- ...eBase{TColor}.cs => IImageBase{TPixel}.cs} | 14 +- src/ImageSharp/Image/IImageProcessor.cs | 10 +- ...geBase{TColor}.cs => ImageBase{TPixel}.cs} | 43 +- ...Frame{TColor}.cs => ImageFrame{TPixel}.cs} | 38 +- .../Image/ImageProcessingExtensions.cs | 11 +- .../{Image{TColor}.cs => Image{TPixel}.cs} | 110 ++- ...or{TColor}.cs => PixelAccessor{TPixel}.cs} | 98 ++- ...elArea{TColor}.cs => PixelArea{TPixel}.cs} | 23 +- src/ImageSharp/ImageProcessor.cs | 16 +- .../MetaData/Profiles/Exif/ExifProfile.cs | 10 +- .../Binarization/BinaryThreshold.cs | 20 +- .../Processing/Binarization/Dither.cs | 32 +- .../Processing/ColorMatrix/BlackWhite.cs | 20 +- .../Processing/ColorMatrix/ColorBlindness.cs | 36 +- .../Processing/ColorMatrix/Grayscale.cs | 24 +- src/ImageSharp/Processing/ColorMatrix/Hue.cs | 20 +- .../Processing/ColorMatrix/Kodachrome.cs | 20 +- .../Processing/ColorMatrix/Lomograph.cs | 20 +- .../Processing/ColorMatrix/Polaroid.cs | 20 +- .../Processing/ColorMatrix/Saturation.cs | 20 +- .../Processing/ColorMatrix/Sepia.cs | 16 +- .../Processing/Convolution/BoxBlur.cs | 20 +- .../Processing/Convolution/DetectEdges.cs | 80 +- .../Processing/Convolution/GaussianBlur.cs | 20 +- .../Processing/Convolution/GaussianSharpen.cs | 20 +- src/ImageSharp/Processing/Effects/Alpha.cs | 16 +- .../Processing/Effects/BackgroundColor.cs | 12 +- .../Processing/Effects/Brightness.cs | 20 +- src/ImageSharp/Processing/Effects/Contrast.cs | 20 +- src/ImageSharp/Processing/Effects/Invert.cs | 16 +- .../Processing/Effects/OilPainting.cs | 20 +- src/ImageSharp/Processing/Effects/Pixelate.cs | 20 +- src/ImageSharp/Processing/Overlays/Glow.cs | 50 +- .../Processing/Overlays/Vignette.cs | 50 +- .../Binarization/BinaryThresholdProcessor.cs | 32 +- .../ErrorDiffusionDitherProcessor.cs | 30 +- .../Binarization/OrderedDitherProcessor.cs | 30 +- .../ColorMatrix/BlackWhiteProcessor.cs | 6 +- .../ColorBlindness/AchromatomalyProcessor.cs | 6 +- .../ColorBlindness/AchromatopsiaProcessor.cs | 6 +- .../ColorBlindness/DeuteranomalyProcessor.cs | 6 +- .../ColorBlindness/DeuteranopiaProcessor.cs | 6 +- .../ColorBlindness/ProtanomalyProcessor.cs | 6 +- .../ColorBlindness/ProtanopiaProcessor.cs | 6 +- .../ColorBlindness/TritanomalyProcessor.cs | 6 +- .../ColorBlindness/TritanopiaProcessor.cs | 6 +- .../ColorMatrix/ColorMatrixProcessor.cs | 14 +- .../ColorMatrix/GrayscaleBt601Processor.cs | 6 +- .../ColorMatrix/GrayscaleBt709Processor.cs | 6 +- .../Processors/ColorMatrix/HueProcessor.cs | 10 +- .../ColorMatrix/IColorMatrixFilter.cs | 6 +- .../ColorMatrix/KodachromeProcessor.cs | 6 +- .../ColorMatrix/LomographProcessor.cs | 12 +- .../ColorMatrix/PolaroidProcessor.cs | 16 +- .../ColorMatrix/SaturationProcessor.cs | 10 +- .../Processors/ColorMatrix/SepiaProcessor.cs | 6 +- .../Convolution/BoxBlurProcessor.cs | 12 +- .../Convolution/Convolution2DProcessor.cs | 16 +- .../Convolution/Convolution2PassProcessor.cs | 22 +- .../Convolution/ConvolutionProcessor.cs | 16 +- .../EdgeDetection/EdgeDetector2DProcessor.cs | 16 +- .../EdgeDetectorCompassProcessor.cs | 26 +- .../EdgeDetection/EdgeDetectorProcessor.cs | 16 +- .../EdgeDetection/IEdgeDetectorProcessor.cs | 6 +- .../EdgeDetection/KayyaliProcessor.cs | 8 +- .../EdgeDetection/KirschProcessor.cs | 6 +- .../EdgeDetection/Laplacian3X3Processor.cs | 8 +- .../EdgeDetection/Laplacian5X5Processor.cs | 8 +- .../LaplacianOfGaussianProcessor.cs | 8 +- .../EdgeDetection/PrewittProcessor.cs | 8 +- .../EdgeDetection/RobertsCrossProcessor.cs | 8 +- .../EdgeDetection/RobinsonProcessor.cs | 6 +- .../EdgeDetection/ScharrProcessor.cs | 8 +- .../EdgeDetection/SobelProcessor.cs | 8 +- .../Convolution/GaussianBlurProcessor.cs | 16 +- .../Convolution/GaussianSharpenProcessor.cs | 16 +- .../Processors/Effects/AlphaProcessor.cs | 16 +- .../Effects/BackgroundColorProcessor.cs | 20 +- .../Processors/Effects/BrightnessProcessor.cs | 16 +- .../Processors/Effects/ContrastProcessor.cs | 16 +- .../Processors/Effects/InvertProcessor.cs | 14 +- .../Effects/OilPaintingProcessor.cs | 18 +- .../Processors/Effects/PixelateProcessor.cs | 18 +- .../Processors/Overlays/GlowProcessor.cs | 22 +- .../Processors/Overlays/VignetteProcessor.cs | 22 +- .../Processors/Transforms/CropProcessor.cs | 14 +- .../Transforms/EntropyCropProcessor.cs | 18 +- .../Processors/Transforms/FlipProcessor.cs | 22 +- .../Transforms/Matrix3x2Processor.cs | 8 +- .../ResamplingWeightedProcessor.Weights.cs | 2 +- .../Transforms/ResamplingWeightedProcessor.cs | 12 +- .../Processors/Transforms/ResizeProcessor.cs | 28 +- .../Processors/Transforms/RotateProcessor.cs | 34 +- .../Processors/Transforms/SkewProcessor.cs | 14 +- .../Processing/Transforms/AutoOrient.cs | 14 +- src/ImageSharp/Processing/Transforms/Crop.cs | 18 +- .../Processing/Transforms/EntropyCrop.cs | 10 +- src/ImageSharp/Processing/Transforms/Flip.cs | 10 +- .../Transforms/Options/ResizeHelper.cs | 36 +- src/ImageSharp/Processing/Transforms/Pad.cs | 10 +- .../Processing/Transforms/Resize.cs | 62 +- .../Processing/Transforms/Rotate.cs | 22 +- .../Processing/Transforms/RotateFlip.cs | 8 +- src/ImageSharp/Processing/Transforms/Skew.cs | 16 +- .../{IQuantizer.cs => IQuantizer{TPixel}.cs} | 16 +- ...uantizer.cs => OctreeQuantizer{TPixel}.cs} | 58 +- ...antizer.cs => PaletteQuantizer{TPixel}.cs} | 38 +- src/ImageSharp/Quantizers/Quantize.cs | 32 +- ...izedImage.cs => QuantizedImage{TPixel}.cs} | 14 +- .../{Quantizer.cs => Quantizer{TPixel}.cs} | 34 +- src/ImageSharp/Quantizers/WuArrayPool.cs | 4 +- ...{WuQuantizer.cs => WuQuantizer{TPixel}.cs} | 40 +- .../Color/Bulk/PackFromXyzw.cs | 16 +- .../Color/Bulk/ToVector4.cs | 16 +- .../ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs | 16 +- .../Color/Bulk/ToXyzw.cs | 16 +- .../Colors/BulkPixelOperationsTests.cs | 42 +- .../Formats/Jpg/BadEofJpegTests.cs | 12 +- .../Formats/Jpg/JpegDecoderTests.cs | 32 +- .../Formats/Jpg/JpegEncoderTests.cs | 12 +- .../Formats/Jpg/JpegUtilsTests.cs | 38 +- .../Formats/Png/PngEncoderTests.cs | 6 +- .../Formats/Png/PngSmokeTests.cs | 24 +- .../Image/PixelAccessorTests.cs | 84 +- tests/ImageSharp.Tests/ImageComparer.cs | 34 +- .../Processors/Filters/GrayscaleTest.cs | 8 +- tests/ImageSharp.Tests/TestFormat.cs | 16 +- .../Attributes/ImageDataAttributeBase.cs | 2 +- .../Attributes/WithBlankImageAttribute.cs | 6 +- .../Attributes/WithFileAttribute.cs | 8 +- .../Attributes/WithFileCollectionAttribute.cs | 8 +- .../Attributes/WithMemberFactoryAttribute.cs | 10 +- .../WithSolidFilledImagesAttribute.cs | 12 +- .../WithTestPatternImageAttribute.cs | 6 +- .../TestUtilities/Factories/GenericFactory.cs | 16 +- .../ImageProviders/BlankProvider.cs | 8 +- .../ImageProviders/FileProvider.cs | 16 +- .../ImageProviders/LambdaProvider.cs | 16 +- .../ImageProviders/SolidProvider.cs | 14 +- .../ImageProviders/TestImageProvider.cs | 34 +- .../ImageProviders/TestPatternProvider.cs | 42 +- .../TestUtilities/ImagingTestCaseUtility.cs | 10 +- .../TestUtilities/PixelTypes.cs | 4 +- .../TestUtilities/TestImageExtensions.cs | 4 +- .../TestUtilities/TestUtilityExtensions.cs | 12 +- .../Tests/TestImageProviderTests.cs | 72 +- .../Tests/TestUtilityExtensionsTests.cs | 26 +- 222 files changed, 3240 insertions(+), 3248 deletions(-) rename src/ImageSharp.Drawing/Brushes/{Brushes{TColor}.cs => Brushes{TPixel}.cs} (78%) rename src/ImageSharp.Drawing/Brushes/{ImageBrush{TColor}.cs => ImageBrush{TPixel}.cs} (83%) rename src/ImageSharp.Drawing/Brushes/{PatternBrush{TColor}.cs => PatternBrush{TPixel}.cs} (85%) rename src/ImageSharp.Drawing/Brushes/{RecolorBrush{TColor}.cs => RecolorBrush{TPixel}.cs} (80%) rename src/ImageSharp.Drawing/Brushes/{SolidBrush{TColor}.cs => SolidBrush{TPixel}.cs} (80%) rename src/ImageSharp.Drawing/Pens/{Pens{TColor}.cs => Pens{TPixel}.cs} (68%) rename src/ImageSharp.Drawing/Pens/{Pen{TColor}.cs => Pen{TPixel}.cs} (81%) rename src/ImageSharp/Colors/{ColorBuilder{TColor}.cs => ColorBuilder{TPixel}.cs} (78%) delete mode 100644 src/ImageSharp/Colors/NamedColors{TColor}.cs create mode 100644 src/ImageSharp/Colors/NamedColors{TPixel}.cs rename src/ImageSharp/Colors/PackedPixel/{BulkPixelOperations{TColor}.cs => BulkPixelOperations{TPixel}.cs} (78%) rename src/ImageSharp/Image/{IImageBase{TColor}.cs => IImageBase{TPixel}.cs} (69%) rename src/ImageSharp/Image/{ImageBase{TColor}.cs => ImageBase{TPixel}.cs} (86%) rename src/ImageSharp/Image/{ImageFrame{TColor}.cs => ImageFrame{TPixel}.cs} (74%) rename src/ImageSharp/Image/{Image{TColor}.cs => Image{TPixel}.cs} (82%) rename src/ImageSharp/Image/{PixelAccessor{TColor}.cs => PixelAccessor{TPixel}.cs} (87%) rename src/ImageSharp/Image/{PixelArea{TColor}.cs => PixelArea{TPixel}.cs} (95%) rename src/ImageSharp/Quantizers/{IQuantizer.cs => IQuantizer{TPixel}.cs} (73%) rename src/ImageSharp/Quantizers/{OctreeQuantizer.cs => OctreeQuantizer{TPixel}.cs} (92%) rename src/ImageSharp/Quantizers/{PaletteQuantizer.cs => PaletteQuantizer{TPixel}.cs} (78%) rename src/ImageSharp/Quantizers/{QuantizedImage.cs => QuantizedImage{TPixel}.cs} (83%) rename src/ImageSharp/Quantizers/{Quantizer.cs => Quantizer{TPixel}.cs} (85%) rename src/ImageSharp/Quantizers/{WuQuantizer.cs => WuQuantizer{TPixel}.cs} (96%) diff --git a/README.md b/README.md index 6d37dd5e7..d62d430f6 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ using (var pixels = image.Lock()) } ``` -For advanced usage the `Image` and `PixelAccessor` classes are available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame. +For advanced usage the `Image` and `PixelAccessor` classes are available allowing developers to implement their own color models in the same manner as Microsoft XNA Game Studio and MonoGame. All in all this should allow image processing to be much more accessible to developers which has always been my goal from the start. diff --git a/src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs b/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs similarity index 78% rename from src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs rename to src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs index 6e092bf18..d56e9e6eb 100644 --- a/src/ImageSharp.Drawing/Brushes/Brushes{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,10 +10,10 @@ namespace ImageSharp.Drawing.Brushes /// /// A collection of methods for creating generic brushes. /// - /// The pixel format. + /// The pixel format. /// A Brush - public class Brushes - where TColor : struct, IPixel + public class Brushes + where TPixel : struct, IPixel { /// /// Percent10 Hatch Pattern @@ -99,8 +99,8 @@ namespace ImageSharp.Drawing.Brushes /// /// The color. /// A Brush - public static SolidBrush Solid(TColor color) - => new SolidBrush(color); + public static SolidBrush Solid(TPixel color) + => new SolidBrush(color); /// /// Create as brush that will paint a Percent10 Hatch Pattern within the specified colors @@ -108,8 +108,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Percent10(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, Percent10Pattern); + public static PatternBrush Percent10(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, Percent10Pattern); /// /// Create as brush that will paint a Percent20 Hatch Pattern within the specified colors @@ -117,8 +117,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Percent20(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, Percent20Pattern); + public static PatternBrush Percent20(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, Percent20Pattern); /// /// Create as brush that will paint a Horizontal Hatch Pattern within the specified colors @@ -126,8 +126,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Horizontal(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, HorizontalPattern); + public static PatternBrush Horizontal(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, HorizontalPattern); /// /// Create as brush that will paint a Min Hatch Pattern within the specified colors @@ -135,8 +135,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Min(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, MinPattern); + public static PatternBrush Min(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, MinPattern); /// /// Create as brush that will paint a Vertical Hatch Pattern within the specified colors @@ -144,8 +144,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush Vertical(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, VerticalPattern); + public static PatternBrush Vertical(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, VerticalPattern); /// /// Create as brush that will paint a Forward Diagonal Hatch Pattern within the specified colors @@ -153,8 +153,8 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush ForwardDiagonal(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, ForwardDiagonalPattern); + public static PatternBrush ForwardDiagonal(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, ForwardDiagonalPattern); /// /// Create as brush that will paint a Backward Diagonal Hatch Pattern within the specified colors @@ -162,7 +162,7 @@ namespace ImageSharp.Drawing.Brushes /// Color of the foreground. /// Color of the background. /// A Brush - public static PatternBrush BackwardDiagonal(TColor foreColor, TColor backColor) - => new PatternBrush(foreColor, backColor, BackwardDiagonalPattern); + public static PatternBrush BackwardDiagonal(TPixel foreColor, TPixel backColor) + => new PatternBrush(foreColor, backColor, BackwardDiagonalPattern); } } diff --git a/src/ImageSharp.Drawing/Brushes/IBrush.cs b/src/ImageSharp.Drawing/Brushes/IBrush.cs index df05fa23e..a19c55169 100644 --- a/src/ImageSharp.Drawing/Brushes/IBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/IBrush.cs @@ -12,13 +12,13 @@ namespace ImageSharp.Drawing /// /// Brush represents a logical configuration of a brush which can be used to source pixel colors /// - /// The pixel format. + /// The pixel format. /// - /// A brush is a simple class that will return an that will perform the - /// logic for converting a pixel location to a . + /// A brush is a simple class that will return an that will perform the + /// logic for converting a pixel location to a . /// - public interface IBrush - where TColor : struct, IPixel + public interface IBrush + where TPixel : struct, IPixel { /// /// Creates the applicator for this brush. @@ -32,6 +32,6 @@ namespace ImageSharp.Drawing /// The when being applied to things like shapes would usually be the /// bounding box of the shape not necessarily the bounds of the whole image /// - BrushApplicator CreateApplicator(PixelAccessor pixelSource, RectangleF region); + BrushApplicator CreateApplicator(PixelAccessor pixelSource, RectangleF region); } } \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs similarity index 83% rename from src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs rename to src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs index b68b02eff..e7ae27b60 100644 --- a/src/ImageSharp.Drawing/Brushes/ImageBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs @@ -1,11 +1,10 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Drawing.Brushes { - using System; using System.Numerics; using Processors; @@ -13,26 +12,26 @@ namespace ImageSharp.Drawing.Brushes /// /// Provides an implementation of an image brush for painting images within areas. /// - /// The pixel format. - public class ImageBrush : IBrush - where TColor : struct, IPixel + /// The pixel format. + public class ImageBrush : IBrush + where TPixel : struct, IPixel { /// /// The image to paint. /// - private readonly IImageBase image; + private readonly IImageBase image; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The image. - public ImageBrush(IImageBase image) + public ImageBrush(IImageBase image) { this.image = image; } /// - public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) + public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) { return new ImageBrushApplicator(sourcePixels, this.image, region); } @@ -40,12 +39,12 @@ namespace ImageSharp.Drawing.Brushes /// /// The image brush applicator. /// - private class ImageBrushApplicator : BrushApplicator + private class ImageBrushApplicator : BrushApplicator { /// /// The source pixel accessor. /// - private readonly PixelAccessor source; + private readonly PixelAccessor source; /// /// The y-length. @@ -74,7 +73,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The sourcePixels. /// - public ImageBrushApplicator(PixelAccessor sourcePixels, IImageBase image, RectangleF region) + public ImageBrushApplicator(PixelAccessor sourcePixels, IImageBase image, RectangleF region) : base(sourcePixels) { this.source = image.Lock(); @@ -91,7 +90,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The color /// - internal override TColor this[int x, int y] + internal override TPixel this[int x, int y] { get { @@ -135,7 +134,7 @@ namespace ImageSharp.Drawing.Brushes Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); this.Target[targetX, targetY] = packed; } diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs similarity index 85% rename from src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs rename to src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs index 1af58bc62..4f3240247 100644 --- a/src/ImageSharp.Drawing/Brushes/PatternBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -31,38 +31,38 @@ namespace ImageSharp.Drawing.Brushes /// 0 /// /// - /// The pixel format. - public class PatternBrush : IBrush - where TColor : struct, IPixel + /// The pixel format. + public class PatternBrush : IBrush + where TPixel : struct, IPixel { /// /// The pattern. /// - private readonly Fast2DArray pattern; + private readonly Fast2DArray pattern; private readonly Fast2DArray patternVector; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Color of the fore. /// Color of the back. /// The pattern. - public PatternBrush(TColor foreColor, TColor backColor, bool[,] pattern) + public PatternBrush(TPixel foreColor, TPixel backColor, bool[,] pattern) : this(foreColor, backColor, new Fast2DArray(pattern)) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Color of the fore. /// Color of the back. /// The pattern. - internal PatternBrush(TColor foreColor, TColor backColor, Fast2DArray pattern) + internal PatternBrush(TPixel foreColor, TPixel backColor, Fast2DArray pattern) { Vector4 foreColorVector = foreColor.ToVector4(); Vector4 backColorVector = backColor.ToVector4(); - this.pattern = new Fast2DArray(pattern.Width, pattern.Height); + this.pattern = new Fast2DArray(pattern.Width, pattern.Height); this.patternVector = new Fast2DArray(pattern.Width, pattern.Height); for (int i = 0; i < pattern.Data.Length; i++) { @@ -80,17 +80,17 @@ namespace ImageSharp.Drawing.Brushes } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The brush. - internal PatternBrush(PatternBrush brush) + internal PatternBrush(PatternBrush brush) { this.pattern = brush.pattern; this.patternVector = brush.patternVector; } /// - public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) + public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) { return new PatternBrushApplicator(sourcePixels, this.pattern, this.patternVector); } @@ -98,12 +98,12 @@ namespace ImageSharp.Drawing.Brushes /// /// The pattern brush applicator. /// - private class PatternBrushApplicator : BrushApplicator + private class PatternBrushApplicator : BrushApplicator { /// /// The pattern. /// - private readonly Fast2DArray pattern; + private readonly Fast2DArray pattern; private readonly Fast2DArray patternVector; /// @@ -112,7 +112,7 @@ namespace ImageSharp.Drawing.Brushes /// The sourcePixels. /// The pattern. /// The patternVector. - public PatternBrushApplicator(PixelAccessor sourcePixels, Fast2DArray pattern, Fast2DArray patternVector) + public PatternBrushApplicator(PixelAccessor sourcePixels, Fast2DArray pattern, Fast2DArray patternVector) : base(sourcePixels) { this.pattern = pattern; @@ -127,7 +127,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The Color. /// - internal override TColor this[int x, int y] + internal override TPixel this[int x, int y] { get { @@ -169,7 +169,7 @@ namespace ImageSharp.Drawing.Brushes Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); this.Target[targetX, targetY] = packed; } diff --git a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs index 0ef11e161..0116a13ae 100644 --- a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs +++ b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs @@ -12,16 +12,16 @@ namespace ImageSharp.Drawing.Processors /// /// primitive that converts a point in to a color for discovering the fill color based on an implementation /// - /// The pixel format. + /// The pixel format. /// - public abstract class BrushApplicator : IDisposable // disposable will be required if/when there is an ImageBrush - where TColor : struct, IPixel + public abstract class BrushApplicator : IDisposable // disposable will be required if/when there is an ImageBrush + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The target. - internal BrushApplicator(PixelAccessor target) + internal BrushApplicator(PixelAccessor target) { this.Target = target; } @@ -29,15 +29,15 @@ namespace ImageSharp.Drawing.Processors /// /// Gets the destinaion /// - protected PixelAccessor Target { get; } + protected PixelAccessor Target { get; } /// /// Gets the color for a single pixel. /// /// The x cordinate. /// The y cordinate. - /// The a that should be applied to the pixel. - internal abstract TColor this[int x, int y] { get; } + /// The a that should be applied to the pixel. + internal abstract TPixel this[int x, int y] { get; } /// public abstract void Dispose(); @@ -73,7 +73,7 @@ namespace ImageSharp.Drawing.Processors Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); this.Target[targetX, targetY] = packed; } diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs index b18800371..3041d0edf 100644 --- a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs @@ -14,10 +14,10 @@ namespace ImageSharp.Drawing.Brushes /// Initializes a new instance of the class. /// /// Color of the source. - /// Color of the target. + /// Color of the target. /// The threshold. - public RecolorBrush(Rgba32 sourceColor, Rgba32 targetColor, float threshold) - : base(sourceColor, targetColor, threshold) + public RecolorBrush(Rgba32 sourceColor, Rgba32 targeTPixel, float threshold) + : base(sourceColor, targeTPixel, threshold) { } } diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs similarity index 80% rename from src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs rename to src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs index 4e3cd01ae..aa1b5cb82 100644 --- a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -13,21 +13,21 @@ namespace ImageSharp.Drawing.Brushes /// /// Provides an implementation of a brush that can recolor an image /// - /// The pixel format. - public class RecolorBrush : IBrush - where TColor : struct, IPixel + /// The pixel format. + public class RecolorBrush : IBrush + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Color of the source. - /// Color of the target. + /// Color of the target. /// The threshold as a value between 0 and 1. - public RecolorBrush(TColor sourceColor, TColor targetColor, float threshold) + public RecolorBrush(TPixel sourceColor, TPixel targeTPixel, float threshold) { this.SourceColor = sourceColor; this.Threshold = threshold; - this.TargetColor = targetColor; + this.TargeTPixel = targeTPixel; } /// @@ -44,7 +44,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The color of the source. /// - public TColor SourceColor { get; } + public TPixel SourceColor { get; } /// /// Gets the target color. @@ -52,18 +52,18 @@ namespace ImageSharp.Drawing.Brushes /// /// The color of the target. /// - public TColor TargetColor { get; } + public TPixel TargeTPixel { get; } /// - public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) + public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) { - return new RecolorBrushApplicator(sourcePixels, this.SourceColor, this.TargetColor, this.Threshold); + return new RecolorBrushApplicator(sourcePixels, this.SourceColor, this.TargeTPixel, this.Threshold); } /// /// The recolor brush applicator. /// - private class RecolorBrushApplicator : BrushApplicator + private class RecolorBrushApplicator : BrushApplicator { /// /// The source color. @@ -73,7 +73,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The target color. /// - private readonly Vector4 targetColor; + private readonly Vector4 targeTPixel; /// /// The threshold. @@ -85,18 +85,18 @@ namespace ImageSharp.Drawing.Brushes /// /// The source pixels. /// Color of the source. - /// Color of the target. + /// Color of the target. /// The threshold . - public RecolorBrushApplicator(PixelAccessor sourcePixels, TColor sourceColor, TColor targetColor, float threshold) + public RecolorBrushApplicator(PixelAccessor sourcePixels, TPixel sourceColor, TPixel targeTPixel, float threshold) : base(sourcePixels) { this.sourceColor = sourceColor.ToVector4(); - this.targetColor = targetColor.ToVector4(); + this.targeTPixel = targeTPixel.ToVector4(); // Lets hack a min max extreams for a color space by letteing the IPackedPixel clamp our values to something in the correct spaces :) - TColor maxColor = default(TColor); + TPixel maxColor = default(TPixel); maxColor.PackFromVector4(new Vector4(float.MaxValue)); - TColor minColor = default(TColor); + TPixel minColor = default(TPixel); minColor.PackFromVector4(new Vector4(float.MinValue)); this.threshold = Vector4.DistanceSquared(maxColor.ToVector4(), minColor.ToVector4()) * threshold; } @@ -109,12 +109,12 @@ namespace ImageSharp.Drawing.Brushes /// /// The color /// - internal override TColor this[int x, int y] + internal override TPixel this[int x, int y] { get { // Offset the requested pixel by the value in the rectangle (the shapes position) - TColor result = this.Target[x, y]; + TPixel result = this.Target[x, y]; Vector4 background = result.ToVector4(); float distance = Vector4.DistanceSquared(background, this.sourceColor); if (distance <= this.threshold) @@ -122,7 +122,7 @@ namespace ImageSharp.Drawing.Brushes float lerpAmount = (this.threshold - distance) / this.threshold; Vector4 blended = Vector4BlendTransforms.PremultipliedLerp( background, - this.targetColor, + this.targeTPixel, lerpAmount); result.PackFromVector4(blended); } @@ -162,12 +162,12 @@ namespace ImageSharp.Drawing.Brushes float lerpAmount = (this.threshold - distance) / this.threshold; sourceVector = Vector4BlendTransforms.PremultipliedLerp( sourceVector, - this.targetColor, + this.targeTPixel, lerpAmount); Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); this.Target[targetX, targetY] = packed; } diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs similarity index 80% rename from src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs rename to src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs index 74c7081b3..4d9b6adb3 100644 --- a/src/ImageSharp.Drawing/Brushes/SolidBrush{TColor}.cs +++ b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -13,20 +13,20 @@ namespace ImageSharp.Drawing.Brushes /// /// Provides an implementation of a solid brush for painting solid color areas. /// - /// The pixel format. - public class SolidBrush : IBrush - where TColor : struct, IPixel + /// The pixel format. + public class SolidBrush : IBrush + where TPixel : struct, IPixel { /// /// The color to paint. /// - private readonly TColor color; + private readonly TPixel color; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color. - public SolidBrush(TColor color) + public SolidBrush(TPixel color) { this.color = color; } @@ -37,10 +37,10 @@ namespace ImageSharp.Drawing.Brushes /// /// The color. /// - public TColor Color => this.color; + public TPixel Color => this.color; /// - public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) + public BrushApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) { return new SolidBrushApplicator(sourcePixels, this.color); } @@ -48,12 +48,12 @@ namespace ImageSharp.Drawing.Brushes /// /// The solid brush applicator. /// - private class SolidBrushApplicator : BrushApplicator + private class SolidBrushApplicator : BrushApplicator { /// /// The solid color. /// - private readonly TColor color; + private readonly TPixel color; private readonly Vector4 colorVector; /// @@ -61,7 +61,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The color. /// The sourcePixels. - public SolidBrushApplicator(PixelAccessor sourcePixels, TColor color) + public SolidBrushApplicator(PixelAccessor sourcePixels, TPixel color) : base(sourcePixels) { this.color = color; @@ -76,7 +76,7 @@ namespace ImageSharp.Drawing.Brushes /// /// The color /// - internal override TColor this[int x, int y] => this.color; + internal override TPixel this[int x, int y] => this.color; /// public override void Dispose() @@ -106,7 +106,7 @@ namespace ImageSharp.Drawing.Brushes Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); this.Target[targetX, targetY] = packed; } diff --git a/src/ImageSharp.Drawing/DrawImage.cs b/src/ImageSharp.Drawing/DrawImage.cs index 16582e7ee..7f4fb3392 100644 --- a/src/ImageSharp.Drawing/DrawImage.cs +++ b/src/ImageSharp.Drawing/DrawImage.cs @@ -17,13 +17,13 @@ namespace ImageSharp /// /// Draws the given image together with the current one by blending their pixels. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The image to blend with the currently processing image. /// The opacity of the image image to blend. Must be between 0 and 100. - /// The . - public static Image Blend(this Image source, Image image, int percent = 50) - where TColor : struct, IPixel + /// The . + public static Image Blend(this Image source, Image image, int percent = 50) + where TPixel : struct, IPixel { return DrawImage(source, image, percent, default(Size), default(Point)); } @@ -33,13 +33,13 @@ namespace ImageSharp /// /// The image this method extends. /// The image to blend with the currently processing image. - /// The pixel format. + /// The pixel format. /// The opacity of the image image to blend. Must be between 0 and 100. /// The size to draw the blended image. /// The location to draw the blended image. - /// The . - public static Image DrawImage(this Image source, Image image, int percent, Size size, Point location) - where TColor : struct, IPixel + /// The . + public static Image DrawImage(this Image source, Image image, int percent, Size size, Point location) + where TPixel : struct, IPixel { if (size == default(Size)) { @@ -51,7 +51,7 @@ namespace ImageSharp location = Point.Empty; } - source.ApplyProcessor(new DrawImageProcessor(image, size, location, percent), source.Bounds); + source.ApplyProcessor(new DrawImageProcessor(image, size, location, percent), source.Bounds); return source; } } diff --git a/src/ImageSharp.Drawing/DrawPath.cs b/src/ImageSharp.Drawing/DrawPath.cs index e91b97203..64f69c4db 100644 --- a/src/ImageSharp.Drawing/DrawPath.cs +++ b/src/ImageSharp.Drawing/DrawPath.cs @@ -13,35 +13,35 @@ namespace ImageSharp using Drawing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the outline of the region with the provided pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The path. /// The options. - /// The . - public static Image Draw(this Image source, IPen pen, Drawable path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IPen pen, Drawable path, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Apply(new DrawPathProcessor(pen, path, options)); + return source.Apply(new DrawPathProcessor(pen, path, options)); } /// /// Draws the outline of the polygon with the provided pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The path. - /// The . - public static Image Draw(this Image source, IPen pen, Drawable path) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IPen pen, Drawable path) + where TPixel : struct, IPixel { return source.Draw(pen, path, GraphicsOptions.Default); } @@ -49,63 +49,63 @@ namespace ImageSharp /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The path. /// The options. - /// The . - public static Image Draw(this Image source, IBrush brush, float thickness, Drawable path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IBrush brush, float thickness, Drawable path, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), path, options); + return source.Draw(new Pen(brush, thickness), path, options); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The path. - /// The . - public static Image Draw(this Image source, IBrush brush, float thickness, Drawable path) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IBrush brush, float thickness, Drawable path) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), path); + return source.Draw(new Pen(brush, thickness), path); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The path. /// The options. - /// The . - public static Image Draw(this Image source, TColor color, float thickness, Drawable path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, TPixel color, float thickness, Drawable path, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new SolidBrush(color), thickness, path, options); + return source.Draw(new SolidBrush(color), thickness, path, options); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The path. - /// The . - public static Image Draw(this Image source, TColor color, float thickness, Drawable path) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, TPixel color, float thickness, Drawable path) + where TPixel : struct, IPixel { - return source.Draw(new SolidBrush(color), thickness, path); + return source.Draw(new SolidBrush(color), thickness, path); } } } diff --git a/src/ImageSharp.Drawing/FillRegion.cs b/src/ImageSharp.Drawing/FillRegion.cs index 8aab20251..fda5c2c26 100644 --- a/src/ImageSharp.Drawing/FillRegion.cs +++ b/src/ImageSharp.Drawing/FillRegion.cs @@ -12,61 +12,61 @@ namespace ImageSharp using Drawing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flood fills the image with the specified brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The details how to fill the region of interest. - /// The . - public static Image Fill(this Image source, IBrush brush) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush) + where TPixel : struct, IPixel { - return source.Apply(new FillProcessor(brush)); + return source.Apply(new FillProcessor(brush)); } /// /// Flood fills the image with the specified color. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. - /// The . - public static Image Fill(this Image source, TColor color) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color)); + return source.Fill(new SolidBrush(color)); } /// /// Flood fills the image with in the region with the specified brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The region. /// The graphics options. - /// The . - public static Image Fill(this Image source, IBrush brush, Region region, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush, Region region, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Apply(new FillRegionProcessor(brush, region, options)); + return source.Apply(new FillRegionProcessor(brush, region, options)); } /// /// Flood fills the image with in the region with the specified brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The region. - /// The . - public static Image Fill(this Image source, IBrush brush, Region region) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush, Region region) + where TPixel : struct, IPixel { return source.Fill(brush, region, GraphicsOptions.Default); } @@ -74,30 +74,30 @@ namespace ImageSharp /// /// Flood fills the image with in the region with the specified color. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The region. /// The options. - /// The . - public static Image Fill(this Image source, TColor color, Region region, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color, Region region, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), region, options); + return source.Fill(new SolidBrush(color), region, options); } /// /// Flood fills the image with in the region with the specified color. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The region. - /// The . - public static Image Fill(this Image source, TColor color, Region region) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color, Region region) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), region); + return source.Fill(new SolidBrush(color), region); } } } diff --git a/src/ImageSharp.Drawing/Paths/DrawBeziers.cs b/src/ImageSharp.Drawing/Paths/DrawBeziers.cs index 936d5a9ce..af96ef50e 100644 --- a/src/ImageSharp.Drawing/Paths/DrawBeziers.cs +++ b/src/ImageSharp.Drawing/Paths/DrawBeziers.cs @@ -14,83 +14,83 @@ namespace ImageSharp using SixLabors.Shapes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. /// The options. - /// The . - public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), new Path(new BezierLineSegment(points)), options); + return source.Draw(new Pen(brush, thickness), new Path(new BezierLineSegment(points)), options); } /// /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. - /// The . - public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawBeziers(this Image source, IBrush brush, float thickness, Vector2[] points) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), new Path(new BezierLineSegment(points))); + return source.Draw(new Pen(brush, thickness), new Path(new BezierLineSegment(points))); } /// /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. - /// The . - public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawBeziers(this Image source, TPixel color, float thickness, Vector2[] points) + where TPixel : struct, IPixel { - return source.DrawBeziers(new SolidBrush(color), thickness, points); + return source.DrawBeziers(new SolidBrush(color), thickness, points); } /// /// Draws the provided Points as an open Bezier path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. /// The options. - /// The . - public static Image DrawBeziers(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawBeziers(this Image source, TPixel color, float thickness, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.DrawBeziers(new SolidBrush(color), thickness, points, options); + return source.DrawBeziers(new SolidBrush(color), thickness, points, options); } /// /// Draws the provided Points as an open Bezier path with the supplied pen /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The points. /// The options. - /// The . - public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Draw(pen, new Path(new BezierLineSegment(points)), options); } @@ -98,13 +98,13 @@ namespace ImageSharp /// /// Draws the provided Points as an open Bezier path with the supplied pen /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The points. - /// The . - public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawBeziers(this Image source, IPen pen, Vector2[] points) + where TPixel : struct, IPixel { return source.Draw(pen, new Path(new BezierLineSegment(points))); } diff --git a/src/ImageSharp.Drawing/Paths/DrawLines.cs b/src/ImageSharp.Drawing/Paths/DrawLines.cs index 42f4406e8..c0c49a77a 100644 --- a/src/ImageSharp.Drawing/Paths/DrawLines.cs +++ b/src/ImageSharp.Drawing/Paths/DrawLines.cs @@ -14,83 +14,83 @@ namespace ImageSharp using SixLabors.Shapes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. /// The options. - /// The . - public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options); + return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points)), options); } /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. - /// The . - public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawLines(this Image source, IBrush brush, float thickness, Vector2[] points) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points))); + return source.Draw(new Pen(brush, thickness), new Path(new LinearLineSegment(points))); } /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. - /// The . - public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawLines(this Image source, TPixel color, float thickness, Vector2[] points) + where TPixel : struct, IPixel { - return source.DrawLines(new SolidBrush(color), thickness, points); + return source.DrawLines(new SolidBrush(color), thickness, points); } /// /// Draws the provided Points as an open Linear path at the provided thickness with the supplied brush /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. /// The options. - /// The .> - public static Image DrawLines(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The .> + public static Image DrawLines(this Image source, TPixel color, float thickness, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.DrawLines(new SolidBrush(color), thickness, points, options); + return source.DrawLines(new SolidBrush(color), thickness, points, options); } /// /// Draws the provided Points as an open Linear path with the supplied pen /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The points. /// The options. - /// The . - public static Image DrawLines(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawLines(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points)), options); } @@ -98,13 +98,13 @@ namespace ImageSharp /// /// Draws the provided Points as an open Linear path with the supplied pen /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The points. - /// The . - public static Image DrawLines(this Image source, IPen pen, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawLines(this Image source, IPen pen, Vector2[] points) + where TPixel : struct, IPixel { return source.Draw(pen, new Path(new LinearLineSegment(points))); } diff --git a/src/ImageSharp.Drawing/Paths/DrawPath.cs b/src/ImageSharp.Drawing/Paths/DrawPath.cs index e2c1442de..f25c15336 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPath.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPath.cs @@ -14,21 +14,21 @@ namespace ImageSharp using SixLabors.Shapes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the outline of the polygon with the provided pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The path. /// The options. - /// The . - public static Image Draw(this Image source, IPen pen, IPath path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IPen pen, IPath path, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Draw(pen, new ShapePath(path), options); } @@ -36,13 +36,13 @@ namespace ImageSharp /// /// Draws the outline of the polygon with the provided pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The path. - /// The . - public static Image Draw(this Image source, IPen pen, IPath path) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IPen pen, IPath path) + where TPixel : struct, IPixel { return source.Draw(pen, path, GraphicsOptions.Default); } @@ -50,63 +50,63 @@ namespace ImageSharp /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The shape. /// The options. - /// The . - public static Image Draw(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IBrush brush, float thickness, IPath path, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), path, options); + return source.Draw(new Pen(brush, thickness), path, options); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The path. - /// The . - public static Image Draw(this Image source, IBrush brush, float thickness, IPath path) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IBrush brush, float thickness, IPath path) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), path); + return source.Draw(new Pen(brush, thickness), path); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The path. /// The options. - /// The . - public static Image Draw(this Image source, TColor color, float thickness, IPath path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, TPixel color, float thickness, IPath path, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new SolidBrush(color), thickness, path, options); + return source.Draw(new SolidBrush(color), thickness, path, options); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The path. - /// The . - public static Image Draw(this Image source, TColor color, float thickness, IPath path) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, TPixel color, float thickness, IPath path) + where TPixel : struct, IPixel { - return source.Draw(new SolidBrush(color), thickness, path); + return source.Draw(new SolidBrush(color), thickness, path); } } } diff --git a/src/ImageSharp.Drawing/Paths/DrawPolygon.cs b/src/ImageSharp.Drawing/Paths/DrawPolygon.cs index 8043d18e5..5f62759ce 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPolygon.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPolygon.cs @@ -14,82 +14,82 @@ namespace ImageSharp using SixLabors.Shapes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. /// The options. - /// The . - public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options); + return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points)), options); } /// /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The points. - /// The . - public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawPolygon(this Image source, IBrush brush, float thickness, Vector2[] points) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points))); + return source.Draw(new Pen(brush, thickness), new Polygon(new LinearLineSegment(points))); } /// /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. - /// The . - public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawPolygon(this Image source, TPixel color, float thickness, Vector2[] points) + where TPixel : struct, IPixel { - return source.DrawPolygon(new SolidBrush(color), thickness, points); + return source.DrawPolygon(new SolidBrush(color), thickness, points); } /// /// Draws the provided Points as a closed Linear Polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The points. /// The options. - /// The . - public static Image DrawPolygon(this Image source, TColor color, float thickness, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawPolygon(this Image source, TPixel color, float thickness, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.DrawPolygon(new SolidBrush(color), thickness, points, options); + return source.DrawPolygon(new SolidBrush(color), thickness, points, options); } /// /// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The points. - /// The . - public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points) + where TPixel : struct, IPixel { return source.Draw(pen, new Polygon(new LinearLineSegment(points)), GraphicsOptions.Default); } @@ -97,14 +97,14 @@ namespace ImageSharp /// /// Draws the provided Points as a closed Linear Polygon with the provided Pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The points. /// The options. - /// The . - public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image DrawPolygon(this Image source, IPen pen, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Draw(pen, new Polygon(new LinearLineSegment(points)), options); } diff --git a/src/ImageSharp.Drawing/Paths/DrawRectangle.cs b/src/ImageSharp.Drawing/Paths/DrawRectangle.cs index b35665240..5514217ff 100644 --- a/src/ImageSharp.Drawing/Paths/DrawRectangle.cs +++ b/src/ImageSharp.Drawing/Paths/DrawRectangle.cs @@ -12,21 +12,21 @@ namespace ImageSharp using Drawing.Pens; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Draws the outline of the polygon with the provided pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The shape. /// The options. - /// The . - public static Image Draw(this Image source, IPen pen, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IPen pen, Rectangle shape, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Draw(pen, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options); } @@ -34,13 +34,13 @@ namespace ImageSharp /// /// Draws the outline of the polygon with the provided pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The pen. /// The shape. - /// The . - public static Image Draw(this Image source, IPen pen, Rectangle shape) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IPen pen, Rectangle shape) + where TPixel : struct, IPixel { return source.Draw(pen, shape, GraphicsOptions.Default); } @@ -48,63 +48,63 @@ namespace ImageSharp /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The shape. /// The options. - /// The . - public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), shape, options); + return source.Draw(new Pen(brush, thickness), shape, options); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The thickness. /// The shape. - /// The . - public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, IBrush brush, float thickness, Rectangle shape) + where TPixel : struct, IPixel { - return source.Draw(new Pen(brush, thickness), shape); + return source.Draw(new Pen(brush, thickness), shape); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The shape. /// The options. - /// The . - public static Image Draw(this Image source, TColor color, float thickness, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, TPixel color, float thickness, Rectangle shape, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Draw(new SolidBrush(color), thickness, shape, options); + return source.Draw(new SolidBrush(color), thickness, shape, options); } /// /// Draws the outline of the polygon with the provided brush at the provided thickness. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The thickness. /// The shape. - /// The . - public static Image Draw(this Image source, TColor color, float thickness, Rectangle shape) - where TColor : struct, IPixel + /// The . + public static Image Draw(this Image source, TPixel color, float thickness, Rectangle shape) + where TPixel : struct, IPixel { - return source.Draw(new SolidBrush(color), thickness, shape); + return source.Draw(new SolidBrush(color), thickness, shape); } } } diff --git a/src/ImageSharp.Drawing/Paths/FillPaths.cs b/src/ImageSharp.Drawing/Paths/FillPaths.cs index 92e227ce1..b4d0b14cb 100644 --- a/src/ImageSharp.Drawing/Paths/FillPaths.cs +++ b/src/ImageSharp.Drawing/Paths/FillPaths.cs @@ -13,21 +13,21 @@ namespace ImageSharp using SixLabors.Shapes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The shape. /// The graphics options. - /// The . - public static Image Fill(this Image source, IBrush brush, IPath path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush, IPath path, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), options); } @@ -35,13 +35,13 @@ namespace ImageSharp /// /// Flood fills the image in the shape of the provided polygon with the specified brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The path. - /// The . - public static Image Fill(this Image source, IBrush brush, IPath path) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush, IPath path) + where TPixel : struct, IPixel { return source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default); } @@ -49,30 +49,30 @@ namespace ImageSharp /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The path. /// The options. - /// The . - public static Image Fill(this Image source, TColor color, IPath path, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color, IPath path, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), path, options); + return source.Fill(new SolidBrush(color), path, options); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The path. - /// The . - public static Image Fill(this Image source, TColor color, IPath path) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color, IPath path) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), path); + return source.Fill(new SolidBrush(color), path); } } } diff --git a/src/ImageSharp.Drawing/Paths/FillPolygon.cs b/src/ImageSharp.Drawing/Paths/FillPolygon.cs index cd3d15466..dfc56c5d2 100644 --- a/src/ImageSharp.Drawing/Paths/FillPolygon.cs +++ b/src/ImageSharp.Drawing/Paths/FillPolygon.cs @@ -13,21 +13,21 @@ namespace ImageSharp using SixLabors.Shapes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flood fills the image in the shape of a Linear polygon described by the points /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The points. /// The options. - /// The . - public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points)), options); } @@ -35,13 +35,13 @@ namespace ImageSharp /// /// Flood fills the image in the shape of a Linear polygon described by the points /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The points. - /// The . - public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image FillPolygon(this Image source, IBrush brush, Vector2[] points) + where TPixel : struct, IPixel { return source.Fill(brush, new Polygon(new LinearLineSegment(points))); } @@ -49,30 +49,30 @@ namespace ImageSharp /// /// Flood fills the image in the shape of a Linear polygon described by the points /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The points. /// The options. - /// The . - public static Image FillPolygon(this Image source, TColor color, Vector2[] points, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image FillPolygon(this Image source, TPixel color, Vector2[] points, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); + return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points)), options); } /// /// Flood fills the image in the shape of a Linear polygon described by the points /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The points. - /// The . - public static Image FillPolygon(this Image source, TColor color, Vector2[] points) - where TColor : struct, IPixel + /// The . + public static Image FillPolygon(this Image source, TPixel color, Vector2[] points) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); + return source.Fill(new SolidBrush(color), new Polygon(new LinearLineSegment(points))); } } } diff --git a/src/ImageSharp.Drawing/Paths/FillRectangle.cs b/src/ImageSharp.Drawing/Paths/FillRectangle.cs index 1928e54d3..b20cb8971 100644 --- a/src/ImageSharp.Drawing/Paths/FillRectangle.cs +++ b/src/ImageSharp.Drawing/Paths/FillRectangle.cs @@ -11,21 +11,21 @@ namespace ImageSharp using Drawing.Brushes; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The shape. /// The options. - /// The . - public static Image Fill(this Image source, IBrush brush, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush, Rectangle shape, GraphicsOptions options) + where TPixel : struct, IPixel { return source.Fill(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height), options); } @@ -33,13 +33,13 @@ namespace ImageSharp /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The brush. /// The shape. - /// The . - public static Image Fill(this Image source, IBrush brush, Rectangle shape) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, IBrush brush, Rectangle shape) + where TPixel : struct, IPixel { return source.Fill(brush, new SixLabors.Shapes.Rectangle(shape.X, shape.Y, shape.Width, shape.Height)); } @@ -47,30 +47,30 @@ namespace ImageSharp /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The shape. /// The options. - /// The . - public static Image Fill(this Image source, TColor color, Rectangle shape, GraphicsOptions options) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color, Rectangle shape, GraphicsOptions options) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), shape, options); + return source.Fill(new SolidBrush(color), shape, options); } /// /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The color. /// The shape. - /// The . - public static Image Fill(this Image source, TColor color, Rectangle shape) - where TColor : struct, IPixel + /// The . + public static Image Fill(this Image source, TPixel color, Rectangle shape) + where TPixel : struct, IPixel { - return source.Fill(new SolidBrush(color), shape); + return source.Fill(new SolidBrush(color), shape); } } } diff --git a/src/ImageSharp.Drawing/Pens/IPen.cs b/src/ImageSharp.Drawing/Pens/IPen.cs index 72a5ffc36..573a126de 100644 --- a/src/ImageSharp.Drawing/Pens/IPen.cs +++ b/src/ImageSharp.Drawing/Pens/IPen.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Drawing.Pens /// /// Interface representing a Pen /// - /// The type of the color. - public interface IPen - where TColor : struct, IPixel + /// The type of the color. + public interface IPen + where TPixel : struct, IPixel { /// /// Creates the applicator for applying this pen to an Image @@ -26,6 +26,6 @@ namespace ImageSharp.Drawing.Pens /// /// The when being applied to things like shapes would usually be the bounding box of the shape not necessarily the shape of the whole image. /// - PenApplicator CreateApplicator(PixelAccessor pixelSource, RectangleF region); + PenApplicator CreateApplicator(PixelAccessor pixelSource, RectangleF region); } } diff --git a/src/ImageSharp.Drawing/Pens/Pen.cs b/src/ImageSharp.Drawing/Pens/Pen.cs index 991ee14de..c3a530964 100644 --- a/src/ImageSharp.Drawing/Pens/Pen.cs +++ b/src/ImageSharp.Drawing/Pens/Pen.cs @@ -6,7 +6,7 @@ namespace ImageSharp.Drawing.Pens { /// - /// Represents a in the color space. + /// Represents a in the color space. /// public class Pen : Pen { diff --git a/src/ImageSharp.Drawing/Pens/Pens{TColor}.cs b/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs similarity index 68% rename from src/ImageSharp.Drawing/Pens/Pens{TColor}.cs rename to src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs index 49eed370d..096262f44 100644 --- a/src/ImageSharp.Drawing/Pens/Pens{TColor}.cs +++ b/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs @@ -1,18 +1,16 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // namespace ImageSharp.Drawing.Pens { - using System; - /// /// Common Pen styles /// - /// The type of the color. - public class Pens - where TColor : struct, IPixel + /// The type of the color. + public class Pens + where TPixel : struct, IPixel { private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f }; private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f }; @@ -25,8 +23,8 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen Solid(TColor color, float width) - => new Pen(color, width); + public static Pen Solid(TPixel color, float width) + => new Pen(color, width); /// /// Create a solid pen with out any drawing patterns @@ -34,8 +32,8 @@ 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 @@ -43,8 +41,8 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen Dash(TColor color, float width) - => new Pen(color, width, DashedPattern); + public static Pen Dash(TPixel color, float width) + => new Pen(color, width, DashedPattern); /// /// Create a pen with a 'Dash' drawing patterns @@ -52,8 +50,8 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen Dash(IBrush brush, float width) - => new Pen(brush, width, DashedPattern); + public static Pen Dash(IBrush brush, float width) + => new Pen(brush, width, DashedPattern); /// /// Create a pen with a 'Dot' drawing patterns @@ -61,8 +59,8 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen Dot(TColor color, float width) - => new Pen(color, width, DottedPattern); + public static Pen Dot(TPixel color, float width) + => new Pen(color, width, DottedPattern); /// /// Create a pen with a 'Dot' drawing patterns @@ -70,8 +68,8 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen Dot(IBrush brush, float width) - => new Pen(brush, width, DottedPattern); + public static Pen Dot(IBrush brush, float width) + => new Pen(brush, width, DottedPattern); /// /// Create a pen with a 'Dash Dot' drawing patterns @@ -79,8 +77,8 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen DashDot(TColor color, float width) - => new Pen(color, width, DashDotPattern); + public static Pen DashDot(TPixel color, float width) + => new Pen(color, width, DashDotPattern); /// /// Create a pen with a 'Dash Dot' drawing patterns @@ -88,8 +86,8 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen DashDot(IBrush brush, float width) - => new Pen(brush, width, DashDotPattern); + public static Pen DashDot(IBrush brush, float width) + => new Pen(brush, width, DashDotPattern); /// /// Create a pen with a 'Dash Dot Dot' drawing patterns @@ -97,8 +95,8 @@ namespace ImageSharp.Drawing.Pens /// The color. /// The width. /// The Pen - public static Pen DashDotDot(TColor color, float width) - => new Pen(color, width, DashDotDotPattern); + public static Pen DashDotDot(TPixel color, float width) + => new Pen(color, width, DashDotDotPattern); /// /// Create a pen with a 'Dash Dot Dot' drawing patterns @@ -106,7 +104,7 @@ namespace ImageSharp.Drawing.Pens /// The brush. /// The width. /// The Pen - public static Pen DashDotDot(IBrush brush, float width) - => new Pen(brush, width, DashDotDotPattern); + public static Pen DashDotDot(IBrush brush, float width) + => new Pen(brush, width, DashDotDotPattern); } } \ No newline at end of file diff --git a/src/ImageSharp.Drawing/Pens/Pen{TColor}.cs b/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs similarity index 81% rename from src/ImageSharp.Drawing/Pens/Pen{TColor}.cs rename to src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs index e3716124e..05af44ca3 100644 --- a/src/ImageSharp.Drawing/Pens/Pen{TColor}.cs +++ b/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -14,7 +14,7 @@ namespace ImageSharp.Drawing.Pens /// /// Provides a pen that can apply a pattern to a line with a set brush and thickness /// - /// The type of the color. + /// The type of the color. /// /// The pattern will be in to the form of new float[]{ 1f, 2f, 0.5f} this will be /// converted into a pattern that is 3.5 times longer that the width with 3 sections @@ -23,30 +23,30 @@ namespace ImageSharp.Drawing.Pens /// section 3 will be width/2 long and will be filled /// the the pattern will imidiatly repeat without gap. /// - public class Pen : IPen - where TColor : struct, IPixel + public class Pen : IPen + where TPixel : struct, IPixel { private static readonly float[] EmptyPattern = new float[0]; private readonly float[] pattern; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color. /// The width. /// The pattern. - public Pen(TColor color, float width, float[] pattern) - : this(new SolidBrush(color), width, pattern) + public Pen(TPixel color, float width, float[] pattern) + : this(new SolidBrush(color), width, pattern) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The brush. /// The width. /// The pattern. - public Pen(IBrush brush, float width, float[] pattern) + public Pen(IBrush brush, float width, float[] pattern) { this.Brush = brush; this.Width = width; @@ -54,30 +54,30 @@ namespace ImageSharp.Drawing.Pens } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color. /// The width. - public Pen(TColor color, float width) - : this(new SolidBrush(color), width) + public Pen(TPixel color, float width) + : this(new SolidBrush(color), width) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The brush. /// The width. - public Pen(IBrush brush, float width) + public Pen(IBrush brush, float width) : this(brush, width, EmptyPattern) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The pen. - internal Pen(Pen pen) + internal Pen(Pen pen) : this(pen.Brush, pen.Width, pen.pattern) { } @@ -88,7 +88,7 @@ namespace ImageSharp.Drawing.Pens /// /// The brush. /// - public IBrush Brush { get; } + public IBrush Brush { get; } /// /// Gets the width. @@ -110,7 +110,7 @@ namespace ImageSharp.Drawing.Pens /// The when being applied to things like shapes would ussually be the /// bounding box of the shape not necorserrally the shape of the whole image /// - public PenApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) + public PenApplicator CreateApplicator(PixelAccessor sourcePixels, RectangleF region) { if (this.pattern == null || this.pattern.Length < 2) { @@ -122,12 +122,12 @@ namespace ImageSharp.Drawing.Pens return new PatternPenApplicator(sourcePixels, this.Brush, region, this.Width, this.pattern); } - private class SolidPenApplicator : PenApplicator + private class SolidPenApplicator : PenApplicator { - private readonly BrushApplicator brush; + private readonly BrushApplicator brush; private readonly float halfWidth; - public SolidPenApplicator(PixelAccessor sourcePixels, IBrush brush, RectangleF region, float width) + public SolidPenApplicator(PixelAccessor sourcePixels, IBrush brush, RectangleF region, float width) { this.brush = brush.CreateApplicator(sourcePixels, region); this.halfWidth = width / 2; @@ -144,9 +144,9 @@ namespace ImageSharp.Drawing.Pens this.brush.Dispose(); } - public override ColoredPointInfo GetColor(int x, int y, PointInfo info) + public override ColoredPointInfo GetColor(int x, int y, PointInfo info) { - ColoredPointInfo result = default(ColoredPointInfo); + ColoredPointInfo result = default(ColoredPointInfo); result.Color = this.brush[x, y]; if (info.DistanceFromPath < this.halfWidth) @@ -163,14 +163,14 @@ namespace ImageSharp.Drawing.Pens } } - private class PatternPenApplicator : PenApplicator + private class PatternPenApplicator : PenApplicator { - private readonly BrushApplicator brush; + private readonly BrushApplicator brush; private readonly float halfWidth; private readonly float[] pattern; private readonly float totalLength; - public PatternPenApplicator(PixelAccessor sourcePixels, IBrush brush, RectangleF region, float width, float[] pattern) + public PatternPenApplicator(PixelAccessor sourcePixels, IBrush brush, RectangleF region, float width, float[] pattern) { this.brush = brush.CreateApplicator(sourcePixels, region); this.halfWidth = width / 2; @@ -197,16 +197,16 @@ namespace ImageSharp.Drawing.Pens this.brush.Dispose(); } - public override ColoredPointInfo GetColor(int x, int y, PointInfo info) + public override ColoredPointInfo GetColor(int x, int y, PointInfo info) { - ColoredPointInfo infoResult = default(ColoredPointInfo); + ColoredPointInfo infoResult = default(ColoredPointInfo); infoResult.DistanceFromElement = float.MaxValue; // is really outside the element float length = info.DistanceAlongPath % this.totalLength; // we can treat the DistanceAlongPath and DistanceFromPath as x,y coords for the pattern // we need to calcualte the distance from the outside edge of the pattern - // and set them on the ColoredPointInfo along with the color. + // and set them on the ColoredPointInfo along with the color. infoResult.Color = this.brush[x, y]; float distanceWAway = 0; diff --git a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs index d042bdccb..edee5bb19 100644 --- a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs +++ b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Drawing.Processors /// /// Returns details about how far away from the inside of a shape and the color the pixel could be. /// - /// The type of the color. - public struct ColoredPointInfo - where TColor : struct, IPixel + /// The type of the color. + public struct ColoredPointInfo + where TPixel : struct, IPixel { /// /// The color /// - public TColor Color; + public TPixel Color; /// /// The distance from element diff --git a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs index 8cdb04b45..7e9671cac 100644 --- a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs +++ b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Drawing.Processors /// /// primitive that converts a into a color and a distance away from the drawable part of the path. /// - /// The type of the color. - public abstract class PenApplicator : IDisposable - where TColor : struct, IPixel + /// The type of the color. + public abstract class PenApplicator : IDisposable + where TPixel : struct, IPixel { /// /// Gets the required region. @@ -27,7 +27,7 @@ namespace ImageSharp.Drawing.Processors public abstract void Dispose(); /// - /// Gets a from a point represented by a . + /// Gets a from a point represented by a . /// /// The x. /// The y. @@ -35,6 +35,6 @@ namespace ImageSharp.Drawing.Processors /// /// Returns the color details and distance from a solid bit of the line. /// - public abstract ColoredPointInfo GetColor(int x, int y, PointInfo info); + public abstract ColoredPointInfo GetColor(int x, int y, PointInfo info); } } diff --git a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs index c67ba0370..9bb452f19 100644 --- a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs @@ -14,18 +14,18 @@ namespace ImageSharp.Drawing.Processors /// /// Combines two images together by blending the pixels. /// - /// The pixel format. - internal class DrawImageProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class DrawImageProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The image to blend with the currently processing image. /// The size to draw the blended image. /// The location to draw the blended image. /// The opacity of the image to blend. Between 0 and 100. - public DrawImageProcessor(Image image, Size size, Point location, int alpha = 100) + public DrawImageProcessor(Image image, Size size, Point location, int alpha = 100) { Guard.MustBeBetweenOrEqualTo(alpha, 0, 100, nameof(alpha)); this.Image = image; @@ -37,7 +37,7 @@ namespace ImageSharp.Drawing.Processors /// /// Gets the image to blend. /// - public Image Image { get; private set; } + public Image Image { get; private set; } /// /// Gets the alpha percentage value. @@ -55,7 +55,7 @@ namespace ImageSharp.Drawing.Processors public Point Location { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { if (this.Image.Bounds.Size != this.Size) { @@ -72,8 +72,8 @@ namespace ImageSharp.Drawing.Processors float alpha = this.Alpha / 100F; - using (PixelAccessor toBlendPixels = this.Image.Lock()) - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor toBlendPixels = this.Image.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -89,7 +89,7 @@ namespace ImageSharp.Drawing.Processors // Lerping colors is dependent on the alpha of the blended color backgroundVector = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, alpha); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(backgroundVector); sourcePixels[x, y] = packed; } diff --git a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs index 89ba0968b..32e44bce9 100644 --- a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs @@ -15,21 +15,21 @@ namespace ImageSharp.Drawing.Processors /// /// Draws a path using the processor pipeline /// - /// The type of the color. - /// - internal class DrawPathProcessor : ImageProcessor - where TColor : struct, IPixel + /// The type of the color. + /// + internal class DrawPathProcessor : ImageProcessor + where TPixel : struct, IPixel { private const float AntialiasFactor = 1f; private const int PaddingFactor = 1; // needs to been the same or greater than AntialiasFactor /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The details how to draw the outline/path. /// The details of the paths and outlines to draw. /// The drawing configuration options. - public DrawPathProcessor(IPen pen, Drawable drawable, GraphicsOptions options) + public DrawPathProcessor(IPen pen, Drawable drawable, GraphicsOptions options) { this.Path = drawable; this.Pen = pen; @@ -44,7 +44,7 @@ namespace ImageSharp.Drawing.Processors /// /// Gets the pen. /// - public IPen Pen { get; } + public IPen Pen { get; } /// /// Gets the path. @@ -52,10 +52,10 @@ namespace ImageSharp.Drawing.Processors public Drawable Path { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - using (PixelAccessor sourcePixels = source.Lock()) - using (PenApplicator applicator = this.Pen.CreateApplicator(sourcePixels, this.Path.Bounds)) + using (PixelAccessor sourcePixels = source.Lock()) + using (PenApplicator applicator = this.Pen.CreateApplicator(sourcePixels, this.Path.Bounds)) { Rectangle rect = RectangleF.Ceiling(applicator.RequiredRegion); @@ -100,7 +100,7 @@ namespace ImageSharp.Drawing.Processors int offsetX = x - startX; PointInfo info = this.Path.GetPointInfo(offsetX, offsetY); - ColoredPointInfo color = applicator.GetColor(offsetX, offsetY, info); + ColoredPointInfo color = applicator.GetColor(offsetX, offsetY, info); float opacity = this.Opacity(color.DistanceFromElement); @@ -111,7 +111,7 @@ namespace ImageSharp.Drawing.Processors Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp.Drawing/Processors/FillProcessor.cs b/src/ImageSharp.Drawing/Processors/FillProcessor.cs index 635829e9f..d0ad0cc1d 100644 --- a/src/ImageSharp.Drawing/Processors/FillProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillProcessor.cs @@ -15,26 +15,26 @@ namespace ImageSharp.Drawing.Processors /// /// Using the bursh as a source of pixels colors blends the brush color with source. /// - /// The pixel format. - internal class FillProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class FillProcessor : ImageProcessor + where TPixel : struct, IPixel { /// /// The brush. /// - private readonly IBrush brush; + private readonly IBrush brush; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The brush to source pixel colors from. - public FillProcessor(IBrush brush) + public FillProcessor(IBrush brush) { this.brush = brush; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startX = sourceRectangle.X; int endX = sourceRectangle.Right; @@ -59,10 +59,10 @@ namespace ImageSharp.Drawing.Processors } // we could possibly do some optermising by having knowledge about the individual brushes operate - // for example If brush is SolidBrush then we could just get the color upfront - // and skip using the IBrushApplicator?. - using (PixelAccessor sourcePixels = source.Lock()) - using (BrushApplicator applicator = this.brush.CreateApplicator(sourcePixels, sourceRectangle)) + // for example If brush is SolidBrush then we could just get the color upfront + // and skip using the IBrushApplicator?. + using (PixelAccessor sourcePixels = source.Lock()) + using (BrushApplicator applicator = this.brush.CreateApplicator(sourcePixels, sourceRectangle)) { Parallel.For( minY, @@ -80,7 +80,7 @@ namespace ImageSharp.Drawing.Processors Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, 1); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(finalColor); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs index 80a3e6793..88830f094 100644 --- a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs @@ -15,21 +15,21 @@ namespace ImageSharp.Drawing.Processors /// /// Usinf a brsuh and a shape fills shape with contents of brush the /// - /// The type of the color. - /// - internal class FillRegionProcessor : ImageProcessor - where TColor : struct, IPixel + /// The type of the color. + /// + internal class FillRegionProcessor : ImageProcessor + where TPixel : struct, IPixel { private const float AntialiasFactor = 1f; private const int DrawPadding = 1; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The details how to fill the region of interest. /// The region of interest to be filled. /// The configuration options. - public FillRegionProcessor(IBrush brush, Region region, GraphicsOptions options) + public FillRegionProcessor(IBrush brush, Region region, GraphicsOptions options) { this.Region = region; this.Brush = brush; @@ -39,7 +39,7 @@ namespace ImageSharp.Drawing.Processors /// /// Gets the brush. /// - public IBrush Brush { get; } + public IBrush Brush { get; } /// /// Gets the region that this processor applies to. @@ -55,7 +55,7 @@ namespace ImageSharp.Drawing.Processors public GraphicsOptions Options { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { Region region = this.Region; Rectangle rect = region.Bounds; @@ -88,8 +88,8 @@ namespace ImageSharp.Drawing.Processors } } - using (PixelAccessor sourcePixels = source.Lock()) - using (BrushApplicator applicator = this.Brush.CreateApplicator(sourcePixels, rect)) + using (PixelAccessor sourcePixels = source.Lock()) + using (BrushApplicator applicator = this.Brush.CreateApplicator(sourcePixels, rect)) { float[] buffer = arrayPool.Rent(maxIntersections); int scanlineWidth = maxX - minX; diff --git a/src/ImageSharp.Drawing/Text/DrawText.cs b/src/ImageSharp.Drawing/Text/DrawText.cs index eba11b5c5..93486e2bb 100644 --- a/src/ImageSharp.Drawing/Text/DrawText.cs +++ b/src/ImageSharp.Drawing/Text/DrawText.cs @@ -14,7 +14,7 @@ namespace ImageSharp using SixLabors.Fonts; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { @@ -23,17 +23,17 @@ namespace ImageSharp /// /// Draws the text onto the the image filled via the brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. /// The color. /// The location. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, TColor color, Vector2 location) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, TPixel color, Vector2 location) + where TPixel : struct, IPixel { return source.DrawText(text, font, color, location, TextGraphicsOptions.Default); } @@ -41,7 +41,7 @@ namespace ImageSharp /// /// Draws the text onto the the image filled via the brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. @@ -49,28 +49,28 @@ namespace ImageSharp /// The location. /// The options. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, TColor color, Vector2 location, TextGraphicsOptions options) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, TPixel color, Vector2 location, TextGraphicsOptions options) + where TPixel : struct, IPixel { - return source.DrawText(text, font, Brushes.Solid(color), null, location, options); + return source.DrawText(text, font, Brushes.Solid(color), null, location, options); } /// /// Draws the text onto the the image filled via the brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. /// The brush. /// The location. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, IBrush brush, Vector2 location) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, IBrush brush, Vector2 location) + where TPixel : struct, IPixel { return source.DrawText(text, font, brush, location, TextGraphicsOptions.Default); } @@ -78,7 +78,7 @@ namespace ImageSharp /// /// Draws the text onto the the image filled via the brush. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. @@ -86,10 +86,10 @@ namespace ImageSharp /// The location. /// The options. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, IBrush brush, Vector2 location, TextGraphicsOptions options) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, IBrush brush, Vector2 location, TextGraphicsOptions options) + where TPixel : struct, IPixel { return source.DrawText(text, font, brush, null, location, options); } @@ -97,17 +97,17 @@ namespace ImageSharp /// /// Draws the text onto the the image outlined via the pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. /// The pen. /// The location. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, IPen pen, Vector2 location) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, IPen pen, Vector2 location) + where TPixel : struct, IPixel { return source.DrawText(text, font, pen, location, TextGraphicsOptions.Default); } @@ -115,7 +115,7 @@ namespace ImageSharp /// /// Draws the text onto the the image outlined via the pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. @@ -123,10 +123,10 @@ namespace ImageSharp /// The location. /// The options. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, IPen pen, Vector2 location, TextGraphicsOptions options) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, IPen pen, Vector2 location, TextGraphicsOptions options) + where TPixel : struct, IPixel { return source.DrawText(text, font, null, pen, location, options); } @@ -134,7 +134,7 @@ namespace ImageSharp /// /// Draws the text onto the the image filled via the brush then outlined via the pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. @@ -142,10 +142,10 @@ namespace ImageSharp /// The pen. /// The location. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, IBrush brush, IPen pen, Vector2 location) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, IBrush brush, IPen pen, Vector2 location) + where TPixel : struct, IPixel { return source.DrawText(text, font, brush, pen, location, TextGraphicsOptions.Default); } @@ -153,7 +153,7 @@ namespace ImageSharp /// /// Draws the text onto the the image filled via the brush then outlined via the pen. /// - /// The type of the color. + /// The type of the color. /// The image this method extends. /// The text. /// The font. @@ -162,10 +162,10 @@ namespace ImageSharp /// The location. /// The options. /// - /// The . + /// The . /// - public static Image DrawText(this Image source, string text, Font font, IBrush brush, IPen pen, Vector2 location, TextGraphicsOptions options) - where TColor : struct, IPixel + public static Image DrawText(this Image source, string text, Font font, IBrush brush, IPen pen, Vector2 location, TextGraphicsOptions options) + where TPixel : struct, IPixel { GlyphBuilder glyphBuilder = new GlyphBuilder(location); diff --git a/src/ImageSharp/Colors/ColorBuilder{TColor}.cs b/src/ImageSharp/Colors/ColorBuilder{TPixel}.cs similarity index 78% rename from src/ImageSharp/Colors/ColorBuilder{TColor}.cs rename to src/ImageSharp/Colors/ColorBuilder{TPixel}.cs index f60b5c8c0..3021cb39e 100644 --- a/src/ImageSharp/Colors/ColorBuilder{TColor}.cs +++ b/src/ImageSharp/Colors/ColorBuilder{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -11,19 +11,19 @@ namespace ImageSharp /// /// A set of named colors mapped to the provided Color space. /// - /// The type of the color. - public static class ColorBuilder - where TColor : struct, IPixel + /// The type of the color. + public static class ColorBuilder + where TPixel : struct, IPixel { /// - /// Creates a new representation from the string representing a color. + /// Creates a new representation from the string representing a color. /// /// /// The hexadecimal representation of the combined color components arranged /// in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax. /// - /// Returns a that represents the color defined by the provided RGBA heax string. - public static TColor FromHex(string hex) + /// Returns a that represents the color defined by the provided RGBA heax string. + public static TPixel FromHex(string hex) { Guard.NotNullOrEmpty(hex, nameof(hex)); @@ -34,7 +34,7 @@ namespace ImageSharp throw new ArgumentException("Hexadecimal string is not in the correct format.", nameof(hex)); } - TColor result = default(TColor); + TPixel result = default(TPixel); result.PackFromBytes( (byte)(packedValue >> 24), @@ -45,30 +45,30 @@ namespace ImageSharp } /// - /// Creates a new representation from standard RGB bytes with 100% opacity. + /// Creates a new representation from standard RGB bytes with 100% opacity. /// /// The red intensity. /// The green intensity. /// The blue intensity. - /// Returns a that represents the color defined by the provided RGB values with 100% opacity. - public static TColor FromRGB(byte red, byte green, byte blue) + /// Returns a that represents the color defined by the provided RGB values with 100% opacity. + public static TPixel FromRGB(byte red, byte green, byte blue) { - TColor color = default(TColor); + TPixel color = default(TPixel); color.PackFromBytes(red, green, blue, 255); return color; } /// - /// Creates a new representation from standard RGBA bytes. + /// Creates a new representation from standard RGBA bytes. /// /// The red intensity. /// The green intensity. /// The blue intensity. /// The alpha intensity. - /// Returns a that represents the color defined by the provided RGBA values. - public static TColor FromRGBA(byte red, byte green, byte blue, byte alpha) + /// Returns a that represents the color defined by the provided RGBA values. + public static TPixel FromRGBA(byte red, byte green, byte blue, byte alpha) { - TColor color = default(TColor); + TPixel color = default(TPixel); color.PackFromBytes(red, green, blue, alpha); return color; } diff --git a/src/ImageSharp/Colors/NamedColors{TColor}.cs b/src/ImageSharp/Colors/NamedColors{TColor}.cs deleted file mode 100644 index 274ab0562..000000000 --- a/src/ImageSharp/Colors/NamedColors{TColor}.cs +++ /dev/null @@ -1,725 +0,0 @@ -// -// Copyright (c) James Jackson-South and contributors. -// Licensed under the Apache License, Version 2.0. -// - -namespace ImageSharp -{ - /// - /// A set of named colors mapped to the provided color space. - /// - /// The type of the color. - public static class NamedColors - where TColor : struct, IPixel - { - /// - /// Represents a matching the W3C definition that has an hex value of #F0F8FF. - /// - public static readonly TColor AliceBlue = ColorBuilder.FromRGBA(240, 248, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FAEBD7. - /// - public static readonly TColor AntiqueWhite = ColorBuilder.FromRGBA(250, 235, 215, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00FFFF. - /// - public static readonly TColor Aqua = ColorBuilder.FromRGBA(0, 255, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #7FFFD4. - /// - public static readonly TColor Aquamarine = ColorBuilder.FromRGBA(127, 255, 212, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F0FFFF. - /// - public static readonly TColor Azure = ColorBuilder.FromRGBA(240, 255, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F5F5DC. - /// - public static readonly TColor Beige = ColorBuilder.FromRGBA(245, 245, 220, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4C4. - /// - public static readonly TColor Bisque = ColorBuilder.FromRGBA(255, 228, 196, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #000000. - /// - public static readonly TColor Black = ColorBuilder.FromRGBA(0, 0, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFEBCD. - /// - public static readonly TColor BlanchedAlmond = ColorBuilder.FromRGBA(255, 235, 205, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #0000FF. - /// - public static readonly TColor Blue = ColorBuilder.FromRGBA(0, 0, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #8A2BE2. - /// - public static readonly TColor BlueViolet = ColorBuilder.FromRGBA(138, 43, 226, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #A52A2A. - /// - public static readonly TColor Brown = ColorBuilder.FromRGBA(165, 42, 42, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DEB887. - /// - public static readonly TColor BurlyWood = ColorBuilder.FromRGBA(222, 184, 135, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #5F9EA0. - /// - public static readonly TColor CadetBlue = ColorBuilder.FromRGBA(95, 158, 160, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #7FFF00. - /// - public static readonly TColor Chartreuse = ColorBuilder.FromRGBA(127, 255, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #D2691E. - /// - public static readonly TColor Chocolate = ColorBuilder.FromRGBA(210, 105, 30, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF7F50. - /// - public static readonly TColor Coral = ColorBuilder.FromRGBA(255, 127, 80, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #6495ED. - /// - public static readonly TColor CornflowerBlue = ColorBuilder.FromRGBA(100, 149, 237, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF8DC. - /// - public static readonly TColor Cornsilk = ColorBuilder.FromRGBA(255, 248, 220, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DC143C. - /// - public static readonly TColor Crimson = ColorBuilder.FromRGBA(220, 20, 60, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00FFFF. - /// - public static readonly TColor Cyan = ColorBuilder.FromRGBA(0, 255, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00008B. - /// - public static readonly TColor DarkBlue = ColorBuilder.FromRGBA(0, 0, 139, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #008B8B. - /// - public static readonly TColor DarkCyan = ColorBuilder.FromRGBA(0, 139, 139, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #B8860B. - /// - public static readonly TColor DarkGoldenrod = ColorBuilder.FromRGBA(184, 134, 11, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #A9A9A9. - /// - public static readonly TColor DarkGray = ColorBuilder.FromRGBA(169, 169, 169, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #006400. - /// - public static readonly TColor DarkGreen = ColorBuilder.FromRGBA(0, 100, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #BDB76B. - /// - public static readonly TColor DarkKhaki = ColorBuilder.FromRGBA(189, 183, 107, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #8B008B. - /// - public static readonly TColor DarkMagenta = ColorBuilder.FromRGBA(139, 0, 139, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #556B2F. - /// - public static readonly TColor DarkOliveGreen = ColorBuilder.FromRGBA(85, 107, 47, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF8C00. - /// - public static readonly TColor DarkOrange = ColorBuilder.FromRGBA(255, 140, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #9932CC. - /// - public static readonly TColor DarkOrchid = ColorBuilder.FromRGBA(153, 50, 204, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #8B0000. - /// - public static readonly TColor DarkRed = ColorBuilder.FromRGBA(139, 0, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #E9967A. - /// - public static readonly TColor DarkSalmon = ColorBuilder.FromRGBA(233, 150, 122, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #8FBC8B. - /// - public static readonly TColor DarkSeaGreen = ColorBuilder.FromRGBA(143, 188, 139, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #483D8B. - /// - public static readonly TColor DarkSlateBlue = ColorBuilder.FromRGBA(72, 61, 139, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #2F4F4F. - /// - public static readonly TColor DarkSlateGray = ColorBuilder.FromRGBA(47, 79, 79, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00CED1. - /// - public static readonly TColor DarkTurquoise = ColorBuilder.FromRGBA(0, 206, 209, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #9400D3. - /// - public static readonly TColor DarkViolet = ColorBuilder.FromRGBA(148, 0, 211, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF1493. - /// - public static readonly TColor DeepPink = ColorBuilder.FromRGBA(255, 20, 147, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00BFFF. - /// - public static readonly TColor DeepSkyBlue = ColorBuilder.FromRGBA(0, 191, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #696969. - /// - public static readonly TColor DimGray = ColorBuilder.FromRGBA(105, 105, 105, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #1E90FF. - /// - public static readonly TColor DodgerBlue = ColorBuilder.FromRGBA(30, 144, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #B22222. - /// - public static readonly TColor Firebrick = ColorBuilder.FromRGBA(178, 34, 34, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFAF0. - /// - public static readonly TColor FloralWhite = ColorBuilder.FromRGBA(255, 250, 240, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #228B22. - /// - public static readonly TColor ForestGreen = ColorBuilder.FromRGBA(34, 139, 34, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF00FF. - /// - public static readonly TColor Fuchsia = ColorBuilder.FromRGBA(255, 0, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DCDCDC. - /// - public static readonly TColor Gainsboro = ColorBuilder.FromRGBA(220, 220, 220, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F8F8FF. - /// - public static readonly TColor GhostWhite = ColorBuilder.FromRGBA(248, 248, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFD700. - /// - public static readonly TColor Gold = ColorBuilder.FromRGBA(255, 215, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DAA520. - /// - public static readonly TColor Goldenrod = ColorBuilder.FromRGBA(218, 165, 32, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #808080. - /// - public static readonly TColor Gray = ColorBuilder.FromRGBA(128, 128, 128, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #008000. - /// - public static readonly TColor Green = ColorBuilder.FromRGBA(0, 128, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #ADFF2F. - /// - public static readonly TColor GreenYellow = ColorBuilder.FromRGBA(173, 255, 47, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F0FFF0. - /// - public static readonly TColor Honeydew = ColorBuilder.FromRGBA(240, 255, 240, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF69B4. - /// - public static readonly TColor HotPink = ColorBuilder.FromRGBA(255, 105, 180, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #CD5C5C. - /// - public static readonly TColor IndianRed = ColorBuilder.FromRGBA(205, 92, 92, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #4B0082. - /// - public static readonly TColor Indigo = ColorBuilder.FromRGBA(75, 0, 130, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFF0. - /// - public static readonly TColor Ivory = ColorBuilder.FromRGBA(255, 255, 240, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F0E68C. - /// - public static readonly TColor Khaki = ColorBuilder.FromRGBA(240, 230, 140, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #E6E6FA. - /// - public static readonly TColor Lavender = ColorBuilder.FromRGBA(230, 230, 250, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF0F5. - /// - public static readonly TColor LavenderBlush = ColorBuilder.FromRGBA(255, 240, 245, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #7CFC00. - /// - public static readonly TColor LawnGreen = ColorBuilder.FromRGBA(124, 252, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFACD. - /// - public static readonly TColor LemonChiffon = ColorBuilder.FromRGBA(255, 250, 205, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #ADD8E6. - /// - public static readonly TColor LightBlue = ColorBuilder.FromRGBA(173, 216, 230, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F08080. - /// - public static readonly TColor LightCoral = ColorBuilder.FromRGBA(240, 128, 128, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #E0FFFF. - /// - public static readonly TColor LightCyan = ColorBuilder.FromRGBA(224, 255, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FAFAD2. - /// - public static readonly TColor LightGoldenrodYellow = ColorBuilder.FromRGBA(250, 250, 210, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #D3D3D3. - /// - public static readonly TColor LightGray = ColorBuilder.FromRGBA(211, 211, 211, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #90EE90. - /// - public static readonly TColor LightGreen = ColorBuilder.FromRGBA(144, 238, 144, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFB6C1. - /// - public static readonly TColor LightPink = ColorBuilder.FromRGBA(255, 182, 193, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFA07A. - /// - public static readonly TColor LightSalmon = ColorBuilder.FromRGBA(255, 160, 122, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #20B2AA. - /// - public static readonly TColor LightSeaGreen = ColorBuilder.FromRGBA(32, 178, 170, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #87CEFA. - /// - public static readonly TColor LightSkyBlue = ColorBuilder.FromRGBA(135, 206, 250, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #778899. - /// - public static readonly TColor LightSlateGray = ColorBuilder.FromRGBA(119, 136, 153, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #B0C4DE. - /// - public static readonly TColor LightSteelBlue = ColorBuilder.FromRGBA(176, 196, 222, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFE0. - /// - public static readonly TColor LightYellow = ColorBuilder.FromRGBA(255, 255, 224, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00FF00. - /// - public static readonly TColor Lime = ColorBuilder.FromRGBA(0, 255, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #32CD32. - /// - public static readonly TColor LimeGreen = ColorBuilder.FromRGBA(50, 205, 50, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FAF0E6. - /// - public static readonly TColor Linen = ColorBuilder.FromRGBA(250, 240, 230, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF00FF. - /// - public static readonly TColor Magenta = ColorBuilder.FromRGBA(255, 0, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #800000. - /// - public static readonly TColor Maroon = ColorBuilder.FromRGBA(128, 0, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #66CDAA. - /// - public static readonly TColor MediumAquamarine = ColorBuilder.FromRGBA(102, 205, 170, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #0000CD. - /// - public static readonly TColor MediumBlue = ColorBuilder.FromRGBA(0, 0, 205, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #BA55D3. - /// - public static readonly TColor MediumOrchid = ColorBuilder.FromRGBA(186, 85, 211, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #9370DB. - /// - public static readonly TColor MediumPurple = ColorBuilder.FromRGBA(147, 112, 219, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #3CB371. - /// - public static readonly TColor MediumSeaGreen = ColorBuilder.FromRGBA(60, 179, 113, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #7B68EE. - /// - public static readonly TColor MediumSlateBlue = ColorBuilder.FromRGBA(123, 104, 238, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00FA9A. - /// - public static readonly TColor MediumSpringGreen = ColorBuilder.FromRGBA(0, 250, 154, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #48D1CC. - /// - public static readonly TColor MediumTurquoise = ColorBuilder.FromRGBA(72, 209, 204, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #C71585. - /// - public static readonly TColor MediumVioletRed = ColorBuilder.FromRGBA(199, 21, 133, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #191970. - /// - public static readonly TColor MidnightBlue = ColorBuilder.FromRGBA(25, 25, 112, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F5FFFA. - /// - public static readonly TColor MintCream = ColorBuilder.FromRGBA(245, 255, 250, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4E1. - /// - public static readonly TColor MistyRose = ColorBuilder.FromRGBA(255, 228, 225, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFE4B5. - /// - public static readonly TColor Moccasin = ColorBuilder.FromRGBA(255, 228, 181, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFDEAD. - /// - public static readonly TColor NavajoWhite = ColorBuilder.FromRGBA(255, 222, 173, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #000080. - /// - public static readonly TColor Navy = ColorBuilder.FromRGBA(0, 0, 128, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FDF5E6. - /// - public static readonly TColor OldLace = ColorBuilder.FromRGBA(253, 245, 230, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #808000. - /// - public static readonly TColor Olive = ColorBuilder.FromRGBA(128, 128, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #6B8E23. - /// - public static readonly TColor OliveDrab = ColorBuilder.FromRGBA(107, 142, 35, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFA500. - /// - public static readonly TColor Orange = ColorBuilder.FromRGBA(255, 165, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF4500. - /// - public static readonly TColor OrangeRed = ColorBuilder.FromRGBA(255, 69, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DA70D6. - /// - public static readonly TColor Orchid = ColorBuilder.FromRGBA(218, 112, 214, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #EEE8AA. - /// - public static readonly TColor PaleGoldenrod = ColorBuilder.FromRGBA(238, 232, 170, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #98FB98. - /// - public static readonly TColor PaleGreen = ColorBuilder.FromRGBA(152, 251, 152, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #AFEEEE. - /// - public static readonly TColor PaleTurquoise = ColorBuilder.FromRGBA(175, 238, 238, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DB7093. - /// - public static readonly TColor PaleVioletRed = ColorBuilder.FromRGBA(219, 112, 147, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFEFD5. - /// - public static readonly TColor PapayaWhip = ColorBuilder.FromRGBA(255, 239, 213, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFDAB9. - /// - public static readonly TColor PeachPuff = ColorBuilder.FromRGBA(255, 218, 185, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #CD853F. - /// - public static readonly TColor Peru = ColorBuilder.FromRGBA(205, 133, 63, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFC0CB. - /// - public static readonly TColor Pink = ColorBuilder.FromRGBA(255, 192, 203, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #DDA0DD. - /// - public static readonly TColor Plum = ColorBuilder.FromRGBA(221, 160, 221, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #B0E0E6. - /// - public static readonly TColor PowderBlue = ColorBuilder.FromRGBA(176, 224, 230, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #800080. - /// - public static readonly TColor Purple = ColorBuilder.FromRGBA(128, 0, 128, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #663399. - /// - public static readonly TColor RebeccaPurple = ColorBuilder.FromRGBA(102, 51, 153, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF0000. - /// - public static readonly TColor Red = ColorBuilder.FromRGBA(255, 0, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #BC8F8F. - /// - public static readonly TColor RosyBrown = ColorBuilder.FromRGBA(188, 143, 143, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #4169E1. - /// - public static readonly TColor RoyalBlue = ColorBuilder.FromRGBA(65, 105, 225, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #8B4513. - /// - public static readonly TColor SaddleBrown = ColorBuilder.FromRGBA(139, 69, 19, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FA8072. - /// - public static readonly TColor Salmon = ColorBuilder.FromRGBA(250, 128, 114, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F4A460. - /// - public static readonly TColor SandyBrown = ColorBuilder.FromRGBA(244, 164, 96, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #2E8B57. - /// - public static readonly TColor SeaGreen = ColorBuilder.FromRGBA(46, 139, 87, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFF5EE. - /// - public static readonly TColor SeaShell = ColorBuilder.FromRGBA(255, 245, 238, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #A0522D. - /// - public static readonly TColor Sienna = ColorBuilder.FromRGBA(160, 82, 45, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #C0C0C0. - /// - public static readonly TColor Silver = ColorBuilder.FromRGBA(192, 192, 192, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #87CEEB. - /// - public static readonly TColor SkyBlue = ColorBuilder.FromRGBA(135, 206, 235, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #6A5ACD. - /// - public static readonly TColor SlateBlue = ColorBuilder.FromRGBA(106, 90, 205, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #708090. - /// - public static readonly TColor SlateGray = ColorBuilder.FromRGBA(112, 128, 144, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFAFA. - /// - public static readonly TColor Snow = ColorBuilder.FromRGBA(255, 250, 250, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #00FF7F. - /// - public static readonly TColor SpringGreen = ColorBuilder.FromRGBA(0, 255, 127, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #4682B4. - /// - public static readonly TColor SteelBlue = ColorBuilder.FromRGBA(70, 130, 180, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #D2B48C. - /// - public static readonly TColor Tan = ColorBuilder.FromRGBA(210, 180, 140, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #008080. - /// - public static readonly TColor Teal = ColorBuilder.FromRGBA(0, 128, 128, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #D8BFD8. - /// - public static readonly TColor Thistle = ColorBuilder.FromRGBA(216, 191, 216, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FF6347. - /// - public static readonly TColor Tomato = ColorBuilder.FromRGBA(255, 99, 71, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFFF. - /// - public static readonly TColor Transparent = ColorBuilder.FromRGBA(255, 255, 255, 0); - - /// - /// Represents a matching the W3C definition that has an hex value of #40E0D0. - /// - public static readonly TColor Turquoise = ColorBuilder.FromRGBA(64, 224, 208, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #EE82EE. - /// - public static readonly TColor Violet = ColorBuilder.FromRGBA(238, 130, 238, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F5DEB3. - /// - public static readonly TColor Wheat = ColorBuilder.FromRGBA(245, 222, 179, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFFFF. - /// - public static readonly TColor White = ColorBuilder.FromRGBA(255, 255, 255, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #F5F5F5. - /// - public static readonly TColor WhiteSmoke = ColorBuilder.FromRGBA(245, 245, 245, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #FFFF00. - /// - public static readonly TColor Yellow = ColorBuilder.FromRGBA(255, 255, 0, 255); - - /// - /// Represents a matching the W3C definition that has an hex value of #9ACD32. - /// - public static readonly TColor YellowGreen = ColorBuilder.FromRGBA(154, 205, 50, 255); - } -} \ No newline at end of file diff --git a/src/ImageSharp/Colors/NamedColors{TPixel}.cs b/src/ImageSharp/Colors/NamedColors{TPixel}.cs new file mode 100644 index 000000000..ee87dd00f --- /dev/null +++ b/src/ImageSharp/Colors/NamedColors{TPixel}.cs @@ -0,0 +1,725 @@ +// +// Copyright (c) James Jackson-South and contributors. +// Licensed under the Apache License, Version 2.0. +// + +namespace ImageSharp +{ + /// + /// A set of named colors mapped to the provided color space. + /// + /// The type of the color. + public static class NamedColors + where TPixel : struct, IPixel + { + /// + /// Represents a matching the W3C definition that has an hex value of #F0F8FF. + /// + public static readonly TPixel AliceBlue = ColorBuilder.FromRGBA(240, 248, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FAEBD7. + /// + public static readonly TPixel AntiqueWhite = ColorBuilder.FromRGBA(250, 235, 215, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00FFFF. + /// + public static readonly TPixel Aqua = ColorBuilder.FromRGBA(0, 255, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #7FFFD4. + /// + public static readonly TPixel Aquamarine = ColorBuilder.FromRGBA(127, 255, 212, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F0FFFF. + /// + public static readonly TPixel Azure = ColorBuilder.FromRGBA(240, 255, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F5F5DC. + /// + public static readonly TPixel Beige = ColorBuilder.FromRGBA(245, 245, 220, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4C4. + /// + public static readonly TPixel Bisque = ColorBuilder.FromRGBA(255, 228, 196, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #000000. + /// + public static readonly TPixel Black = ColorBuilder.FromRGBA(0, 0, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFEBCD. + /// + public static readonly TPixel BlanchedAlmond = ColorBuilder.FromRGBA(255, 235, 205, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #0000FF. + /// + public static readonly TPixel Blue = ColorBuilder.FromRGBA(0, 0, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #8A2BE2. + /// + public static readonly TPixel BlueViolet = ColorBuilder.FromRGBA(138, 43, 226, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #A52A2A. + /// + public static readonly TPixel Brown = ColorBuilder.FromRGBA(165, 42, 42, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DEB887. + /// + public static readonly TPixel BurlyWood = ColorBuilder.FromRGBA(222, 184, 135, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #5F9EA0. + /// + public static readonly TPixel CadetBlue = ColorBuilder.FromRGBA(95, 158, 160, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #7FFF00. + /// + public static readonly TPixel Chartreuse = ColorBuilder.FromRGBA(127, 255, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #D2691E. + /// + public static readonly TPixel Chocolate = ColorBuilder.FromRGBA(210, 105, 30, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF7F50. + /// + public static readonly TPixel Coral = ColorBuilder.FromRGBA(255, 127, 80, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #6495ED. + /// + public static readonly TPixel CornflowerBlue = ColorBuilder.FromRGBA(100, 149, 237, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF8DC. + /// + public static readonly TPixel Cornsilk = ColorBuilder.FromRGBA(255, 248, 220, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DC143C. + /// + public static readonly TPixel Crimson = ColorBuilder.FromRGBA(220, 20, 60, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00FFFF. + /// + public static readonly TPixel Cyan = ColorBuilder.FromRGBA(0, 255, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00008B. + /// + public static readonly TPixel DarkBlue = ColorBuilder.FromRGBA(0, 0, 139, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #008B8B. + /// + public static readonly TPixel DarkCyan = ColorBuilder.FromRGBA(0, 139, 139, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #B8860B. + /// + public static readonly TPixel DarkGoldenrod = ColorBuilder.FromRGBA(184, 134, 11, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #A9A9A9. + /// + public static readonly TPixel DarkGray = ColorBuilder.FromRGBA(169, 169, 169, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #006400. + /// + public static readonly TPixel DarkGreen = ColorBuilder.FromRGBA(0, 100, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #BDB76B. + /// + public static readonly TPixel DarkKhaki = ColorBuilder.FromRGBA(189, 183, 107, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #8B008B. + /// + public static readonly TPixel DarkMagenta = ColorBuilder.FromRGBA(139, 0, 139, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #556B2F. + /// + public static readonly TPixel DarkOliveGreen = ColorBuilder.FromRGBA(85, 107, 47, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF8C00. + /// + public static readonly TPixel DarkOrange = ColorBuilder.FromRGBA(255, 140, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #9932CC. + /// + public static readonly TPixel DarkOrchid = ColorBuilder.FromRGBA(153, 50, 204, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #8B0000. + /// + public static readonly TPixel DarkRed = ColorBuilder.FromRGBA(139, 0, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #E9967A. + /// + public static readonly TPixel DarkSalmon = ColorBuilder.FromRGBA(233, 150, 122, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #8FBC8B. + /// + public static readonly TPixel DarkSeaGreen = ColorBuilder.FromRGBA(143, 188, 139, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #483D8B. + /// + public static readonly TPixel DarkSlateBlue = ColorBuilder.FromRGBA(72, 61, 139, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #2F4F4F. + /// + public static readonly TPixel DarkSlateGray = ColorBuilder.FromRGBA(47, 79, 79, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00CED1. + /// + public static readonly TPixel DarkTurquoise = ColorBuilder.FromRGBA(0, 206, 209, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #9400D3. + /// + public static readonly TPixel DarkViolet = ColorBuilder.FromRGBA(148, 0, 211, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF1493. + /// + public static readonly TPixel DeepPink = ColorBuilder.FromRGBA(255, 20, 147, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00BFFF. + /// + public static readonly TPixel DeepSkyBlue = ColorBuilder.FromRGBA(0, 191, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #696969. + /// + public static readonly TPixel DimGray = ColorBuilder.FromRGBA(105, 105, 105, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #1E90FF. + /// + public static readonly TPixel DodgerBlue = ColorBuilder.FromRGBA(30, 144, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #B22222. + /// + public static readonly TPixel Firebrick = ColorBuilder.FromRGBA(178, 34, 34, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFAF0. + /// + public static readonly TPixel FloralWhite = ColorBuilder.FromRGBA(255, 250, 240, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #228B22. + /// + public static readonly TPixel ForestGreen = ColorBuilder.FromRGBA(34, 139, 34, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF00FF. + /// + public static readonly TPixel Fuchsia = ColorBuilder.FromRGBA(255, 0, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DCDCDC. + /// + public static readonly TPixel Gainsboro = ColorBuilder.FromRGBA(220, 220, 220, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F8F8FF. + /// + public static readonly TPixel GhostWhite = ColorBuilder.FromRGBA(248, 248, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFD700. + /// + public static readonly TPixel Gold = ColorBuilder.FromRGBA(255, 215, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DAA520. + /// + public static readonly TPixel Goldenrod = ColorBuilder.FromRGBA(218, 165, 32, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #808080. + /// + public static readonly TPixel Gray = ColorBuilder.FromRGBA(128, 128, 128, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #008000. + /// + public static readonly TPixel Green = ColorBuilder.FromRGBA(0, 128, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #ADFF2F. + /// + public static readonly TPixel GreenYellow = ColorBuilder.FromRGBA(173, 255, 47, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F0FFF0. + /// + public static readonly TPixel Honeydew = ColorBuilder.FromRGBA(240, 255, 240, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF69B4. + /// + public static readonly TPixel HotPink = ColorBuilder.FromRGBA(255, 105, 180, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #CD5C5C. + /// + public static readonly TPixel IndianRed = ColorBuilder.FromRGBA(205, 92, 92, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #4B0082. + /// + public static readonly TPixel Indigo = ColorBuilder.FromRGBA(75, 0, 130, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFF0. + /// + public static readonly TPixel Ivory = ColorBuilder.FromRGBA(255, 255, 240, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F0E68C. + /// + public static readonly TPixel Khaki = ColorBuilder.FromRGBA(240, 230, 140, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #E6E6FA. + /// + public static readonly TPixel Lavender = ColorBuilder.FromRGBA(230, 230, 250, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF0F5. + /// + public static readonly TPixel LavenderBlush = ColorBuilder.FromRGBA(255, 240, 245, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #7CFC00. + /// + public static readonly TPixel LawnGreen = ColorBuilder.FromRGBA(124, 252, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFACD. + /// + public static readonly TPixel LemonChiffon = ColorBuilder.FromRGBA(255, 250, 205, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #ADD8E6. + /// + public static readonly TPixel LightBlue = ColorBuilder.FromRGBA(173, 216, 230, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F08080. + /// + public static readonly TPixel LightCoral = ColorBuilder.FromRGBA(240, 128, 128, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #E0FFFF. + /// + public static readonly TPixel LightCyan = ColorBuilder.FromRGBA(224, 255, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FAFAD2. + /// + public static readonly TPixel LightGoldenrodYellow = ColorBuilder.FromRGBA(250, 250, 210, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #D3D3D3. + /// + public static readonly TPixel LightGray = ColorBuilder.FromRGBA(211, 211, 211, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #90EE90. + /// + public static readonly TPixel LightGreen = ColorBuilder.FromRGBA(144, 238, 144, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFB6C1. + /// + public static readonly TPixel LightPink = ColorBuilder.FromRGBA(255, 182, 193, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFA07A. + /// + public static readonly TPixel LightSalmon = ColorBuilder.FromRGBA(255, 160, 122, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #20B2AA. + /// + public static readonly TPixel LightSeaGreen = ColorBuilder.FromRGBA(32, 178, 170, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #87CEFA. + /// + public static readonly TPixel LightSkyBlue = ColorBuilder.FromRGBA(135, 206, 250, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #778899. + /// + public static readonly TPixel LightSlateGray = ColorBuilder.FromRGBA(119, 136, 153, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #B0C4DE. + /// + public static readonly TPixel LightSteelBlue = ColorBuilder.FromRGBA(176, 196, 222, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFE0. + /// + public static readonly TPixel LightYellow = ColorBuilder.FromRGBA(255, 255, 224, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00FF00. + /// + public static readonly TPixel Lime = ColorBuilder.FromRGBA(0, 255, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #32CD32. + /// + public static readonly TPixel LimeGreen = ColorBuilder.FromRGBA(50, 205, 50, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FAF0E6. + /// + public static readonly TPixel Linen = ColorBuilder.FromRGBA(250, 240, 230, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF00FF. + /// + public static readonly TPixel Magenta = ColorBuilder.FromRGBA(255, 0, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #800000. + /// + public static readonly TPixel Maroon = ColorBuilder.FromRGBA(128, 0, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #66CDAA. + /// + public static readonly TPixel MediumAquamarine = ColorBuilder.FromRGBA(102, 205, 170, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #0000CD. + /// + public static readonly TPixel MediumBlue = ColorBuilder.FromRGBA(0, 0, 205, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #BA55D3. + /// + public static readonly TPixel MediumOrchid = ColorBuilder.FromRGBA(186, 85, 211, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #9370DB. + /// + public static readonly TPixel MediumPurple = ColorBuilder.FromRGBA(147, 112, 219, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #3CB371. + /// + public static readonly TPixel MediumSeaGreen = ColorBuilder.FromRGBA(60, 179, 113, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #7B68EE. + /// + public static readonly TPixel MediumSlateBlue = ColorBuilder.FromRGBA(123, 104, 238, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00FA9A. + /// + public static readonly TPixel MediumSpringGreen = ColorBuilder.FromRGBA(0, 250, 154, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #48D1CC. + /// + public static readonly TPixel MediumTurquoise = ColorBuilder.FromRGBA(72, 209, 204, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #C71585. + /// + public static readonly TPixel MediumVioletRed = ColorBuilder.FromRGBA(199, 21, 133, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #191970. + /// + public static readonly TPixel MidnightBlue = ColorBuilder.FromRGBA(25, 25, 112, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F5FFFA. + /// + public static readonly TPixel MintCream = ColorBuilder.FromRGBA(245, 255, 250, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4E1. + /// + public static readonly TPixel MistyRose = ColorBuilder.FromRGBA(255, 228, 225, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFE4B5. + /// + public static readonly TPixel Moccasin = ColorBuilder.FromRGBA(255, 228, 181, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFDEAD. + /// + public static readonly TPixel NavajoWhite = ColorBuilder.FromRGBA(255, 222, 173, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #000080. + /// + public static readonly TPixel Navy = ColorBuilder.FromRGBA(0, 0, 128, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FDF5E6. + /// + public static readonly TPixel OldLace = ColorBuilder.FromRGBA(253, 245, 230, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #808000. + /// + public static readonly TPixel Olive = ColorBuilder.FromRGBA(128, 128, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #6B8E23. + /// + public static readonly TPixel OliveDrab = ColorBuilder.FromRGBA(107, 142, 35, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFA500. + /// + public static readonly TPixel Orange = ColorBuilder.FromRGBA(255, 165, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF4500. + /// + public static readonly TPixel OrangeRed = ColorBuilder.FromRGBA(255, 69, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DA70D6. + /// + public static readonly TPixel Orchid = ColorBuilder.FromRGBA(218, 112, 214, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #EEE8AA. + /// + public static readonly TPixel PaleGoldenrod = ColorBuilder.FromRGBA(238, 232, 170, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #98FB98. + /// + public static readonly TPixel PaleGreen = ColorBuilder.FromRGBA(152, 251, 152, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #AFEEEE. + /// + public static readonly TPixel PaleTurquoise = ColorBuilder.FromRGBA(175, 238, 238, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DB7093. + /// + public static readonly TPixel PaleVioletRed = ColorBuilder.FromRGBA(219, 112, 147, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFEFD5. + /// + public static readonly TPixel PapayaWhip = ColorBuilder.FromRGBA(255, 239, 213, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFDAB9. + /// + public static readonly TPixel PeachPuff = ColorBuilder.FromRGBA(255, 218, 185, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #CD853F. + /// + public static readonly TPixel Peru = ColorBuilder.FromRGBA(205, 133, 63, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFC0CB. + /// + public static readonly TPixel Pink = ColorBuilder.FromRGBA(255, 192, 203, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #DDA0DD. + /// + public static readonly TPixel Plum = ColorBuilder.FromRGBA(221, 160, 221, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #B0E0E6. + /// + public static readonly TPixel PowderBlue = ColorBuilder.FromRGBA(176, 224, 230, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #800080. + /// + public static readonly TPixel Purple = ColorBuilder.FromRGBA(128, 0, 128, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #663399. + /// + public static readonly TPixel RebeccaPurple = ColorBuilder.FromRGBA(102, 51, 153, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF0000. + /// + public static readonly TPixel Red = ColorBuilder.FromRGBA(255, 0, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #BC8F8F. + /// + public static readonly TPixel RosyBrown = ColorBuilder.FromRGBA(188, 143, 143, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #4169E1. + /// + public static readonly TPixel RoyalBlue = ColorBuilder.FromRGBA(65, 105, 225, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #8B4513. + /// + public static readonly TPixel SaddleBrown = ColorBuilder.FromRGBA(139, 69, 19, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FA8072. + /// + public static readonly TPixel Salmon = ColorBuilder.FromRGBA(250, 128, 114, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F4A460. + /// + public static readonly TPixel SandyBrown = ColorBuilder.FromRGBA(244, 164, 96, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #2E8B57. + /// + public static readonly TPixel SeaGreen = ColorBuilder.FromRGBA(46, 139, 87, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFF5EE. + /// + public static readonly TPixel SeaShell = ColorBuilder.FromRGBA(255, 245, 238, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #A0522D. + /// + public static readonly TPixel Sienna = ColorBuilder.FromRGBA(160, 82, 45, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #C0C0C0. + /// + public static readonly TPixel Silver = ColorBuilder.FromRGBA(192, 192, 192, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #87CEEB. + /// + public static readonly TPixel SkyBlue = ColorBuilder.FromRGBA(135, 206, 235, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #6A5ACD. + /// + public static readonly TPixel SlateBlue = ColorBuilder.FromRGBA(106, 90, 205, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #708090. + /// + public static readonly TPixel SlateGray = ColorBuilder.FromRGBA(112, 128, 144, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFAFA. + /// + public static readonly TPixel Snow = ColorBuilder.FromRGBA(255, 250, 250, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #00FF7F. + /// + public static readonly TPixel SpringGreen = ColorBuilder.FromRGBA(0, 255, 127, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #4682B4. + /// + public static readonly TPixel SteelBlue = ColorBuilder.FromRGBA(70, 130, 180, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #D2B48C. + /// + public static readonly TPixel Tan = ColorBuilder.FromRGBA(210, 180, 140, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #008080. + /// + public static readonly TPixel Teal = ColorBuilder.FromRGBA(0, 128, 128, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #D8BFD8. + /// + public static readonly TPixel Thistle = ColorBuilder.FromRGBA(216, 191, 216, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FF6347. + /// + public static readonly TPixel Tomato = ColorBuilder.FromRGBA(255, 99, 71, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFFF. + /// + public static readonly TPixel Transparent = ColorBuilder.FromRGBA(255, 255, 255, 0); + + /// + /// Represents a matching the W3C definition that has an hex value of #40E0D0. + /// + public static readonly TPixel Turquoise = ColorBuilder.FromRGBA(64, 224, 208, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #EE82EE. + /// + public static readonly TPixel Violet = ColorBuilder.FromRGBA(238, 130, 238, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F5DEB3. + /// + public static readonly TPixel Wheat = ColorBuilder.FromRGBA(245, 222, 179, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFFFF. + /// + public static readonly TPixel White = ColorBuilder.FromRGBA(255, 255, 255, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #F5F5F5. + /// + public static readonly TPixel WhiteSmoke = ColorBuilder.FromRGBA(245, 245, 245, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #FFFF00. + /// + public static readonly TPixel Yellow = ColorBuilder.FromRGBA(255, 255, 0, 255); + + /// + /// Represents a matching the W3C definition that has an hex value of #9ACD32. + /// + public static readonly TPixel YellowGreen = ColorBuilder.FromRGBA(154, 205, 50, 255); + } +} \ No newline at end of file diff --git a/src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TColor}.cs b/src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TPixel}.cs similarity index 78% rename from src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TColor}.cs rename to src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TPixel}.cs index db0251703..d58e48ffd 100644 --- a/src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TColor}.cs +++ b/src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,16 +10,16 @@ namespace ImageSharp /// /// A stateless class implementing Strategy Pattern for batched pixel-data conversion operations - /// for pixel buffers of type . + /// for pixel buffers of type . /// - /// The pixel format. - public class BulkPixelOperations - where TColor : struct, IPixel + /// The pixel format. + public class BulkPixelOperations + where TPixel : struct, IPixel { /// - /// Gets the global instance for the pixel type + /// Gets the global instance for the pixel type /// - public static BulkPixelOperations Instance { get; } = default(TColor).CreateBulkOperations(); + public static BulkPixelOperations Instance { get; } = default(TPixel).CreateBulkOperations(); /// /// Bulk version of @@ -27,15 +27,15 @@ namespace ImageSharp /// The to the source vectors. /// The to the destination colors. /// The number of pixels to convert. - internal virtual void PackFromVector4(BufferSpan sourceVectors, BufferSpan destColors, int count) + internal virtual void PackFromVector4(BufferSpan sourceVectors, BufferSpan destColors, int count) { ref Vector4 sourceRef = ref sourceVectors.DangerousGetPinnableReference(); - ref TColor destRef = ref destColors.DangerousGetPinnableReference(); + ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { ref Vector4 sp = ref Unsafe.Add(ref sourceRef, i); - ref TColor dp = ref Unsafe.Add(ref destRef, i); + ref TPixel dp = ref Unsafe.Add(ref destRef, i); dp.PackFromVector4(sp); } } @@ -46,14 +46,14 @@ namespace ImageSharp /// The to the source colors. /// The to the destination vectors. /// The number of pixels to convert. - internal virtual void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count) + internal virtual void ToVector4(BufferSpan sourceColors, BufferSpan destVectors, int count) { - ref TColor sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); ref Vector4 destRef = ref destVectors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { - ref TColor sp = ref Unsafe.Add(ref sourceRef, i); + ref TPixel sp = ref Unsafe.Add(ref sourceRef, i); ref Vector4 dp = ref Unsafe.Add(ref destRef, i); dp = sp.ToVector4(); } @@ -65,15 +65,15 @@ namespace ImageSharp /// The to the source bytes. /// The to the destination colors. /// The number of pixels to convert. - internal virtual void PackFromXyzBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal virtual void PackFromXyzBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); - ref TColor destRef = ref destColors.DangerousGetPinnableReference(); + ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { int i3 = i * 3; - ref TColor dp = ref Unsafe.Add(ref destRef, i); + ref TPixel dp = ref Unsafe.Add(ref destRef, i); dp.PackFromBytes( Unsafe.Add(ref sourceRef, i3), Unsafe.Add(ref sourceRef, i3 + 1), @@ -88,14 +88,14 @@ namespace ImageSharp /// The to the source colors. /// The to the destination bytes. /// The number of pixels to convert. - internal virtual void ToXyzBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal virtual void ToXyzBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref TColor sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); byte[] dest = destBytes.Array; for (int i = 0; i < count; i++) { - ref TColor sp = ref Unsafe.Add(ref sourceRef, i); + ref TPixel sp = ref Unsafe.Add(ref sourceRef, i); sp.ToXyzBytes(dest, destBytes.Start + (i * 3)); } } @@ -106,15 +106,15 @@ namespace ImageSharp /// The to the source bytes. /// The to the destination colors. /// The number of pixels to convert. - internal virtual void PackFromXyzwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal virtual void PackFromXyzwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); - ref TColor destRef = ref destColors.DangerousGetPinnableReference(); + ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { int i4 = i * 4; - ref TColor dp = ref Unsafe.Add(ref destRef, i); + ref TPixel dp = ref Unsafe.Add(ref destRef, i); dp.PackFromBytes( Unsafe.Add(ref sourceRef, i4), Unsafe.Add(ref sourceRef, i4 + 1), @@ -129,14 +129,14 @@ namespace ImageSharp /// The to the source colors. /// The to the destination bytes. /// The number of pixels to convert. - internal virtual void ToXyzwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal virtual void ToXyzwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref TColor sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); byte[] dest = destBytes.Array; for (int i = 0; i < count; i++) { - ref TColor sp = ref Unsafe.Add(ref sourceRef, i); + ref TPixel sp = ref Unsafe.Add(ref sourceRef, i); sp.ToXyzwBytes(dest, destBytes.Start + (i * 4)); } } @@ -147,15 +147,15 @@ namespace ImageSharp /// The to the source bytes. /// The to the destination colors. /// The number of pixels to convert. - internal virtual void PackFromZyxBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal virtual void PackFromZyxBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); - ref TColor destRef = ref destColors.DangerousGetPinnableReference(); + ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { int i3 = i * 3; - ref TColor dp = ref Unsafe.Add(ref destRef, i); + ref TPixel dp = ref Unsafe.Add(ref destRef, i); dp.PackFromBytes( Unsafe.Add(ref sourceRef, i3 + 2), Unsafe.Add(ref sourceRef, i3 + 1), @@ -170,14 +170,14 @@ namespace ImageSharp /// The to the source colors. /// The to the destination bytes. /// The number of pixels to convert. - internal virtual void ToZyxBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal virtual void ToZyxBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref TColor sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); byte[] dest = destBytes.Array; for (int i = 0; i < count; i++) { - ref TColor sp = ref Unsafe.Add(ref sourceRef, i); + ref TPixel sp = ref Unsafe.Add(ref sourceRef, i); sp.ToZyxBytes(dest, destBytes.Start + (i * 3)); } } @@ -188,15 +188,15 @@ namespace ImageSharp /// The to the source bytes. /// The to the destination colors. /// The number of pixels to convert. - internal virtual void PackFromZyxwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) + internal virtual void PackFromZyxwBytes(BufferSpan sourceBytes, BufferSpan destColors, int count) { ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); - ref TColor destRef = ref destColors.DangerousGetPinnableReference(); + ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); for (int i = 0; i < count; i++) { int i4 = i * 4; - ref TColor dp = ref Unsafe.Add(ref destRef, i); + ref TPixel dp = ref Unsafe.Add(ref destRef, i); dp.PackFromBytes( Unsafe.Add(ref sourceRef, i4 + 2), Unsafe.Add(ref sourceRef, i4 + 1), @@ -211,14 +211,14 @@ namespace ImageSharp /// The to the source colors. /// The to the destination bytes. /// The number of pixels to convert. - internal virtual void ToZyxwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) + internal virtual void ToZyxwBytes(BufferSpan sourceColors, BufferSpan destBytes, int count) { - ref TColor sourceRef = ref sourceColors.DangerousGetPinnableReference(); + ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); byte[] dest = destBytes.Array; for (int i = 0; i < count; i++) { - ref TColor sp = ref Unsafe.Add(ref sourceRef, i); + ref TPixel sp = ref Unsafe.Add(ref sourceRef, i); sp.ToZyxwBytes(dest, destBytes.Start + (i * 4)); } } diff --git a/src/ImageSharp/Colors/PackedPixel/IPixel.cs b/src/ImageSharp/Colors/PackedPixel/IPixel.cs index 024ceafb3..08f2eafb0 100644 --- a/src/ImageSharp/Colors/PackedPixel/IPixel.cs +++ b/src/ImageSharp/Colors/PackedPixel/IPixel.cs @@ -16,10 +16,10 @@ namespace ImageSharp where TSelf : struct, IPixel { /// - /// Creates a instance for this pixel type. - /// This method is not intended to be consumed directly. Use instead. + /// Creates a instance for this pixel type. + /// This method is not intended to be consumed directly. Use instead. /// - /// The instance. + /// The instance. BulkPixelOperations CreateBulkOperations(); } diff --git a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs b/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs index 5e8ad66fe..16d73f785 100644 --- a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs +++ b/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs @@ -22,10 +22,10 @@ namespace ImageSharp /// Returns the correct scaling function for the given types The compute scale function. /// /// The scale function. - /// The source pixel format. - /// The target pixel format. + /// The source pixel format. + /// The target pixel format. /// The - public static Func ComputeScaleFunction(Func scaleFunc) + public static Func ComputeScaleFunction(Func scaleFunc) { // Custom type with a custom function. if (scaleFunc != null) @@ -33,8 +33,8 @@ namespace ImageSharp return scaleFunc; } - Type source = typeof(TColor); - Type target = typeof(TColor2); + Type source = typeof(TPixel); + Type target = typeof(TPixel2); // Normalized standard if (IsStandardNormalizedType(source)) diff --git a/src/ImageSharp/Colors/Rgba32.BulkOperations.cs b/src/ImageSharp/Colors/Rgba32.BulkOperations.cs index 4dc8bb051..e35de0ad5 100644 --- a/src/ImageSharp/Colors/Rgba32.BulkOperations.cs +++ b/src/ImageSharp/Colors/Rgba32.BulkOperations.cs @@ -21,7 +21,7 @@ namespace ImageSharp public partial struct Rgba32 { /// - /// implementation optimized for . + /// implementation optimized for . /// internal class BulkOperations : BulkPixelOperations { diff --git a/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs b/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs index aa83c31d9..0e5029920 100644 --- a/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs +++ b/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs @@ -189,9 +189,9 @@ namespace ImageSharp float temp2 = (l < 0.5f) ? l * (1f + s) : l + s - (l * s); float temp1 = (2f * l) - temp2; - r = GeTPixelComponent(temp1, temp2, rangedH + 0.3333333F); - g = GeTPixelComponent(temp1, temp2, rangedH); - b = GeTPixelComponent(temp1, temp2, rangedH - 0.3333333F); + r = GetColorComponent(temp1, temp2, rangedH + 0.3333333F); + g = GetColorComponent(temp1, temp2, rangedH); + b = GetColorComponent(temp1, temp2, rangedH - 0.3333333F); } } @@ -241,7 +241,7 @@ namespace ImageSharp /// /// The . /// - private static float GeTPixelComponent(float first, float second, float third) + private static float GetColorComponent(float first, float second, float third) { third = MoveIntoRange(third); if (third < 0.1666667F) diff --git a/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs b/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs index 1a3357c51..e26048fc4 100644 --- a/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs +++ b/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs @@ -18,7 +18,7 @@ namespace ImageSharp public partial struct RgbaVector { /// - /// implementation optimized for . + /// implementation optimized for . /// internal class BulkOperations : BulkPixelOperations { diff --git a/src/ImageSharp/Colors/Spaces/IAlmostEquatable.cs b/src/ImageSharp/Colors/Spaces/IAlmostEquatable.cs index a2183d396..04ea91cba 100644 --- a/src/ImageSharp/Colors/Spaces/IAlmostEquatable.cs +++ b/src/ImageSharp/Colors/Spaces/IAlmostEquatable.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Colors.Spaces /// Defines a generalized method that a value type or class implements to create /// a type-specific method for determining approximate equality of instances. /// - /// The type of objects to compare. + /// The type of objects to compare. /// The object specifying the type to specify precision with. - public interface IAlmostEquatable + public interface IAlmostEquatable where TPrecision : struct, IComparable { /// @@ -25,6 +25,6 @@ namespace ImageSharp.Colors.Spaces /// /// true if the current object is equal to the other parameter; otherwise, false. /// - bool AlmostEquals(TColor other, TPrecision precision); + bool AlmostEquals(TPixel other, TPrecision precision); } } diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index 224b267e4..3cfea581d 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -175,22 +175,22 @@ namespace ImageSharp /// Finds the bounding rectangle based on the first instance of any color component other /// than the given one. /// - /// The pixel format. + /// The pixel format. /// The to search within. /// The color component value to remove. /// The channel to test against. /// /// The . /// - public static Rectangle GetFilteredBoundingRectangle(ImageBase bitmap, float componentValue, RgbaComponent channel = RgbaComponent.B) - where TColor : struct, IPixel + public static Rectangle GetFilteredBoundingRectangle(ImageBase bitmap, float componentValue, RgbaComponent channel = RgbaComponent.B) + where TPixel : struct, IPixel { int width = bitmap.Width; int height = bitmap.Height; Point topLeft = default(Point); Point bottomRight = default(Point); - Func, int, int, float, bool> delegateFunc; + Func, int, int, float, bool> delegateFunc; // Determine which channel to check against switch (channel) @@ -212,7 +212,7 @@ namespace ImageSharp break; } - Func, int> getMinY = pixels => + Func, int> getMinY = pixels => { for (int y = 0; y < height; y++) { @@ -228,7 +228,7 @@ namespace ImageSharp return 0; }; - Func, int> getMaxY = pixels => + Func, int> getMaxY = pixels => { for (int y = height - 1; y > -1; y--) { @@ -244,7 +244,7 @@ namespace ImageSharp return height; }; - Func, int> getMinX = pixels => + Func, int> getMinX = pixels => { for (int x = 0; x < width; x++) { @@ -260,7 +260,7 @@ namespace ImageSharp return 0; }; - Func, int> getMaxX = pixels => + Func, int> getMaxX = pixels => { for (int x = width - 1; x > -1; x--) { @@ -276,7 +276,7 @@ namespace ImageSharp return height; }; - using (PixelAccessor bitmapPixels = bitmap.Lock()) + using (PixelAccessor bitmapPixels = bitmap.Lock()) { topLeft.Y = getMinY(bitmapPixels); topLeft.X = getMinX(bitmapPixels); diff --git a/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs b/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs index f5c787140..8bb446535 100644 --- a/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs +++ b/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs @@ -24,7 +24,7 @@ namespace ImageSharp /// Rents the pixel array from the pool. /// /// The minimum length of the array to return. - /// The + /// The public static T[] Rent(int minimumLength) { return ArrayPool.Rent(minimumLength); diff --git a/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs b/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs index d6ab8eb64..af78c8f86 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs +++ b/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs @@ -68,16 +68,16 @@ namespace ImageSharp.Dithering /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Dither(PixelAccessor pixels, TColor source, TColor transformed, int x, int y, int width, int height) - where TColor : struct, IPixel + public void Dither(PixelAccessor pixels, TPixel source, TPixel transformed, int x, int y, int width, int height) + where TPixel : struct, IPixel { this.Dither(pixels, source, transformed, x, y, width, height, true); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Dither(PixelAccessor pixels, TColor source, TColor transformed, int x, int y, int width, int height, bool replacePixel) - where TColor : struct, IPixel + public void Dither(PixelAccessor pixels, TPixel source, TPixel transformed, int x, int y, int width, int height, bool replacePixel) + where TPixel : struct, IPixel { if (replacePixel) { @@ -113,7 +113,7 @@ namespace ImageSharp.Dithering Vector4 result = ((error * coefficientVector) / this.divisorVector) + offsetColor; result.W = offsetColor.W; - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(result); pixels[matrixX, matrixY] = packed; } diff --git a/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs b/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs index 66ec3d515..f7a13984a 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs +++ b/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs @@ -22,9 +22,9 @@ namespace ImageSharp.Dithering /// The row index. /// The image width. /// The image height. - /// The pixel format. - void Dither(PixelAccessor pixels, TColor source, TColor transformed, int x, int y, int width, int height) - where TColor : struct, IPixel; + /// The pixel format. + void Dither(PixelAccessor pixels, TPixel source, TPixel transformed, int x, int y, int width, int height) + where TPixel : struct, IPixel; /// /// Transforms the image applying the dither matrix. This method alters the input pixels array @@ -40,8 +40,8 @@ namespace ImageSharp.Dithering /// Whether to replace the pixel at the given coordinates with the transformed value. /// Generally this would be true for standard two-color dithering but when used in conjunction with color quantization this should be false. /// - /// The pixel format. - void Dither(PixelAccessor pixels, TColor source, TColor transformed, int x, int y, int width, int height, bool replacePixel) - where TColor : struct, IPixel; + /// The pixel format. + void Dither(PixelAccessor pixels, TPixel source, TPixel transformed, int x, int y, int width, int height, bool replacePixel) + where TPixel : struct, IPixel; } } diff --git a/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs b/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs index 5c9897374..0762f61a7 100644 --- a/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs +++ b/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs @@ -23,8 +23,8 @@ namespace ImageSharp.Dithering /// The row index. /// The image width. /// The image height. - /// The pixel format. - void Dither(PixelAccessor pixels, TColor source, TColor upper, TColor lower, byte[] bytes, int index, int x, int y, int width, int height) - where TColor : struct, IPixel; + /// The pixel format. + void Dither(PixelAccessor pixels, TPixel source, TPixel upper, TPixel lower, byte[] bytes, int index, int x, int y, int width, int height) + where TPixel : struct, IPixel; } } \ No newline at end of file diff --git a/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs b/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs index c2b55d98e..ce0ae1d97 100644 --- a/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs +++ b/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs @@ -25,8 +25,8 @@ namespace ImageSharp.Dithering.Ordered } /// - public void Dither(PixelAccessor pixels, TColor source, TColor upper, TColor lower, byte[] bytes, int index, int x, int y, int width, int height) - where TColor : struct, IPixel + public void Dither(PixelAccessor pixels, TPixel source, TPixel upper, TPixel lower, byte[] bytes, int index, int x, int y, int width, int height) + where TPixel : struct, IPixel { // TODO: This doesn't really cut it for me. // I'd rather be using float but we need to add some sort of movalization vector methods to all IPixel implementations diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs index da5d24637..94f045efa 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs @@ -26,13 +26,13 @@ namespace ImageSharp.Formats public class BmpDecoder : IImageDecoder { /// - public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) + public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + where TPixel : struct, IPixel { Guard.NotNull(stream, "stream"); - return new BmpDecoderCore(configuration).Decode(stream); + return new BmpDecoderCore(configuration).Decode(stream); } } } diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 18e4e858b..9f15bf0b2 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -58,15 +58,15 @@ namespace ImageSharp.Formats /// Decodes the image from the specified this._stream and sets /// the data to image. /// - /// The pixel format. + /// The pixel format. /// The stream, where the image should be /// decoded from. Cannot be null (Nothing in Visual Basic). /// /// is null. /// /// The decoded image. - public Image Decode(Stream stream) - where TColor : struct, IPixel + public Image Decode(Stream stream) + where TPixel : struct, IPixel { this.currentStream = stream; @@ -118,15 +118,15 @@ namespace ImageSharp.Formats this.currentStream.Read(palette, 0, colorMapSize); } - if (this.infoHeader.Width > Image.MaxWidth || this.infoHeader.Height > Image.MaxHeight) + if (this.infoHeader.Width > Image.MaxWidth || this.infoHeader.Height > Image.MaxHeight) { throw new ArgumentOutOfRangeException( $"The input bitmap '{this.infoHeader.Width}x{this.infoHeader.Height}' is " - + $"bigger then the max allowed size '{Image.MaxWidth}x{Image.MaxHeight}'"); + + $"bigger then the max allowed size '{Image.MaxWidth}x{Image.MaxHeight}'"); } - Image image = Image.Create(this.infoHeader.Width, this.infoHeader.Height, this.configuration); - using (PixelAccessor pixels = image.Lock()) + Image image = Image.Create(this.infoHeader.Width, this.infoHeader.Height, this.configuration); + using (PixelAccessor pixels = image.Lock()) { switch (this.infoHeader.Compression) { @@ -213,15 +213,15 @@ namespace ImageSharp.Formats /// /// Reads the color palette from the stream. /// - /// The pixel format. - /// The to assign the palette to. + /// The pixel format. + /// The to assign the palette to. /// The containing the colors. /// The width of the bitmap. /// The height of the bitmap. /// The number of bits per pixel. /// Whether the bitmap is inverted. - private void ReadRgbPalette(PixelAccessor pixels, byte[] colors, int width, int height, int bits, bool inverted) - where TColor : struct, IPixel + private void ReadRgbPalette(PixelAccessor pixels, byte[] colors, int width, int height, int bits, bool inverted) + where TPixel : struct, IPixel { // Pixels per byte (bits per pixel) int ppb = 8 / bits; @@ -239,7 +239,7 @@ namespace ImageSharp.Formats } byte[] row = new byte[arrayWidth + padding]; - TColor color = default(TColor); + TPixel color = default(TPixel); for (int y = 0; y < height; y++) { @@ -270,21 +270,21 @@ namespace ImageSharp.Formats /// /// Reads the 16 bit color palette from the stream /// - /// The pixel format. - /// The to assign the palette to. + /// The pixel format. + /// The to assign the palette to. /// The width of the bitmap. /// The height of the bitmap. /// Whether the bitmap is inverted. - private void ReadRgb16(PixelAccessor pixels, int width, int height, bool inverted) - where TColor : struct, IPixel + private void ReadRgb16(PixelAccessor pixels, int width, int height, bool inverted) + where TPixel : struct, IPixel { // We divide here as we will store the colors in our floating point format. const int ScaleR = 8; // 256/32 const int ScaleG = 4; // 256/64 const int ComponentCount = 2; - TColor color = default(TColor); - using (PixelArea row = new PixelArea(width, ComponentOrder.Xyz)) + TPixel color = default(TPixel); + using (PixelArea row = new PixelArea(width, ComponentOrder.Xyz)) { for (int y = 0; y < height; y++) { @@ -312,16 +312,16 @@ namespace ImageSharp.Formats /// /// Reads the 24 bit color palette from the stream /// - /// The pixel format. - /// The to assign the palette to. + /// The pixel format. + /// The to assign the palette to. /// The width of the bitmap. /// The height of the bitmap. /// Whether the bitmap is inverted. - private void ReadRgb24(PixelAccessor pixels, int width, int height, bool inverted) - where TColor : struct, IPixel + private void ReadRgb24(PixelAccessor pixels, int width, int height, bool inverted) + where TPixel : struct, IPixel { int padding = CalculatePadding(width, 3); - using (PixelArea row = new PixelArea(width, ComponentOrder.Zyx, padding)) + using (PixelArea row = new PixelArea(width, ComponentOrder.Zyx, padding)) { for (int y = 0; y < height; y++) { @@ -336,16 +336,16 @@ namespace ImageSharp.Formats /// /// Reads the 32 bit color palette from the stream /// - /// The pixel format. - /// The to assign the palette to. + /// The pixel format. + /// The to assign the palette to. /// The width of the bitmap. /// The height of the bitmap. /// Whether the bitmap is inverted. - private void ReadRgb32(PixelAccessor pixels, int width, int height, bool inverted) - where TColor : struct, IPixel + private void ReadRgb32(PixelAccessor pixels, int width, int height, bool inverted) + where TPixel : struct, IPixel { int padding = CalculatePadding(width, 4); - using (PixelArea row = new PixelArea(width, ComponentOrder.Zyxw, padding)) + using (PixelArea row = new PixelArea(width, ComponentOrder.Zyxw, padding)) { for (int y = 0; y < height; y++) { diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoder.cs b/src/ImageSharp/Formats/Bmp/BmpEncoder.cs index d0a3550f6..deca6cf2c 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoder.cs @@ -15,8 +15,8 @@ namespace ImageSharp.Formats public class BmpEncoder : IImageEncoder { /// - public void Encode(Image image, Stream stream, IEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IEncoderOptions options) + where TPixel : struct, IPixel { IBmpEncoderOptions bmpOptions = BmpEncoderOptions.Create(options); @@ -24,14 +24,14 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. /// The options for the encoder. - public void Encode(Image image, Stream stream, IBmpEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IBmpEncoderOptions options) + where TPixel : struct, IPixel { BmpEncoderCore encoder = new BmpEncoderCore(options); encoder.Encode(image, stream); diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs index df62fb6f4..634b3a784 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs @@ -35,13 +35,13 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. - public void Encode(ImageBase image, Stream stream) - where TColor : struct, IPixel + public void Encode(ImageBase image, Stream stream) + where TPixel : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -124,15 +124,15 @@ namespace ImageSharp.Formats /// /// Writes the pixel data to the binary stream. /// - /// The pixel format. + /// The pixel format. /// The containing the stream to write to. /// - /// The containing pixel data. + /// The containing pixel data. /// - private void WriteImage(EndianBinaryWriter writer, ImageBase image) - where TColor : struct, IPixel + private void WriteImage(EndianBinaryWriter writer, ImageBase image) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { switch (this.options.BitsPerPixel) { @@ -150,13 +150,13 @@ namespace ImageSharp.Formats /// /// Writes the 32bit color palette to the stream. /// - /// The pixel format. + /// The pixel format. /// The containing the stream to write to. - /// The containing pixel data. - private void Write32Bit(EndianBinaryWriter writer, PixelAccessor pixels) - where TColor : struct, IPixel + /// The containing pixel data. + private void Write32Bit(EndianBinaryWriter writer, PixelAccessor pixels) + where TPixel : struct, IPixel { - using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.Zyxw, this.padding)) + using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.Zyxw, this.padding)) { for (int y = pixels.Height - 1; y >= 0; y--) { @@ -169,13 +169,13 @@ namespace ImageSharp.Formats /// /// Writes the 24bit color palette to the stream. /// - /// The pixel format. + /// The pixel format. /// The containing the stream to write to. - /// The containing pixel data. - private void Write24Bit(EndianBinaryWriter writer, PixelAccessor pixels) - where TColor : struct, IPixel + /// The containing pixel data. + private void Write24Bit(EndianBinaryWriter writer, PixelAccessor pixels) + where TPixel : struct, IPixel { - using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.Zyx, this.padding)) + using (PixelArea row = new PixelArea(pixels.Width, ComponentOrder.Zyx, this.padding)) { for (int y = pixels.Height - 1; y >= 0; y--) { diff --git a/src/ImageSharp/Formats/Bmp/ImageExtensions.cs b/src/ImageSharp/Formats/Bmp/ImageExtensions.cs index 5b92b90d6..14d657c32 100644 --- a/src/ImageSharp/Formats/Bmp/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Bmp/ImageExtensions.cs @@ -11,22 +11,22 @@ namespace ImageSharp using Formats; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Saves the image to the given stream with the bmp format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsBmp(this Image source, Stream stream) - where TColor : struct, IPixel + public static Image SaveAsBmp(this Image source, Stream stream) + where TPixel : struct, IPixel => source.Save(stream, new BmpEncoder()); } } diff --git a/src/ImageSharp/Formats/Gif/GifDecoder.cs b/src/ImageSharp/Formats/Gif/GifDecoder.cs index 2eb89de8f..4ba06efe8 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoder.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoder.cs @@ -14,27 +14,27 @@ namespace ImageSharp.Formats public class GifDecoder : IImageDecoder { /// - public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) + public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + where TPixel : struct, IPixel { IGifDecoderOptions gifOptions = GifDecoderOptions.Create(options); - return this.Decode(configuration, stream, gifOptions); + return this.Decode(configuration, stream, gifOptions); } /// - /// Decodes the image from the specified stream to the . + /// Decodes the image from the specified stream to the . /// - /// The pixel format. + /// The pixel format. /// The configuration. /// The containing image data. /// The options for the decoder. /// The image thats been decoded. - public Image Decode(Configuration configuration, Stream stream, IGifDecoderOptions options) - where TColor : struct, IPixel + public Image Decode(Configuration configuration, Stream stream, IGifDecoderOptions options) + where TPixel : struct, IPixel { - return new GifDecoderCore(options, configuration).Decode(stream); + return new GifDecoderCore(options, configuration).Decode(stream); } } } diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index 4c119ca73..1ee2d152a 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -13,9 +13,9 @@ namespace ImageSharp.Formats /// /// Performs the gif decoding operation. /// - /// The pixel format. - internal class GifDecoderCore - where TColor : struct, IPixel + /// The pixel format. + internal class GifDecoderCore + where TPixel : struct, IPixel { /// /// The temp buffer used to reduce allocations. @@ -50,7 +50,7 @@ namespace ImageSharp.Formats /// /// The previous frame. /// - private ImageFrame previousFrame; + private ImageFrame previousFrame; /// /// The area to restore. @@ -75,10 +75,10 @@ namespace ImageSharp.Formats /// /// The image to decode the information to. /// - private Image image; + private Image image; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The decoder options. /// The configuration. @@ -93,7 +93,7 @@ namespace ImageSharp.Formats /// /// The stream containing image data. /// The decoded image - public Image Decode(Stream stream) + public Image Decode(Stream stream) { try { @@ -227,10 +227,10 @@ namespace ImageSharp.Formats } /* // No point doing this as the max width/height is always int.Max and that always bigger than the max size of a gif which is stored in a short. - if (this.logicalScreenDescriptor.Width > Image.MaxWidth || this.logicalScreenDescriptor.Height > Image.MaxHeight) + if (this.logicalScreenDescriptor.Width > Image.MaxWidth || this.logicalScreenDescriptor.Height > Image.MaxHeight) { throw new ArgumentOutOfRangeException( - $"The input gif '{this.logicalScreenDescriptor.Width}x{this.logicalScreenDescriptor.Height}' is bigger then the max allowed size '{Image.MaxWidth}x{Image.MaxHeight}'"); + $"The input gif '{this.logicalScreenDescriptor.Width}x{this.logicalScreenDescriptor.Height}' is bigger then the max allowed size '{Image.MaxWidth}x{Image.MaxHeight}'"); } */ } @@ -351,18 +351,18 @@ namespace ImageSharp.Formats int imageWidth = this.logicalScreenDescriptor.Width; int imageHeight = this.logicalScreenDescriptor.Height; - ImageFrame previousFrame = null; + ImageFrame previousFrame = null; - ImageFrame currentFrame = null; + ImageFrame currentFrame = null; - ImageBase image; + ImageBase image; if (this.previousFrame == null) { this.metaData.Quality = colorTableLength / 3; // This initializes the image to become fully transparent because the alpha channel is zero. - this.image = Image.Create(imageWidth, imageHeight, this.metaData, this.configuration); + this.image = Image.Create(imageWidth, imageHeight, this.metaData, this.configuration); this.SetFrameDelay(this.metaData); @@ -392,7 +392,7 @@ namespace ImageSharp.Formats int interlaceIncrement = 8; // The interlacing line increment int interlaceY = 0; // The current interlaced line - using (PixelAccessor pixelAccessor = image.Lock()) + using (PixelAccessor pixelAccessor = image.Lock()) { for (int y = descriptor.Top; y < descriptor.Top + descriptor.Height; y++) { @@ -441,7 +441,7 @@ namespace ImageSharp.Formats { int indexOffset = index * 3; - TColor pixel = default(TColor); + TPixel pixel = default(TPixel); pixel.PackFromBytes(colorTable[indexOffset], colorTable[indexOffset + 1], colorTable[indexOffset + 2], 255); pixelAccessor[x, writeY] = pixel; } @@ -470,7 +470,7 @@ namespace ImageSharp.Formats /// Restores the current frame area to the background. /// /// The frame. - private void RestoreToBackground(ImageBase frame) + private void RestoreToBackground(ImageBase frame) { if (this.restoreArea == null) { @@ -481,16 +481,16 @@ namespace ImageSharp.Formats if (this.restoreArea.Value.Width == this.image.Width && this.restoreArea.Value.Height == this.image.Height) { - using (PixelAccessor pixelAccessor = frame.Lock()) + using (PixelAccessor pixelAccessor = frame.Lock()) { pixelAccessor.Reset(); } } else { - using (PixelArea emptyRow = new PixelArea(this.restoreArea.Value.Width, ComponentOrder.Xyzw)) + using (PixelArea emptyRow = new PixelArea(this.restoreArea.Value.Width, ComponentOrder.Xyzw)) { - using (PixelAccessor pixelAccessor = frame.Lock()) + using (PixelAccessor pixelAccessor = frame.Lock()) { for (int y = this.restoreArea.Value.Top; y < this.restoreArea.Value.Top + this.restoreArea.Value.Height; y++) { diff --git a/src/ImageSharp/Formats/Gif/GifEncoder.cs b/src/ImageSharp/Formats/Gif/GifEncoder.cs index cc8516ed9..005ec1ee2 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoder.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoder.cs @@ -14,8 +14,8 @@ namespace ImageSharp.Formats public class GifEncoder : IImageEncoder { /// - public void Encode(Image image, Stream stream, IEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IEncoderOptions options) + where TPixel : struct, IPixel { IGifEncoderOptions gifOptions = GifEncoderOptions.Create(options); @@ -23,14 +23,14 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. /// The options for the encoder. - public void Encode(Image image, Stream stream, IGifEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IGifEncoderOptions options) + where TPixel : struct, IPixel { GifEncoderCore encoder = new GifEncoderCore(options); encoder.Encode(image, stream); diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 38cbba850..dec0dc411 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -48,18 +48,18 @@ namespace ImageSharp.Formats public IQuantizer Quantizer { get; set; } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. - public void Encode(Image image, Stream stream) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream) + where TPixel : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); - this.Quantizer = this.options.Quantizer ?? new OctreeQuantizer(); + this.Quantizer = this.options.Quantizer ?? new OctreeQuantizer(); // Do not use IDisposable pattern here as we want to preserve the stream. EndianBinaryWriter writer = new EndianBinaryWriter(Endianness.LittleEndian, stream); @@ -72,7 +72,7 @@ namespace ImageSharp.Formats this.bitDepth = ImageMaths.GetBitsNeededForColorDepth(quality); // Quantize the image returning a palette. - QuantizedImage quantized = ((IQuantizer)this.Quantizer).Quantize(image, quality); + QuantizedImage quantized = ((IQuantizer)this.Quantizer).Quantize(image, quality); int index = this.GetTransparentIndex(quantized); @@ -97,8 +97,8 @@ namespace ImageSharp.Formats // ReSharper disable once ForCanBeConvertedToForeach for (int i = 0; i < image.Frames.Count; i++) { - ImageFrame frame = image.Frames[i]; - QuantizedImage quantizedFrame = ((IQuantizer)this.Quantizer).Quantize(frame, quality); + ImageFrame frame = image.Frames[i]; + QuantizedImage quantizedFrame = ((IQuantizer)this.Quantizer).Quantize(frame, quality); this.WriteGraphicalControlExtension(frame, writer, this.GetTransparentIndex(quantizedFrame)); this.WriteImageDescriptor(frame, writer); @@ -117,12 +117,12 @@ namespace ImageSharp.Formats /// /// The quantized. /// - /// The pixel format. + /// The pixel format. /// /// The . /// - private int GetTransparentIndex(QuantizedImage quantized) - where TColor : struct, IPixel + private int GetTransparentIndex(QuantizedImage quantized) + where TPixel : struct, IPixel { // Find the lowest alpha value and make it the transparent index. int index = 255; @@ -167,12 +167,12 @@ namespace ImageSharp.Formats /// /// Writes the logical screen descriptor to the stream. /// - /// The pixel format. + /// The pixel format. /// The image to encode. /// The writer to write to the stream with. /// The transparency index to set the default background index to. - private void WriteLogicalScreenDescriptor(Image image, EndianBinaryWriter writer, int tranparencyIndex) - where TColor : struct, IPixel + private void WriteLogicalScreenDescriptor(Image image, EndianBinaryWriter writer, int tranparencyIndex) + where TPixel : struct, IPixel { GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor { @@ -233,11 +233,11 @@ namespace ImageSharp.Formats /// /// Writes the image comments to the stream. /// - /// The pixel format. - /// The to be encoded. + /// The pixel format. + /// The to be encoded. /// The stream to write to. - private void WriteComments(Image image, EndianBinaryWriter writer) - where TColor : struct, IPixel + private void WriteComments(Image image, EndianBinaryWriter writer) + where TPixel : struct, IPixel { if (this.options.IgnoreMetadata == true) { @@ -266,12 +266,12 @@ namespace ImageSharp.Formats /// /// Writes the graphics control extension to the stream. /// - /// The pixel format. - /// The to encode. + /// The pixel format. + /// The to encode. /// The stream to write to. /// The index of the color in the color palette to make transparent. - private void WriteGraphicalControlExtension(Image image, EndianBinaryWriter writer, int transparencyIndex) - where TColor : struct, IPixel + private void WriteGraphicalControlExtension(Image image, EndianBinaryWriter writer, int transparencyIndex) + where TPixel : struct, IPixel { this.WriteGraphicalControlExtension(image, image.MetaData, writer, transparencyIndex); } @@ -279,12 +279,12 @@ namespace ImageSharp.Formats /// /// Writes the graphics control extension to the stream. /// - /// The pixel format. - /// The to encode. + /// The pixel format. + /// The to encode. /// The stream to write to. /// The index of the color in the color palette to make transparent. - private void WriteGraphicalControlExtension(ImageFrame imageFrame, EndianBinaryWriter writer, int transparencyIndex) - where TColor : struct, IPixel + private void WriteGraphicalControlExtension(ImageFrame imageFrame, EndianBinaryWriter writer, int transparencyIndex) + where TPixel : struct, IPixel { this.WriteGraphicalControlExtension(imageFrame, imageFrame.MetaData, writer, transparencyIndex); } @@ -292,13 +292,13 @@ namespace ImageSharp.Formats /// /// Writes the graphics control extension to the stream. /// - /// The pixel format. - /// The to encode. + /// The pixel format. + /// The to encode. /// The metadata of the image or frame. /// The stream to write to. /// The index of the color in the color palette to make transparent. - private void WriteGraphicalControlExtension(ImageBase image, IMetaData metaData, EndianBinaryWriter writer, int transparencyIndex) - where TColor : struct, IPixel + private void WriteGraphicalControlExtension(ImageBase image, IMetaData metaData, EndianBinaryWriter writer, int transparencyIndex) + where TPixel : struct, IPixel { // TODO: Check transparency logic. bool hasTransparent = transparencyIndex < 255; @@ -336,11 +336,11 @@ namespace ImageSharp.Formats /// /// Writes the image descriptor to the stream. /// - /// The pixel format. - /// The to be encoded. + /// The pixel format. + /// The to be encoded. /// The stream to write to. - private void WriteImageDescriptor(ImageBase image, EndianBinaryWriter writer) - where TColor : struct, IPixel + private void WriteImageDescriptor(ImageBase image, EndianBinaryWriter writer) + where TPixel : struct, IPixel { writer.Write(GifConstants.ImageDescriptorLabel); // 2c @@ -362,11 +362,11 @@ namespace ImageSharp.Formats /// /// Writes the color table to the stream. /// - /// The pixel format. - /// The to encode. + /// The pixel format. + /// The to encode. /// The writer to write to the stream with. - private void WriteColorTable(QuantizedImage image, EndianBinaryWriter writer) - where TColor : struct, IPixel + private void WriteColorTable(QuantizedImage image, EndianBinaryWriter writer) + where TPixel : struct, IPixel { // Grab the palette and write it to the stream. int pixelCount = image.Palette.Length; @@ -397,11 +397,11 @@ namespace ImageSharp.Formats /// /// Writes the image pixel data to the stream. /// - /// The pixel format. - /// The containing indexed pixels. + /// The pixel format. + /// The containing indexed pixels. /// The stream to write to. - private void WriteImageData(QuantizedImage image, EndianBinaryWriter writer) - where TColor : struct, IPixel + private void WriteImageData(QuantizedImage image, EndianBinaryWriter writer) + where TPixel : struct, IPixel { using (LzwEncoder encoder = new LzwEncoder(image.Pixels, (byte)this.bitDepth)) { diff --git a/src/ImageSharp/Formats/Gif/ImageExtensions.cs b/src/ImageSharp/Formats/Gif/ImageExtensions.cs index 1ba03ed35..523086ded 100644 --- a/src/ImageSharp/Formats/Gif/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Gif/ImageExtensions.cs @@ -11,22 +11,22 @@ namespace ImageSharp using Formats; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Saves the image to the given stream with the gif format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsGif(this Image source, Stream stream) - where TColor : struct, IPixel + public static Image SaveAsGif(this Image source, Stream stream) + where TPixel : struct, IPixel { return SaveAsGif(source, stream, null); } @@ -34,16 +34,16 @@ namespace ImageSharp /// /// Saves the image to the given stream with the gif format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// The options for the encoder. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsGif(this Image source, Stream stream, IGifEncoderOptions options) - where TColor : struct, IPixel + public static Image SaveAsGif(this Image source, Stream stream, IGifEncoderOptions options) + where TPixel : struct, IPixel { GifEncoder encoder = new GifEncoder(); encoder.Encode(source, stream, options); diff --git a/src/ImageSharp/Formats/IImageDecoder.cs b/src/ImageSharp/Formats/IImageDecoder.cs index c85fbef10..2f71108a7 100644 --- a/src/ImageSharp/Formats/IImageDecoder.cs +++ b/src/ImageSharp/Formats/IImageDecoder.cs @@ -14,14 +14,14 @@ namespace ImageSharp.Formats public interface IImageDecoder { /// - /// Decodes the image from the specified stream to the . + /// Decodes the image from the specified stream to the . /// - /// The pixel format. + /// The pixel format. /// The configuration for the image. /// The containing image data. /// The options for the decoder. /// The decoded image - Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel; + Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) + where TPixel : struct, IPixel; } } diff --git a/src/ImageSharp/Formats/IImageEncoder.cs b/src/ImageSharp/Formats/IImageEncoder.cs index 918f0d273..222fb6ed6 100644 --- a/src/ImageSharp/Formats/IImageEncoder.cs +++ b/src/ImageSharp/Formats/IImageEncoder.cs @@ -14,13 +14,13 @@ namespace ImageSharp.Formats public interface IImageEncoder { /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. /// The options for the encoder. - void Encode(Image image, Stream stream, IEncoderOptions options) - where TColor : struct, IPixel; + void Encode(Image image, Stream stream, IEncoderOptions options) + where TPixel : struct, IPixel; } } diff --git a/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs b/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs index 351275ebb..e52d43625 100644 --- a/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs @@ -11,22 +11,22 @@ namespace ImageSharp using Formats; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Saves the image to the given stream with the jpeg format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsJpeg(this Image source, Stream stream) - where TColor : struct, IPixel + public static Image SaveAsJpeg(this Image source, Stream stream) + where TPixel : struct, IPixel { return SaveAsJpeg(source, stream, null); } @@ -34,16 +34,16 @@ namespace ImageSharp /// /// Saves the image to the given stream with the jpeg format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// The options for the encoder. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsJpeg(this Image source, Stream stream, IJpegEncoderOptions options) - where TColor : struct, IPixel + public static Image SaveAsJpeg(this Image source, Stream stream, IJpegEncoderOptions options) + where TPixel : struct, IPixel { JpegEncoder encoder = new JpegEncoder(); encoder.Encode(source, stream, options); diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs index 0aac31603..97593a0a3 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs @@ -14,14 +14,14 @@ namespace ImageSharp.Formats public class JpegDecoder : IImageDecoder { /// - public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) + where TPixel : struct, IPixel { Guard.NotNull(stream, "stream"); using (JpegDecoderCore decoder = new JpegDecoderCore(options, configuration)) { - return decoder.Decode(stream); + return decoder.Decode(stream); } } } diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index 33533aa12..ccc6b91bb 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -121,7 +121,7 @@ namespace ImageSharp.Formats /// /// Gets the array of -s storing the "raw" frequency-domain decoded blocks. /// We need to apply IDCT, dequantiazition and unzigging to transform them into color-space blocks. - /// This is done by . + /// This is done by . /// When ==true, we are touching these blocks multiple times - each time we process a Scan. /// public DecodedBlockArray[] DecodedBlocks { get; } @@ -186,16 +186,16 @@ namespace ImageSharp.Formats /// Decodes the image from the specified and sets /// the data to image. /// - /// The pixel format. + /// The pixel format. /// The stream, where the image should be. /// The decoded image. - public Image Decode(Stream stream) - where TColor : struct, IPixel + public Image Decode(Stream stream) + where TPixel : struct, IPixel { ImageMetaData metadata = new ImageMetaData(); this.ProcessStream(metadata, stream, false); - this.ProcessBlocksIntoJpegImageChannels(); - Image image = this.ConvertJpegPixelsToImagePixels(metadata); + this.ProcessBlocksIntoJpegImageChannels(); + Image image = this.ConvertJpegPixelsToImagePixels(metadata); return image; } @@ -254,14 +254,14 @@ namespace ImageSharp.Formats /// Optimized method to pack bytes to the image from the YCbCr color space. /// This is faster than implicit casting as it avoids double packing. /// - /// The pixel format. + /// The pixel format. /// The packed pixel. /// The y luminance component. /// The cb chroma component. /// The cr chroma component. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void PackYcbCr(ref TColor packed, byte y, byte cb, byte cr) - where TColor : struct, IPixel + private static void PackYcbCr(ref TPixel packed, byte y, byte cb, byte cr) + where TPixel : struct, IPixel { int ccb = cb - 128; int ccr = cr - 128; @@ -481,9 +481,9 @@ namespace ImageSharp.Formats /// are in a "raw" frequency-domain form. We need to apply IDCT, dequantization and unzigging to transform them into color-space blocks. /// We can copy these blocks into -s afterwards. /// - /// The pixel type - private void ProcessBlocksIntoJpegImageChannels() - where TColor : struct, IPixel + /// The pixel type + private void ProcessBlocksIntoJpegImageChannels() + where TPixel : struct, IPixel { Parallel.For( 0, @@ -497,15 +497,15 @@ namespace ImageSharp.Formats } /// - /// Convert the pixel data in and/or into pixels of + /// Convert the pixel data in and/or into pixels of /// - /// The pixel type + /// The pixel type /// The metadata for the image. /// The decoded image. - private Image ConvertJpegPixelsToImagePixels(ImageMetaData metadata) - where TColor : struct, IPixel + private Image ConvertJpegPixelsToImagePixels(ImageMetaData metadata) + where TPixel : struct, IPixel { - Image image = Image.Create(this.ImageWidth, this.ImageHeight, metadata, this.configuration); + Image image = Image.Create(this.ImageWidth, this.ImageHeight, metadata, this.configuration); if (this.grayImage.IsInitialized) { @@ -561,10 +561,10 @@ namespace ImageSharp.Formats /// /// Assigns the horizontal and vertical resolution to the image if it has a JFIF header. /// - /// The pixel format. + /// The pixel format. /// The image to assign the resolution to. - private void AssignResolution(Image image) - where TColor : struct, IPixel + private void AssignResolution(Image image) + where TPixel : struct, IPixel { if (this.isJfif && this.horizontalResolution > 0 && this.verticalResolution > 0) { @@ -589,14 +589,14 @@ namespace ImageSharp.Formats /// /// Converts the image from the original CMYK image pixels. /// - /// The pixel format. + /// The pixel format. /// The image. - private void ConvertFromCmyk(Image image) - where TColor : struct, IPixel + private void ConvertFromCmyk(Image image) + where TPixel : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { Parallel.For( 0, @@ -613,7 +613,7 @@ namespace ImageSharp.Formats byte magenta = this.ycbcrImage.CbChannel.Pixels[co + (x / scale)]; byte yellow = this.ycbcrImage.CrChannel.Pixels[co + (x / scale)]; - TColor packed = default(TColor); + TPixel packed = default(TPixel); this.PackCmyk(ref packed, cyan, magenta, yellow, x, y); pixels[x, y] = packed; } @@ -626,12 +626,12 @@ namespace ImageSharp.Formats /// /// Converts the image from the original grayscale image pixels. /// - /// The pixel format. + /// The pixel format. /// The image. - private void ConvertFromGrayScale(Image image) - where TColor : struct, IPixel + private void ConvertFromGrayScale(Image image) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { Parallel.For( 0, @@ -644,7 +644,7 @@ namespace ImageSharp.Formats { byte rgb = this.grayImage.Pixels[yoff + x]; - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromBytes(rgb, rgb, rgb, 255); pixels[x, y] = packed; } @@ -657,14 +657,14 @@ namespace ImageSharp.Formats /// /// Converts the image from the original RBG image pixels. /// - /// The pixel format. + /// The pixel format. /// The image. - private void ConvertFromRGB(Image image) - where TColor : struct, IPixel + private void ConvertFromRGB(Image image) + where TPixel : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { Parallel.For( 0, @@ -682,7 +682,7 @@ namespace ImageSharp.Formats byte green = this.ycbcrImage.CbChannel.Pixels[co + (x / scale)]; byte blue = this.ycbcrImage.CrChannel.Pixels[co + (x / scale)]; - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromBytes(red, green, blue, 255); pixels[x, y] = packed; } @@ -695,13 +695,13 @@ namespace ImageSharp.Formats /// /// Converts the image from the original YCbCr image pixels. /// - /// The pixel format. + /// The pixel format. /// The image. - private void ConvertFromYCbCr(Image image) - where TColor : struct, IPixel + private void ConvertFromYCbCr(Image image) + where TPixel : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { Parallel.For( 0, @@ -719,8 +719,8 @@ namespace ImageSharp.Formats byte cb = this.ycbcrImage.CbChannel.Pixels[co + (x / scale)]; byte cr = this.ycbcrImage.CrChannel.Pixels[co + (x / scale)]; - TColor packed = default(TColor); - PackYcbCr(ref packed, yy, cb, cr); + TPixel packed = default(TPixel); + PackYcbCr(ref packed, yy, cb, cr); pixels[x, y] = packed; } }); @@ -732,14 +732,14 @@ namespace ImageSharp.Formats /// /// Converts the image from the original YCCK image pixels. /// - /// The pixel format. + /// The pixel format. /// The image. - private void ConvertFromYcck(Image image) - where TColor : struct, IPixel + private void ConvertFromYcck(Image image) + where TPixel : struct, IPixel { int scale = this.ComponentArray[0].HorizontalFactor / this.ComponentArray[1].HorizontalFactor; - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { Parallel.For( 0, @@ -756,7 +756,7 @@ namespace ImageSharp.Formats byte cb = this.ycbcrImage.CbChannel.Pixels[co + (x / scale)]; byte cr = this.ycbcrImage.CrChannel.Pixels[co + (x / scale)]; - TColor packed = default(TColor); + TPixel packed = default(TPixel); this.PackYcck(ref packed, yy, cb, cr, x, y); pixels[x, y] = packed; } @@ -850,15 +850,15 @@ namespace ImageSharp.Formats /// Optimized method to pack bytes to the image from the CMYK color space. /// This is faster than implicit casting as it avoids double packing. /// - /// The pixel format. + /// The pixel format. /// The packed pixel. /// The cyan component. /// The magenta component. /// The yellow component. /// The x-position within the image. /// The y-position within the image. - private void PackCmyk(ref TColor packed, byte c, byte m, byte y, int xx, int yy) - where TColor : struct, IPixel + private void PackCmyk(ref TPixel packed, byte c, byte m, byte y, int xx, int yy) + where TPixel : struct, IPixel { // Get keyline float keyline = (255 - this.blackImage[xx, yy]) / 255F; @@ -875,15 +875,15 @@ namespace ImageSharp.Formats /// Optimized method to pack bytes to the image from the YCCK color space. /// This is faster than implicit casting as it avoids double packing. /// - /// The pixel format. + /// The pixel format. /// The packed pixel. /// The y luminance component. /// The cb chroma component. /// The cr chroma component. /// The x-position within the image. /// The y-position within the image. - private void PackYcck(ref TColor packed, byte y, byte cb, byte cr, int xx, int yy) - where TColor : struct, IPixel + private void PackYcck(ref TPixel packed, byte y, byte cb, byte cr, int xx, int yy) + where TPixel : struct, IPixel { // Convert the YCbCr part of the YCbCrK to RGB, invert the RGB to get // CMY, and patch in the original K. The RGB to CMY inversion cancels diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs index 2f2823fa2..dd467462b 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs @@ -13,8 +13,8 @@ namespace ImageSharp.Formats public class JpegEncoder : IImageEncoder { /// - public void Encode(Image image, Stream stream, IEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IEncoderOptions options) + where TPixel : struct, IPixel { IJpegEncoderOptions gifOptions = JpegEncoderOptions.Create(options); @@ -22,14 +22,14 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. /// The options for the encoder. - public void Encode(Image image, Stream stream, IJpegEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IJpegEncoderOptions options) + where TPixel : struct, IPixel { JpegEncoderCore encode = new JpegEncoderCore(options); encode.Encode(image, stream); diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs index c3cf75a0f..e29b5474b 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs @@ -165,11 +165,11 @@ namespace ImageSharp.Formats /// /// Encode writes the image to the jpeg baseline format with the given options. /// - /// The pixel format. + /// The pixel format. /// The image to write from. /// The stream to write to. - public void Encode(Image image, Stream stream) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream) + where TPixel : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -225,7 +225,7 @@ namespace ImageSharp.Formats this.WriteDefineHuffmanTables(componentCount); // Write the image data. - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { this.WriteStartOfScan(pixels); } @@ -282,23 +282,23 @@ namespace ImageSharp.Formats /// /// Converts the 8x8 region of the image whose top-left corner is x,y to its YCbCr values. /// - /// The pixel format. + /// The pixel format. /// The pixel accessor. /// The x-position within the image. /// The y-position within the image. /// The luminance block. /// The red chroma block. /// The blue chroma block. - /// Temporal provided by the caller - private static void ToYCbCr( - PixelAccessor pixels, + /// Temporal provided by the caller + private static void ToYCbCr( + PixelAccessor pixels, int x, int y, Block8x8F* yBlock, Block8x8F* cbBlock, Block8x8F* crBlock, - PixelArea rgbBytes) - where TColor : struct, IPixel + PixelArea rgbBytes) + where TPixel : struct, IPixel { float* yBlockRaw = (float*)yBlock; float* cbBlockRaw = (float*)cbBlock; @@ -442,12 +442,12 @@ namespace ImageSharp.Formats /// /// Encodes the image with no subsampling. /// - /// The pixel format. + /// The pixel format. /// The pixel accessor providing access to the image pixels. - private void Encode444(PixelAccessor pixels) - where TColor : struct, IPixel + private void Encode444(PixelAccessor pixels) + where TPixel : struct, IPixel { - // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) + // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) Block8x8F b = default(Block8x8F); Block8x8F cb = default(Block8x8F); Block8x8F cr = default(Block8x8F); @@ -463,7 +463,7 @@ namespace ImageSharp.Formats // ReSharper disable once InconsistentNaming int prevDCY = 0, prevDCCb = 0, prevDCCr = 0; - using (PixelArea rgbBytes = new PixelArea(8, 8, ComponentOrder.Xyz)) + using (PixelArea rgbBytes = new PixelArea(8, 8, ComponentOrder.Xyz)) { for (int y = 0; y < pixels.Height; y += 8) { @@ -714,9 +714,9 @@ namespace ImageSharp.Formats /// Writes the metadata profiles to the image. /// /// The image. - /// The pixel format. - private void WriteProfiles(Image image) - where TColor : struct, IPixel + /// The pixel format. + private void WriteProfiles(Image image) + where TPixel : struct, IPixel { if (this.options.IgnoreMetadata) { @@ -786,12 +786,12 @@ namespace ImageSharp.Formats /// /// Writes the StartOfScan marker. /// - /// The pixel format. + /// The pixel format. /// The pixel accessor providing access to the image pixels. - private void WriteStartOfScan(PixelAccessor pixels) - where TColor : struct, IPixel + private void WriteStartOfScan(PixelAccessor pixels) + where TPixel : struct, IPixel { - // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) + // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) // TODO: We should allow grayscale writing. this.outputStream.Write(SosHeaderYCbCr, 0, SosHeaderYCbCr.Length); @@ -813,12 +813,12 @@ namespace ImageSharp.Formats /// Encodes the image with subsampling. The Cb and Cr components are each subsampled /// at a factor of 2 both horizontally and vertically. /// - /// The pixel format. + /// The pixel format. /// The pixel accessor providing access to the image pixels. - private void Encode420(PixelAccessor pixels) - where TColor : struct, IPixel + private void Encode420(PixelAccessor pixels) + where TPixel : struct, IPixel { - // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) + // TODO: Need a JpegScanEncoder class or struct that encapsulates the scan-encoding implementation. (Similar to JpegScanDecoder.) Block8x8F b = default(Block8x8F); BlockQuad cb = default(BlockQuad); @@ -837,7 +837,7 @@ namespace ImageSharp.Formats // ReSharper disable once InconsistentNaming int prevDCY = 0, prevDCCb = 0, prevDCCr = 0; - using (PixelArea rgbBytes = new PixelArea(8, 8, ComponentOrder.Xyz)) + using (PixelArea rgbBytes = new PixelArea(8, 8, ComponentOrder.Xyz)) { for (int y = 0; y < pixels.Height; y += 16) { diff --git a/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs b/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs index ace309812..73918c060 100644 --- a/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs +++ b/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs @@ -16,17 +16,17 @@ namespace ImageSharp.Formats.Jpg /// /// Copy a region of an image into dest. De "outlier" area will be stretched out with pixels on the right and bottom of the image. /// - /// The pixel type + /// The pixel type /// The input pixel acessor - /// The destination + /// The destination /// Starting Y coord /// Starting X coord - public static void CopyRGBBytesStretchedTo( - this PixelAccessor pixels, - PixelArea dest, + public static void CopyRGBBytesStretchedTo( + this PixelAccessor pixels, + PixelArea dest, int sourceY, int sourceX) - where TColor : struct, IPixel + where TPixel : struct, IPixel { pixels.SafeCopyTo(dest, sourceY, sourceX); int stretchFromX = pixels.Width - sourceX; @@ -36,14 +36,14 @@ namespace ImageSharp.Formats.Jpg // Nothing to stretch if (fromX, fromY) is outside the area, or is at (0,0) [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsInvalidStretchStartingPosition(PixelArea area, int fromX, int fromY) - where TColor : struct, IPixel + private static bool IsInvalidStretchStartingPosition(PixelArea area, int fromX, int fromY) + where TPixel : struct, IPixel { return fromX <= 0 || fromY <= 0 || fromX >= area.Width || fromY >= area.Height; } - private static void StretchPixels(PixelArea area, int fromX, int fromY) - where TColor : struct, IPixel + private static void StretchPixels(PixelArea area, int fromX, int fromY) + where TPixel : struct, IPixel { if (IsInvalidStretchStartingPosition(area, fromX, fromY)) { @@ -75,8 +75,8 @@ namespace ImageSharp.Formats.Jpg } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static ref RGB24 GetRowStart(PixelArea area, int y) - where TColor : struct, IPixel + private static ref RGB24 GetRowStart(PixelArea area, int y) + where TPixel : struct, IPixel { return ref Unsafe.As(ref area.GetRowSpan(y).DangerousGetPinnableReference()); } diff --git a/src/ImageSharp/Formats/Png/ImageExtensions.cs b/src/ImageSharp/Formats/Png/ImageExtensions.cs index 79e96175c..277a3397e 100644 --- a/src/ImageSharp/Formats/Png/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Png/ImageExtensions.cs @@ -10,22 +10,22 @@ namespace ImageSharp using Formats; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Saves the image to the given stream with the png format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsPng(this Image source, Stream stream) - where TColor : struct, IPixel + public static Image SaveAsPng(this Image source, Stream stream) + where TPixel : struct, IPixel { return SaveAsPng(source, stream, null); } @@ -33,16 +33,16 @@ namespace ImageSharp /// /// Saves the image to the given stream with the png format. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The stream to save the image to. /// The options for the encoder. /// Thrown if the stream is null. /// - /// The . + /// The . /// - public static Image SaveAsPng(this Image source, Stream stream, IPngEncoderOptions options) - where TColor : struct, IPixel + public static Image SaveAsPng(this Image source, Stream stream, IPngEncoderOptions options) + where TPixel : struct, IPixel { PngEncoder encoder = new PngEncoder(); encoder.Encode(source, stream, options); diff --git a/src/ImageSharp/Formats/Png/PngDecoder.cs b/src/ImageSharp/Formats/Png/PngDecoder.cs index d0a820c17..8dd9168f4 100644 --- a/src/ImageSharp/Formats/Png/PngDecoder.cs +++ b/src/ImageSharp/Formats/Png/PngDecoder.cs @@ -31,27 +31,27 @@ namespace ImageSharp.Formats public class PngDecoder : IImageDecoder { /// - public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) + public Image Decode(Configuration configuration, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + where TPixel : struct, IPixel { IPngDecoderOptions pngOptions = PngDecoderOptions.Create(options); - return this.Decode(configuration, stream, pngOptions); + return this.Decode(configuration, stream, pngOptions); } /// - /// Decodes the image from the specified stream to the . + /// Decodes the image from the specified stream to the . /// - /// The pixel format. + /// The pixel format. /// The configuration for the image. /// The containing image data. /// The options for the decoder. /// The decoded image. - public Image Decode(Configuration configuration, Stream stream, IPngDecoderOptions options) - where TColor : struct, IPixel + public Image Decode(Configuration configuration, Stream stream, IPngDecoderOptions options) + where TPixel : struct, IPixel { - return new PngDecoderCore(options, configuration).Decode(stream); + return new PngDecoderCore(options, configuration).Decode(stream); } } } diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 5ce9b5eb0..d64978385 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -154,7 +154,7 @@ namespace ImageSharp.Formats /// /// Decodes the stream to the image. /// - /// The pixel format. + /// The pixel format. /// The stream containing image data. /// /// Thrown if the stream does not contain and end chunk. @@ -163,8 +163,8 @@ namespace ImageSharp.Formats /// Thrown if the image is larger than the maximum allowable size. /// /// The decoded image - public Image Decode(Stream stream) - where TColor : struct, IPixel + public Image Decode(Stream stream) + where TPixel : struct, IPixel { ImageMetaData metadata = new ImageMetaData(); this.currentStream = stream; @@ -215,14 +215,14 @@ namespace ImageSharp.Formats } } - if (this.header.Width > Image.MaxWidth || this.header.Height > Image.MaxHeight) + if (this.header.Width > Image.MaxWidth || this.header.Height > Image.MaxHeight) { - throw new ArgumentOutOfRangeException($"The input png '{this.header.Width}x{this.header.Height}' is bigger than the max allowed size '{Image.MaxWidth}x{Image.MaxHeight}'"); + throw new ArgumentOutOfRangeException($"The input png '{this.header.Width}x{this.header.Height}' is bigger than the max allowed size '{Image.MaxWidth}x{Image.MaxHeight}'"); } - Image image = Image.Create(this.header.Width, this.header.Height, metadata, this.configuration); + Image image = Image.Create(this.header.Width, this.header.Height, metadata, this.configuration); - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { this.ReadScanlines(dataStream, pixels); } @@ -340,11 +340,11 @@ namespace ImageSharp.Formats /// /// Reads the scanlines within the image. /// - /// The pixel format. + /// The pixel format. /// The containing data. /// The pixel data. - private void ReadScanlines(MemoryStream dataStream, PixelAccessor pixels) - where TColor : struct, IPixel + private void ReadScanlines(MemoryStream dataStream, PixelAccessor pixels) + where TPixel : struct, IPixel { this.bytesPerPixel = this.CalculateBytesPerPixel(); this.bytesPerScanline = this.CalculateScanlineLength(this.header.Width) + 1; @@ -371,11 +371,11 @@ namespace ImageSharp.Formats /// /// Decodes the raw pixel data row by row /// - /// The pixel format. + /// The pixel format. /// The compressed pixel data stream. /// The image pixel accessor. - private void DecodePixelData(Stream compressedStream, PixelAccessor pixels) - where TColor : struct, IPixel + private void DecodePixelData(Stream compressedStream, PixelAccessor pixels) + where TPixel : struct, IPixel { byte[] previousScanline = ArrayPool.Shared.Rent(this.bytesPerScanline); byte[] scanline = ArrayPool.Shared.Rent(this.bytesPerScanline); @@ -444,11 +444,11 @@ namespace ImageSharp.Formats /// Decodes the raw interlaced pixel data row by row /// /// - /// The pixel format. + /// The pixel format. /// The compressed pixel data stream. /// The image pixel accessor. - private void DecodeInterlacedPixelData(Stream compressedStream, PixelAccessor pixels) - where TColor : struct, IPixel + private void DecodeInterlacedPixelData(Stream compressedStream, PixelAccessor pixels) + where TPixel : struct, IPixel { byte[] previousScanline = ArrayPool.Shared.Rent(this.bytesPerScanline); byte[] scanline = ArrayPool.Shared.Rent(this.bytesPerScanline); @@ -532,14 +532,14 @@ namespace ImageSharp.Formats /// /// Processes the de-filtered scanline filling the image pixel data /// - /// The pixel format. + /// The pixel format. /// The de-filtered scanline /// The current image row. /// The image pixels - private void ProcessDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels) - where TColor : struct, IPixel + private void ProcessDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels) + where TPixel : struct, IPixel { - TColor color = default(TColor); + TPixel color = default(TPixel); switch (this.PngColorType) { case PngColorType.Grayscale: @@ -655,16 +655,16 @@ namespace ImageSharp.Formats /// /// Processes the interlaced de-filtered scanline filling the image pixel data /// - /// The pixel format. + /// The pixel format. /// The de-filtered scanline /// The current image row. /// The image pixels /// The column start index. Always 0 for none interlaced images. /// The column increment. Always 1 for none interlaced images. - private void ProcessInterlacedDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels, int pixelOffset = 0, int increment = 1) - where TColor : struct, IPixel + private void ProcessInterlacedDefilteredScanline(byte[] defilteredScanline, int row, PixelAccessor pixels, int pixelOffset = 0, int increment = 1) + where TPixel : struct, IPixel { - TColor color = default(TColor); + TPixel color = default(TPixel); switch (this.PngColorType) { diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs index e583f381f..a74916f2f 100644 --- a/src/ImageSharp/Formats/Png/PngEncoder.cs +++ b/src/ImageSharp/Formats/Png/PngEncoder.cs @@ -13,8 +13,8 @@ namespace ImageSharp.Formats public class PngEncoder : IImageEncoder { /// - public void Encode(Image image, Stream stream, IEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IEncoderOptions options) + where TPixel : struct, IPixel { IPngEncoderOptions pngOptions = PngEncoderOptions.Create(options); @@ -22,14 +22,14 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. /// The options for the encoder. - public void Encode(Image image, Stream stream, IPngEncoderOptions options) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IPngEncoderOptions options) + where TPixel : struct, IPixel { PngEncoderCore encode = new PngEncoderCore(options); encode.Encode(image, stream); diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index c11fc94df..e17902b5a 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -114,13 +114,13 @@ namespace ImageSharp.Formats } /// - /// Encodes the image to the specified stream from the . + /// Encodes the image to the specified stream from the . /// - /// The pixel format. - /// The to encode from. + /// The pixel format. + /// The to encode from. /// The to encode the image data to. - public void Encode(Image image, Stream stream) - where TColor : struct, IPixel + public void Encode(Image image, Stream stream) + where TPixel : struct, IPixel { Guard.NotNull(image, nameof(image)); Guard.NotNull(stream, nameof(stream)); @@ -196,7 +196,7 @@ namespace ImageSharp.Formats this.WritePhysicalChunk(stream, image); this.WriteGammaChunk(stream); - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { this.WriteDataChunks(pixels, stream); } @@ -248,27 +248,27 @@ namespace ImageSharp.Formats /// /// Collects the indexed pixel data. /// - /// The pixel format. + /// The pixel format. /// The image to encode. /// The containing image data. /// The . - private void CollectIndexedBytes(ImageBase image, Stream stream, PngHeader header) - where TColor : struct, IPixel + private void CollectIndexedBytes(ImageBase image, Stream stream, PngHeader header) + where TPixel : struct, IPixel { // Quantize the image and get the pixels. - QuantizedImage quantized = this.WritePaletteChunk(stream, header, image); + QuantizedImage quantized = this.WritePaletteChunk(stream, header, image); this.palettePixelData = quantized.Pixels; } /// /// Collects a row of grayscale pixels. /// - /// The pixel format. + /// The pixel format. /// The image pixels accessor. /// The row index. /// The raw scanline. - private void CollectGrayscaleBytes(PixelAccessor pixels, int row, byte[] rawScanline) - where TColor : struct, IPixel + private void CollectGrayscaleBytes(PixelAccessor pixels, int row, byte[] rawScanline) + where TPixel : struct, IPixel { // Copy the pixels across from the image. // Reuse the chunk type buffer. @@ -297,15 +297,15 @@ namespace ImageSharp.Formats /// /// Collects a row of true color pixel data. /// - /// The pixel format. + /// The pixel format. /// The image pixel accessor. /// The row index. /// The raw scanline. - private void CollectColorBytes(PixelAccessor pixels, int row, byte[] rawScanline) - where TColor : struct, IPixel + private void CollecTPixelBytes(PixelAccessor pixels, int row, byte[] rawScanline) + where TPixel : struct, IPixel { // We can use the optimized PixelAccessor here and copy the bytes in unmanaged memory. - using (PixelArea pixelRow = new PixelArea(this.width, rawScanline, this.bytesPerPixel == 4 ? ComponentOrder.Xyzw : ComponentOrder.Xyz)) + using (PixelArea pixelRow = new PixelArea(this.width, rawScanline, this.bytesPerPixel == 4 ? ComponentOrder.Xyzw : ComponentOrder.Xyz)) { pixels.CopyTo(pixelRow, row); } @@ -315,15 +315,15 @@ namespace ImageSharp.Formats /// Encodes the pixel data line by line. /// Each scanline is encoded in the most optimal manner to improve compression. /// - /// The pixel format. + /// The pixel format. /// The image pixel accessor. /// The row. /// The previous scanline. /// The raw scanline. /// The filtered scanline result. /// The - private byte[] EncodePixelRow(PixelAccessor pixels, int row, byte[] previousScanline, byte[] rawScanline, byte[] result) - where TColor : struct, IPixel + private byte[] EncodePixelRow(PixelAccessor pixels, int row, byte[] previousScanline, byte[] rawScanline, byte[] result) + where TPixel : struct, IPixel { switch (this.pngColorType) { @@ -335,7 +335,7 @@ namespace ImageSharp.Formats this.CollectGrayscaleBytes(pixels, row, rawScanline); break; default: - this.CollectColorBytes(pixels, row, rawScanline); + this.CollecTPixelBytes(pixels, row, rawScanline); break; } @@ -471,13 +471,13 @@ namespace ImageSharp.Formats /// /// Writes the palette chunk to the stream. /// - /// The pixel format. + /// The pixel format. /// The containing image data. /// The . /// The image to encode. - /// The - private QuantizedImage WritePaletteChunk(Stream stream, PngHeader header, ImageBase image) - where TColor : struct, IPixel + /// The + private QuantizedImage WritePaletteChunk(Stream stream, PngHeader header, ImageBase image) + where TPixel : struct, IPixel { if (this.quality > 256) { @@ -486,14 +486,14 @@ namespace ImageSharp.Formats if (this.quantizer == null) { - this.quantizer = new WuQuantizer(); + this.quantizer = new WuQuantizer(); } // Quantize the image returning a palette. This boxing is icky. - QuantizedImage quantized = ((IQuantizer)this.quantizer).Quantize(image, this.quality); + QuantizedImage quantized = ((IQuantizer)this.quantizer).Quantize(image, this.quality); // Grab the palette and write it to the stream. - TColor[] palette = quantized.Palette; + TPixel[] palette = quantized.Palette; byte pixelCount = palette.Length.ToByte(); // Get max colors for bit depth. @@ -548,11 +548,11 @@ namespace ImageSharp.Formats /// /// Writes the physical dimension information to the stream. /// - /// The pixel format. + /// The pixel format. /// The containing image data. /// The image. - private void WritePhysicalChunk(Stream stream, Image image) - where TColor : struct, IPixel + private void WritePhysicalChunk(Stream stream, Image image) + where TPixel : struct, IPixel { if (image.MetaData.HorizontalResolution > 0 && image.MetaData.VerticalResolution > 0) { @@ -593,11 +593,11 @@ namespace ImageSharp.Formats /// /// Writes the pixel information to the stream. /// - /// The pixel format. + /// The pixel format. /// The pixel accessor. /// The stream. - private void WriteDataChunks(PixelAccessor pixels, Stream stream) - where TColor : struct, IPixel + private void WriteDataChunks(PixelAccessor pixels, Stream stream) + where TPixel : struct, IPixel { int bytesPerScanline = this.width * this.bytesPerPixel; byte[] previousScanline = new byte[bytesPerScanline]; diff --git a/src/ImageSharp/Image.Create.cs b/src/ImageSharp/Image.Create.cs index fe3247049..5fcb2fa21 100644 --- a/src/ImageSharp/Image.Create.cs +++ b/src/ImageSharp/Image.Create.cs @@ -12,10 +12,10 @@ namespace ImageSharp public sealed partial class Image { /// - /// Create a new instance of the class + /// Create a new instance of the class /// with the height and the width of the image. /// - /// The pixel format. + /// The pixel format. /// The width of the image in pixels. /// The height of the image in pixels. /// The images matadata to preload. @@ -23,38 +23,38 @@ 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 + internal static Image Create(int width, int height, ImageMetaData metadata, Configuration configuration) + where TPixel : struct, IPixel { - if (typeof(TColor) == typeof(Rgba32)) + if (typeof(TPixel) == typeof(Rgba32)) { - return new Image(width, height, metadata, configuration) as Image; + return new Image(width, height, metadata, configuration) as Image; } else { - return new Image(width, height, metadata, configuration); + return new Image(width, height, metadata, configuration); } } /// - /// Create a new instance of the class + /// Create a new instance of the class /// with the height and the width of the image. /// - /// The pixel format. + /// The pixel format. /// The width of the image in pixels. /// The height of the image in pixels. /// /// 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 + internal static Image Create(int width, int height, Configuration configuration) + where TPixel : struct, IPixel { - return Image.Create(width, height, null, configuration); + return Image.Create(width, height, null, configuration); } } } \ No newline at end of file diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs index c1c137122..5e060ab6b 100644 --- a/src/ImageSharp/Image.Decode.cs +++ b/src/ImageSharp/Image.Decode.cs @@ -51,15 +51,15 @@ namespace ImageSharp /// /// Decodes the image stream to the current image. /// - /// The pixel format. + /// The pixel format. /// The stream. /// The options for the decoder. /// the configuration. /// /// The decoded image /// - private static Image Decode(Stream stream, IDecoderOptions options, Configuration config) - where TColor : struct, IPixel + private static Image Decode(Stream stream, IDecoderOptions options, Configuration config) + where TPixel : struct, IPixel { IImageFormat format = DiscoverFormat(stream, config); if (format == null) @@ -67,7 +67,7 @@ namespace ImageSharp return null; } - Image img = format.Decoder.Decode(config, stream, options); + Image img = format.Decoder.Decode(config, stream, options); img.CurrentImageFormat = format; return img; } diff --git a/src/ImageSharp/Image.FromBytes.cs b/src/ImageSharp/Image.FromBytes.cs index b2f9854f2..b2f39aae6 100644 --- a/src/ImageSharp/Image.FromBytes.cs +++ b/src/ImageSharp/Image.FromBytes.cs @@ -109,70 +109,70 @@ namespace ImageSharp /// /// Loads the image from the given byte array. /// - /// The pixel format. + /// The pixel format. /// The byte array containing image data. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(byte[] data) - where TColor : struct, IPixel + public static Image Load(byte[] data) + where TPixel : struct, IPixel { - return Load(null, data, null); + return Load(null, data, null); } /// /// Loads the image from the given byte array. /// - /// The pixel format. + /// The pixel format. /// The byte array containing image data. /// The options for the decoder. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(byte[] data, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(byte[] data, IDecoderOptions options) + where TPixel : struct, IPixel { - return Load(null, data, options); + return Load(null, data, options); } /// /// Loads the image from the given byte array. /// - /// The pixel format. + /// The pixel format. /// The config for the decoder. /// The byte array containing image data. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Configuration config, byte[] data) - where TColor : struct, IPixel + public static Image Load(Configuration config, byte[] data) + where TPixel : struct, IPixel { - return Load(config, data, null); + return Load(config, data, null); } /// /// Loads the image from the given byte array. /// - /// The pixel format. + /// The pixel format. /// The byte array containing image data. /// The decoder. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(byte[] data, IImageDecoder decoder) - where TColor : struct, IPixel + public static Image Load(byte[] data, IImageDecoder decoder) + where TPixel : struct, IPixel { - return Load(data, decoder, null); + return Load(data, decoder, null); } /// /// Loads the image from the given byte array. /// - /// The pixel format. + /// The pixel format. /// The configuration options. /// The byte array containing image data. /// The options for the decoder. @@ -180,19 +180,19 @@ namespace ImageSharp /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Configuration config, byte[] data, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(Configuration config, byte[] data, IDecoderOptions options) + where TPixel : struct, IPixel { using (MemoryStream ms = new MemoryStream(data)) { - return Load(config, ms, options); + return Load(config, ms, options); } } /// /// Loads the image from the given byte array. /// - /// The pixel format. + /// The pixel format. /// The byte array containing image data. /// The decoder. /// The options for the decoder. @@ -200,12 +200,12 @@ namespace ImageSharp /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(byte[] data, IImageDecoder decoder, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(byte[] data, IImageDecoder decoder, IDecoderOptions options) + where TPixel : struct, IPixel { using (MemoryStream ms = new MemoryStream(data)) { - return Load(ms, decoder, options); + return Load(ms, decoder, options); } } } diff --git a/src/ImageSharp/Image.FromFile.cs b/src/ImageSharp/Image.FromFile.cs index 5a2cfc86d..b21307aba 100644 --- a/src/ImageSharp/Image.FromFile.cs +++ b/src/ImageSharp/Image.FromFile.cs @@ -108,70 +108,70 @@ namespace ImageSharp /// /// Loads the image from the given file. /// - /// The pixel format. + /// The pixel format. /// The file path to the image. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(string path) - where TColor : struct, IPixel + public static Image Load(string path) + where TPixel : struct, IPixel { - return Load(null, path, null); + return Load(null, path, null); } /// /// Loads the image from the given file. /// - /// The pixel format. + /// The pixel format. /// The file path to the image. /// The options for the decoder. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(string path, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(string path, IDecoderOptions options) + where TPixel : struct, IPixel { - return Load(null, path, options); + return Load(null, path, options); } /// /// Loads the image from the given file. /// - /// The pixel format. + /// The pixel format. /// The config for the decoder. /// The file path to the image. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Configuration config, string path) - where TColor : struct, IPixel + public static Image Load(Configuration config, string path) + where TPixel : struct, IPixel { - return Load(config, path, null); + return Load(config, path, null); } /// /// Loads the image from the given file. /// - /// The pixel format. + /// The pixel format. /// The file path to the image. /// The decoder. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(string path, IImageDecoder decoder) - where TColor : struct, IPixel + public static Image Load(string path, IImageDecoder decoder) + where TPixel : struct, IPixel { - return Load(path, decoder, null); + return Load(path, decoder, null); } /// /// Loads the image from the given file. /// - /// The pixel format. + /// The pixel format. /// The configuration options. /// The file path to the image. /// The options for the decoder. @@ -179,20 +179,20 @@ namespace ImageSharp /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Configuration config, string path, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(Configuration config, string path, IDecoderOptions options) + where TPixel : struct, IPixel { config = config ?? Configuration.Default; using (Stream s = config.FileSystem.OpenRead(path)) { - return Load(config, s, options); + return Load(config, s, options); } } /// /// Loads the image from the given file. /// - /// The pixel format. + /// The pixel format. /// The file path to the image. /// The decoder. /// The options for the decoder. @@ -200,13 +200,13 @@ namespace ImageSharp /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(string path, IImageDecoder decoder, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(string path, IImageDecoder decoder, IDecoderOptions options) + where TPixel : struct, IPixel { Configuration config = Configuration.Default; using (Stream s = config.FileSystem.OpenRead(path)) { - return Load(s, decoder, options); + return Load(s, decoder, options); } } } diff --git a/src/ImageSharp/Image.FromStream.cs b/src/ImageSharp/Image.FromStream.cs index edff0d620..8fb1fac4e 100644 --- a/src/ImageSharp/Image.FromStream.cs +++ b/src/ImageSharp/Image.FromStream.cs @@ -108,70 +108,70 @@ namespace ImageSharp /// /// Loads the image from the given stream. /// - /// The pixel format. + /// The pixel format. /// The stream containing image information. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Stream stream) - where TColor : struct, IPixel + public static Image Load(Stream stream) + where TPixel : struct, IPixel { - return Load(null, stream, null); + return Load(null, stream, null); } /// /// Loads the image from the given stream. /// - /// The pixel format. + /// The pixel format. /// The stream containing image information. /// The options for the decoder. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(Stream stream, IDecoderOptions options) + where TPixel : struct, IPixel { - return Load(null, stream, options); + return Load(null, stream, options); } /// /// Loads the image from the given stream. /// - /// The pixel format. + /// The pixel format. /// The config for the decoder. /// The stream containing image information. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Configuration config, Stream stream) - where TColor : struct, IPixel + public static Image Load(Configuration config, Stream stream) + where TPixel : struct, IPixel { - return Load(config, stream, null); + return Load(config, stream, null); } /// /// Loads the image from the given stream. /// - /// The pixel format. + /// The pixel format. /// The stream containing image information. /// The decoder. /// /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Stream stream, IImageDecoder decoder) - where TColor : struct, IPixel + public static Image Load(Stream stream, IImageDecoder decoder) + where TPixel : struct, IPixel { - return Load(stream, decoder, null); + return Load(stream, decoder, null); } /// /// Loads the image from the given stream. /// - /// The pixel format. + /// The pixel format. /// The stream containing image information. /// The decoder. /// The options for the decoder. @@ -179,16 +179,16 @@ namespace ImageSharp /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Stream stream, IImageDecoder decoder, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(Stream stream, IImageDecoder decoder, IDecoderOptions options) + where TPixel : struct, IPixel { - return WithSeekableStream(stream, s => decoder.Decode(Configuration.Default, s, options)); + return WithSeekableStream(stream, s => decoder.Decode(Configuration.Default, s, options)); } /// /// Loads the image from the given stream. /// - /// The pixel format. + /// The pixel format. /// The configuration options. /// The stream containing image information. /// The options for the decoder. @@ -196,12 +196,12 @@ namespace ImageSharp /// Thrown if the stream is not readable nor seekable. /// /// The image - public static Image Load(Configuration config, Stream stream, IDecoderOptions options) - where TColor : struct, IPixel + public static Image Load(Configuration config, Stream stream, IDecoderOptions options) + where TPixel : struct, IPixel { config = config ?? Configuration.Default; - Image img = WithSeekableStream(stream, s => Decode(s, options, config)); + Image img = WithSeekableStream(stream, s => Decode(s, options, config)); if (img != null) { diff --git a/src/ImageSharp/Image/IImageBase{TColor}.cs b/src/ImageSharp/Image/IImageBase{TPixel}.cs similarity index 69% rename from src/ImageSharp/Image/IImageBase{TColor}.cs rename to src/ImageSharp/Image/IImageBase{TPixel}.cs index 14bdffc67..d95e52337 100644 --- a/src/ImageSharp/Image/IImageBase{TColor}.cs +++ b/src/ImageSharp/Image/IImageBase{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,16 +10,16 @@ namespace ImageSharp /// /// Encapsulates the basic properties and methods required to manipulate images in varying formats. /// - /// The pixel format. - public interface IImageBase : IImageBase, IDisposable - where TColor : struct, IPixel + /// The pixel format. + public interface IImageBase : IImageBase, IDisposable + where TPixel : struct, IPixel { /// /// Gets the pixels as an array of the given packed pixel format. /// Important. Due to the nature in the way this is constructed do not rely on the length /// of the array for calculations. Use Width * Height. /// - TColor[] Pixels { get; } + TPixel[] Pixels { get; } /// /// Locks the image providing access to the pixels. @@ -27,7 +27,7 @@ namespace ImageSharp /// It is imperative that the accessor is correctly disposed off after use. /// /// - /// The - PixelAccessor Lock(); + /// The + PixelAccessor Lock(); } } \ No newline at end of file diff --git a/src/ImageSharp/Image/IImageProcessor.cs b/src/ImageSharp/Image/IImageProcessor.cs index 0440cdd76..cf442cd6c 100644 --- a/src/ImageSharp/Image/IImageProcessor.cs +++ b/src/ImageSharp/Image/IImageProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing /// /// Encapsulates methods to alter the pixels of an image. /// - /// The pixel format. - public interface IImageProcessor - where TColor : struct, IPixel + /// The pixel format. + public interface IImageProcessor + where TPixel : struct, IPixel { /// /// Gets or sets the parallel options for processing tasks in parallel. @@ -27,7 +27,7 @@ namespace ImageSharp.Processing bool Compand { get; set; } /// - /// Applies the process to the specified portion of the specified . + /// Applies the process to the specified portion of the specified . /// /// The source image. Cannot be null. /// @@ -39,6 +39,6 @@ namespace ImageSharp.Processing /// /// doesnt fit the dimension of the image. /// - void Apply(ImageBase source, Rectangle sourceRectangle); + void Apply(ImageBase source, Rectangle sourceRectangle); } } diff --git a/src/ImageSharp/Image/ImageBase{TColor}.cs b/src/ImageSharp/Image/ImageBase{TPixel}.cs similarity index 86% rename from src/ImageSharp/Image/ImageBase{TColor}.cs rename to src/ImageSharp/Image/ImageBase{TPixel}.cs index cfce7184b..ec458e676 100644 --- a/src/ImageSharp/Image/ImageBase{TColor}.cs +++ b/src/ImageSharp/Image/ImageBase{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -13,10 +13,10 @@ namespace ImageSharp /// The base class of all images. Encapsulates the basic properties and methods required to manipulate /// images in different pixel formats. /// - /// The pixel format. + /// The pixel format. [DebuggerDisplay("Image: {Width}x{Height}")] - public abstract class ImageBase : IImageBase - where TColor : struct, IPixel + public abstract class ImageBase : IImageBase + where TPixel : struct, IPixel { /// /// Gets or sets the maximum allowable width in pixels. @@ -31,7 +31,7 @@ namespace ImageSharp /// /// The image pixels /// - private TColor[] pixelBuffer; + private TPixel[] pixelBuffer; /// /// A value indicating whether this instance of the given entity has been disposed. @@ -45,7 +45,7 @@ namespace ImageSharp private bool isDisposed; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The configuration providing initialization code which allows extending the library. @@ -56,7 +56,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width of the image in pixels. /// The height of the image in pixels. @@ -79,15 +79,15 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The other to create this instance from. + /// The other to create this instance from. /// /// - /// Thrown if the given is null. + /// Thrown if the given is null. /// - protected ImageBase(ImageBase other) + protected ImageBase(ImageBase other) : this(other.Configuration) { Guard.NotNull(other, nameof(other), "Other image cannot be null."); @@ -98,8 +98,8 @@ namespace ImageSharp // Rent then copy the pixels. Unsafe.CopyBlock gives us a nice speed boost here. this.RentPixels(); - using (PixelAccessor sourcePixels = other.Lock()) - using (PixelAccessor target = this.Lock()) + using (PixelAccessor sourcePixels = other.Lock()) + using (PixelAccessor target = this.Lock()) { // Check we can do this without crashing sourcePixels.CopyTo(target); @@ -107,7 +107,7 @@ namespace ImageSharp } /// - public TColor[] Pixels => this.pixelBuffer; + public TPixel[] Pixels => this.pixelBuffer; /// public int Width { get; private set; } @@ -131,7 +131,7 @@ namespace ImageSharp /// /// The processor. /// The rectangle. - public virtual void ApplyProcessor(IImageProcessor processor, Rectangle rectangle) + public virtual void ApplyProcessor(IImageProcessor processor, Rectangle rectangle) { processor.Apply(this, rectangle); } @@ -150,16 +150,16 @@ namespace ImageSharp } /// - public PixelAccessor Lock() + public PixelAccessor Lock() { - return new PixelAccessor(this); + return new PixelAccessor(this); } /// /// Switches the buffers used by the image and the PixelAccessor meaning that the Image will "own" the buffer from the PixelAccessor and the PixelAccessor will now own the Images buffer. /// /// The pixel source. - internal void SwapPixelsBuffers(PixelAccessor pixelSource) + internal void SwapPixelsBuffers(PixelAccessor pixelSource) { Guard.NotNull(pixelSource, nameof(pixelSource)); @@ -167,7 +167,6 @@ namespace ImageSharp int newHeight = pixelSource.Height; // Push my memory into the accessor (which in turn unpins the old puffer ready for the images use) - TColor[] newPixels = pixelSource.ReturnCurrentPixelsAndReplaceThemInternally(this.Width, this.Height, this.pixelBuffer); this.Width = newWidth; this.Height = newHeight; this.pixelBuffer = newPixels; @@ -221,7 +220,7 @@ namespace ImageSharp /// private void RentPixels() { - this.pixelBuffer = PixelDataPool.Rent(this.Width * this.Height); + this.pixelBuffer = PixelDataPool.Rent(this.Width * this.Height); } /// @@ -229,7 +228,7 @@ namespace ImageSharp /// private void ReturnPixels() { - PixelDataPool.Return(this.pixelBuffer); + PixelDataPool.Return(this.pixelBuffer); this.pixelBuffer = null; } @@ -241,4 +240,4 @@ namespace ImageSharp Array.Clear(this.pixelBuffer, 0, this.Width * this.Height); } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Image/ImageFrame{TColor}.cs b/src/ImageSharp/Image/ImageFrame{TPixel}.cs similarity index 74% rename from src/ImageSharp/Image/ImageFrame{TColor}.cs rename to src/ImageSharp/Image/ImageFrame{TPixel}.cs index 2712dc687..e85177f59 100644 --- a/src/ImageSharp/Image/ImageFrame{TColor}.cs +++ b/src/ImageSharp/Image/ImageFrame{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -12,12 +12,12 @@ namespace ImageSharp /// /// Represents a single frame in a animation. /// - /// The pixel format. - public class ImageFrame : ImageBase, IImageFrame - where TColor : struct, IPixel + /// The pixel format. + public class ImageFrame : ImageBase, IImageFrame + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width of the image in pixels. /// The height of the image in pixels. @@ -30,10 +30,10 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The image to create the frame from. - public ImageFrame(ImageBase image) + public ImageFrame(ImageBase image) : base(image) { } @@ -53,18 +53,18 @@ namespace ImageSharp /// Returns a copy of the image frame in the given pixel format. /// /// A function that allows for the correction of vector scaling between unknown color formats. - /// The pixel format. - /// The - public ImageFrame To(Func scaleFunc = null) - where TColor2 : struct, IPixel + /// The pixel format. + /// The + public ImageFrame To(Func scaleFunc = null) + where TPixel2 : struct, IPixel { - scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); + scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); - ImageFrame target = new ImageFrame(this.Width, this.Height, this.Configuration); + ImageFrame target = new ImageFrame(this.Width, this.Height, this.Configuration); target.CopyProperties(this); - using (PixelAccessor pixels = this.Lock()) - using (PixelAccessor targetPixels = target.Lock()) + using (PixelAccessor pixels = this.Lock()) + using (PixelAccessor targetPixels = target.Lock()) { Parallel.For( 0, @@ -74,7 +74,7 @@ namespace ImageSharp { for (int x = 0; x < target.Width; x++) { - TColor2 color = default(TColor2); + TPixel2 color = default(TPixel2); color.PackFromVector4(scaleFunc(pixels[x, y].ToVector4())); targetPixels[x, y] = color; } @@ -87,10 +87,10 @@ namespace ImageSharp /// /// Clones the current instance. /// - /// The - internal virtual ImageFrame Clone() + /// The + internal virtual ImageFrame Clone() { - return new ImageFrame(this); + return new ImageFrame(this); } /// diff --git a/src/ImageSharp/Image/ImageProcessingExtensions.cs b/src/ImageSharp/Image/ImageProcessingExtensions.cs index ff3ecd5ee..405cb48b4 100644 --- a/src/ImageSharp/Image/ImageProcessingExtensions.cs +++ b/src/ImageSharp/Image/ImageProcessingExtensions.cs @@ -5,11 +5,10 @@ namespace ImageSharp { - using System; using Processing; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { @@ -17,12 +16,12 @@ namespace ImageSharp /// Applies the processor to the image. /// This method does not resize the target image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The processor to apply to the image. - /// The . - public static Image Apply(this Image source, IImageProcessor processor) - where TColor : struct, IPixel + /// The . + public static Image Apply(this Image source, IImageProcessor processor) + where TPixel : struct, IPixel { source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Image/Image{TColor}.cs b/src/ImageSharp/Image/Image{TPixel}.cs similarity index 82% rename from src/ImageSharp/Image/Image{TColor}.cs rename to src/ImageSharp/Image/Image{TPixel}.cs index d063c3ff1..88fb04226 100644 --- a/src/ImageSharp/Image/Image{TColor}.cs +++ b/src/ImageSharp/Image/Image{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -6,13 +6,11 @@ namespace ImageSharp { using System; - using System.Buffers; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; - using System.Text; using System.Threading.Tasks; using Formats; @@ -21,13 +19,13 @@ namespace ImageSharp /// /// Encapsulates an image, which consists of the pixel data for a graphics image and its attributes. /// - /// The pixel format. + /// The pixel format. [DebuggerDisplay("Image: {Width}x{Height}")] - public class Image : ImageBase, IImage - where TColor : struct, IPixel + public class Image : ImageBase, IImage + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// with the height and the width of the image. /// /// The width of the image in pixels. @@ -41,7 +39,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// with the height and the width of the image. /// /// The width of the image in pixels. @@ -52,19 +50,19 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// by making a copy from another image. /// /// The other image, where the clone should be made from. /// is null. - public Image(Image other) + public Image(Image other) : base(other) { - foreach (ImageFrame frame in other.Frames) + foreach (ImageFrame frame in other.Frames) { if (frame != null) { - this.Frames.Add(new ImageFrame(frame)); + this.Frames.Add(new ImageFrame(frame)); } } @@ -72,19 +70,19 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// by making a copy from another image. /// /// The other image, where the clone should be made from. /// is null. - public Image(ImageBase other) + public Image(ImageBase other) : base(other) { this.MetaData = new ImageMetaData(); } /// - /// Initializes a new instance of the class + /// Initializes a new instance of the class /// with the height and the width of the image. /// /// The width of the image in pixels. @@ -138,7 +136,7 @@ namespace ImageSharp /// Gets the other frames for the animation. /// /// The list of frame images. - public IList> Frames { get; } = new List>(); + public IList> Frames { get; } = new List>(); /// /// Gets the currently loaded image format. @@ -150,11 +148,11 @@ namespace ImageSharp /// /// The processor to apply to the image. /// The structure that specifies the portion of the image object to draw. - public override void ApplyProcessor(IImageProcessor processor, Rectangle rectangle) + public override void ApplyProcessor(IImageProcessor processor, Rectangle rectangle) { // we want to put this on on here as it gives us a really go place to test/verify processor settings base.ApplyProcessor(processor, rectangle); - foreach (ImageFrame sourceFrame in this.Frames) + foreach (ImageFrame sourceFrame in this.Frames) { sourceFrame.ApplyProcessor(processor, rectangle); } @@ -165,8 +163,8 @@ namespace ImageSharp /// /// The stream to save the image to. /// Thrown if the stream is null. - /// The - public Image Save(Stream stream) + /// The + public Image Save(Stream stream) { return this.Save(stream, (IEncoderOptions)null); } @@ -177,8 +175,8 @@ namespace ImageSharp /// The stream to save the image to. /// The options for the encoder. /// Thrown if the stream is null. - /// The - public Image Save(Stream stream, IEncoderOptions options) + /// The + public Image Save(Stream stream, IEncoderOptions options) { return this.Save(stream, this.CurrentImageFormat?.Encoder, options); } @@ -188,8 +186,8 @@ namespace ImageSharp /// /// The stream to save the image to. /// The format to save the image as. - /// The - public Image Save(Stream stream, IImageFormat format) + /// The + public Image Save(Stream stream, IImageFormat format) { return this.Save(stream, format, null); } @@ -200,8 +198,8 @@ namespace ImageSharp /// The stream to save the image to. /// The format to save the image as. /// The options for the encoder. - /// The - public Image Save(Stream stream, IImageFormat format, IEncoderOptions options) + /// The + public Image Save(Stream stream, IImageFormat format, IEncoderOptions options) { Guard.NotNull(format, nameof(format)); @@ -215,9 +213,9 @@ namespace ImageSharp /// The encoder to save the image with. /// Thrown if the stream or encoder is null. /// - /// The . + /// The . /// - public Image Save(Stream stream, IImageEncoder encoder) + public Image Save(Stream stream, IImageEncoder encoder) { return this.Save(stream, encoder, null); } @@ -230,9 +228,9 @@ namespace ImageSharp /// The options for the encoder. /// Thrown if the stream or encoder is null. /// - /// The . + /// The . /// - public Image Save(Stream stream, IImageEncoder encoder, IEncoderOptions options) + public Image Save(Stream stream, IImageEncoder encoder, IEncoderOptions options) { Guard.NotNull(stream, nameof(stream)); Guard.NotNull(encoder, nameof(encoder)); @@ -248,8 +246,8 @@ namespace ImageSharp /// /// The file path to save the image to. /// Thrown if the stream is null. - /// The - public Image Save(string filePath) + /// The + public Image Save(string filePath) { return this.Save(filePath, (IEncoderOptions)null); } @@ -260,8 +258,8 @@ namespace ImageSharp /// The file path to save the image to. /// The options for the encoder. /// Thrown if the stream is null. - /// The - public Image Save(string filePath, IEncoderOptions options) + /// The + public Image Save(string filePath, IEncoderOptions options) { string ext = Path.GetExtension(filePath).Trim('.'); IImageFormat format = this.Configuration.ImageFormats.SingleOrDefault(f => f.SupportedExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase)); @@ -279,8 +277,8 @@ namespace ImageSharp /// The file path to save the image to. /// The format to save the image as. /// Thrown if the format is null. - /// The - public Image Save(string filePath, IImageFormat format) + /// The + public Image Save(string filePath, IImageFormat format) { return this.Save(filePath, format, null); } @@ -292,8 +290,8 @@ namespace ImageSharp /// The format to save the image as. /// The options for the encoder. /// Thrown if the format is null. - /// The - public Image Save(string filePath, IImageFormat format, IEncoderOptions options) + /// The + public Image Save(string filePath, IImageFormat format, IEncoderOptions options) { Guard.NotNull(format, nameof(format)); return this.Save(filePath, format.Encoder, options); @@ -305,8 +303,8 @@ namespace ImageSharp /// The file path to save the image to. /// The encoder to save the image with. /// Thrown if the encoder is null. - /// The - public Image Save(string filePath, IImageEncoder encoder) + /// The + public Image Save(string filePath, IImageEncoder encoder) { return this.Save(filePath, encoder, null); } @@ -318,8 +316,8 @@ namespace ImageSharp /// The encoder to save the image with. /// The options for the encoder. /// Thrown if the encoder is null. - /// The - public Image Save(string filePath, IImageEncoder encoder, IEncoderOptions options) + /// The + public Image Save(string filePath, IImageEncoder encoder, IEncoderOptions options) { Guard.NotNull(encoder, nameof(encoder)); using (Stream fs = this.Configuration.FileSystem.Create(filePath)) @@ -354,18 +352,18 @@ namespace ImageSharp /// Returns a copy of the image in the given pixel format. /// /// A function that allows for the correction of vector scaling between unknown color formats. - /// The pixel format. - /// The - public Image To(Func scaleFunc = null) - where TColor2 : struct, IPixel + /// The pixel format. + /// The + public Image To(Func scaleFunc = null) + where TPixel2 : struct, IPixel { - scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); + scaleFunc = PackedPixelConverterHelper.ComputeScaleFunction(scaleFunc); - Image target = new Image(this.Width, this.Height, this.Configuration); + Image target = new Image(this.Width, this.Height, this.Configuration); target.CopyProperties(this); - using (PixelAccessor pixels = this.Lock()) - using (PixelAccessor targetPixels = target.Lock()) + using (PixelAccessor pixels = this.Lock()) + using (PixelAccessor targetPixels = target.Lock()) { Parallel.For( 0, @@ -375,7 +373,7 @@ namespace ImageSharp { for (int x = 0; x < target.Width; x++) { - TColor2 color = default(TColor2); + TPixel2 color = default(TPixel2); color.PackFromVector4(scaleFunc(pixels[x, y].ToVector4())); targetPixels[x, y] = color; } @@ -384,19 +382,19 @@ namespace ImageSharp for (int i = 0; i < this.Frames.Count; i++) { - target.Frames.Add(this.Frames[i].To()); + target.Frames.Add(this.Frames[i].To()); } return target; } /// - /// Creates a new from this instance + /// Creates a new from this instance /// - /// The - internal virtual ImageFrame ToFrame() + /// The + internal virtual ImageFrame ToFrame() { - return new ImageFrame(this); + return new ImageFrame(this); } /// diff --git a/src/ImageSharp/Image/PixelAccessor{TColor}.cs b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs similarity index 87% rename from src/ImageSharp/Image/PixelAccessor{TColor}.cs rename to src/ImageSharp/Image/PixelAccessor{TPixel}.cs index fb3613adf..5cb19c2e8 100644 --- a/src/ImageSharp/Image/PixelAccessor{TColor}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -8,15 +8,14 @@ namespace ImageSharp using System; using System.Diagnostics; using System.Runtime.CompilerServices; - using System.Runtime.InteropServices; using System.Threading.Tasks; /// - /// Provides per-pixel access to generic pixels. + /// Provides per-pixel access to generic pixels. /// - /// The pixel format. - public sealed class PixelAccessor : IDisposable, IBuffer2D - where TColor : struct, IPixel + /// The pixel format. + public sealed class PixelAccessor : IDisposable, IBuffer2D + where TPixel : struct, IPixel { /// /// A value indicating whether this instance of the given entity has been disposed. @@ -32,13 +31,13 @@ namespace ImageSharp /// /// The containing the pixel data. /// - private Buffer2D pixelBuffer; + private Buffer2D pixelBuffer; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The image to provide pixel access for. - public PixelAccessor(ImageBase image) + public PixelAccessor(ImageBase image) { Guard.NotNull(image, nameof(image)); Guard.MustBeGreaterThan(image.Width, 0, "image width"); @@ -49,22 +48,22 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width of the image represented by the pixel buffer. /// The height of the image represented by the pixel buffer. public PixelAccessor(int width, int height) - : this(width, height, Buffer2D.CreateClean(width, height)) + : this(width, height, Buffer2D.CreateClean(width, height)) { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width of the image represented by the pixel buffer. /// The height of the image represented by the pixel buffer. /// The pixel buffer. - private PixelAccessor(int width, int height, Buffer2D pixels) + private PixelAccessor(int width, int height, Buffer2D pixels) { Guard.NotNull(pixels, nameof(pixels)); Guard.MustBeGreaterThan(width, 0, nameof(width)); @@ -76,7 +75,7 @@ namespace ImageSharp } /// - /// Finalizes an instance of the class. + /// Finalizes an instance of the class. /// ~PixelAccessor() { @@ -86,7 +85,7 @@ namespace ImageSharp /// /// Gets the pixel buffer array. /// - public TColor[] PixelArray => this.pixelBuffer.Array; + public TPixel[] PixelArray => this.pixelBuffer.Array; /// /// Gets the size of a single pixel in the number of bytes. @@ -114,17 +113,17 @@ namespace ImageSharp public ParallelOptions ParallelOptions { get; } /// - BufferSpan IBuffer2D.Span => this.pixelBuffer; + BufferSpan IBuffer2D.Span => this.pixelBuffer; - private static BulkPixelOperations Operations => BulkPixelOperations.Instance; + private static BulkPixelOperations Operations => BulkPixelOperations.Instance; /// /// Gets or sets the pixel at the specified position. /// /// The x-coordinate of the pixel. Must be greater than or equal to zero and less than the width of the image. /// The y-coordinate of the pixel. Must be greater than or equal to zero and less than the height of the image. - /// The at the specified position. - public TColor this[int x, int y] + /// The at the specified position. + public TPixel this[int x, int y] { get { @@ -179,7 +178,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - internal void CopyFrom(PixelArea area, int targetY, int targetX = 0) + internal void CopyFrom(PixelArea area, int targetY, int targetX = 0) { this.CheckCoordinates(area, targetX, targetY); @@ -195,7 +194,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - internal void CopyTo(PixelArea area, int sourceY, int sourceX = 0) + internal void CopyTo(PixelArea area, int sourceY, int sourceX = 0) { this.CheckCoordinates(area, sourceX, sourceY); @@ -212,7 +211,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - internal void SafeCopyTo(PixelArea area, int sourceY, int sourceX = 0) + internal void SafeCopyTo(PixelArea area, int sourceY, int sourceX = 0) { int width = Math.Min(area.Width, this.Width - sourceX); if (width < 1) @@ -237,18 +236,17 @@ namespace ImageSharp /// The pixels. /// Returns the old pixel data thats has gust been replaced. /// If is true then caller is responsible for ensuring is called. - internal TColor[] ReturnCurrentPixelsAndReplaceThemInternally(int width, int height, TColor[] pixels) { - TColor[] oldPixels = this.pixelBuffer.TakeArrayOwnership(); + TPixel[] oldPixels = this.pixelBuffer.TakeArrayOwnership(); this.SetPixelBufferUnsafe(width, height, pixels); return oldPixels; } /// - /// Copies the pixels to another of the same size. + /// Copies the pixels to another of the same size. /// /// The target pixel buffer accessor. - internal void CopyTo(PixelAccessor target) + internal void CopyTo(PixelAccessor target) { BufferSpan.Copy(this.pixelBuffer.Span, target.pixelBuffer.Span); } @@ -262,12 +260,12 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyFromZyx(PixelArea area, int targetX, int targetY, int width, int height) + private void CopyFromZyx(PixelArea area, int targetX, int targetY, int width, int height) { for (int y = 0; y < height; y++) { BufferSpan source = area.GetRowSpan(y); - BufferSpan destination = this.GetRowSpan(targetX, targetY + y); + BufferSpan destination = this.GetRowSpan(targetX, targetY + y); Operations.PackFromZyxBytes(source, destination, width); } @@ -282,12 +280,12 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyFromZyxw(PixelArea area, int targetX, int targetY, int width, int height) + private void CopyFromZyxw(PixelArea area, int targetX, int targetY, int width, int height) { for (int y = 0; y < height; y++) { BufferSpan source = area.GetRowSpan(y); - BufferSpan destination = this.GetRowSpan(targetX, targetY + y); + BufferSpan destination = this.GetRowSpan(targetX, targetY + y); Operations.PackFromZyxwBytes(source, destination, width); } @@ -302,12 +300,12 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyFromXyz(PixelArea area, int targetX, int targetY, int width, int height) + private void CopyFromXyz(PixelArea area, int targetX, int targetY, int width, int height) { for (int y = 0; y < height; y++) { BufferSpan source = area.GetRowSpan(y); - BufferSpan destination = this.GetRowSpan(targetX, targetY + y); + BufferSpan destination = this.GetRowSpan(targetX, targetY + y); Operations.PackFromXyzBytes(source, destination, width); } @@ -322,12 +320,12 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyFromXyzw(PixelArea area, int targetX, int targetY, int width, int height) + private void CopyFromXyzw(PixelArea area, int targetX, int targetY, int width, int height) { for (int y = 0; y < height; y++) { BufferSpan source = area.GetRowSpan(y); - BufferSpan destination = this.GetRowSpan(targetX, targetY + y); + BufferSpan destination = this.GetRowSpan(targetX, targetY + y); Operations.PackFromXyzwBytes(source, destination, width); } } @@ -341,11 +339,11 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyToZyx(PixelArea area, int sourceX, int sourceY, int width, int height) + private void CopyToZyx(PixelArea area, int sourceX, int sourceY, int width, int height) { for (int y = 0; y < height; y++) { - BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); + BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); BufferSpan destination = area.GetRowSpan(y); Operations.ToZyxBytes(source, destination, width); } @@ -360,11 +358,11 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyToZyxw(PixelArea area, int sourceX, int sourceY, int width, int height) + private void CopyToZyxw(PixelArea area, int sourceX, int sourceY, int width, int height) { for (int y = 0; y < height; y++) { - BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); + BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); BufferSpan destination = area.GetRowSpan(y); Operations.ToZyxwBytes(source, destination, width); } @@ -379,11 +377,11 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyToXyz(PixelArea area, int sourceX, int sourceY, int width, int height) + private void CopyToXyz(PixelArea area, int sourceX, int sourceY, int width, int height) { for (int y = 0; y < height; y++) { - BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); + BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); BufferSpan destination = area.GetRowSpan(y); Operations.ToXyzBytes(source, destination, width); } @@ -398,19 +396,19 @@ namespace ImageSharp /// The width. /// The height. [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void CopyToXyzw(PixelArea area, int sourceX, int sourceY, int width, int height) + private void CopyToXyzw(PixelArea area, int sourceX, int sourceY, int width, int height) { for (int y = 0; y < height; y++) { - BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); + BufferSpan source = this.GetRowSpan(sourceX, sourceY + y); BufferSpan destination = area.GetRowSpan(y); Operations.ToXyzwBytes(source, destination, width); } } - private void SetPixelBufferUnsafe(int width, int height, TColor[] pixels) + private void SetPixelBufferUnsafe(int width, int height, TPixel[] pixels) { - this.SetPixelBufferUnsafe(width, height, new Buffer2D(pixels, width, height)); + this.SetPixelBufferUnsafe(width, height, new Buffer2D(pixels, width, height)); } /// @@ -419,13 +417,13 @@ namespace ImageSharp /// The width. /// The height. /// The pixel buffer - private void SetPixelBufferUnsafe(int width, int height, Buffer2D pixels) + private void SetPixelBufferUnsafe(int width, int height, Buffer2D pixels) { this.pixelBuffer = pixels; this.Width = width; this.Height = height; - this.PixelSize = Unsafe.SizeOf(); + this.PixelSize = Unsafe.SizeOf(); this.RowStride = this.Width * this.PixelSize; } @@ -440,7 +438,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - private void CopyFrom(PixelArea area, int targetX, int targetY, int width, int height) + private void CopyFrom(PixelArea area, int targetX, int targetY, int width, int height) { switch (area.ComponentOrder) { @@ -472,7 +470,7 @@ namespace ImageSharp /// /// Thrown when an unsupported component order value is passed. /// - private void CopyTo(PixelArea area, int sourceX, int sourceY, int width, int height) + private void CopyTo(PixelArea area, int sourceX, int sourceY, int width, int height) { switch (area.ComponentOrder) { @@ -503,7 +501,7 @@ namespace ImageSharp /// Thrown if the dimensions are not within the bounds of the image. /// [Conditional("DEBUG")] - private void CheckCoordinates(PixelArea area, int x, int y) + private void CheckCoordinates(PixelArea area, int x, int y) { int width = Math.Min(area.Width, this.Width - x); if (width < 1) @@ -540,4 +538,4 @@ namespace ImageSharp } } } -} \ No newline at end of file +} diff --git a/src/ImageSharp/Image/PixelArea{TColor}.cs b/src/ImageSharp/Image/PixelArea{TPixel}.cs similarity index 95% rename from src/ImageSharp/Image/PixelArea{TColor}.cs rename to src/ImageSharp/Image/PixelArea{TPixel}.cs index 176eb0a16..936fc16b3 100644 --- a/src/ImageSharp/Image/PixelArea{TColor}.cs +++ b/src/ImageSharp/Image/PixelArea{TPixel}.cs @@ -1,7 +1,8 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // + namespace ImageSharp { using System; @@ -10,11 +11,11 @@ namespace ImageSharp using System.Runtime.CompilerServices; /// - /// Represents an area of generic pixels. + /// Represents an area of generic pixels. /// - /// The pixel format. - internal sealed class PixelArea : IDisposable - where TColor : struct, IPixel + /// The pixel format. + internal sealed class PixelArea : IDisposable + where TPixel : struct, IPixel { /// /// A value indicating whether this instance of the given entity has been disposed. @@ -33,7 +34,7 @@ namespace ImageSharp private Buffer byteBuffer; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width. /// The bytes. @@ -47,7 +48,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width. /// The height. @@ -70,7 +71,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width. /// The component order. @@ -80,7 +81,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width. /// The component order. @@ -91,7 +92,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width. /// The height. @@ -102,7 +103,7 @@ namespace ImageSharp } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The width. /// The height. diff --git a/src/ImageSharp/ImageProcessor.cs b/src/ImageSharp/ImageProcessor.cs index 79525a8e8..fd577ed22 100644 --- a/src/ImageSharp/ImageProcessor.cs +++ b/src/ImageSharp/ImageProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing /// /// Allows the application of processors to images. /// - /// The pixel format. - internal abstract class ImageProcessor : IImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal abstract class ImageProcessor : IImageProcessor + where TPixel : struct, IPixel { /// public virtual ParallelOptions ParallelOptions { get; set; } @@ -22,7 +22,7 @@ namespace ImageSharp.Processing public virtual bool Compand { get; set; } = false; /// - public void Apply(ImageBase source, Rectangle sourceRectangle) + public void Apply(ImageBase source, Rectangle sourceRectangle) { if (this.ParallelOptions == null) { @@ -50,19 +50,19 @@ namespace ImageSharp.Processing /// /// The structure that specifies the portion of the image object to draw. /// - protected virtual void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected virtual void BeforeApply(ImageBase source, Rectangle sourceRectangle) { } /// - /// Applies the process to the specified portion of the specified at the specified location + /// Applies the process to the specified portion of the specified at the specified location /// and with the specified size. /// /// The source image. Cannot be null. /// /// The structure that specifies the portion of the image object to draw. /// - protected abstract void OnApply(ImageBase source, Rectangle sourceRectangle); + protected abstract void OnApply(ImageBase source, Rectangle sourceRectangle); /// /// This method is called after the process is applied to prepare the processor. @@ -71,7 +71,7 @@ namespace ImageSharp.Processing /// /// The structure that specifies the portion of the image object to draw. /// - protected virtual void AfterApply(ImageBase source, Rectangle sourceRectangle) + protected virtual void AfterApply(ImageBase source, Rectangle sourceRectangle) { } } diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs index c4a94c5ff..89c0b9c5c 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs @@ -116,12 +116,12 @@ namespace ImageSharp /// /// Returns the thumbnail in the EXIF profile when available. /// - /// The pixel format. + /// The pixel format. /// - /// The . + /// The . /// - public Image CreateThumbnail() - where TColor : struct, IPixel + public Image CreateThumbnail() + where TPixel : struct, IPixel { this.InitializeValues(); @@ -137,7 +137,7 @@ namespace ImageSharp using (MemoryStream memStream = new MemoryStream(this.data, this.thumbnailOffset, this.thumbnailLength)) { - return Image.Load(memStream); + return Image.Load(memStream); } } diff --git a/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs b/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs index 672726d92..a704acc30 100644 --- a/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs +++ b/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs @@ -10,19 +10,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies binarization to the image splitting the pixels at the given threshold. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The threshold to apply binarization of the image. Must be between 0 and 1. - /// The . - public static Image BinaryThreshold(this Image source, float threshold) - where TColor : struct, IPixel + /// The . + public static Image BinaryThreshold(this Image source, float threshold) + where TPixel : struct, IPixel { return BinaryThreshold(source, threshold, source.Bounds); } @@ -30,17 +30,17 @@ namespace ImageSharp /// /// Applies binarization to the image splitting the pixels at the given threshold. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The threshold to apply binarization of the image. Must be between 0 and 1. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image BinaryThreshold(this Image source, float threshold, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image BinaryThreshold(this Image source, float threshold, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new BinaryThresholdProcessor(threshold), rectangle); + source.ApplyProcessor(new BinaryThresholdProcessor(threshold), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Binarization/Dither.cs b/src/ImageSharp/Processing/Binarization/Dither.cs index dd6dfe8a1..eb58fe33f 100644 --- a/src/ImageSharp/Processing/Binarization/Dither.cs +++ b/src/ImageSharp/Processing/Binarization/Dither.cs @@ -18,13 +18,13 @@ namespace ImageSharp /// /// Dithers the image reducing it to two colors using ordered dithering. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The ordered ditherer. /// The component index to test the threshold against. Must range from 0 to 3. - /// The . - public static Image Dither(this Image source, IOrderedDither dither, int index = 0) - where TColor : struct, IPixel + /// The . + public static Image Dither(this Image source, IOrderedDither dither, int index = 0) + where TPixel : struct, IPixel { return Dither(source, dither, source.Bounds, index); } @@ -32,7 +32,7 @@ namespace ImageSharp /// /// Dithers the image reducing it to two colors using ordered dithering. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The ordered ditherer. /// @@ -40,23 +40,23 @@ namespace ImageSharp /// /// The component index to test the threshold against. Must range from 0 to 3. /// The . - public static Image Dither(this Image source, IOrderedDither dither, Rectangle rectangle, int index = 0) - where TColor : struct, IPixel + public static Image Dither(this Image source, IOrderedDither dither, Rectangle rectangle, int index = 0) + where TPixel : struct, IPixel { - source.ApplyProcessor(new OrderedDitherProcessor(dither, index), rectangle); + source.ApplyProcessor(new OrderedDitherProcessor(dither, index), rectangle); return source; } /// /// Dithers the image reducing it to two colors using error diffusion. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The diffusion algorithm to apply. /// The threshold to apply binarization of the image. Must be between 0 and 1. - /// The . - public static Image Dither(this Image source, IErrorDiffuser diffuser, float threshold) - where TColor : struct, IPixel + /// The . + public static Image Dither(this Image source, IErrorDiffuser diffuser, float threshold) + where TPixel : struct, IPixel { return Dither(source, diffuser, threshold, source.Bounds); } @@ -64,7 +64,7 @@ namespace ImageSharp /// /// Dithers the image reducing it to two colors using error diffusion. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The diffusion algorithm to apply. /// The threshold to apply binarization of the image. Must be between 0 and 1. @@ -72,10 +72,10 @@ namespace ImageSharp /// The structure that specifies the portion of the image object to alter. /// /// The . - public static Image Dither(this Image source, IErrorDiffuser diffuser, float threshold, Rectangle rectangle) - where TColor : struct, IPixel + public static Image Dither(this Image source, IErrorDiffuser diffuser, float threshold, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new ErrorDiffusionDitherProcessor(diffuser, threshold), rectangle); + source.ApplyProcessor(new ErrorDiffusionDitherProcessor(diffuser, threshold), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs b/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs index 63d6dd33c..767c72eea 100644 --- a/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs +++ b/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs @@ -11,18 +11,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies black and white toning to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image BlackWhite(this Image source) - where TColor : struct, IPixel + /// The . + public static Image BlackWhite(this Image source) + where TPixel : struct, IPixel { return BlackWhite(source, source.Bounds); } @@ -30,16 +30,16 @@ namespace ImageSharp /// /// Applies black and white toning to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image BlackWhite(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image BlackWhite(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new BlackWhiteProcessor(), rectangle); + source.ApplyProcessor(new BlackWhiteProcessor(), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs b/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs index 36a139d0e..784d52cce 100644 --- a/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs +++ b/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies the given colorblindness simulator to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The type of color blindness simulator to apply. - /// The . - public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness) - where TColor : struct, IPixel + /// The . + public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness) + where TPixel : struct, IPixel { return ColorBlindness(source, colorBlindness, source.Bounds); } @@ -31,50 +31,50 @@ namespace ImageSharp /// /// Applies the given colorblindness simulator to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The type of color blindness simulator to apply. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image ColorBlindness(this Image source, ColorBlindness colorBlindness, Rectangle rectangle) + where TPixel : struct, IPixel { - IImageProcessor processor; + IImageProcessor processor; switch (colorBlindness) { case ImageSharp.Processing.ColorBlindness.Achromatomaly: - processor = new AchromatomalyProcessor(); + processor = new AchromatomalyProcessor(); break; case ImageSharp.Processing.ColorBlindness.Achromatopsia: - processor = new AchromatopsiaProcessor(); + processor = new AchromatopsiaProcessor(); break; case ImageSharp.Processing.ColorBlindness.Deuteranomaly: - processor = new DeuteranomalyProcessor(); + processor = new DeuteranomalyProcessor(); break; case ImageSharp.Processing.ColorBlindness.Deuteranopia: - processor = new DeuteranopiaProcessor(); + processor = new DeuteranopiaProcessor(); break; case ImageSharp.Processing.ColorBlindness.Protanomaly: - processor = new ProtanomalyProcessor(); + processor = new ProtanomalyProcessor(); break; case ImageSharp.Processing.ColorBlindness.Protanopia: - processor = new ProtanopiaProcessor(); + processor = new ProtanopiaProcessor(); break; case ImageSharp.Processing.ColorBlindness.Tritanomaly: - processor = new TritanomalyProcessor(); + processor = new TritanomalyProcessor(); break; default: - processor = new TritanopiaProcessor(); + processor = new TritanopiaProcessor(); break; } diff --git a/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs b/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs index 613b999d4..10888da44 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies Grayscale toning to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The formula to apply to perform the operation. - /// The . - public static Image Grayscale(this Image source, GrayscaleMode mode = GrayscaleMode.Bt709) - where TColor : struct, IPixel + /// The . + public static Image Grayscale(this Image source, GrayscaleMode mode = GrayscaleMode.Bt709) + where TPixel : struct, IPixel { return Grayscale(source, source.Bounds, mode); } @@ -31,19 +31,19 @@ namespace ImageSharp /// /// Applies Grayscale toning to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// /// The formula to apply to perform the operation. - /// The . - public static Image Grayscale(this Image source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709) - where TColor : struct, IPixel + /// The . + public static Image Grayscale(this Image source, Rectangle rectangle, GrayscaleMode mode = GrayscaleMode.Bt709) + where TPixel : struct, IPixel { - IImageProcessor processor = mode == GrayscaleMode.Bt709 - ? (IImageProcessor)new GrayscaleBt709Processor() - : new GrayscaleBt601Processor(); + IImageProcessor processor = mode == GrayscaleMode.Bt709 + ? (IImageProcessor)new GrayscaleBt709Processor() + : new GrayscaleBt601Processor(); source.ApplyProcessor(processor, rectangle); return source; diff --git a/src/ImageSharp/Processing/ColorMatrix/Hue.cs b/src/ImageSharp/Processing/ColorMatrix/Hue.cs index 8edeb2ff3..5e6a20523 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Hue.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Hue.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the hue component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The angle in degrees to adjust the image. - /// The . - public static Image Hue(this Image source, float degrees) - where TColor : struct, IPixel + /// The . + public static Image Hue(this Image source, float degrees) + where TPixel : struct, IPixel { return Hue(source, degrees, source.Bounds); } @@ -31,17 +31,17 @@ namespace ImageSharp /// /// Alters the hue component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The angle in degrees to adjust the image. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Hue(this Image source, float degrees, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Hue(this Image source, float degrees, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new HueProcessor(degrees), rectangle); + source.ApplyProcessor(new HueProcessor(degrees), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs b/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs index 5084c96b2..2fca3f1c2 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs @@ -11,18 +11,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the colors of the image recreating an old Kodachrome camera effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image Kodachrome(this Image source) - where TColor : struct, IPixel + /// The . + public static Image Kodachrome(this Image source) + where TPixel : struct, IPixel { return Kodachrome(source, source.Bounds); } @@ -30,16 +30,16 @@ namespace ImageSharp /// /// Alters the colors of the image recreating an old Kodachrome camera effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Kodachrome(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Kodachrome(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new KodachromeProcessor(), rectangle); + source.ApplyProcessor(new KodachromeProcessor(), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs b/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs index ef6b23d5d..1e486ce30 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs @@ -11,18 +11,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the colors of the image recreating an old Lomograph camera effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image Lomograph(this Image source) - where TColor : struct, IPixel + /// The . + public static Image Lomograph(this Image source) + where TPixel : struct, IPixel { return Lomograph(source, source.Bounds); } @@ -30,16 +30,16 @@ namespace ImageSharp /// /// Alters the colors of the image recreating an old Lomograph camera effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Lomograph(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Lomograph(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new LomographProcessor(), rectangle); + source.ApplyProcessor(new LomographProcessor(), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs b/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs index 68b10173c..798a2ab3f 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs @@ -11,18 +11,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the colors of the image recreating an old Polaroid camera effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image Polaroid(this Image source) - where TColor : struct, IPixel + /// The . + public static Image Polaroid(this Image source) + where TPixel : struct, IPixel { return Polaroid(source, source.Bounds); } @@ -30,16 +30,16 @@ namespace ImageSharp /// /// Alters the colors of the image recreating an old Polaroid camera effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Polaroid(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Polaroid(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new PolaroidProcessor(), rectangle); + source.ApplyProcessor(new PolaroidProcessor(), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/Saturation.cs b/src/ImageSharp/Processing/ColorMatrix/Saturation.cs index 7a6359744..faca73fc6 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Saturation.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Saturation.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the saturation component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new saturation of the image. Must be between -100 and 100. - /// The . - public static Image Saturation(this Image source, int amount) - where TColor : struct, IPixel + /// The . + public static Image Saturation(this Image source, int amount) + where TPixel : struct, IPixel { return Saturation(source, amount, source.Bounds); } @@ -31,17 +31,17 @@ namespace ImageSharp /// /// Alters the saturation component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new saturation of the image. Must be between -100 and 100. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Saturation(this Image source, int amount, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Saturation(this Image source, int amount, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new SaturationProcessor(amount), rectangle); + source.ApplyProcessor(new SaturationProcessor(amount), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/ColorMatrix/Sepia.cs b/src/ImageSharp/Processing/ColorMatrix/Sepia.cs index 4943635e0..96c82c259 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Sepia.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Sepia.cs @@ -11,18 +11,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies sepia toning to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The . - public static Image Sepia(this Image source) - where TColor : struct, IPixel + public static Image Sepia(this Image source) + where TPixel : struct, IPixel { return Sepia(source, source.Bounds); } @@ -30,16 +30,16 @@ namespace ImageSharp /// /// Applies sepia toning to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// /// The . - public static Image Sepia(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + public static Image Sepia(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new SepiaProcessor(), rectangle); + source.ApplyProcessor(new SepiaProcessor(), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Convolution/BoxBlur.cs b/src/ImageSharp/Processing/Convolution/BoxBlur.cs index 428142ffa..6912d4885 100644 --- a/src/ImageSharp/Processing/Convolution/BoxBlur.cs +++ b/src/ImageSharp/Processing/Convolution/BoxBlur.cs @@ -10,19 +10,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies a box blur to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The 'radius' value representing the size of the area to sample. - /// The . - public static Image BoxBlur(this Image source, int radius = 7) - where TColor : struct, IPixel + /// The . + public static Image BoxBlur(this Image source, int radius = 7) + where TPixel : struct, IPixel { return BoxBlur(source, radius, source.Bounds); } @@ -30,17 +30,17 @@ namespace ImageSharp /// /// Applies a box blur to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The 'radius' value representing the size of the area to sample. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image BoxBlur(this Image source, int radius, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image BoxBlur(this Image source, int radius, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle); + source.ApplyProcessor(new BoxBlurProcessor(radius), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Convolution/DetectEdges.cs b/src/ImageSharp/Processing/Convolution/DetectEdges.cs index dba062b56..6ffeaa63d 100644 --- a/src/ImageSharp/Processing/Convolution/DetectEdges.cs +++ b/src/ImageSharp/Processing/Convolution/DetectEdges.cs @@ -11,49 +11,49 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// - /// Detects any edges within the image. Uses the filter + /// Detects any edges within the image. Uses the filter /// operating in Grayscale mode. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image DetectEdges(this Image source) - where TColor : struct, IPixel + /// The . + public static Image DetectEdges(this Image source) + where TPixel : struct, IPixel { - return DetectEdges(source, source.Bounds, new SobelProcessor { Grayscale = true }); + return DetectEdges(source, source.Bounds, new SobelProcessor { Grayscale = true }); } /// - /// Detects any edges within the image. Uses the filter + /// Detects any edges within the image. Uses the filter /// operating in Grayscale mode. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image DetectEdges(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image DetectEdges(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - return DetectEdges(source, rectangle, new SobelProcessor { Grayscale = true }); + return DetectEdges(source, rectangle, new SobelProcessor { Grayscale = true }); } /// /// Detects any edges within the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The filter for detecting edges. /// Whether to convert the image to Grayscale first. Defaults to true. - /// The . - public static Image DetectEdges(this Image source, EdgeDetection filter, bool grayscale = true) - where TColor : struct, IPixel + /// The . + public static Image DetectEdges(this Image source, EdgeDetection filter, bool grayscale = true) + where TPixel : struct, IPixel { return DetectEdges(source, filter, source.Bounds, grayscale); } @@ -61,59 +61,59 @@ namespace ImageSharp /// /// Detects any edges within the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The filter for detecting edges. /// /// The structure that specifies the portion of the image object to alter. /// /// Whether to convert the image to Grayscale first. Defaults to true. - /// The . - public static Image DetectEdges(this Image source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) - where TColor : struct, IPixel + /// The . + public static Image DetectEdges(this Image source, EdgeDetection filter, Rectangle rectangle, bool grayscale = true) + where TPixel : struct, IPixel { - IEdgeDetectorProcessor processor; + IEdgeDetectorProcessor processor; switch (filter) { case EdgeDetection.Kayyali: - processor = new KayyaliProcessor { Grayscale = grayscale }; + processor = new KayyaliProcessor { Grayscale = grayscale }; break; case EdgeDetection.Kirsch: - processor = new KirschProcessor { Grayscale = grayscale }; + processor = new KirschProcessor { Grayscale = grayscale }; break; case EdgeDetection.Lapacian3X3: - processor = new Laplacian3X3Processor { Grayscale = grayscale }; + processor = new Laplacian3X3Processor { Grayscale = grayscale }; break; case EdgeDetection.Lapacian5X5: - processor = new Laplacian5X5Processor { Grayscale = grayscale }; + processor = new Laplacian5X5Processor { Grayscale = grayscale }; break; case EdgeDetection.LaplacianOfGaussian: - processor = new LaplacianOfGaussianProcessor { Grayscale = grayscale }; + processor = new LaplacianOfGaussianProcessor { Grayscale = grayscale }; break; case EdgeDetection.Prewitt: - processor = new PrewittProcessor { Grayscale = grayscale }; + processor = new PrewittProcessor { Grayscale = grayscale }; break; case EdgeDetection.RobertsCross: - processor = new RobertsCrossProcessor { Grayscale = grayscale }; + processor = new RobertsCrossProcessor { Grayscale = grayscale }; break; case EdgeDetection.Robinson: - processor = new RobinsonProcessor { Grayscale = grayscale }; + processor = new RobinsonProcessor { Grayscale = grayscale }; break; case EdgeDetection.Scharr: - processor = new ScharrProcessor { Grayscale = grayscale }; + processor = new ScharrProcessor { Grayscale = grayscale }; break; default: - processor = new SobelProcessor { Grayscale = grayscale }; + processor = new SobelProcessor { Grayscale = grayscale }; break; } @@ -123,12 +123,12 @@ namespace ImageSharp /// /// Detects any edges within the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The filter for detecting edges. - /// The . - public static Image DetectEdges(this Image source, IEdgeDetectorProcessor filter) - where TColor : struct, IPixel + /// The . + public static Image DetectEdges(this Image source, IEdgeDetectorProcessor filter) + where TPixel : struct, IPixel { return DetectEdges(source, source.Bounds, filter); } @@ -136,15 +136,15 @@ namespace ImageSharp /// /// Detects any edges within the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// /// The filter for detecting edges. - /// The . - public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorProcessor filter) - where TColor : struct, IPixel + /// The . + public static Image DetectEdges(this Image source, Rectangle rectangle, IEdgeDetectorProcessor filter) + where TPixel : struct, IPixel { source.ApplyProcessor(filter, rectangle); return source; diff --git a/src/ImageSharp/Processing/Convolution/GaussianBlur.cs b/src/ImageSharp/Processing/Convolution/GaussianBlur.cs index 81f854638..3472ceadb 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianBlur.cs +++ b/src/ImageSharp/Processing/Convolution/GaussianBlur.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies a Gaussian blur to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The 'sigma' value representing the weight of the blur. - /// The . - public static Image GaussianBlur(this Image source, float sigma = 3f) - where TColor : struct, IPixel + /// The . + public static Image GaussianBlur(this Image source, float sigma = 3f) + where TPixel : struct, IPixel { return GaussianBlur(source, sigma, source.Bounds); } @@ -31,17 +31,17 @@ namespace ImageSharp /// /// Applies a Gaussian blur to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The 'sigma' value representing the weight of the blur. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image GaussianBlur(this Image source, float sigma, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image GaussianBlur(this Image source, float sigma, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle); + source.ApplyProcessor(new GaussianBlurProcessor(sigma), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs b/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs index 61816198a..196bda837 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs +++ b/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies a Gaussian sharpening filter to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The 'sigma' value representing the weight of the blur. - /// The . - public static Image GaussianSharpen(this Image source, float sigma = 3f) - where TColor : struct, IPixel + /// The . + public static Image GaussianSharpen(this Image source, float sigma = 3f) + where TPixel : struct, IPixel { return GaussianSharpen(source, sigma, source.Bounds); } @@ -31,17 +31,17 @@ namespace ImageSharp /// /// Applies a Gaussian sharpening filter to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The 'sigma' value representing the weight of the blur. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image GaussianSharpen(this Image source, float sigma, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image GaussianSharpen(this Image source, float sigma, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new GaussianSharpenProcessor(sigma), rectangle); + source.ApplyProcessor(new GaussianSharpenProcessor(sigma), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Effects/Alpha.cs b/src/ImageSharp/Processing/Effects/Alpha.cs index 39849d4d4..f38953e38 100644 --- a/src/ImageSharp/Processing/Effects/Alpha.cs +++ b/src/ImageSharp/Processing/Effects/Alpha.cs @@ -17,12 +17,12 @@ namespace ImageSharp /// /// Alters the alpha component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new opacity of the image. Must be between 0 and 100. - /// The . - public static Image Alpha(this Image source, int percent) - where TColor : struct, IPixel + /// The . + public static Image Alpha(this Image source, int percent) + where TPixel : struct, IPixel { return Alpha(source, percent, source.Bounds); } @@ -30,17 +30,17 @@ namespace ImageSharp /// /// Alters the alpha component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new opacity of the image. Must be between 0 and 100. /// /// The structure that specifies the portion of the image object to alter. /// /// The . - public static Image Alpha(this Image source, int percent, Rectangle rectangle) - where TColor : struct, IPixel + public static Image Alpha(this Image source, int percent, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new AlphaProcessor(percent), rectangle); + source.ApplyProcessor(new AlphaProcessor(percent), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Effects/BackgroundColor.cs b/src/ImageSharp/Processing/Effects/BackgroundColor.cs index 2e621172e..e1107258f 100644 --- a/src/ImageSharp/Processing/Effects/BackgroundColor.cs +++ b/src/ImageSharp/Processing/Effects/BackgroundColor.cs @@ -10,21 +10,21 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Replaces the background color of image with the given one. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The color to set as the background. - /// The . - public static Image BackgroundColor(this Image source, TColor color) - where TColor : struct, IPixel + /// The . + public static Image BackgroundColor(this Image source, TPixel color) + where TPixel : struct, IPixel { - source.ApplyProcessor(new BackgroundColorProcessor(color), source.Bounds); + source.ApplyProcessor(new BackgroundColorProcessor(color), source.Bounds); return source; } } diff --git a/src/ImageSharp/Processing/Effects/Brightness.cs b/src/ImageSharp/Processing/Effects/Brightness.cs index 8ba702c4f..585db7346 100644 --- a/src/ImageSharp/Processing/Effects/Brightness.cs +++ b/src/ImageSharp/Processing/Effects/Brightness.cs @@ -10,19 +10,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the brightness component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new brightness of the image. Must be between -100 and 100. - /// The . - public static Image Brightness(this Image source, int amount) - where TColor : struct, IPixel + /// The . + public static Image Brightness(this Image source, int amount) + where TPixel : struct, IPixel { return Brightness(source, amount, source.Bounds); } @@ -30,17 +30,17 @@ namespace ImageSharp /// /// Alters the brightness component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new brightness of the image. Must be between -100 and 100. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Brightness(this Image source, int amount, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Brightness(this Image source, int amount, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new BrightnessProcessor(amount), rectangle); + source.ApplyProcessor(new BrightnessProcessor(amount), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Effects/Contrast.cs b/src/ImageSharp/Processing/Effects/Contrast.cs index 0228f4fe3..99a90455f 100644 --- a/src/ImageSharp/Processing/Effects/Contrast.cs +++ b/src/ImageSharp/Processing/Effects/Contrast.cs @@ -10,19 +10,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the contrast component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new contrast of the image. Must be between -100 and 100. - /// The . - public static Image Contrast(this Image source, int amount) - where TColor : struct, IPixel + /// The . + public static Image Contrast(this Image source, int amount) + where TPixel : struct, IPixel { return Contrast(source, amount, source.Bounds); } @@ -30,17 +30,17 @@ namespace ImageSharp /// /// Alters the contrast component of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The new contrast of the image. Must be between -100 and 100. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Contrast(this Image source, int amount, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Contrast(this Image source, int amount, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new ContrastProcessor(amount), rectangle); + source.ApplyProcessor(new ContrastProcessor(amount), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Effects/Invert.cs b/src/ImageSharp/Processing/Effects/Invert.cs index 6c51ad3eb..3bb1124ce 100644 --- a/src/ImageSharp/Processing/Effects/Invert.cs +++ b/src/ImageSharp/Processing/Effects/Invert.cs @@ -10,18 +10,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Inverts the colors of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The . - public static Image Invert(this Image source) - where TColor : struct, IPixel + public static Image Invert(this Image source) + where TPixel : struct, IPixel { return Invert(source, source.Bounds); } @@ -29,16 +29,16 @@ namespace ImageSharp /// /// Inverts the colors of the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// /// The . - public static Image Invert(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + public static Image Invert(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - source.ApplyProcessor(new InvertProcessor(), rectangle); + source.ApplyProcessor(new InvertProcessor(), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Effects/OilPainting.cs b/src/ImageSharp/Processing/Effects/OilPainting.cs index d7d8444c0..62e6aeda7 100644 --- a/src/ImageSharp/Processing/Effects/OilPainting.cs +++ b/src/ImageSharp/Processing/Effects/OilPainting.cs @@ -10,20 +10,20 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Alters the colors of the image recreating an oil painting effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image. /// The number of neighboring pixels used in calculating each individual pixel value. - /// The . - public static Image OilPaint(this Image source, int levels = 10, int brushSize = 15) - where TColor : struct, IPixel + /// The . + public static Image OilPaint(this Image source, int levels = 10, int brushSize = 15) + where TPixel : struct, IPixel { return OilPaint(source, levels, brushSize, source.Bounds); } @@ -31,16 +31,16 @@ namespace ImageSharp /// /// Alters the colors of the image recreating an oil painting effect. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image. /// The number of neighboring pixels used in calculating each individual pixel value. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image OilPaint(this Image source, int levels, int brushSize, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image OilPaint(this Image source, int levels, int brushSize, Rectangle rectangle) + where TPixel : struct, IPixel { Guard.MustBeGreaterThan(levels, 0, nameof(levels)); @@ -49,7 +49,7 @@ namespace ImageSharp throw new ArgumentOutOfRangeException(nameof(brushSize)); } - source.ApplyProcessor(new OilPaintingProcessor(levels, brushSize), rectangle); + source.ApplyProcessor(new OilPaintingProcessor(levels, brushSize), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Effects/Pixelate.cs b/src/ImageSharp/Processing/Effects/Pixelate.cs index 721dd930b..a57f30c96 100644 --- a/src/ImageSharp/Processing/Effects/Pixelate.cs +++ b/src/ImageSharp/Processing/Effects/Pixelate.cs @@ -10,19 +10,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Pixelates an image with the given pixel size. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The size of the pixels. - /// The . - public static Image Pixelate(this Image source, int size = 4) - where TColor : struct, IPixel + /// The . + public static Image Pixelate(this Image source, int size = 4) + where TPixel : struct, IPixel { return Pixelate(source, size, source.Bounds); } @@ -30,22 +30,22 @@ namespace ImageSharp /// /// Pixelates an image with the given pixel size. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The size of the pixels. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Pixelate(this Image source, int size, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Pixelate(this Image source, int size, Rectangle rectangle) + where TPixel : struct, IPixel { if (size <= 0 || size > source.Height || size > source.Width) { throw new ArgumentOutOfRangeException(nameof(size)); } - source.ApplyProcessor(new PixelateProcessor(size), rectangle); + source.ApplyProcessor(new PixelateProcessor(size), rectangle); return source; } } diff --git a/src/ImageSharp/Processing/Overlays/Glow.cs b/src/ImageSharp/Processing/Overlays/Glow.cs index e8dfbdf0e..562012f97 100644 --- a/src/ImageSharp/Processing/Overlays/Glow.cs +++ b/src/ImageSharp/Processing/Overlays/Glow.cs @@ -10,31 +10,31 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies a radial glow effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image Glow(this Image source) - where TColor : struct, IPixel + /// The . + public static Image Glow(this Image source) + where TPixel : struct, IPixel { - return Glow(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds); + return Glow(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds); } /// /// Applies a radial glow effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The color to set as the glow. - /// The . - public static Image Glow(this Image source, TColor color) - where TColor : struct, IPixel + /// The . + public static Image Glow(this Image source, TPixel color) + where TPixel : struct, IPixel { return Glow(source, color, source.Bounds.Width * .5F, source.Bounds); } @@ -42,46 +42,46 @@ namespace ImageSharp /// /// Applies a radial glow effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The the radius. - /// The . - public static Image Glow(this Image source, float radius) - where TColor : struct, IPixel + /// The . + public static Image Glow(this Image source, float radius) + where TPixel : struct, IPixel { - return Glow(source, NamedColors.Black, radius, source.Bounds); + return Glow(source, NamedColors.Black, radius, source.Bounds); } /// /// Applies a radial glow effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Glow(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Glow(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - return Glow(source, NamedColors.Black, 0, rectangle); + return Glow(source, NamedColors.Black, 0, rectangle); } /// /// Applies a radial glow effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The color to set as the glow. /// The the radius. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Glow(this Image source, TColor color, float radius, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Glow(this Image source, TPixel color, float radius, Rectangle rectangle) + where TPixel : struct, IPixel { - GlowProcessor processor = new GlowProcessor(color) { Radius = radius, }; + GlowProcessor processor = new GlowProcessor(color) { Radius = radius, }; source.ApplyProcessor(processor, rectangle); return source; } diff --git a/src/ImageSharp/Processing/Overlays/Vignette.cs b/src/ImageSharp/Processing/Overlays/Vignette.cs index e42ead8d3..424200fdd 100644 --- a/src/ImageSharp/Processing/Overlays/Vignette.cs +++ b/src/ImageSharp/Processing/Overlays/Vignette.cs @@ -10,31 +10,31 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies a radial vignette effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. - /// The . - public static Image Vignette(this Image source) - where TColor : struct, IPixel + /// The . + public static Image Vignette(this Image source) + where TPixel : struct, IPixel { - return Vignette(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); + return Vignette(source, NamedColors.Black, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); } /// /// Applies a radial vignette effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The color to set as the vignette. - /// The . - public static Image Vignette(this Image source, TColor color) - where TColor : struct, IPixel + /// The . + public static Image Vignette(this Image source, TPixel color) + where TPixel : struct, IPixel { return Vignette(source, color, source.Bounds.Width * .5F, source.Bounds.Height * .5F, source.Bounds); } @@ -42,36 +42,36 @@ namespace ImageSharp /// /// Applies a radial vignette effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The the x-radius. /// The the y-radius. - /// The . - public static Image Vignette(this Image source, float radiusX, float radiusY) - where TColor : struct, IPixel + /// The . + public static Image Vignette(this Image source, float radiusX, float radiusY) + where TPixel : struct, IPixel { - return Vignette(source, NamedColors.Black, radiusX, radiusY, source.Bounds); + return Vignette(source, NamedColors.Black, radiusX, radiusY, source.Bounds); } /// /// Applies a radial vignette effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Vignette(this Image source, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Vignette(this Image source, Rectangle rectangle) + where TPixel : struct, IPixel { - return Vignette(source, NamedColors.Black, 0, 0, rectangle); + return Vignette(source, NamedColors.Black, 0, 0, rectangle); } /// /// Applies a radial vignette effect to an image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The color to set as the vignette. /// The the x-radius. @@ -79,11 +79,11 @@ namespace ImageSharp /// /// The structure that specifies the portion of the image object to alter. /// - /// The . - public static Image Vignette(this Image source, TColor color, float radiusX, float radiusY, Rectangle rectangle) - where TColor : struct, IPixel + /// The . + public static Image Vignette(this Image source, TPixel color, float radiusX, float radiusY, Rectangle rectangle) + where TPixel : struct, IPixel { - VignetteProcessor processor = new VignetteProcessor(color) { RadiusX = radiusX, RadiusY = radiusY }; + VignetteProcessor processor = new VignetteProcessor(color) { RadiusX = radiusX, RadiusY = radiusY }; source.ApplyProcessor(processor, rectangle); return source; } diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs index 555546341..f187cfcff 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs @@ -9,15 +9,15 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to perform binary threshold filtering against an + /// An to perform binary threshold filtering against an /// . The image will be converted to grayscale before thresholding occurs. /// - /// The pixel format. - internal class BinaryThresholdProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class BinaryThresholdProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The threshold to split the image. Must be between 0 and 1. public BinaryThresholdProcessor(float threshold) @@ -27,8 +27,8 @@ namespace ImageSharp.Processing.Processors this.Threshold = threshold; // Default to white/black for upper/lower. - this.UpperColor = NamedColors.White; - this.LowerColor = NamedColors.Black; + this.UpperColor = NamedColors.White; + this.LowerColor = NamedColors.Black; } /// @@ -39,25 +39,25 @@ namespace ImageSharp.Processing.Processors /// /// Gets or sets the color to use for pixels that are above the threshold. /// - public TColor UpperColor { get; set; } + public TPixel UpperColor { get; set; } /// /// Gets or sets the color to use for pixels that fall below the threshold. /// - public TColor LowerColor { get; set; } + public TPixel LowerColor { get; set; } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { - new GrayscaleBt709Processor().Apply(source, sourceRectangle); + new GrayscaleBt709Processor().Apply(source, sourceRectangle); } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { float threshold = this.Threshold; - TColor upper = this.UpperColor; - TColor lower = this.LowerColor; + TPixel upper = this.UpperColor; + TPixel lower = this.LowerColor; int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -81,7 +81,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -93,7 +93,7 @@ namespace ImageSharp.Processing.Processors for (int x = minX; x < maxX; x++) { int offsetX = x - startX; - TColor color = sourcePixels[offsetX, offsetY]; + TPixel color = sourcePixels[offsetX, offsetY]; // Any channel will do since it's Grayscale. sourcePixels[offsetX, offsetY] = color.ToVector4().X >= threshold ? upper : lower; diff --git a/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs index 50f042bd6..0fd73a84a 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Processing.Processors using ImageSharp.Dithering; /// - /// An that dithers an image using error diffusion. + /// An that dithers an image using error diffusion. /// - /// The pixel format. - internal class ErrorDiffusionDitherProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class ErrorDiffusionDitherProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error diffuser /// The threshold to split the image. Must be between 0 and 1. @@ -29,8 +29,8 @@ namespace ImageSharp.Processing.Processors this.Threshold = threshold; // Default to white/black for upper/lower. - this.UpperColor = NamedColors.White; - this.LowerColor = NamedColors.Black; + this.UpperColor = NamedColors.White; + this.LowerColor = NamedColors.Black; } /// @@ -46,21 +46,21 @@ namespace ImageSharp.Processing.Processors /// /// Gets or sets the color to use for pixels that are above the threshold. /// - public TColor UpperColor { get; set; } + public TPixel UpperColor { get; set; } /// /// Gets or sets the color to use for pixels that fall below the threshold. /// - public TColor LowerColor { get; set; } + public TPixel LowerColor { get; set; } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { - new GrayscaleBt709Processor().Apply(source, sourceRectangle); + new GrayscaleBt709Processor().Apply(source, sourceRectangle); } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -84,7 +84,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { for (int y = minY; y < maxY; y++) { @@ -92,8 +92,8 @@ namespace ImageSharp.Processing.Processors for (int x = minX; x < maxX; x++) { int offsetX = x - startX; - TColor sourceColor = sourcePixels[offsetX, offsetY]; - TColor transformedColor = sourceColor.ToVector4().X >= this.Threshold ? this.UpperColor : this.LowerColor; + TPixel sourceColor = sourcePixels[offsetX, offsetY]; + TPixel transformedColor = sourceColor.ToVector4().X >= this.Threshold ? this.UpperColor : this.LowerColor; this.Diffuser.Dither(sourcePixels, sourceColor, transformedColor, offsetX, offsetY, maxX, maxY); } } diff --git a/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs index c7f4d20ac..08f653271 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs @@ -11,14 +11,14 @@ namespace ImageSharp.Processing.Processors using ImageSharp.Dithering; /// - /// An that dithers an image using error diffusion. + /// An that dithers an image using error diffusion. /// - /// The pixel format. - internal class OrderedDitherProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class OrderedDitherProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The ordered ditherer. /// The component index to test the threshold against. Must range from 0 to 3. @@ -28,7 +28,7 @@ namespace ImageSharp.Processing.Processors Guard.MustBeBetweenOrEqualTo(index, 0, 3, nameof(index)); // Alpha8 only stores the pixel data in the alpha channel. - if (typeof(TColor) == typeof(Alpha8)) + if (typeof(TPixel) == typeof(Alpha8)) { index = 3; } @@ -37,8 +37,8 @@ namespace ImageSharp.Processing.Processors this.Index = index; // Default to white/black for upper/lower. - this.UpperColor = NamedColors.White; - this.LowerColor = NamedColors.Black; + this.UpperColor = NamedColors.White; + this.LowerColor = NamedColors.Black; } /// @@ -54,21 +54,21 @@ namespace ImageSharp.Processing.Processors /// /// Gets or sets the color to use for pixels that are above the threshold. /// - public TColor UpperColor { get; set; } + public TPixel UpperColor { get; set; } /// /// Gets or sets the color to use for pixels that fall below the threshold. /// - public TColor LowerColor { get; set; } + public TPixel LowerColor { get; set; } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { - new GrayscaleBt709Processor().Apply(source, sourceRectangle); + new GrayscaleBt709Processor().Apply(source, sourceRectangle); } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -92,7 +92,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { for (int y = minY; y < maxY; y++) { @@ -102,7 +102,7 @@ namespace ImageSharp.Processing.Processors for (int x = minX; x < maxX; x++) { int offsetX = x - startX; - TColor sourceColor = sourcePixels[offsetX, offsetY]; + TPixel sourceColor = sourcePixels[offsetX, offsetY]; this.Dither.Dither(sourcePixels, sourceColor, this.UpperColor, this.LowerColor, bytes, this.Index, offsetX, offsetY, maxX, maxY); } diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs index 0214af72d..6676d89ba 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image to their black and white equivalent. /// - /// The pixel format. - internal class BlackWhiteProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class BlackWhiteProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs index d1e986a9d..3bad624ba 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Achromatomaly (Color desensitivity) color blindness. /// - /// The pixel format. - internal class AchromatomalyProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class AchromatomalyProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs index d17e28dca..246a57481 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Achromatopsia (Monochrome) color blindness. /// - /// The pixel format. - internal class AchromatopsiaProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class AchromatopsiaProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs index 7f4529ba4..a79716859 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Deuteranomaly (Green-Weak) color blindness. /// - /// The pixel format. - internal class DeuteranomalyProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class DeuteranomalyProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs index 493ed2cae..c8cc1a962 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Deuteranopia (Green-Blind) color blindness. /// - /// The pixel format. - internal class DeuteranopiaProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class DeuteranopiaProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs index ddea24be0..618c6deae 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Protanopia (Red-Weak) color blindness. /// - /// The pixel format. - internal class ProtanomalyProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class ProtanomalyProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs index c5446dbe1..de87ede0c 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Protanopia (Red-Blind) color blindness. /// - /// The pixel format. - internal class ProtanopiaProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class ProtanopiaProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs index 846e9c61a..dd2a6067c 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Tritanomaly (Blue-Weak) color blindness. /// - /// The pixel format. - internal class TritanomalyProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class TritanomalyProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs index a0094f71f..5d8098c62 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating Tritanopia (Blue-Blind) color blindness. /// - /// The pixel format. - internal class TritanopiaProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class TritanopiaProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs index 55ea50869..7f5d4465a 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// /// The color matrix filter. Inherit from this class to perform operation involving color matrices. /// - /// The pixel format. - internal abstract class ColorMatrixProcessor : ImageProcessor, IColorMatrixFilter - where TColor : struct, IPixel + /// The pixel format. + internal abstract class ColorMatrixProcessor : ImageProcessor, IColorMatrixFilter + where TPixel : struct, IPixel { /// public abstract Matrix4x4 Matrix { get; } @@ -23,7 +23,7 @@ namespace ImageSharp.Processing.Processors public override bool Compand { get; set; } = true; /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -50,7 +50,7 @@ namespace ImageSharp.Processing.Processors Matrix4x4 matrix = this.Matrix; bool compand = this.Compand; - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -77,7 +77,7 @@ namespace ImageSharp.Processing.Processors /// /// The . /// - private TColor ApplyMatrix(TColor color, Matrix4x4 matrix, bool compand) + private TPixel ApplyMatrix(TPixel color, Matrix4x4 matrix, bool compand) { Vector4 vector = color.ToVector4(); @@ -87,7 +87,7 @@ namespace ImageSharp.Processing.Processors } vector = Vector4.Transform(vector, matrix); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(compand ? vector.Compress() : vector); return packed; } diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs index 1f5a0fa7e..add3e266b 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// Converts the colors of the image to Grayscale applying the formula as specified by ITU-R Recommendation BT.601 /// . /// - /// The pixel format. - internal class GrayscaleBt601Processor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class GrayscaleBt601Processor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs index 048462696..8e7956e5d 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// Converts the colors of the image to Grayscale applying the formula as specified by ITU-R Recommendation BT.709 /// . /// - /// The pixel format. - internal class GrayscaleBt709Processor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class GrayscaleBt709Processor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs index 0d06c5868..e5fd0318c 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs @@ -9,14 +9,14 @@ namespace ImageSharp.Processing.Processors using System.Numerics; /// - /// An to change the hue of an . + /// An to change the hue of an . /// - /// The pixel format. - internal class HueProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class HueProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The new brightness of the image. Must be between -100 and 100. public HueProcessor(float angle) diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs index 57296a0c3..ca57f6633 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// Encapsulates properties and methods for creating processors that utilize a matrix to /// alter the image pixels. /// - /// The pixel format. - internal interface IColorMatrixFilter : IImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal interface IColorMatrixFilter : IImageProcessor + where TPixel : struct, IPixel { /// /// Gets the used to alter the image. diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs index 8df8efcd1..fe6b07c03 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating an old Kodachrome camera effect. /// - /// The pixel format. - internal class KodachromeProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class KodachromeProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4() diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs index b89caec86..2071fc7bb 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs @@ -11,11 +11,11 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating an old Lomograph effect. /// - /// The pixel format. - internal class LomographProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class LomographProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { - private static readonly TColor VeryDarkGreen = ColorBuilder.FromRGBA(0, 10, 0, 255); + private static readonly TPixel VeryDarkGreen = ColorBuilder.FromRGBA(0, 10, 0, 255); /// public override Matrix4x4 Matrix => new Matrix4x4() @@ -30,9 +30,9 @@ namespace ImageSharp.Processing.Processors }; /// - protected override void AfterApply(ImageBase source, Rectangle sourceRectangle) + protected override void AfterApply(ImageBase source, Rectangle sourceRectangle) { - new VignetteProcessor(VeryDarkGreen).Apply(source, sourceRectangle); + new VignetteProcessor(VeryDarkGreen).Apply(source, sourceRectangle); } } } \ No newline at end of file diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs index b5a23f855..d625b641d 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs @@ -11,12 +11,12 @@ namespace ImageSharp.Processing.Processors /// /// Converts the colors of the image recreating an old Polaroid effect. /// - /// The pixel format. - internal class PolaroidProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class PolaroidProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { - private static TColor veryDarkOrange = ColorBuilder.FromRGB(102, 34, 0); - private static TColor lightOrange = ColorBuilder.FromRGBA(255, 153, 102, 178); + private static TPixel veryDarkOrange = ColorBuilder.FromRGB(102, 34, 0); + private static TPixel lightOrange = ColorBuilder.FromRGBA(255, 153, 102, 178); /// public override Matrix4x4 Matrix => new Matrix4x4() @@ -37,10 +37,10 @@ namespace ImageSharp.Processing.Processors }; /// - protected override void AfterApply(ImageBase source, Rectangle sourceRectangle) + protected override void AfterApply(ImageBase source, Rectangle sourceRectangle) { - new VignetteProcessor(veryDarkOrange).Apply(source, sourceRectangle); - new GlowProcessor(lightOrange) { Radius = source.Width / 4F }.Apply(source, sourceRectangle); + new VignetteProcessor(veryDarkOrange).Apply(source, sourceRectangle); + new GlowProcessor(lightOrange) { Radius = source.Width / 4F }.Apply(source, sourceRectangle); } } } \ No newline at end of file diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs index 371294dd5..cd8947d05 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs @@ -9,14 +9,14 @@ namespace ImageSharp.Processing.Processors using System.Numerics; /// - /// An to change the saturation of an . + /// An to change the saturation of an . /// - /// The pixel format. - internal class SaturationProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class SaturationProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The new saturation of the image. Must be between -100 and 100. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs index 49a071bd9..8d9ef17d0 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// Converts the colors of the image to their sepia equivalent. /// The formula used matches the svg specification. /// - /// The pixel format. - internal class SepiaProcessor : ColorMatrixProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class SepiaProcessor : ColorMatrixProcessor + where TPixel : struct, IPixel { /// public override Matrix4x4 Matrix => new Matrix4x4 diff --git a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs index 7ffca534c..26a531d0c 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs @@ -10,9 +10,9 @@ namespace ImageSharp.Processing.Processors /// /// Applies a Box blur sampler to the image. /// - /// The pixel format. - internal class BoxBlurProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class BoxBlurProcessor : ImageProcessor + where TPixel : struct, IPixel { /// /// The maximum size of the kernel in either direction. @@ -20,7 +20,7 @@ namespace ImageSharp.Processing.Processors private readonly int kernelSize; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The 'radius' value representing the size of the area to sample. @@ -43,9 +43,9 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelY { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); + new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); } /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs index fa06a863e..8ca06b359 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs @@ -12,12 +12,12 @@ namespace ImageSharp.Processing.Processors /// /// Defines a sampler that uses two one-dimensional matrices to perform convolution against an image. /// - /// The pixel format. - internal class Convolution2DProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class Convolution2DProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The horizontal gradient operator. /// The vertical gradient operator. @@ -38,7 +38,7 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelY { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int kernelYHeight = this.KernelY.Height; int kernelYWidth = this.KernelY.Width; @@ -54,9 +54,9 @@ namespace ImageSharp.Processing.Processors int maxY = endY - 1; int maxX = endX - 1; - using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) + using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( startY, @@ -112,7 +112,7 @@ namespace ImageSharp.Processing.Processors float green = MathF.Sqrt((gX * gX) + (gY * gY)); float blue = MathF.Sqrt((bX * bX) + (bY * bY)); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(new Vector4(red, green, blue, sourcePixels[x, y].ToVector4().W)); targetPixels[x, y] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs index 45906a46f..ca114b10a 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs @@ -12,12 +12,12 @@ namespace ImageSharp.Processing.Processors /// /// Defines a sampler that uses two one-dimensional matrices to perform two-pass convolution against an image. /// - /// The pixel format. - internal class Convolution2PassProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class Convolution2PassProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The horizontal gradient operator. /// The vertical gradient operator. @@ -38,15 +38,15 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelY { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int width = source.Width; int height = source.Height; - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor firstPassPixels = new PixelAccessor(width, height)) - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor firstPassPixels = new PixelAccessor(width, height)) + using (PixelAccessor sourcePixels = source.Lock()) { this.ApplyConvolution(firstPassPixels, sourcePixels, sourceRectangle, this.KernelX); this.ApplyConvolution(targetPixels, firstPassPixels, sourceRectangle, this.KernelY); @@ -57,7 +57,7 @@ namespace ImageSharp.Processing.Processors } /// - /// Applies the process to the specified portion of the specified at the specified location + /// Applies the process to the specified portion of the specified at the specified location /// and with the specified size. /// /// The target pixels to apply the process to. @@ -66,7 +66,7 @@ namespace ImageSharp.Processing.Processors /// The structure that specifies the portion of the image object to draw. /// /// The kernel operator. - private void ApplyConvolution(PixelAccessor targetPixels, PixelAccessor sourcePixels, Rectangle sourceRectangle, Fast2DArray kernel) + private void ApplyConvolution(PixelAccessor targetPixels, PixelAccessor sourcePixels, Rectangle sourceRectangle, Fast2DArray kernel) { int kernelHeight = kernel.Height; int kernelWidth = kernel.Width; @@ -110,7 +110,7 @@ namespace ImageSharp.Processing.Processors } } - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(destination); targetPixels[x, y] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs index 3ab95c4ce..d3b11d781 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs @@ -12,12 +12,12 @@ namespace ImageSharp.Processing.Processors /// /// Defines a sampler that uses a 2 dimensional matrix to perform convolution against an image. /// - /// The pixel format. - internal class ConvolutionProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class ConvolutionProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The 2d gradient operator. public ConvolutionProcessor(Fast2DArray kernelXY) @@ -31,7 +31,7 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelXY { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int kernelLength = this.KernelXY.Height; int radius = kernelLength >> 1; @@ -43,9 +43,9 @@ namespace ImageSharp.Processing.Processors int maxY = endY - 1; int maxX = endX - 1; - using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) + using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( startY, @@ -83,7 +83,7 @@ namespace ImageSharp.Processing.Processors } } - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(new Vector4(red, green, blue, sourcePixels[x, y].ToVector4().W)); targetPixels[x, y] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs index b5c681656..855820f18 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs @@ -10,12 +10,12 @@ namespace ImageSharp.Processing.Processors /// /// Defines a sampler that detects edges within an image using two one-dimensional matrices. /// - /// The pixel format. - internal abstract class EdgeDetector2DProcessor : ImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPixel + /// The pixel format. + internal abstract class EdgeDetector2DProcessor : ImageProcessor, IEdgeDetectorProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The horizontal gradient operator. /// The vertical gradient operator. @@ -39,17 +39,17 @@ namespace ImageSharp.Processing.Processors public bool Grayscale { get; set; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - new Convolution2DProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); + new Convolution2DProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { if (this.Grayscale) { - new GrayscaleBt709Processor().Apply(source, sourceRectangle); + new GrayscaleBt709Processor().Apply(source, sourceRectangle); } } } diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs index e92c2d109..43a0942b8 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// /// Defines a sampler that detects edges within an image using a eight two dimensional matrices. /// - /// The pixel format. - internal abstract class EdgeDetectorCompassProcessor : ImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPixel + /// The pixel format. + internal abstract class EdgeDetectorCompassProcessor : ImageProcessor, IEdgeDetectorProcessor + where TPixel : struct, IPixel { /// /// Gets the North gradient operator @@ -60,16 +60,16 @@ namespace ImageSharp.Processing.Processors public bool Grayscale { get; set; } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { if (this.Grayscale) { - new GrayscaleBt709Processor().Apply(source, sourceRectangle); + new GrayscaleBt709Processor().Apply(source, sourceRectangle); } } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { Fast2DArray[] kernels = { this.North, this.NorthWest, this.West, this.SouthWest, this.South, this.SouthEast, this.East, this.NorthEast }; @@ -85,9 +85,9 @@ namespace ImageSharp.Processing.Processors int maxY = Math.Min(source.Height, endY); // we need a clean copy for each pass to start from - using (ImageBase cleanCopy = new Image(source)) + using (ImageBase cleanCopy = new Image(source)) { - new ConvolutionProcessor(kernels[0]).Apply(source, sourceRectangle); + new ConvolutionProcessor(kernels[0]).Apply(source, sourceRectangle); if (kernels.Length == 1) { @@ -112,12 +112,12 @@ namespace ImageSharp.Processing.Processors // ReSharper disable once ForCanBeConvertedToForeach for (int i = 1; i < kernels.Length; i++) { - using (ImageBase pass = new Image(cleanCopy)) + using (ImageBase pass = new Image(cleanCopy)) { - new ConvolutionProcessor(kernels[i]).Apply(pass, sourceRectangle); + new ConvolutionProcessor(kernels[i]).Apply(pass, sourceRectangle); - using (PixelAccessor passPixels = pass.Lock()) - using (PixelAccessor targetPixels = source.Lock()) + using (PixelAccessor passPixels = pass.Lock()) + using (PixelAccessor targetPixels = source.Lock()) { Parallel.For( minY, @@ -131,7 +131,7 @@ namespace ImageSharp.Processing.Processors int offsetX = x - shiftX; // Grab the max components of the two pixels - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(Vector4.Max(passPixels[offsetX, offsetY].ToVector4(), targetPixels[offsetX, offsetY].ToVector4())); targetPixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs index d8b491faf..8fbf2fe0b 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs @@ -10,12 +10,12 @@ namespace ImageSharp.Processing.Processors /// /// Defines a sampler that detects edges within an image using a single two dimensional matrix. /// - /// The pixel format. - internal abstract class EdgeDetectorProcessor : ImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPixel + /// The pixel format. + internal abstract class EdgeDetectorProcessor : ImageProcessor, IEdgeDetectorProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The 2d gradient operator. protected EdgeDetectorProcessor(Fast2DArray kernelXY) @@ -32,18 +32,18 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelXY { get; } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { if (this.Grayscale) { - new GrayscaleBt709Processor().Apply(source, sourceRectangle); + new GrayscaleBt709Processor().Apply(source, sourceRectangle); } } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - new ConvolutionProcessor(this.KernelXY).Apply(source, sourceRectangle); + new ConvolutionProcessor(this.KernelXY).Apply(source, sourceRectangle); } } } \ No newline at end of file diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs index 7c0923bbb..39d11a485 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs @@ -10,9 +10,9 @@ namespace ImageSharp.Processing.Processors /// /// Provides properties and methods allowing the detection of edges within an image. /// - /// The pixel format. - public interface IEdgeDetectorProcessor : IImageProcessor, IEdgeDetectorProcessor - where TColor : struct, IPixel + /// The pixel format. + public interface IEdgeDetectorProcessor : IImageProcessor, IEdgeDetectorProcessor + where TPixel : struct, IPixel { } diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs index 20e7b1b17..56d5ac01d 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Kayyali operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class KayyaliProcessor : EdgeDetector2DProcessor - where TColor : struct, IPixel + internal class KayyaliProcessor : EdgeDetector2DProcessor + where TPixel : struct, IPixel { /// /// The horizontal gradient operator. @@ -40,7 +40,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public KayyaliProcessor() : base(KayyaliX, KayyaliY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs index 1b88a2200..f1f504f26 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Kirsch operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class KirschProcessor : EdgeDetectorCompassProcessor - where TColor : struct, IPixel + internal class KirschProcessor : EdgeDetectorCompassProcessor + where TPixel : struct, IPixel { /// /// The North gradient operator diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs index ec6963b1e..61a8858b7 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Laplacian 3 x 3 operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class Laplacian3X3Processor : EdgeDetectorProcessor - where TColor : struct, IPixel + internal class Laplacian3X3Processor : EdgeDetectorProcessor + where TPixel : struct, IPixel { /// /// The 2d gradient operator. @@ -29,7 +29,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public Laplacian3X3Processor() : base(Laplacian3X3XY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs index cc68c4fb7..2c3929712 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Laplacian 5 x 5 operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class Laplacian5X5Processor : EdgeDetectorProcessor - where TColor : struct, IPixel + internal class Laplacian5X5Processor : EdgeDetectorProcessor + where TPixel : struct, IPixel { /// /// The 2d gradient operator. @@ -31,7 +31,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public Laplacian5X5Processor() : base(Laplacian5X5XY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs index f0944e681..aa9b4b9f2 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Laplacian of Gaussian operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class LaplacianOfGaussianProcessor : EdgeDetectorProcessor - where TColor : struct, IPixel + internal class LaplacianOfGaussianProcessor : EdgeDetectorProcessor + where TPixel : struct, IPixel { /// /// The 2d gradient operator. @@ -31,7 +31,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public LaplacianOfGaussianProcessor() : base(LaplacianOfGaussianXY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs index fdb63d837..24faf20d0 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Prewitt operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class PrewittProcessor : EdgeDetector2DProcessor - where TColor : struct, IPixel + internal class PrewittProcessor : EdgeDetector2DProcessor + where TPixel : struct, IPixel { /// /// The horizontal gradient operator. @@ -40,7 +40,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public PrewittProcessor() : base(PrewittX, PrewittY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs index d9c5f5d21..efbdc7ffa 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Roberts Cross operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class RobertsCrossProcessor : EdgeDetector2DProcessor - where TColor : struct, IPixel + internal class RobertsCrossProcessor : EdgeDetector2DProcessor + where TPixel : struct, IPixel { /// /// The horizontal gradient operator. @@ -38,7 +38,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public RobertsCrossProcessor() : base(RobertsCrossX, RobertsCrossY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs index 681d983c4..f6ab60fd3 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Kirsch operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class RobinsonProcessor : EdgeDetectorCompassProcessor - where TColor : struct, IPixel + internal class RobinsonProcessor : EdgeDetectorCompassProcessor + where TPixel : struct, IPixel { /// /// The North gradient operator diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs index c1e83b7f9..41e3d16f4 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Scharr operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class ScharrProcessor : EdgeDetector2DProcessor - where TColor : struct, IPixel + internal class ScharrProcessor : EdgeDetector2DProcessor + where TPixel : struct, IPixel { /// /// The horizontal gradient operator. @@ -40,7 +40,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public ScharrProcessor() : base(ScharrX, ScharrY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs index 0c13fa3d2..245df5afd 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs @@ -12,10 +12,10 @@ namespace ImageSharp.Processing.Processors /// The Sobel operator filter. /// /// - /// The pixel format. + /// The pixel format. [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "We want to use only one instance of each array field for each generic type.")] - internal class SobelProcessor : EdgeDetector2DProcessor - where TColor : struct, IPixel + internal class SobelProcessor : EdgeDetector2DProcessor + where TPixel : struct, IPixel { /// /// The horizontal gradient operator. @@ -40,7 +40,7 @@ namespace ImageSharp.Processing.Processors }; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public SobelProcessor() : base(SobelX, SobelY) diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs index 65a137e35..c0f025630 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs @@ -10,9 +10,9 @@ namespace ImageSharp.Processing.Processors /// /// Applies a Gaussian blur sampler to the image. /// - /// The pixel format. - internal class GaussianBlurProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class GaussianBlurProcessor : ImageProcessor + where TPixel : struct, IPixel { /// /// The maximum size of the kernel in either direction. @@ -25,7 +25,7 @@ namespace ImageSharp.Processing.Processors private readonly float sigma; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The 'sigma' value representing the weight of the blur. public GaussianBlurProcessor(float sigma = 3f) @@ -37,7 +37,7 @@ namespace ImageSharp.Processing.Processors } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The 'radius' value representing the size of the area to sample. @@ -51,7 +51,7 @@ namespace ImageSharp.Processing.Processors } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The 'sigma' value representing the weight of the blur. @@ -79,9 +79,9 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelY { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); + new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); } /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs index bb3dc6f99..353763843 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs @@ -10,9 +10,9 @@ namespace ImageSharp.Processing.Processors /// /// Applies a Gaussian sharpening sampler to the image. /// - /// The pixel format. - internal class GaussianSharpenProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class GaussianSharpenProcessor : ImageProcessor + where TPixel : struct, IPixel { /// /// The maximum size of the kernel in either direction. @@ -25,7 +25,7 @@ namespace ImageSharp.Processing.Processors private readonly float sigma; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The 'sigma' value representing the weight of the sharpening. @@ -39,7 +39,7 @@ namespace ImageSharp.Processing.Processors } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The 'radius' value representing the size of the area to sample. @@ -53,7 +53,7 @@ namespace ImageSharp.Processing.Processors } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The 'sigma' value representing the weight of the sharpen. @@ -81,9 +81,9 @@ namespace ImageSharp.Processing.Processors public Fast2DArray KernelY { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); + new Convolution2PassProcessor(this.KernelX, this.KernelY).Apply(source, sourceRectangle); } /// diff --git a/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs index ce48aea1a..48b8a64b2 100644 --- a/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to change the alpha component of an . + /// An to change the alpha component of an . /// - /// The pixel format. - internal class AlphaProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class AlphaProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The percentage to adjust the opacity of the image. Must be between 0 and 100. /// @@ -35,7 +35,7 @@ namespace ImageSharp.Processing.Processors public int Value { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { float alpha = this.Value / 100F; @@ -63,7 +63,7 @@ namespace ImageSharp.Processing.Processors Vector4 alphaVector = new Vector4(1, 1, 1, alpha); - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -75,7 +75,7 @@ namespace ImageSharp.Processing.Processors for (int x = minX; x < maxX; x++) { int offsetX = x - startX; - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(sourcePixels[offsetX, offsetY].ToVector4() * alphaVector); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs index d928eb1a4..368986b5d 100644 --- a/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs @@ -12,15 +12,15 @@ namespace ImageSharp.Processing.Processors /// /// Sets the background color of the image. /// - /// The pixel format. - internal class BackgroundColorProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class BackgroundColorProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// The to set the background color to. - public BackgroundColorProcessor(TColor color) + /// The to set the background color to. + public BackgroundColorProcessor(TPixel color) { this.Value = color; } @@ -28,10 +28,10 @@ namespace ImageSharp.Processing.Processors /// /// Gets the background color value. /// - public TColor Value { get; } + public TPixel Value { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -57,7 +57,7 @@ namespace ImageSharp.Processing.Processors Vector4 backgroundColor = this.Value.ToVector4(); - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -82,7 +82,7 @@ namespace ImageSharp.Processing.Processors color = backgroundColor; } - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(color); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs index 84df5e89e..5647a6453 100644 --- a/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to change the brightness of an . + /// An to change the brightness of an . /// - /// The pixel format. - internal class BrightnessProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class BrightnessProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The new brightness of the image. Must be between -100 and 100. /// @@ -35,7 +35,7 @@ namespace ImageSharp.Processing.Processors public int Value { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { float brightness = this.Value / 100F; @@ -61,7 +61,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -79,7 +79,7 @@ namespace ImageSharp.Processing.Processors Vector3 transformed = new Vector3(vector.X, vector.Y, vector.Z) + new Vector3(brightness); vector = new Vector4(transformed, vector.W); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(vector.Compress()); sourcePixels[offsetX, offsetY] = packed; diff --git a/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs index 042e39699..c6abd250b 100644 --- a/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to change the contrast of an . + /// An to change the contrast of an . /// - /// The pixel format. - internal class ContrastProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class ContrastProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The new contrast of the image. Must be between -100 and 100. /// @@ -35,7 +35,7 @@ namespace ImageSharp.Processing.Processors public int Value { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { float contrast = (100F + this.Value) / 100F; @@ -63,7 +63,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -80,7 +80,7 @@ namespace ImageSharp.Processing.Processors vector -= shiftVector; vector *= contrastVector; vector += shiftVector; - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(vector.Compress()); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs index 4358e8946..9eaa99c71 100644 --- a/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to invert the colors of an . + /// An to invert the colors of an . /// - /// The pixel format. - internal class InvertProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class InvertProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -42,7 +42,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -57,7 +57,7 @@ namespace ImageSharp.Processing.Processors Vector4 color = sourcePixels[offsetX, offsetY].ToVector4(); Vector3 vector = inverseVector - new Vector3(color.X, color.Y, color.Z); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(new Vector4(vector, color.W)); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs index 957955c6c..3ef56b745 100644 --- a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs @@ -10,15 +10,15 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to apply an oil painting effect to an . + /// An to apply an oil painting effect to an . /// /// Adapted from by Dewald Esterhuizen. - /// The pixel format. - internal class OilPaintingProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class OilPaintingProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The number of intensity levels. Higher values result in a broader range of color intensities forming part of the result image. @@ -46,7 +46,7 @@ namespace ImageSharp.Processing.Processors public int BrushSize { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -67,9 +67,9 @@ namespace ImageSharp.Processing.Processors startX = 0; } - using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) + using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -143,7 +143,7 @@ namespace ImageSharp.Processing.Processors float green = MathF.Abs(greenBin[maxIndex] / maxIntensity); float blue = MathF.Abs(blueBin[maxIndex] / maxIntensity); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(new Vector4(red, green, blue, sourcePixels[x, y].ToVector4().W)); targetPixels[x, y] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs index 818b1f513..006ae8e60 100644 --- a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs @@ -10,14 +10,14 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An to pixelate the colors of an . + /// An to pixelate the colors of an . /// - /// The pixel format. - internal class PixelateProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class PixelateProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The size of the pixels. Must be greater than 0. /// @@ -35,7 +35,7 @@ namespace ImageSharp.Processing.Processors public int Value { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; @@ -64,9 +64,9 @@ namespace ImageSharp.Processing.Processors // Get the range on the y-plane to choose from. IEnumerable range = EnumerableExtensions.SteppedRange(minY, i => i < maxY, size); - using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) + using (PixelAccessor targetPixels = new PixelAccessor(source.Width, source.Height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.ForEach( range, @@ -94,7 +94,7 @@ namespace ImageSharp.Processing.Processors // Get the pixel color in the centre of the soon to be pixelated area. // ReSharper disable AccessToDisposedClosure - TColor pixel = sourcePixels[offsetX + offsetPx, offsetY + offsetPy]; + TPixel pixel = sourcePixels[offsetX + offsetPx, offsetY + offsetPy]; // For each pixel in the pixelate size, set it to the centre color. for (int l = offsetY; l < offsetY + size && l < maxY; l++) diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs index 6eeb7398a..223da64ac 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs @@ -10,17 +10,17 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An that applies a radial glow effect an . + /// An that applies a radial glow effect an . /// - /// The pixel format. - internal class GlowProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class GlowProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color or the glow. - public GlowProcessor(TColor color) + public GlowProcessor(TPixel color) { this.GlowColor = color; } @@ -28,7 +28,7 @@ namespace ImageSharp.Processing.Processors /// /// Gets or sets the glow color to apply. /// - public TColor GlowColor { get; set; } + public TPixel GlowColor { get; set; } /// /// Gets or sets the the radius. @@ -36,13 +36,13 @@ namespace ImageSharp.Processing.Processors public float Radius { get; set; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; int startX = sourceRectangle.X; int endX = sourceRectangle.Right; - TColor glowColor = this.GlowColor; + TPixel glowColor = this.GlowColor; Vector2 centre = Rectangle.Center(sourceRectangle).ToVector2(); float maxDistance = this.Radius > 0 ? MathF.Min(this.Radius, sourceRectangle.Width * .5F) : sourceRectangle.Width * .5F; @@ -63,7 +63,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -77,7 +77,7 @@ namespace ImageSharp.Processing.Processors int offsetX = x - startX; float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY)); Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4(); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(Vector4BlendTransforms.PremultipliedLerp(sourceColor, glowColor.ToVector4(), 1 - (.95F * (distance / maxDistance)))); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs index 40d6d94ac..9be0cfde2 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs @@ -10,17 +10,17 @@ namespace ImageSharp.Processing.Processors using System.Threading.Tasks; /// - /// An that applies a radial vignette effect to an . + /// An that applies a radial vignette effect to an . /// - /// The pixel format. - internal class VignetteProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class VignetteProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color of the vignette. - public VignetteProcessor(TColor color) + public VignetteProcessor(TPixel color) { this.VignetteColor = color; } @@ -28,7 +28,7 @@ namespace ImageSharp.Processing.Processors /// /// Gets or sets the vignette color to apply. /// - public TColor VignetteColor { get; set; } + public TPixel VignetteColor { get; set; } /// /// Gets or sets the the x-radius. @@ -41,13 +41,13 @@ namespace ImageSharp.Processing.Processors public float RadiusY { get; set; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int startY = sourceRectangle.Y; int endY = sourceRectangle.Bottom; int startX = sourceRectangle.X; int endX = sourceRectangle.Right; - TColor vignetteColor = this.VignetteColor; + TPixel vignetteColor = this.VignetteColor; Vector2 centre = Rectangle.Center(sourceRectangle).ToVector2(); float rX = this.RadiusX > 0 ? MathF.Min(this.RadiusX, sourceRectangle.Width * .5F) : sourceRectangle.Width * .5F; float rY = this.RadiusY > 0 ? MathF.Min(this.RadiusY, sourceRectangle.Height * .5F) : sourceRectangle.Height * .5F; @@ -70,7 +70,7 @@ namespace ImageSharp.Processing.Processors startY = 0; } - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -84,7 +84,7 @@ namespace ImageSharp.Processing.Processors int offsetX = x - startX; float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY)); Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4(); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromVector4(Vector4BlendTransforms.PremultipliedLerp(sourceColor, vignetteColor.ToVector4(), .9F * (distance / maxDistance))); sourcePixels[offsetX, offsetY] = packed; } diff --git a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs index 7d473c55e..1b96e098e 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs @@ -11,12 +11,12 @@ namespace ImageSharp.Processing.Processors /// /// Provides methods to allow the cropping of an image. /// - /// The pixel format. - internal class CropProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class CropProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The target cropped rectangle. public CropProcessor(Rectangle cropRectangle) @@ -30,7 +30,7 @@ namespace ImageSharp.Processing.Processors public Rectangle CropRectangle { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { if (this.CropRectangle == sourceRectangle) { @@ -42,9 +42,9 @@ namespace ImageSharp.Processing.Processors int minX = Math.Max(this.CropRectangle.X, sourceRectangle.X); int maxX = Math.Min(this.CropRectangle.Right, sourceRectangle.Right); - using (PixelAccessor targetPixels = new PixelAccessor(this.CropRectangle.Width, this.CropRectangle.Height)) + using (PixelAccessor targetPixels = new PixelAccessor(this.CropRectangle.Width, this.CropRectangle.Height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, diff --git a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs index 049fbf2de..67259477c 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs @@ -11,12 +11,12 @@ namespace ImageSharp.Processing.Processors /// Provides methods to allow the cropping of an image to preserve areas of highest /// entropy. /// - /// The pixel format. - internal class EntropyCropProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class EntropyCropProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The threshold to split the image. Must be between 0 and 1. /// @@ -34,15 +34,15 @@ namespace ImageSharp.Processing.Processors public float Value { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { - using (ImageBase temp = new Image(source)) + using (ImageBase temp = new Image(source)) { // Detect the edges. - new SobelProcessor().Apply(temp, sourceRectangle); + new SobelProcessor().Apply(temp, sourceRectangle); // Apply threshold binarization filter. - new BinaryThresholdProcessor(this.Value).Apply(temp, sourceRectangle); + new BinaryThresholdProcessor(this.Value).Apply(temp, sourceRectangle); // Search for the first white pixels Rectangle rectangle = ImageMaths.GetFilteredBoundingRectangle(temp, 0); @@ -52,7 +52,7 @@ namespace ImageSharp.Processing.Processors return; } - new CropProcessor(rectangle).Apply(source, sourceRectangle); + new CropProcessor(rectangle).Apply(source, sourceRectangle); } } } diff --git a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs index 290d81799..86dc8bb15 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs @@ -11,12 +11,12 @@ namespace ImageSharp.Processing.Processors /// /// Provides methods that allow the flipping of an image around its center point. /// - /// The pixel format. - internal class FlipProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class FlipProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The used to perform flipping. public FlipProcessor(FlipType flipType) @@ -30,7 +30,7 @@ namespace ImageSharp.Processing.Processors public FlipType FlipType { get; } /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { switch (this.FlipType) { @@ -49,15 +49,15 @@ namespace ImageSharp.Processing.Processors /// at half the height of the image. /// /// The source image to apply the process to. - private void FlipX(ImageBase source) + private void FlipX(ImageBase source) { int width = source.Width; int height = source.Height; int halfHeight = (int)Math.Ceiling(source.Height * .5F); - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, @@ -83,15 +83,15 @@ namespace ImageSharp.Processing.Processors /// at half of the width of the image. /// /// The source image to apply the process to. - private void FlipY(ImageBase source) + private void FlipY(ImageBase source) { int width = source.Width; int height = source.Height; int halfWidth = (int)Math.Ceiling(width * .5F); - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, diff --git a/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs b/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs index 0c290a9b6..a8cd71003 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs @@ -11,9 +11,9 @@ namespace ImageSharp.Processing.Processors /// /// Provides methods to transform an image using a . /// - /// The pixel format. - internal abstract class Matrix3x2Processor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal abstract class Matrix3x2Processor : ImageProcessor + where TPixel : struct, IPixel { /// /// Gets the rectangle designating the target canvas. @@ -41,7 +41,7 @@ namespace ImageSharp.Processing.Processors /// /// The . /// - protected Matrix3x2 GetCenteredMatrix(ImageBase source, Matrix3x2 matrix) + protected Matrix3x2 GetCenteredMatrix(ImageBase source, Matrix3x2 matrix) { Matrix3x2 translationToTargetCenter = Matrix3x2.CreateTranslation(-this.CanvasRectangle.Width * .5F, -this.CanvasRectangle.Height * .5F); Matrix3x2 translateToSourceCenter = Matrix3x2.CreateTranslation(source.Width * .5F, source.Height * .5F); diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs index 4c43d654d..5d29924e1 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.Weights.cs @@ -7,7 +7,7 @@ namespace ImageSharp.Processing.Processors /// /// Conains the definition of and . /// - internal abstract partial class ResamplingWeightedProcessor + internal abstract partial class ResamplingWeightedProcessor { /// /// Points to a collection of of weights allocated in . diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs index 50c75a3fd..bd7ca3f60 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs @@ -14,12 +14,12 @@ namespace ImageSharp.Processing.Processors /// Provides methods that allow the resizing of images using various algorithms. /// Adapted from /// - /// The pixel format. - internal abstract partial class ResamplingWeightedProcessor : ImageProcessor - where TColor : struct, IPixel + /// The pixel format. + internal abstract partial class ResamplingWeightedProcessor : ImageProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The sampler to perform the resize operation. /// The target width. @@ -139,7 +139,7 @@ namespace ImageSharp.Processing.Processors } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { if (!(this.Sampler is NearestNeighborResampler)) { @@ -154,7 +154,7 @@ namespace ImageSharp.Processing.Processors } /// - protected override void AfterApply(ImageBase source, Rectangle sourceRectangle) + protected override void AfterApply(ImageBase source, Rectangle sourceRectangle) { base.AfterApply(source, sourceRectangle); this.HorizontalWeights?.Dispose(); diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs index 08d96e283..9601cc7bb 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs @@ -12,12 +12,12 @@ namespace ImageSharp.Processing.Processors /// /// Provides methods that allow the resizing of images using various algorithms. /// - /// The pixel format. - internal class ResizeProcessor : ResamplingWeightedProcessor - where TColor : struct, IPixel + /// The pixel format. + internal class ResizeProcessor : ResamplingWeightedProcessor + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The sampler to perform the resize operation. /// The target width. @@ -28,7 +28,7 @@ namespace ImageSharp.Processing.Processors } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The sampler to perform the resize operation. /// The target width. @@ -42,7 +42,7 @@ namespace ImageSharp.Processing.Processors } /// - protected override unsafe void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override unsafe void OnApply(ImageBase source, Rectangle sourceRectangle) { // Jump out, we'll deal with that later. if (source.Width == this.Width && source.Height == this.Height && sourceRectangle == this.ResizeRectangle) @@ -70,9 +70,9 @@ namespace ImageSharp.Processing.Processors float widthFactor = sourceRectangle.Width / (float)this.ResizeRectangle.Width; float heightFactor = sourceRectangle.Height / (float)this.ResizeRectangle.Height; - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( minY, @@ -103,9 +103,9 @@ namespace ImageSharp.Processing.Processors // are the upper and lower bounds of the source rectangle. // TODO: Using a transposed variant of 'firstPassPixels' could eliminate the need for the WeightsWindow.ComputeWeightedColumnSum() method, and improve speed! - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) using (Buffer2D firstPassPixels = new Buffer2D(width, source.Height)) { firstPassPixels.Clear(); @@ -119,9 +119,9 @@ namespace ImageSharp.Processing.Processors // TODO: Without Parallel.For() this buffer object could be reused: using (Buffer tempRowBuffer = new Buffer(sourcePixels.Width)) { - BufferSpan sourceRow = sourcePixels.GetRowSpan(y); + BufferSpan sourceRow = sourcePixels.GetRowSpan(y); - BulkPixelOperations.Instance.ToVector4( + BulkPixelOperations.Instance.ToVector4( sourceRow, tempRowBuffer, sourceRow.Length); @@ -162,7 +162,7 @@ namespace ImageSharp.Processing.Processors // Destination color components Vector4 destination = window.ComputeWeightedColumnSum(firstPassPixels, x); destination = destination.Compress(); - TColor d = default(TColor); + TPixel d = default(TPixel); d.PackFromVector4(destination); targetPixels[x, y] = d; } @@ -174,7 +174,7 @@ namespace ImageSharp.Processing.Processors // Destination color components Vector4 destination = window.ComputeWeightedColumnSum(firstPassPixels, x); - TColor d = default(TColor); + TPixel d = default(TPixel); d.PackFromVector4(destination); targetPixels[x, y] = d; } diff --git a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs index 16e0b6635..7d0afce26 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// /// Provides methods that allow the rotating of images. /// - /// The pixel format. - internal class RotateProcessor : Matrix3x2Processor - where TColor : struct, IPixel + /// The pixel format. + internal class RotateProcessor : Matrix3x2Processor + where TPixel : struct, IPixel { /// /// The transform matrix to apply. @@ -32,7 +32,7 @@ namespace ImageSharp.Processing.Processors public bool Expand { get; set; } = true; /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { if (this.OptimizedApply(source)) { @@ -43,9 +43,9 @@ namespace ImageSharp.Processing.Processors int width = this.CanvasRectangle.Width; Matrix3x2 matrix = this.GetCenteredMatrix(source, this.processMatrix); - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, @@ -69,7 +69,7 @@ namespace ImageSharp.Processing.Processors } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { if (MathF.Abs(this.Angle) < Constants.Epsilon || MathF.Abs(this.Angle - 90) < Constants.Epsilon || MathF.Abs(this.Angle - 180) < Constants.Epsilon || MathF.Abs(this.Angle - 270) < Constants.Epsilon) { @@ -88,7 +88,7 @@ namespace ImageSharp.Processing.Processors /// /// The source image. /// The - private bool OptimizedApply(ImageBase source) + private bool OptimizedApply(ImageBase source) { if (MathF.Abs(this.Angle) < Constants.Epsilon) { @@ -121,14 +121,14 @@ namespace ImageSharp.Processing.Processors /// Rotates the image 270 degrees clockwise at the centre point. /// /// The source image. - private void Rotate270(ImageBase source) + private void Rotate270(ImageBase source) { int width = source.Width; int height = source.Height; - using (PixelAccessor targetPixels = new PixelAccessor(height, width)) + using (PixelAccessor targetPixels = new PixelAccessor(height, width)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, @@ -154,14 +154,14 @@ namespace ImageSharp.Processing.Processors /// Rotates the image 180 degrees clockwise at the centre point. /// /// The source image. - private void Rotate180(ImageBase source) + private void Rotate180(ImageBase source) { int width = source.Width; int height = source.Height; - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, @@ -186,14 +186,14 @@ namespace ImageSharp.Processing.Processors /// Rotates the image 90 degrees clockwise at the centre point. /// /// The source image. - private void Rotate90(ImageBase source) + private void Rotate90(ImageBase source) { int width = source.Width; int height = source.Height; - using (PixelAccessor targetPixels = new PixelAccessor(height, width)) + using (PixelAccessor targetPixels = new PixelAccessor(height, width)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, diff --git a/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs index 5fe3f7d95..e5b6f12bf 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs @@ -12,9 +12,9 @@ namespace ImageSharp.Processing.Processors /// /// Provides methods that allow the skewing of images. /// - /// The pixel format. - internal class SkewProcessor : Matrix3x2Processor - where TColor : struct, IPixel + /// The pixel format. + internal class SkewProcessor : Matrix3x2Processor + where TPixel : struct, IPixel { /// /// The transform matrix to apply. @@ -37,15 +37,15 @@ namespace ImageSharp.Processing.Processors public bool Expand { get; set; } = true; /// - protected override void OnApply(ImageBase source, Rectangle sourceRectangle) + protected override void OnApply(ImageBase source, Rectangle sourceRectangle) { int height = this.CanvasRectangle.Height; int width = this.CanvasRectangle.Width; Matrix3x2 matrix = this.GetCenteredMatrix(source, this.processMatrix); - using (PixelAccessor targetPixels = new PixelAccessor(width, height)) + using (PixelAccessor targetPixels = new PixelAccessor(width, height)) { - using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) { Parallel.For( 0, @@ -69,7 +69,7 @@ namespace ImageSharp.Processing.Processors } /// - protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) + protected override void BeforeApply(ImageBase source, Rectangle sourceRectangle) { this.processMatrix = Point.CreateSkew(new Point(0, 0), -this.AngleX, -this.AngleY); if (this.Expand) diff --git a/src/ImageSharp/Processing/Transforms/AutoOrient.cs b/src/ImageSharp/Processing/Transforms/AutoOrient.cs index 8c5e22b99..5634c3299 100644 --- a/src/ImageSharp/Processing/Transforms/AutoOrient.cs +++ b/src/ImageSharp/Processing/Transforms/AutoOrient.cs @@ -10,18 +10,18 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Adjusts an image so that its orientation is suitable for viewing. Adjustments are based on EXIF metadata embedded in the image. /// - /// The pixel format. + /// The pixel format. /// The image to auto rotate. /// The - public static Image AutoOrient(this Image source) - where TColor : struct, IPixel + public static Image AutoOrient(this Image source) + where TPixel : struct, IPixel { Orientation orientation = GetExifOrientation(source); @@ -60,11 +60,11 @@ namespace ImageSharp /// /// Returns the current EXIF orientation /// - /// The pixel format. + /// The pixel format. /// The image to auto rotate. /// The - private static Orientation GetExifOrientation(Image source) - where TColor : struct, IPixel + private static Orientation GetExifOrientation(Image source) + where TPixel : struct, IPixel { if (source.MetaData.ExifProfile == null) { diff --git a/src/ImageSharp/Processing/Transforms/Crop.cs b/src/ImageSharp/Processing/Transforms/Crop.cs index 92773aaea..59c1209f9 100644 --- a/src/ImageSharp/Processing/Transforms/Crop.cs +++ b/src/ImageSharp/Processing/Transforms/Crop.cs @@ -10,20 +10,20 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Crops an image to the given width and height. /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image width. /// The target image height. - /// The - public static Image Crop(this Image source, int width, int height) - where TColor : struct, IPixel + /// The + public static Image Crop(this Image source, int width, int height) + where TPixel : struct, IPixel { return Crop(source, new Rectangle(0, 0, width, height)); } @@ -31,16 +31,16 @@ namespace ImageSharp /// /// Crops an image to the given rectangle. /// - /// The pixel format. + /// The pixel format. /// The image to crop. /// /// The structure that specifies the portion of the image object to retain. /// /// The - public static Image Crop(this Image source, Rectangle cropRectangle) - where TColor : struct, IPixel + public static Image Crop(this Image source, Rectangle cropRectangle) + where TPixel : struct, IPixel { - CropProcessor processor = new CropProcessor(cropRectangle); + CropProcessor processor = new CropProcessor(cropRectangle); source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Processing/Transforms/EntropyCrop.cs b/src/ImageSharp/Processing/Transforms/EntropyCrop.cs index ad2ce89e3..59d0211a1 100644 --- a/src/ImageSharp/Processing/Transforms/EntropyCrop.cs +++ b/src/ImageSharp/Processing/Transforms/EntropyCrop.cs @@ -10,21 +10,21 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Crops an image to the area of greatest entropy. /// - /// The pixel format. + /// The pixel format. /// The image to crop. /// The threshold for entropic density. /// The - public static Image EntropyCrop(this Image source, float threshold = .5f) - where TColor : struct, IPixel + public static Image EntropyCrop(this Image source, float threshold = .5f) + where TPixel : struct, IPixel { - EntropyCropProcessor processor = new EntropyCropProcessor(threshold); + EntropyCropProcessor processor = new EntropyCropProcessor(threshold); source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Processing/Transforms/Flip.cs b/src/ImageSharp/Processing/Transforms/Flip.cs index ed096eb75..1cc79f888 100644 --- a/src/ImageSharp/Processing/Transforms/Flip.cs +++ b/src/ImageSharp/Processing/Transforms/Flip.cs @@ -11,21 +11,21 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Flips an image by the given instructions. /// - /// The pixel format. + /// The pixel format. /// The image to rotate, flip, or both. /// The to perform the flip. /// The - public static Image Flip(this Image source, FlipType flipType) - where TColor : struct, IPixel + public static Image Flip(this Image source, FlipType flipType) + where TPixel : struct, IPixel { - FlipProcessor processor = new FlipProcessor(flipType); + FlipProcessor processor = new FlipProcessor(flipType); source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs b/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs index 4be938c39..1e7d7e24f 100644 --- a/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs +++ b/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs @@ -17,14 +17,14 @@ namespace ImageSharp.Processing /// /// Calculates the target location and bounds to perform the resize operation against. /// - /// The pixel format. + /// The pixel format. /// The source image. /// The resize options. /// /// The . /// - public static Rectangle CalculateTargetLocationAndBounds(ImageBase source, ResizeOptions options) - where TColor : struct, IPixel + public static Rectangle CalculateTargetLocationAndBounds(ImageBase source, ResizeOptions options) + where TPixel : struct, IPixel { switch (options.Mode) { @@ -48,14 +48,14 @@ namespace ImageSharp.Processing /// /// Calculates the target rectangle for crop mode. /// - /// The pixel format. + /// The pixel format. /// The source image. /// The resize options. /// /// The . /// - private static Rectangle CalculateCropRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPixel + private static Rectangle CalculateCropRectangle(ImageBase source, ResizeOptions options) + where TPixel : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -167,14 +167,14 @@ namespace ImageSharp.Processing /// /// Calculates the target rectangle for pad mode. /// - /// The pixel format. + /// The pixel format. /// The source image. /// The resize options. /// /// The . /// - private static Rectangle CalculatePadRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPixel + private static Rectangle CalculatePadRectangle(ImageBase source, ResizeOptions options) + where TPixel : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -248,14 +248,14 @@ namespace ImageSharp.Processing /// /// Calculates the target rectangle for box pad mode. /// - /// The pixel format. + /// The pixel format. /// The source image. /// The resize options. /// /// The . /// - private static Rectangle CalculateBoxPadRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPixel + private static Rectangle CalculateBoxPadRectangle(ImageBase source, ResizeOptions options) + where TPixel : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -335,14 +335,14 @@ namespace ImageSharp.Processing /// /// Calculates the target rectangle for max mode. /// - /// The pixel format. + /// The pixel format. /// The source image. /// The resize options. /// /// The . /// - private static Rectangle CalculateMaxRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPixel + private static Rectangle CalculateMaxRectangle(ImageBase source, ResizeOptions options) + where TPixel : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; @@ -376,14 +376,14 @@ namespace ImageSharp.Processing /// /// Calculates the target rectangle for min mode. /// - /// The pixel format. + /// The pixel format. /// The source image. /// The resize options. /// /// The . /// - private static Rectangle CalculateMinRectangle(ImageBase source, ResizeOptions options) - where TColor : struct, IPixel + private static Rectangle CalculateMinRectangle(ImageBase source, ResizeOptions options) + where TPixel : struct, IPixel { int width = options.Size.Width; int height = options.Size.Height; diff --git a/src/ImageSharp/Processing/Transforms/Pad.cs b/src/ImageSharp/Processing/Transforms/Pad.cs index bd530ecd8..3aebe2304 100644 --- a/src/ImageSharp/Processing/Transforms/Pad.cs +++ b/src/ImageSharp/Processing/Transforms/Pad.cs @@ -11,20 +11,20 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Evenly pads an image to fit the new dimensions. /// - /// The pixel format. + /// The pixel format. /// The source image to pad. /// The new width. /// The new height. - /// The . - public static Image Pad(this Image source, int width, int height) - where TColor : struct, IPixel + /// The . + public static Image Pad(this Image source, int width, int height) + where TPixel : struct, IPixel { ResizeOptions options = new ResizeOptions { diff --git a/src/ImageSharp/Processing/Transforms/Resize.cs b/src/ImageSharp/Processing/Transforms/Resize.cs index 1952aa1a7..82c4b16c3 100644 --- a/src/ImageSharp/Processing/Transforms/Resize.cs +++ b/src/ImageSharp/Processing/Transforms/Resize.cs @@ -11,20 +11,20 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Resizes an image in accordance with the given . /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The resize options. - /// The + /// The /// Passing zero for one of height or width within the resize options will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, ResizeOptions options) - where TColor : struct, IPixel + public static Image Resize(this Image source, ResizeOptions options) + where TPixel : struct, IPixel { // Ensure size is populated across both dimensions. if (options.Size.Width == 0 && options.Size.Height > 0) @@ -45,13 +45,13 @@ namespace ImageSharp /// /// Resizes an image to the given . /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image size. - /// The + /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, Size size) - where TColor : struct, IPixel + public static Image Resize(this Image source, Size size) + where TPixel : struct, IPixel { return Resize(source, size.Width, size.Height, new BicubicResampler(), false); } @@ -59,14 +59,14 @@ namespace ImageSharp /// /// Resizes an image to the given width and height. /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image width. /// The target image height. - /// The + /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, int width, int height) - where TColor : struct, IPixel + public static Image Resize(this Image source, int width, int height) + where TPixel : struct, IPixel { return Resize(source, width, height, new BicubicResampler(), false); } @@ -74,15 +74,15 @@ namespace ImageSharp /// /// Resizes an image to the given width and height. /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image width. /// The target image height. /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The + /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, int width, int height, bool compand) - where TColor : struct, IPixel + public static Image Resize(this Image source, int width, int height, bool compand) + where TPixel : struct, IPixel { return Resize(source, width, height, new BicubicResampler(), compand); } @@ -90,15 +90,15 @@ namespace ImageSharp /// /// Resizes an image to the given width and height with the given sampler. /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image width. /// The target image height. /// The to perform the resampling. - /// The + /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, int width, int height, IResampler sampler) - where TColor : struct, IPixel + public static Image Resize(this Image source, int width, int height, IResampler sampler) + where TPixel : struct, IPixel { return Resize(source, width, height, sampler, false); } @@ -106,16 +106,16 @@ namespace ImageSharp /// /// Resizes an image to the given width and height with the given sampler. /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image width. /// The target image height. /// The to perform the resampling. /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The + /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, int width, int height, IResampler sampler, bool compand) - where TColor : struct, IPixel + public static Image Resize(this Image source, int width, int height, IResampler sampler, bool compand) + where TPixel : struct, IPixel { return Resize(source, width, height, sampler, source.Bounds, new Rectangle(0, 0, width, height), compand); } @@ -124,7 +124,7 @@ namespace ImageSharp /// Resizes an image to the given width and height with the given sampler and /// source rectangle. /// - /// The pixel format. + /// The pixel format. /// The image to resize. /// The target image width. /// The target image height. @@ -136,10 +136,10 @@ namespace ImageSharp /// The structure that specifies the portion of the target image object to draw to. /// /// Whether to compress and expand the image color-space to gamma correct the image during processing. - /// The + /// The /// Passing zero for one of height or width will automatically preserve the aspect ratio of the original image - public static Image Resize(this Image source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand = false) - where TColor : struct, IPixel + public static Image Resize(this Image source, int width, int height, IResampler sampler, Rectangle sourceRectangle, Rectangle targetRectangle, bool compand = false) + where TPixel : struct, IPixel { if (width == 0 && height > 0) { @@ -156,8 +156,8 @@ namespace ImageSharp Guard.MustBeGreaterThan(width, 0, nameof(width)); Guard.MustBeGreaterThan(height, 0, nameof(height)); - ResizeProcessor processor = - new ResizeProcessor(sampler, width, height, targetRectangle) { Compand = compand }; + ResizeProcessor processor = + new ResizeProcessor(sampler, width, height, targetRectangle) { Compand = compand }; source.ApplyProcessor(processor, sourceRectangle); return source; diff --git a/src/ImageSharp/Processing/Transforms/Rotate.cs b/src/ImageSharp/Processing/Transforms/Rotate.cs index 76311ef25..09fcb3534 100644 --- a/src/ImageSharp/Processing/Transforms/Rotate.cs +++ b/src/ImageSharp/Processing/Transforms/Rotate.cs @@ -11,19 +11,19 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Rotates an image by the given angle in degrees, expanding the image to fit the rotated result. /// - /// The pixel format. + /// The pixel format. /// The image to rotate. /// The angle in degrees to perform the rotation. /// The - public static Image Rotate(this Image source, float degrees) - where TColor : struct, IPixel + public static Image Rotate(this Image source, float degrees) + where TPixel : struct, IPixel { return Rotate(source, degrees, true); } @@ -31,12 +31,12 @@ namespace ImageSharp /// /// Rotates and flips an image by the given instructions. /// - /// The pixel format. + /// The pixel format. /// The image to rotate. /// The to perform the rotation. /// The - public static Image Rotate(this Image source, RotateType rotateType) - where TColor : struct, IPixel + public static Image Rotate(this Image source, RotateType rotateType) + where TPixel : struct, IPixel { return Rotate(source, (float)rotateType, false); } @@ -44,15 +44,15 @@ namespace ImageSharp /// /// Rotates an image by the given angle in degrees. /// - /// The pixel format. + /// The pixel format. /// The image to rotate. /// The angle in degrees to perform the rotation. /// Whether to expand the image to fit the rotated result. /// The - public static Image Rotate(this Image source, float degrees, bool expand) - where TColor : struct, IPixel + public static Image Rotate(this Image source, float degrees, bool expand) + where TPixel : struct, IPixel { - RotateProcessor processor = new RotateProcessor { Angle = degrees, Expand = expand }; + RotateProcessor processor = new RotateProcessor { Angle = degrees, Expand = expand }; source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Processing/Transforms/RotateFlip.cs b/src/ImageSharp/Processing/Transforms/RotateFlip.cs index d6050db3f..2f59438e9 100644 --- a/src/ImageSharp/Processing/Transforms/RotateFlip.cs +++ b/src/ImageSharp/Processing/Transforms/RotateFlip.cs @@ -9,20 +9,20 @@ namespace ImageSharp using Processing; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Rotates and flips an image by the given instructions. /// - /// The pixel format. + /// The pixel format. /// The image to rotate, flip, or both. /// The to perform the rotation. /// The to perform the flip. /// The - public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType) - where TColor : struct, IPixel + public static Image RotateFlip(this Image source, RotateType rotateType, FlipType flipType) + where TPixel : struct, IPixel { return source.Rotate(rotateType).Flip(flipType); } diff --git a/src/ImageSharp/Processing/Transforms/Skew.cs b/src/ImageSharp/Processing/Transforms/Skew.cs index 03fdbcceb..b74660efc 100644 --- a/src/ImageSharp/Processing/Transforms/Skew.cs +++ b/src/ImageSharp/Processing/Transforms/Skew.cs @@ -10,20 +10,20 @@ namespace ImageSharp using Processing.Processors; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Skews an image by the given angles in degrees, expanding the image to fit the skewed result. /// - /// The pixel format. + /// The pixel format. /// The image to skew. /// The angle in degrees to perform the rotation along the x-axis. /// The angle in degrees to perform the rotation along the y-axis. /// The - public static Image Skew(this Image source, float degreesX, float degreesY) - where TColor : struct, IPixel + public static Image Skew(this Image source, float degreesX, float degreesY) + where TPixel : struct, IPixel { return Skew(source, degreesX, degreesY, true); } @@ -31,16 +31,16 @@ namespace ImageSharp /// /// Skews an image by the given angles in degrees. /// - /// The pixel format. + /// The pixel format. /// The image to skew. /// The angle in degrees to perform the rotation along the x-axis. /// The angle in degrees to perform the rotation along the y-axis. /// Whether to expand the image to fit the skewed result. /// The - public static Image Skew(this Image source, float degreesX, float degreesY, bool expand) - where TColor : struct, IPixel + public static Image Skew(this Image source, float degreesX, float degreesY, bool expand) + where TPixel : struct, IPixel { - SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand }; + SkewProcessor processor = new SkewProcessor { AngleX = degreesX, AngleY = degreesY, Expand = expand }; source.ApplyProcessor(processor, source.Bounds); return source; diff --git a/src/ImageSharp/Quantizers/IQuantizer.cs b/src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs similarity index 73% rename from src/ImageSharp/Quantizers/IQuantizer.cs rename to src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs index 88f273e9b..566ddf6b5 100644 --- a/src/ImageSharp/Quantizers/IQuantizer.cs +++ b/src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,9 +10,9 @@ namespace ImageSharp.Quantizers /// /// Provides methods for allowing quantization of images pixels. /// - /// The pixel format. - public interface IQuantizer : IQuantizer - where TColor : struct, IPixel + /// The pixel format. + public interface IQuantizer : IQuantizer + where TPixel : struct, IPixel { /// /// Quantize an image and return the resulting output pixels. @@ -22,15 +22,15 @@ namespace ImageSharp.Quantizers /// /// A representing a quantized version of the image pixels. /// - QuantizedImage Quantize(ImageBase image, int maxColors); + QuantizedImage Quantize(ImageBase image, int maxColors); } /// /// Provides methods for allowing dithering of quantized image pixels. /// - /// The pixel format. - public interface IDitheredQuantizer : IQuantizer - where TColor : struct, IPixel + /// The pixel format. + public interface IDitheredQuantizer : IQuantizer + where TPixel : struct, IPixel { /// /// Gets or sets a value indicating whether to apply dithering to the output image. diff --git a/src/ImageSharp/Quantizers/OctreeQuantizer.cs b/src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs similarity index 92% rename from src/ImageSharp/Quantizers/OctreeQuantizer.cs rename to src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs index df52ee7f9..2296e589c 100644 --- a/src/ImageSharp/Quantizers/OctreeQuantizer.cs +++ b/src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -13,14 +13,14 @@ namespace ImageSharp.Quantizers /// Encapsulates methods to calculate the color palette if an image using an Octree pattern. /// /// - /// The pixel format. - public sealed class OctreeQuantizer : Quantizer - where TColor : struct, IPixel + /// The pixel format. + public sealed class OctreeQuantizer : Quantizer + where TPixel : struct, IPixel { /// /// A lookup table for colors /// - private readonly Dictionary colorMap = new Dictionary(); + private readonly Dictionary colorMap = new Dictionary(); /// /// The pixel buffer, used to reduce allocations. @@ -40,10 +40,10 @@ namespace ImageSharp.Quantizers /// /// The reduced image palette /// - private TColor[] palette; + private TPixel[] palette; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The Octree quantizer is a two pass algorithm. The initial pass sets up the Octree, @@ -55,7 +55,7 @@ namespace ImageSharp.Quantizers } /// - public override QuantizedImage Quantize(ImageBase image, int maxColors) + public override QuantizedImage Quantize(ImageBase image, int maxColors) { this.colors = maxColors.Clamp(1, 255); this.octree = new Octree(this.GetBitsNeededForColorDepth(this.colors)); @@ -64,15 +64,15 @@ namespace ImageSharp.Quantizers } /// - protected override void SecondPass(PixelAccessor source, byte[] output, int width, int height) + protected override void SecondPass(PixelAccessor source, byte[] output, int width, int height) { // Load up the values for the first pixel. We can use these to speed up the second // pass of the algorithm by avoiding transforming rows of identical color. - TColor sourcePixel = source[0, 0]; - TColor previousPixel = sourcePixel; + TPixel sourcePixel = source[0, 0]; + TPixel previousPixel = sourcePixel; byte pixelValue = this.QuantizePixel(sourcePixel); - TColor[] colorPalette = this.GetPalette(); - TColor transformedPixel = colorPalette[pixelValue]; + TPixel[] colorPalette = this.GetPalette(); + TPixel transformedPixel = colorPalette[pixelValue]; for (int y = 0; y < height; y++) { @@ -110,14 +110,14 @@ namespace ImageSharp.Quantizers } /// - protected override void InitialQuantizePixel(TColor pixel) + protected override void InitialQuantizePixel(TPixel pixel) { // Add the color to the Octree this.octree.AddColor(pixel, this.pixelBuffer); } /// - protected override TColor[] GetPalette() + protected override TPixel[] GetPalette() { return this.palette ?? (this.palette = this.octree.Palletize(Math.Max(this.colors, 1))); } @@ -130,13 +130,13 @@ namespace ImageSharp.Quantizers /// The quantized value /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private byte QuantizePixel(TColor pixel) + private byte QuantizePixel(TPixel pixel) { if (this.Dither) { // The colors have changed so we need to use Euclidean distance caclulation to find the closest value. // This palette can never be null here. - return this.GetClosestColor(pixel, this.palette, this.colorMap); + return this.GetClosesTPixel(pixel, this.palette, this.colorMap); } return (byte)this.octree.GetPaletteIndex(pixel, this.pixelBuffer); @@ -190,7 +190,7 @@ namespace ImageSharp.Quantizers /// /// Cache the previous color quantized /// - private TColor previousColor; + private TPixel previousColor; /// /// Initializes a new instance of the class. @@ -204,7 +204,7 @@ namespace ImageSharp.Quantizers this.Leaves = 0; this.reducibleNodes = new OctreeNode[9]; this.root = new OctreeNode(0, this.maxColorBits, this); - this.previousColor = default(TColor); + this.previousColor = default(TPixel); this.previousNode = null; } @@ -223,7 +223,7 @@ namespace ImageSharp.Quantizers /// /// The pixel data. /// The buffer array. - public void AddColor(TColor pixel, byte[] buffer) + public void AddColor(TPixel pixel, byte[] buffer) { // Check if this request is for the same color as the last if (this.previousColor.Equals(pixel)) @@ -253,9 +253,9 @@ namespace ImageSharp.Quantizers /// /// The maximum number of colors /// - /// An with the palletized colors + /// An with the palletized colors /// - public TColor[] Palletize(int colorCount) + public TPixel[] Palletize(int colorCount) { while (this.Leaves > colorCount) { @@ -263,7 +263,7 @@ namespace ImageSharp.Quantizers } // Now palletize the nodes - TColor[] palette = new TColor[colorCount + 1]; + TPixel[] palette = new TPixel[colorCount + 1]; int paletteIndex = 0; this.root.ConstructPalette(palette, ref paletteIndex); @@ -280,7 +280,7 @@ namespace ImageSharp.Quantizers /// /// The . /// - public int GetPaletteIndex(TColor pixel, byte[] buffer) + public int GetPaletteIndex(TPixel pixel, byte[] buffer) { return this.root.GetPaletteIndex(pixel, 0, buffer); } @@ -409,7 +409,7 @@ namespace ImageSharp.Quantizers /// The level in the tree /// The tree to which this node belongs /// The buffer array. - public void AddColor(TColor pixel, int colorBits, int level, Octree octree, byte[] buffer) + public void AddColor(TPixel pixel, int colorBits, int level, Octree octree, byte[] buffer) { // Update the color information if this is a leaf if (this.leaf) @@ -478,7 +478,7 @@ namespace ImageSharp.Quantizers /// /// The palette /// The current palette index - public void ConstructPalette(TColor[] palette, ref int index) + public void ConstructPalette(TPixel[] palette, ref int index) { if (this.leaf) { @@ -488,7 +488,7 @@ namespace ImageSharp.Quantizers byte b = (this.blue / this.pixelCount).ToByte(); // And set the color of the palette entry - TColor pixel = default(TColor); + TPixel pixel = default(TPixel); pixel.PackFromBytes(r, g, b, 255); palette[index] = pixel; @@ -517,7 +517,7 @@ namespace ImageSharp.Quantizers /// /// The representing the index of the pixel in the palette. /// - public int GetPaletteIndex(TColor pixel, int level, byte[] buffer) + public int GetPaletteIndex(TPixel pixel, int level, byte[] buffer) { int index = this.paletteIndex; @@ -548,7 +548,7 @@ namespace ImageSharp.Quantizers /// /// The pixel to add. /// The buffer array. - public void Increment(TColor pixel, byte[] buffer) + public void Increment(TPixel pixel, byte[] buffer) { pixel.ToXyzwBytes(buffer, 0); this.pixelCount++; diff --git a/src/ImageSharp/Quantizers/PaletteQuantizer.cs b/src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs similarity index 78% rename from src/ImageSharp/Quantizers/PaletteQuantizer.cs rename to src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs index f48c9ddd8..1c588b842 100644 --- a/src/ImageSharp/Quantizers/PaletteQuantizer.cs +++ b/src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -13,9 +13,9 @@ namespace ImageSharp.Quantizers /// Encapsulates methods to create a quantized image based upon the given palette. /// /// - /// The pixel format. - public sealed class PaletteQuantizer : Quantizer - where TColor : struct, IPixel + /// The pixel format. + public sealed class PaletteQuantizer : Quantizer + where TPixel : struct, IPixel { /// /// The pixel buffer, used to reduce allocations. @@ -25,32 +25,32 @@ namespace ImageSharp.Quantizers /// /// A lookup table for colors /// - private readonly Dictionary colorMap = new Dictionary(); + private readonly Dictionary colorMap = new Dictionary(); /// /// List of all colors in the palette /// - private TColor[] colors; + private TPixel[] colors; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The color palette. If none is given this will default to the web safe colors defined /// in the CSS Color Module Level 4. /// - public PaletteQuantizer(TColor[] palette = null) + public PaletteQuantizer(TPixel[] palette = null) : base(true) { if (palette == null) { Rgba32[] constants = ColorConstants.WebSafeColors; - TColor[] safe = new TColor[constants.Length + 1]; + TPixel[] safe = new TPixel[constants.Length + 1]; for (int i = 0; i < constants.Length; i++) { constants[i].ToXyzwBytes(this.pixelBuffer, 0); - TColor packed = default(TColor); + TPixel packed = default(TPixel); packed.PackFromBytes(this.pixelBuffer[0], this.pixelBuffer[1], this.pixelBuffer[2], this.pixelBuffer[3]); safe[i] = packed; } @@ -64,22 +64,22 @@ namespace ImageSharp.Quantizers } /// - public override QuantizedImage Quantize(ImageBase image, int maxColors) + public override QuantizedImage Quantize(ImageBase image, int maxColors) { Array.Resize(ref this.colors, maxColors.Clamp(1, 255)); return base.Quantize(image, maxColors); } /// - protected override void SecondPass(PixelAccessor source, byte[] output, int width, int height) + protected override void SecondPass(PixelAccessor source, byte[] output, int width, int height) { // Load up the values for the first pixel. We can use these to speed up the second // pass of the algorithm by avoiding transforming rows of identical color. - TColor sourcePixel = source[0, 0]; - TColor previousPixel = sourcePixel; + TPixel sourcePixel = source[0, 0]; + TPixel previousPixel = sourcePixel; byte pixelValue = this.QuantizePixel(sourcePixel); - TColor[] colorPalette = this.GetPalette(); - TColor transformedPixel = colorPalette[pixelValue]; + TPixel[] colorPalette = this.GetPalette(); + TPixel transformedPixel = colorPalette[pixelValue]; for (int y = 0; y < height; y++) { @@ -117,7 +117,7 @@ namespace ImageSharp.Quantizers } /// - protected override TColor[] GetPalette() + protected override TPixel[] GetPalette() { return this.colors; } @@ -130,9 +130,9 @@ namespace ImageSharp.Quantizers /// The quantized value /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private byte QuantizePixel(TColor pixel) + private byte QuantizePixel(TPixel pixel) { - return this.GetClosestColor(pixel, this.GetPalette(), this.colorMap); + return this.GetClosesTPixel(pixel, this.GetPalette(), this.colorMap); } } } \ No newline at end of file diff --git a/src/ImageSharp/Quantizers/Quantize.cs b/src/ImageSharp/Quantizers/Quantize.cs index f45cd3f79..44be039f4 100644 --- a/src/ImageSharp/Quantizers/Quantize.cs +++ b/src/ImageSharp/Quantizers/Quantize.cs @@ -11,34 +11,34 @@ namespace ImageSharp using ImageSharp.Quantizers; /// - /// Extension methods for the type. + /// Extension methods for the type. /// public static partial class ImageExtensions { /// /// Applies quantization to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The quantization mode to apply to perform the operation. /// The maximum number of colors to return. Defaults to 256. - /// The . - public static Image Quantize(this Image source, Quantization mode = Quantization.Octree, int maxColors = 256) - where TColor : struct, IPixel + /// The . + public static Image Quantize(this Image source, Quantization mode = Quantization.Octree, int maxColors = 256) + where TPixel : struct, IPixel { - IQuantizer quantizer; + IQuantizer quantizer; switch (mode) { case Quantization.Wu: - quantizer = new WuQuantizer(); + quantizer = new WuQuantizer(); break; case Quantization.Palette: - quantizer = new PaletteQuantizer(); + quantizer = new PaletteQuantizer(); break; default: - quantizer = new OctreeQuantizer(); + quantizer = new OctreeQuantizer(); break; } @@ -48,18 +48,18 @@ namespace ImageSharp /// /// Applies quantization to the image. /// - /// The pixel format. + /// The pixel format. /// The image this method extends. /// The quantizer to apply to perform the operation. /// The maximum number of colors to return. - /// The . - public static Image Quantize(this Image source, IQuantizer quantizer, int maxColors) - where TColor : struct, IPixel + /// The . + public static Image Quantize(this Image source, IQuantizer quantizer, int maxColors) + where TPixel : struct, IPixel { - QuantizedImage quantized = quantizer.Quantize(source, maxColors); + QuantizedImage quantized = quantizer.Quantize(source, maxColors); int palleteCount = quantized.Palette.Length - 1; - using (PixelAccessor pixels = new PixelAccessor(quantized.Width, quantized.Height)) + using (PixelAccessor pixels = new PixelAccessor(quantized.Width, quantized.Height)) { Parallel.For( 0, @@ -70,7 +70,7 @@ namespace ImageSharp for (int x = 0; x < pixels.Width; x++) { int i = x + (y * pixels.Width); - TColor color = quantized.Palette[Math.Min(palleteCount, quantized.Pixels[i])]; + TPixel color = quantized.Palette[Math.Min(palleteCount, quantized.Pixels[i])]; pixels[x, y] = color; } }); diff --git a/src/ImageSharp/Quantizers/QuantizedImage.cs b/src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs similarity index 83% rename from src/ImageSharp/Quantizers/QuantizedImage.cs rename to src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs index 471abbae7..927128065 100644 --- a/src/ImageSharp/Quantizers/QuantizedImage.cs +++ b/src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -10,18 +10,18 @@ namespace ImageSharp.Quantizers /// /// Represents a quantized image where the pixels indexed by a color palette. /// - /// The pixel format. - public class QuantizedImage - where TColor : struct, IPixel + /// The pixel format. + public class QuantizedImage + where TPixel : struct, IPixel { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The image width. /// The image height. /// The color palette. /// The quantized pixels. - public QuantizedImage(int width, int height, TColor[] palette, byte[] pixels) + public QuantizedImage(int width, int height, TPixel[] palette, byte[] pixels) { Guard.MustBeGreaterThan(width, 0, nameof(width)); Guard.MustBeGreaterThan(height, 0, nameof(height)); @@ -52,7 +52,7 @@ namespace ImageSharp.Quantizers /// /// Gets the color palette of this . /// - public TColor[] Palette { get; } + public TPixel[] Palette { get; } /// /// Gets the pixels of this . diff --git a/src/ImageSharp/Quantizers/Quantizer.cs b/src/ImageSharp/Quantizers/Quantizer{TPixel}.cs similarity index 85% rename from src/ImageSharp/Quantizers/Quantizer.cs rename to src/ImageSharp/Quantizers/Quantizer{TPixel}.cs index 492ec5f2b..1cf620bf9 100644 --- a/src/ImageSharp/Quantizers/Quantizer.cs +++ b/src/ImageSharp/Quantizers/Quantizer{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -14,9 +14,9 @@ namespace ImageSharp.Quantizers /// /// Encapsulates methods to calculate the color palette of an image. /// - /// The pixel format. - public abstract class Quantizer : IDitheredQuantizer - where TColor : struct, IPixel + /// The pixel format. + public abstract class Quantizer : IDitheredQuantizer + where TPixel : struct, IPixel { /// /// Flag used to indicate whether a single pass or two passes are needed for quantization. @@ -24,7 +24,7 @@ namespace ImageSharp.Quantizers private readonly bool singlePass; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// If true, the quantization only needs to loop through the source pixels once @@ -46,7 +46,7 @@ namespace ImageSharp.Quantizers public IErrorDiffuser DitherType { get; set; } = new SierraLite(); /// - public virtual QuantizedImage Quantize(ImageBase image, int maxColors) + public virtual QuantizedImage Quantize(ImageBase image, int maxColors) { Guard.NotNull(image, nameof(image)); @@ -54,9 +54,9 @@ namespace ImageSharp.Quantizers int height = image.Height; int width = image.Width; byte[] quantizedPixels = new byte[width * height]; - TColor[] colorPalette; + TPixel[] colorPalette; - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { // Call the FirstPass function if not a single pass algorithm. // For something like an Octree quantizer, this will run through @@ -72,8 +72,8 @@ namespace ImageSharp.Quantizers if (this.Dither) { // We clone the image as we don't want to alter the original. - using (Image clone = new Image(image)) - using (PixelAccessor clonedPixels = clone.Lock()) + using (Image clone = new Image(image)) + using (PixelAccessor clonedPixels = clone.Lock()) { this.SecondPass(clonedPixels, quantizedPixels, width, height); } @@ -84,7 +84,7 @@ namespace ImageSharp.Quantizers } } - return new QuantizedImage(width, height, colorPalette, quantizedPixels); + return new QuantizedImage(width, height, colorPalette, quantizedPixels); } /// @@ -93,7 +93,7 @@ namespace ImageSharp.Quantizers /// The source data /// The width in pixels of the image. /// The height in pixels of the image. - protected virtual void FirstPass(PixelAccessor source, int width, int height) + protected virtual void FirstPass(PixelAccessor source, int width, int height) { // Loop through each row for (int y = 0; y < height; y++) @@ -114,7 +114,7 @@ namespace ImageSharp.Quantizers /// The output pixel array /// The width in pixels of the image /// The height in pixels of the image - protected abstract void SecondPass(PixelAccessor source, byte[] output, int width, int height); + protected abstract void SecondPass(PixelAccessor source, byte[] output, int width, int height); /// /// Override this to process the pixel in the first pass of the algorithm @@ -124,7 +124,7 @@ namespace ImageSharp.Quantizers /// This function need only be overridden if your quantize algorithm needs two passes, /// such as an Octree quantizer. /// - protected virtual void InitialQuantizePixel(TColor pixel) + protected virtual void InitialQuantizePixel(TPixel pixel) { } @@ -132,9 +132,9 @@ namespace ImageSharp.Quantizers /// Retrieve the palette for the quantized image. Can be called more than once so make sure calls are cached. /// /// - /// + /// /// - protected abstract TColor[] GetPalette(); + protected abstract TPixel[] GetPalette(); /// /// Returns the closest color from the palette to the given color by calculating the Euclidean distance. @@ -144,7 +144,7 @@ namespace ImageSharp.Quantizers /// The cache to store the result in. /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected byte GetClosestColor(TColor pixel, TColor[] colorPalette, Dictionary cache) + protected byte GetClosesTPixel(TPixel pixel, TPixel[] colorPalette, Dictionary cache) { // Check if the color is in the lookup table if (cache.ContainsKey(pixel)) diff --git a/src/ImageSharp/Quantizers/WuArrayPool.cs b/src/ImageSharp/Quantizers/WuArrayPool.cs index 5e4956f01..bd8ee9d6b 100644 --- a/src/ImageSharp/Quantizers/WuArrayPool.cs +++ b/src/ImageSharp/Quantizers/WuArrayPool.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Quantizers using System.Buffers; /// - /// Provides array pooling for the . + /// Provides array pooling for the . /// This is a separate class so that the pools can be shared accross multiple generic quantizer instaces. /// internal static class WuArrayPool @@ -29,7 +29,7 @@ namespace ImageSharp.Quantizers public static readonly ArrayPool BytePool = ArrayPool.Create(TableLength, 5); /// - /// The table length. Matches the calculated value in + /// The table length. Matches the calculated value in /// private const int TableLength = 2471625; } diff --git a/src/ImageSharp/Quantizers/WuQuantizer.cs b/src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs similarity index 96% rename from src/ImageSharp/Quantizers/WuQuantizer.cs rename to src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs index 46af6fab9..16ab64f3c 100644 --- a/src/ImageSharp/Quantizers/WuQuantizer.cs +++ b/src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // @@ -30,9 +30,9 @@ namespace ImageSharp.Quantizers /// but more expensive versions. /// /// - /// The pixel format. - public class WuQuantizer : Quantizer - where TColor : struct, IPixel + /// The pixel format. + public class WuQuantizer : Quantizer + where TPixel : struct, IPixel { /// /// The index bits. @@ -67,7 +67,7 @@ namespace ImageSharp.Quantizers /// /// A lookup table for colors /// - private readonly Dictionary colorMap = new Dictionary(); + private readonly Dictionary colorMap = new Dictionary(); /// /// Moment of P(c). @@ -112,7 +112,7 @@ namespace ImageSharp.Quantizers /// /// The reduced image palette /// - private TColor[] palette; + private TPixel[] palette; /// /// The color cube representing the image palette @@ -120,7 +120,7 @@ namespace ImageSharp.Quantizers private Box[] colorCube; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The Wu quantizer is a two pass algorithm. The initial pass sets up the 3-D color histogram, @@ -132,7 +132,7 @@ namespace ImageSharp.Quantizers } /// - public override QuantizedImage Quantize(ImageBase image, int maxColors) + public override QuantizedImage Quantize(ImageBase image, int maxColors) { Guard.NotNull(image, nameof(image)); @@ -163,11 +163,11 @@ namespace ImageSharp.Quantizers } /// - protected override TColor[] GetPalette() + protected override TPixel[] GetPalette() { if (this.palette == null) { - this.palette = new TColor[this.colors]; + this.palette = new TPixel[this.colors]; for (int k = 0; k < this.colors; k++) { this.Mark(this.colorCube[k], (byte)k); @@ -181,7 +181,7 @@ namespace ImageSharp.Quantizers float b = Volume(this.colorCube[k], this.vmb) / weight; float a = Volume(this.colorCube[k], this.vma) / weight; - TColor color = default(TColor); + TPixel color = default(TPixel); color.PackFromVector4(new Vector4(r, g, b, a) / 255F); this.palette[k] = color; } @@ -192,7 +192,7 @@ namespace ImageSharp.Quantizers } /// - protected override void InitialQuantizePixel(TColor pixel) + protected override void InitialQuantizePixel(TPixel pixel) { // Add the color to a 3-D color histogram. // Colors are expected in r->g->b->a format @@ -219,7 +219,7 @@ namespace ImageSharp.Quantizers } /// - protected override void FirstPass(PixelAccessor source, int width, int height) + protected override void FirstPass(PixelAccessor source, int width, int height) { // Build up the 3-D color histogram // Loop through each row @@ -238,15 +238,15 @@ namespace ImageSharp.Quantizers } /// - protected override void SecondPass(PixelAccessor source, byte[] output, int width, int height) + protected override void SecondPass(PixelAccessor source, byte[] output, int width, int height) { // Load up the values for the first pixel. We can use these to speed up the second // pass of the algorithm by avoiding transforming rows of identical color. - TColor sourcePixel = source[0, 0]; - TColor previousPixel = sourcePixel; + TPixel sourcePixel = source[0, 0]; + TPixel previousPixel = sourcePixel; byte pixelValue = this.QuantizePixel(sourcePixel); - TColor[] colorPalette = this.GetPalette(); - TColor transformedPixel = colorPalette[pixelValue]; + TPixel[] colorPalette = this.GetPalette(); + TPixel transformedPixel = colorPalette[pixelValue]; for (int y = 0; y < height; y++) { @@ -825,13 +825,13 @@ namespace ImageSharp.Quantizers /// The quantized value /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private byte QuantizePixel(TColor pixel) + private byte QuantizePixel(TPixel pixel) { if (this.Dither) { // The colors have changed so we need to use Euclidean distance caclulation to find the closest value. // This palette can never be null here. - return this.GetClosestColor(pixel, this.palette, this.colorMap); + return this.GetClosesTPixel(pixel, this.palette, this.colorMap); } // Expected order r->g->b->a diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs index c0d50bf5b..00b0b503c 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs @@ -5,10 +5,10 @@ namespace ImageSharp.Benchmarks.Color.Bulk using Rgba32 = ImageSharp.Rgba32; - public abstract class PackFromXyzw - where TColor : struct, IPixel + public abstract class PackFromXyzw + where TPixel : struct, IPixel { - private Buffer destination; + private Buffer destination; private Buffer source; @@ -18,7 +18,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Setup] public void Setup() { - this.destination = new Buffer(this.Count); + this.destination = new Buffer(this.Count); this.source = new Buffer(this.Count * 4); } @@ -33,12 +33,12 @@ namespace ImageSharp.Benchmarks.Color.Bulk public void PerElement() { byte[] s = this.source.Array; - TColor[] d = this.destination.Array; + TPixel[] d = this.destination.Array; for (int i = 0; i < this.Count; i++) { int i4 = i * 4; - TColor c = default(TColor); + TPixel c = default(TPixel); c.PackFromBytes(s[i4], s[i4 + 1], s[i4 + 2], s[i4 + 3]); d[i] = c; } @@ -47,13 +47,13 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark] public void CommonBulk() { - new BulkPixelOperations().PackFromXyzwBytes(this.source, this.destination, this.Count); + new BulkPixelOperations().PackFromXyzwBytes(this.source, this.destination, this.Count); } [Benchmark] public void OptimizedBulk() { - BulkPixelOperations.Instance.PackFromXyzwBytes(this.source, this.destination, this.Count); + BulkPixelOperations.Instance.PackFromXyzwBytes(this.source, this.destination, this.Count); } } diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs index bd1b0e11d..b3a23147e 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs @@ -5,10 +5,10 @@ namespace ImageSharp.Benchmarks.Color.Bulk using BenchmarkDotNet.Attributes; - public abstract class ToVector4 - where TColor : struct, IPixel + public abstract class ToVector4 + where TPixel : struct, IPixel { - private Buffer source; + private Buffer source; private Buffer destination; @@ -18,7 +18,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Setup] public void Setup() { - this.source = new Buffer(this.Count); + this.source = new Buffer(this.Count); this.destination = new Buffer(this.Count); } @@ -32,12 +32,12 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark(Baseline = true)] public void PerElement() { - TColor[] s = this.source.Array; + TPixel[] s = this.source.Array; Vector4[] d = this.destination.Array; for (int i = 0; i < this.Count; i++) { - TColor c = s[i]; + TPixel c = s[i]; d[i] = c.ToVector4(); } } @@ -45,13 +45,13 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark] public void CommonBulk() { - new BulkPixelOperations().ToVector4(this.source, this.destination, this.Count); + new BulkPixelOperations().ToVector4(this.source, this.destination, this.Count); } [Benchmark] public void OptimizedBulk() { - BulkPixelOperations.Instance.ToVector4(this.source, this.destination, this.Count); + BulkPixelOperations.Instance.ToVector4(this.source, this.destination, this.Count); } } diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs index c90f78d16..ad7e2a9cf 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs @@ -5,10 +5,10 @@ namespace ImageSharp.Benchmarks.Color.Bulk using Rgba32 = ImageSharp.Rgba32; - public abstract class ToXyz - where TColor : struct, IPixel + public abstract class ToXyz + where TPixel : struct, IPixel { - private Buffer source; + private Buffer source; private Buffer destination; @@ -18,7 +18,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Setup] public void Setup() { - this.source = new Buffer(this.Count); + this.source = new Buffer(this.Count); this.destination = new Buffer(this.Count * 3); } @@ -32,12 +32,12 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark(Baseline = true)] public void PerElement() { - TColor[] s = this.source.Array; + TPixel[] s = this.source.Array; byte[] d = this.destination.Array; for (int i = 0; i < this.Count; i++) { - TColor c = s[i]; + TPixel c = s[i]; c.ToXyzBytes(d, i * 4); } } @@ -45,13 +45,13 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark] public void CommonBulk() { - new BulkPixelOperations().ToXyzBytes(this.source, this.destination, this.Count); + new BulkPixelOperations().ToXyzBytes(this.source, this.destination, this.Count); } [Benchmark] public void OptimizedBulk() { - BulkPixelOperations.Instance.ToXyzBytes(this.source, this.destination, this.Count); + BulkPixelOperations.Instance.ToXyzBytes(this.source, this.destination, this.Count); } } diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs index 9ec8adc79..75e0f247c 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs @@ -10,10 +10,10 @@ namespace ImageSharp.Benchmarks.Color.Bulk using Rgba32 = ImageSharp.Rgba32; - public abstract class ToXyzw - where TColor : struct, IPixel + public abstract class ToXyzw + where TPixel : struct, IPixel { - private Buffer source; + private Buffer source; private Buffer destination; @@ -23,7 +23,7 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Setup] public void Setup() { - this.source = new Buffer(this.Count); + this.source = new Buffer(this.Count); this.destination = new Buffer(this.Count * 4); } @@ -37,12 +37,12 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark(Baseline = true)] public void PerElement() { - TColor[] s = this.source.Array; + TPixel[] s = this.source.Array; byte[] d = this.destination.Array; for (int i = 0; i < this.Count; i++) { - TColor c = s[i]; + TPixel c = s[i]; c.ToXyzwBytes(d, i * 4); } } @@ -50,13 +50,13 @@ namespace ImageSharp.Benchmarks.Color.Bulk [Benchmark] public void CommonBulk() { - new BulkPixelOperations().ToXyzwBytes(this.source, this.destination, this.Count); + new BulkPixelOperations().ToXyzwBytes(this.source, this.destination, this.Count); } [Benchmark] public void OptimizedBulk() { - BulkPixelOperations.Instance.ToXyzwBytes(this.source, this.destination, this.Count); + BulkPixelOperations.Instance.ToXyzwBytes(this.source, this.destination, this.Count); } } diff --git a/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs b/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs index c34a63ad6..19aefd06b 100644 --- a/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs @@ -71,15 +71,15 @@ namespace ImageSharp.Tests.Colors [Theory] [WithBlankImages(1, 1, PixelTypes.All)] - public void GetGlobalInstance(TestImageProvider dummy) - where TColor : struct, IPixel + public void GetGlobalInstance(TestImageProvider dummy) + where TPixel : struct, IPixel { - Assert.NotNull(BulkPixelOperations.Instance); + Assert.NotNull(BulkPixelOperations.Instance); } } - public abstract class BulkPixelOperationsTests : MeasureFixture - where TColor : struct, IPixel + public abstract class BulkPixelOperationsTests : MeasureFixture + where TPixel : struct, IPixel { protected BulkPixelOperationsTests(ITestOutputHelper output) : base(output) @@ -88,11 +88,11 @@ namespace ImageSharp.Tests.Colors public static TheoryData ArraySizesData => new TheoryData { 7, 16, 1111 }; - private static BulkPixelOperations Operations => BulkPixelOperations.Instance; + private static BulkPixelOperations Operations => BulkPixelOperations.Instance; - internal static TColor[] CreateExpectedPixelData(Vector4[] source) + internal static TPixel[] CreateExpectedPixelData(Vector4[] source) { - TColor[] expected = new TColor[source.Length]; + TPixel[] expected = new TPixel[source.Length]; for (int i = 0; i < expected.Length; i++) { @@ -106,7 +106,7 @@ namespace ImageSharp.Tests.Colors public void PackFromVector4(int count) { Vector4[] source = CreateVector4TestData(count); - TColor[] expected = CreateExpectedPixelData(source); + TPixel[] expected = CreateExpectedPixelData(source); TestOperation( source, @@ -115,7 +115,7 @@ namespace ImageSharp.Tests.Colors ); } - internal static Vector4[] CreateExpectedVector4Data(TColor[] source) + internal static Vector4[] CreateExpectedVector4Data(TPixel[] source) { Vector4[] expected = new Vector4[source.Length]; @@ -130,7 +130,7 @@ namespace ImageSharp.Tests.Colors [MemberData(nameof(ArraySizesData))] public void ToVector4(int count) { - TColor[] source = CreatePixelTestData(count); + TPixel[] source = CreatePixelTestData(count); Vector4[] expected = CreateExpectedVector4Data(source); TestOperation( @@ -146,7 +146,7 @@ namespace ImageSharp.Tests.Colors public void PackFromXyzBytes(int count) { byte[] source = CreateByteTestData(count * 3); - TColor[] expected = new TColor[count]; + TPixel[] expected = new TPixel[count]; for (int i = 0; i < count; i++) { @@ -166,7 +166,7 @@ namespace ImageSharp.Tests.Colors [MemberData(nameof(ArraySizesData))] public void ToXyzBytes(int count) { - TColor[] source = CreatePixelTestData(count); + TPixel[] source = CreatePixelTestData(count); byte[] expected = new byte[count * 3]; for (int i = 0; i < count; i++) @@ -187,7 +187,7 @@ namespace ImageSharp.Tests.Colors public void PackFromXyzwBytes(int count) { byte[] source = CreateByteTestData(count * 4); - TColor[] expected = new TColor[count]; + TPixel[] expected = new TPixel[count]; for (int i = 0; i < count; i++) { @@ -207,7 +207,7 @@ namespace ImageSharp.Tests.Colors [MemberData(nameof(ArraySizesData))] public void ToXyzwBytes(int count) { - TColor[] source = CreatePixelTestData(count); + TPixel[] source = CreatePixelTestData(count); byte[] expected = new byte[count * 4]; for (int i = 0; i < count; i++) @@ -228,7 +228,7 @@ namespace ImageSharp.Tests.Colors public void PackFromZyxBytes(int count) { byte[] source = CreateByteTestData(count * 3); - TColor[] expected = new TColor[count]; + TPixel[] expected = new TPixel[count]; for (int i = 0; i < count; i++) { @@ -248,7 +248,7 @@ namespace ImageSharp.Tests.Colors [MemberData(nameof(ArraySizesData))] public void ToZyxBytes(int count) { - TColor[] source = CreatePixelTestData(count); + TPixel[] source = CreatePixelTestData(count); byte[] expected = new byte[count * 3]; for (int i = 0; i < count; i++) @@ -269,7 +269,7 @@ namespace ImageSharp.Tests.Colors public void PackFromZyxwBytes(int count) { byte[] source = CreateByteTestData(count * 4); - TColor[] expected = new TColor[count]; + TPixel[] expected = new TPixel[count]; for (int i = 0; i < count; i++) { @@ -289,7 +289,7 @@ namespace ImageSharp.Tests.Colors [MemberData(nameof(ArraySizesData))] public void ToZyxwBytes(int count) { - TColor[] source = CreatePixelTestData(count); + TPixel[] source = CreatePixelTestData(count); byte[] expected = new byte[count * 4]; for (int i = 0; i < count; i++) @@ -387,9 +387,9 @@ namespace ImageSharp.Tests.Colors return result; } - internal static TColor[] CreatePixelTestData(int length) + internal static TPixel[] CreatePixelTestData(int length) { - TColor[] result = new TColor[length]; + TPixel[] result = new TPixel[length]; Random rnd = new Random(42); // Deterministic random values diff --git a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs index 47b114393..453f689f2 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs @@ -28,10 +28,10 @@ namespace ImageSharp.Tests [Theory] [WithFile(TestImages.Jpeg.Baseline.Bad.MissingEOF, PixelTypes.Rgba32)] - public void LoadBaselineImage(TestImageProvider provider) - where TColor : struct, IPixel + public void LoadBaselineImage(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { Assert.NotNull(image); provider.Utility.SaveTestOutputFile(image, "bmp"); @@ -40,10 +40,10 @@ namespace ImageSharp.Tests [Theory] // TODO: #18 [WithFile(TestImages.Jpeg.Progressive.Bad.BadEOF, PixelTypes.Rgba32)] - public void LoadProgressiveImage(TestImageProvider provider) - where TColor : struct, IPixel + public void LoadProgressiveImage(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { Assert.NotNull(image); provider.Utility.SaveTestOutputFile(image, "bmp"); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 316430dfc..60f310bbd 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -26,10 +26,10 @@ namespace ImageSharp.Tests [Theory] [WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Rgba32 | PixelTypes.StandardImageClass | PixelTypes.Argb32)] - public void OpenBaselineJpeg_SaveBmp(TestImageProvider provider) - where TColor : struct, IPixel + public void OpenBaselineJpeg_SaveBmp(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { provider.Utility.SaveTestOutputFile(image, "bmp"); } @@ -37,10 +37,10 @@ namespace ImageSharp.Tests [Theory] [WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Rgba32 | PixelTypes.StandardImageClass | PixelTypes.Argb32)] - public void OpenProgressiveJpeg_SaveBmp(TestImageProvider provider) - where TColor : struct, IPixel + public void OpenProgressiveJpeg_SaveBmp(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { provider.Utility.SaveTestOutputFile(image, "bmp"); } @@ -52,14 +52,14 @@ namespace ImageSharp.Tests [WithSolidFilledImages(16, 16, 255, 0, 0, PixelTypes.StandardImageClass, JpegSubsample.Ratio444, 75)] [WithSolidFilledImages(16, 16, 255, 0, 0, PixelTypes.StandardImageClass, JpegSubsample.Ratio444, 100)] [WithSolidFilledImages(8, 8, 255, 0, 0, PixelTypes.StandardImageClass, JpegSubsample.Ratio444, 100)] - public void DecodeGenerated_SaveBmp( - TestImageProvider provider, + public void DecodeGenerated_SaveBmp( + TestImageProvider provider, JpegSubsample subsample, int quality) - where TColor : struct, IPixel + where TPixel : struct, IPixel { byte[] data; - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { JpegEncoder encoder = new JpegEncoder(); JpegEncoderOptions options = new JpegEncoderOptions { Subsample = subsample, Quality = quality }; @@ -72,18 +72,18 @@ namespace ImageSharp.Tests } // TODO: Automatic image comparers could help here a lot :P - Image mirror = provider.Factory.CreateImage(data); + Image mirror = provider.Factory.CreateImage(data); provider.Utility.TestName += $"_{subsample}_Q{quality}"; provider.Utility.SaveTestOutputFile(mirror, "bmp"); } [Theory] [WithSolidFilledImages(42, 88, 255, 0, 0, PixelTypes.StandardImageClass)] - public void DecodeGenerated_MetadataOnly( - TestImageProvider provider) - where TColor : struct, IPixel + public void DecodeGenerated_MetadataOnly( + TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { using (MemoryStream ms = new MemoryStream()) { @@ -92,7 +92,7 @@ namespace ImageSharp.Tests using (JpegDecoderCore decoder = new JpegDecoderCore(null, null)) { - Image mirror = decoder.Decode(ms); + Image mirror = decoder.Decode(ms); Assert.Equal(decoder.ImageWidth, image.Width); Assert.Equal(decoder.ImageHeight, image.Height); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index 3d2e9f310..5bc5e780c 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -31,10 +31,10 @@ namespace ImageSharp.Tests [WithFile(TestImages.Jpeg.Baseline.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio420)] [WithFile(TestImages.Jpeg.Baseline.Snake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)] [WithFile(TestImages.Jpeg.Baseline.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)] - public void LoadResizeSave(TestImageProvider provider, int quality, JpegSubsample subsample) - where TColor : struct, IPixel + public void LoadResizeSave(TestImageProvider provider, int quality, JpegSubsample subsample) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage().Resize(new ResizeOptions { Size = new Size(150, 100), Mode = ResizeMode.Max })) + using (Image image = provider.GetImage().Resize(new ResizeOptions { Size = new Size(150, 100), Mode = ResizeMode.Max })) { image.MetaData.Quality = quality; image.MetaData.ExifProfile = null; // Reduce the size of the file @@ -50,10 +50,10 @@ namespace ImageSharp.Tests [Theory] [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 + public void OpenBmp_SaveJpeg(TestImageProvider provider, JpegSubsample subSample, int quality) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { ImagingTestCaseUtility utility = provider.Utility; utility.TestName += "_" + subSample + "_Q" + quality; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs index ea1a46f2f..117a5354f 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs @@ -15,11 +15,11 @@ namespace ImageSharp.Tests public class JpegUtilsTests : TestBase { - public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPixel + public static Image CreateTestImage(GenericFactory factory) + where TPixel : struct, IPixel { - Image image = factory.CreateImage(10, 10); - using (PixelAccessor pixels = image.Lock()) + Image image = factory.CreateImage(10, 10); + using (PixelAccessor pixels = image.Lock()) { for (int i = 0; i < 10; i++) { @@ -27,7 +27,7 @@ namespace ImageSharp.Tests { Vector4 v = new Vector4(i / 10f, j / 10f, 0, 1); - TColor color = default(TColor); + TPixel color = default(TPixel); color.PackFromVector4(v); pixels[i, j] = color; @@ -40,14 +40,14 @@ namespace ImageSharp.Tests [Theory] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Rgba32| PixelTypes.StandardImageClass | PixelTypes.Argb32)] - public void CopyStretchedRGBTo_FromOrigo(TestImageProvider provider) - where TColor : struct, IPixel + public void CopyStretchedRGBTo_FromOrigo(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image src = provider.GetImage()) - using (Image dest = provider.Factory.CreateImage(8, 8)) - using (PixelArea area = new PixelArea(8, 8, ComponentOrder.Xyz)) - using (PixelAccessor s = src.Lock()) - using (PixelAccessor d = dest.Lock()) + using (Image src = provider.GetImage()) + using (Image dest = provider.Factory.CreateImage(8, 8)) + using (PixelArea area = new PixelArea(8, 8, ComponentOrder.Xyz)) + using (PixelAccessor s = src.Lock()) + using (PixelAccessor d = dest.Lock()) { s.CopyRGBBytesStretchedTo(area, 0, 0); d.CopyFrom(area, 0, 0); @@ -62,14 +62,14 @@ namespace ImageSharp.Tests [Theory] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.Rgba32| PixelTypes.StandardImageClass | PixelTypes.Argb32)] - public void CopyStretchedRGBTo_WithOffset(TestImageProvider provider) - where TColor : struct, IPixel + public void CopyStretchedRGBTo_WithOffset(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image src = provider.GetImage()) - using (PixelArea area = new PixelArea(8, 8, ComponentOrder.Xyz)) - using (Image dest = provider.Factory.CreateImage(8, 8)) - using (PixelAccessor s = src.Lock()) - using (PixelAccessor d = dest.Lock()) + using (Image src = provider.GetImage()) + using (PixelArea area = new PixelArea(8, 8, ComponentOrder.Xyz)) + using (Image dest = provider.Factory.CreateImage(8, 8)) + using (PixelAccessor s = src.Lock()) + using (PixelAccessor d = dest.Lock()) { s.CopyRGBBytesStretchedTo(area, 7, 6); d.CopyFrom(area, 0, 0); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index 51cb0cdc0..b70df9c17 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -17,10 +17,10 @@ namespace ImageSharp.Tests { [Theory] [WithBlankImages(1, 1, PixelTypes.All)] - public void WritesFileMarker(TestImageProvider provider) - where TColor : struct, IPixel + public void WritesFileMarker(TestImageProvider provider) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) using (MemoryStream ms = new MemoryStream()) { image.Save(ms, new PngEncoder()); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs index a7453f77c..1e3879a93 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs @@ -19,11 +19,11 @@ namespace ImageSharp.Tests.Formats.Png { [Theory] [WithTestPatternImages(300, 300, PixelTypes.All)] - public void GeneralTest(TestImageProvider provider) - where TColor : struct, IPixel + public void GeneralTest(TestImageProvider provider) + where TPixel : struct, IPixel { // does saving a file then repoening mean both files are identical??? - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) using (MemoryStream ms = new MemoryStream()) { // image.Save(provider.Utility.GetTestOutputFileName("bmp")); @@ -40,11 +40,11 @@ namespace ImageSharp.Tests.Formats.Png [Theory] [WithTestPatternImages(100, 100, PixelTypes.All)] - public void CanSaveIndexedPng(TestImageProvider provider) - where TColor : struct, IPixel + public void CanSaveIndexedPng(TestImageProvider provider) + where TPixel : struct, IPixel { // does saving a file then repoening mean both files are identical??? - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) using (MemoryStream ms = new MemoryStream()) { // image.Save(provider.Utility.GetTestOutputFileName("bmp")); @@ -62,11 +62,11 @@ namespace ImageSharp.Tests.Formats.Png // JJS: Commented out for now since the test does not take into lossy nature of indexing. //[Theory] //[WithTestPatternImages(100, 100, PixelTypes.Color)] - //public void CanSaveIndexedPngTwice(TestImageProvider provider) - // where TColor : struct, IPixel + //public void CanSaveIndexedPngTwice(TestImageProvider provider) + // where TPixel : struct, IPixel //{ // // does saving a file then repoening mean both files are identical??? - // using (Image source = provider.GetImage()) + // using (Image source = provider.GetImage()) // using (MemoryStream ms = new MemoryStream()) // { // source.MetaData.Quality = 256; @@ -104,11 +104,11 @@ namespace ImageSharp.Tests.Formats.Png [Theory] [WithTestPatternImages(300, 300, PixelTypes.All)] - public void Resize(TestImageProvider provider) - where TColor : struct, IPixel + public void Resize(TestImageProvider provider) + where TPixel : struct, IPixel { // does saving a file then repoening mean both files are identical??? - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) using (MemoryStream ms = new MemoryStream()) { // image.Save(provider.Utility.GetTestOutputFileName("png")); diff --git a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs index 858b968d6..b48ffd7e9 100644 --- a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs +++ b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs @@ -15,11 +15,11 @@ namespace ImageSharp.Tests /// public class PixelAccessorTests { - public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPixel + public static Image CreateTestImage(GenericFactory factory) + where TPixel : struct, IPixel { - Image image = factory.CreateImage(10, 10); - using (PixelAccessor pixels = image.Lock()) + Image image = factory.CreateImage(10, 10); + using (PixelAccessor pixels = image.Lock()) { for (int i = 0; i < 10; i++) { @@ -28,7 +28,7 @@ namespace ImageSharp.Tests Vector4 v = new Vector4(i, j, 0, 1); v /= 10; - TColor color = default(TColor); + TPixel color = default(TPixel); color.PackFromVector4(v); pixels[i, j] = color; @@ -43,21 +43,21 @@ namespace ImageSharp.Tests [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All, ComponentOrder.Zyx)] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All, ComponentOrder.Xyzw)] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All, ComponentOrder.Zyxw)] - public void CopyTo_Then_CopyFrom_OnFullImageRect(TestImageProvider provider, ComponentOrder order) - where TColor : struct, IPixel + public void CopyTo_Then_CopyFrom_OnFullImageRect(TestImageProvider provider, ComponentOrder order) + where TPixel : struct, IPixel { - using (Image src = provider.GetImage()) + using (Image src = provider.GetImage()) { - using (Image dest = new Image(src.Width, src.Height)) + using (Image dest = new Image(src.Width, src.Height)) { - using (PixelArea area = new PixelArea(src.Width, src.Height, order)) + using (PixelArea area = new PixelArea(src.Width, src.Height, order)) { - using (PixelAccessor srcPixels = src.Lock()) + using (PixelAccessor srcPixels = src.Lock()) { srcPixels.CopyTo(area, 0, 0); } - using (PixelAccessor destPixels = dest.Lock()) + using (PixelAccessor destPixels = dest.Lock()) { destPixels.CopyFrom(area, 0, 0); } @@ -69,10 +69,10 @@ namespace ImageSharp.Tests } // TODO: Need a processor in the library with this signature - private static void Fill(Image image, Rectangle region, TColor color) - where TColor : struct, IPixel + private static void Fill(Image image, Rectangle region, TPixel color) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { for (int y = region.Top; y < region.Bottom; y++) { @@ -89,21 +89,21 @@ namespace ImageSharp.Tests [WithBlankImages(16, 16, PixelTypes.All, ComponentOrder.Zyx)] [WithBlankImages(16, 16, PixelTypes.All, ComponentOrder.Xyzw)] [WithBlankImages(16, 16, PixelTypes.All, ComponentOrder.Zyxw)] - public void CopyToThenCopyFromWithOffset(TestImageProvider provider, ComponentOrder order) - where TColor : struct, IPixel + public void CopyToThenCopyFromWithOffset(TestImageProvider provider, ComponentOrder order) + where TPixel : struct, IPixel { - using (Image destImage = new Image(8, 8)) + using (Image destImage = new Image(8, 8)) { - using (Image srcImage = provider.GetImage()) + using (Image srcImage = provider.GetImage()) { - Fill(srcImage, new Rectangle(4, 4, 8, 8), NamedColors.Red); - using (PixelAccessor srcPixels = srcImage.Lock()) + Fill(srcImage, new Rectangle(4, 4, 8, 8), NamedColors.Red); + using (PixelAccessor srcPixels = srcImage.Lock()) { - using (PixelArea area = new PixelArea(8, 8, order)) + using (PixelArea area = new PixelArea(8, 8, order)) { srcPixels.CopyTo(area, 4, 4); - using (PixelAccessor destPixels = destImage.Lock()) + using (PixelAccessor destPixels = destImage.Lock()) { destPixels.CopyFrom(area, 0, 0); } @@ -114,7 +114,7 @@ namespace ImageSharp.Tests provider.Utility.SourceFileOrDescription = order.ToString(); provider.Utility.SaveTestOutputFile(destImage, "bmp"); - using (Image expectedImage = new Image(8, 8).Fill(NamedColors.Red)) + using (Image expectedImage = new Image(8, 8).Fill(NamedColors.Red)) { Assert.True(destImage.IsEquivalentTo(expectedImage)); } @@ -158,17 +158,17 @@ namespace ImageSharp.Tests } } - private static void CopyFromZYX(Image image) - where TColor : struct, IPixel + private static void CopyFromZYX(Image image) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { byte red = 1; byte green = 2; byte blue = 3; byte alpha = 255; - using (PixelArea row = new PixelArea(1, ComponentOrder.Zyx)) + using (PixelArea row = new PixelArea(1, ComponentOrder.Zyx)) { row.Bytes[0] = blue; row.Bytes[1] = green; @@ -185,17 +185,17 @@ namespace ImageSharp.Tests } } - private static void CopyFromZYXW(Image image) - where TColor : struct, IPixel + private static void CopyFromZYXW(Image image) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { byte red = 1; byte green = 2; byte blue = 3; byte alpha = 4; - using (PixelArea row = new PixelArea(1, ComponentOrder.Zyxw)) + using (PixelArea row = new PixelArea(1, ComponentOrder.Zyxw)) { row.Bytes[0] = blue; row.Bytes[1] = green; @@ -213,18 +213,18 @@ namespace ImageSharp.Tests } } - private static void CopyToZYX(Image image) - where TColor : struct, IPixel + private static void CopyToZYX(Image image) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { byte red = 1; byte green = 2; byte blue = 3; - using (PixelArea row = new PixelArea(1, ComponentOrder.Zyx)) + using (PixelArea row = new PixelArea(1, ComponentOrder.Zyx)) { - pixels[0, 0] = (TColor)(object)new Rgba32(red, green, blue); + pixels[0, 0] = (TPixel)(object)new Rgba32(red, green, blue); pixels.CopyTo(row, 0); @@ -235,19 +235,19 @@ namespace ImageSharp.Tests } } - private static void CopyToZYXW(Image image) - where TColor : struct, IPixel + private static void CopyToZYXW(Image image) + where TPixel : struct, IPixel { - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { byte red = 1; byte green = 2; byte blue = 3; byte alpha = 4; - using (PixelArea row = new PixelArea(1, ComponentOrder.Zyxw)) + using (PixelArea row = new PixelArea(1, ComponentOrder.Zyxw)) { - pixels[0, 0] = (TColor)(object)new Rgba32(red, green, blue, alpha); + pixels[0, 0] = (TPixel)(object)new Rgba32(red, green, blue, alpha); pixels.CopyTo(row, 0); diff --git a/tests/ImageSharp.Tests/ImageComparer.cs b/tests/ImageSharp.Tests/ImageComparer.cs index 41b884dd4..37b367931 100644 --- a/tests/ImageSharp.Tests/ImageComparer.cs +++ b/tests/ImageSharp.Tests/ImageComparer.cs @@ -16,8 +16,8 @@ /// /// Does a visual comparison between 2 images and then asserts the difference is less then a configurable threshold /// - /// The color of the expected image - /// The color type fo the the actual image + /// The color of the expected image + /// The color type fo the the actual image /// The expected image /// The actual image /// @@ -32,9 +32,9 @@ /// This is a sampling factor we sample a grid of average pixels width by high /// The default undefined value is /// - public static void CheckSimilarity(Image expected, Image actual, float imageTheshold = DefaultImageThreshold, byte segmentThreshold = DefaultSegmentThreshold, int scalingFactor = DefaultScalingFactor) - where TColorA : struct, IPixel - where TColorB : struct, IPixel + public static void CheckSimilarity(Image expected, Image actual, float imageTheshold = DefaultImageThreshold, byte segmentThreshold = DefaultSegmentThreshold, int scalingFactor = DefaultScalingFactor) + where TPixelA : struct, IPixel + where TPixelB : struct, IPixel { float percentage = expected.PercentageDifference(actual, segmentThreshold, scalingFactor); @@ -44,8 +44,8 @@ /// /// Does a visual comparison between 2 images and then and returns the percentage diffence between the 2 /// - /// The color of the source image - /// The color type for the target image + /// The color of the source image + /// The color type for the target image /// The source image /// The target image /// @@ -57,9 +57,9 @@ /// The default undefined value is /// /// Returns a number from 0 - 1 which represents the diference focter between the images. - public static float PercentageDifference(this Image source, Image target, byte segmentThreshold = DefaultSegmentThreshold, int scalingFactor = DefaultScalingFactor) - where TColorA : struct, IPixel - where TColorB : struct, IPixel + public static float PercentageDifference(this Image source, Image target, byte segmentThreshold = DefaultSegmentThreshold, int scalingFactor = DefaultScalingFactor) + where TPixelA : struct, IPixel + where TPixelB : struct, IPixel { // code adapted from https://www.codeproject.com/Articles/374386/Simple-image-comparison-in-NET Fast2DArray differences = GetDifferences(source, target, scalingFactor); @@ -74,9 +74,9 @@ return diffPixels / (scalingFactor * scalingFactor); } - private static Fast2DArray GetDifferences(Image source, Image target, int scalingFactor) - where TColorA : struct, IPixel - where TColorB : struct, IPixel + private static Fast2DArray GetDifferences(Image source, Image target, int scalingFactor) + where TPixelA : struct, IPixel + where TPixelB : struct, IPixel { Fast2DArray differences = new Fast2DArray(scalingFactor, scalingFactor); Fast2DArray firstGray = source.GetGrayScaleValues(scalingFactor); @@ -93,13 +93,13 @@ return differences; } - private static Fast2DArray GetGrayScaleValues(this Image source, int scalingFactor) - where TColorA : struct, IPixel + private static Fast2DArray GetGrayScaleValues(this Image source, int scalingFactor) + where TPixelA : struct, IPixel { byte[] buffer = new byte[4]; - using (Image img = new Image(source).Resize(scalingFactor, scalingFactor).Grayscale()) + using (Image img = new Image(source).Resize(scalingFactor, scalingFactor).Grayscale()) { - using (PixelAccessor pixels = img.Lock()) + using (PixelAccessor pixels = img.Lock()) { Fast2DArray grayScale = new Fast2DArray(scalingFactor, scalingFactor); for (int y = 0; y < scalingFactor; y++) diff --git a/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs index 97947a787..f4b3c31ef 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs @@ -20,14 +20,14 @@ namespace ImageSharp.Tests [Theory] [WithTestPatternImages(50, 50, PixelTypes.StandardImageClass, GrayscaleMode.Bt709)] [WithTestPatternImages(50, 50, PixelTypes.StandardImageClass, GrayscaleMode.Bt601)] - public void ImageShouldApplyGrayscaleFilterAll(TestImageProvider provider, GrayscaleMode value) - where TColor : struct, IPixel + public void ImageShouldApplyGrayscaleFilterAll(TestImageProvider provider, GrayscaleMode value) + where TPixel : struct, IPixel { - using (Image image = provider.GetImage()) + using (Image image = provider.GetImage()) { image.Grayscale(value); byte[] data = new byte[3]; - foreach (TColor p in image.Pixels) + foreach (TPixel p in image.Pixels) { p.ToXyzBytes(data, 0); Assert.Equal(data[0], data[1]); diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs index 084ad5993..3c4edb7b0 100644 --- a/tests/ImageSharp.Tests/TestFormat.cs +++ b/tests/ImageSharp.Tests/TestFormat.cs @@ -68,17 +68,17 @@ namespace ImageSharp.Tests } } - public Image Sample() - where TColor : struct, IPixel + public Image Sample() + where TPixel : struct, IPixel { lock (this._sampleImages) { - if (!this._sampleImages.ContainsKey(typeof(TColor))) + if (!this._sampleImages.ContainsKey(typeof(TPixel))) { - this._sampleImages.Add(typeof(TColor), new Image(1, 1)); + this._sampleImages.Add(typeof(TPixel), new Image(1, 1)); } - return (Image)this._sampleImages[typeof(TColor)]; + return (Image)this._sampleImages[typeof(TPixel)]; } } @@ -149,7 +149,7 @@ namespace ImageSharp.Tests } - public Image Decode(Configuration config, Stream stream, IDecoderOptions options) where TColor : struct, IPixel + public Image Decode(Configuration config, Stream stream, IDecoderOptions options) where TPixel : struct, IPixel { var ms = new MemoryStream(); @@ -163,7 +163,7 @@ namespace ImageSharp.Tests }); // TODO record this happend so we an verify it. - return this.testFormat.Sample(); + return this.testFormat.Sample(); } } @@ -176,7 +176,7 @@ namespace ImageSharp.Tests this.testFormat = testFormat; } - public void Encode(Image image, Stream stream, IEncoderOptions options) where TColor : struct, IPixel + public void Encode(Image image, Stream stream, IEncoderOptions options) where TPixel : struct, IPixel { // TODO record this happend so we an verify it. } diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs index 206393e27..ffbd1b888 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs @@ -13,7 +13,7 @@ namespace ImageSharp.Tests using Xunit.Sdk; /// - /// Base class for Theory Data attributes which pass an instance of to the test case. + /// Base class for Theory Data attributes which pass an instance of to the test case. /// public abstract class ImageDataAttributeBase : DataAttribute { diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImageAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImageAttribute.cs index e1f8f4c55..25d3c8cac 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImageAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithBlankImageAttribute.cs @@ -9,13 +9,13 @@ namespace ImageSharp.Tests using System.Reflection; /// - /// Triggers passing instances which produce a blank image of size width * height. - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which produce a blank image of size width * height. + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// public class WithBlankImagesAttribute : ImageDataAttributeBase { /// - /// Triggers passing an that produces a blank image of size width * height + /// Triggers passing an that produces a blank image of size width * height /// /// The required width /// The required height diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs index 617a9a237..752c114e5 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileAttribute.cs @@ -9,16 +9,16 @@ namespace ImageSharp.Tests using System.Reflection; /// - /// Triggers passing instances which read an image from the given file - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which read an image from the given file + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// public class WithFileAttribute : ImageDataAttributeBase { private readonly string fileName; /// - /// Triggers passing instances which read an image from the given file - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which read an image from the given file + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// /// The name of the file /// The requested pixel types diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs index be0fa7b3f..3bd93e609 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithFileCollectionAttribute.cs @@ -11,16 +11,16 @@ namespace ImageSharp.Tests using System.Reflection; /// - /// Triggers passing instances which read an image for each file being enumerated by the (static) test class field/property defined by enumeratorMemberName - /// instances will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which read an image for each file being enumerated by the (static) test class field/property defined by enumeratorMemberName + /// instances will be passed for each the pixel format defined by the pixelTypes parameter /// public class WithFileCollectionAttribute : ImageDataAttributeBase { private readonly string enumeratorMemberName; /// - /// Triggers passing instances which read an image for each file being enumerated by the (static) test class field/property defined by enumeratorMemberName - /// instances will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which read an image for each file being enumerated by the (static) test class field/property defined by enumeratorMemberName + /// instances will be passed for each the pixel format defined by the pixelTypes parameter /// /// The name of the static test class field/property enumerating the files /// The requested pixel types diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs index fa5e57dd0..661640f66 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithMemberFactoryAttribute.cs @@ -10,17 +10,17 @@ namespace ImageSharp.Tests using System.Reflection; /// - /// Triggers passing instances which return the image produced by the given test class member method - /// instances will be passed for each the pixel format defined by the pixelTypes parameter - /// The parameter of the factory method must be a instance + /// Triggers passing instances which return the image produced by the given test class member method + /// instances will be passed for each the pixel format defined by the pixelTypes parameter + /// The parameter of the factory method must be a instance /// public class WithMemberFactoryAttribute : ImageDataAttributeBase { private readonly string memberMethodName; /// - /// Triggers passing instances which return the image produced by the given test class member method - /// instances will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which return the image produced by the given test class member method + /// instances will be passed for each the pixel format defined by the pixelTypes parameter /// /// The name of the static test class which returns the image /// The requested pixel types diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs index d225f8a77..9a8538e78 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithSolidFilledImagesAttribute.cs @@ -9,14 +9,14 @@ namespace ImageSharp.Tests using System.Reflection; /// - /// Triggers passing instances which produce an image of size width * height filled with the requested color. - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which produce an image of size width * height filled with the requested color. + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// public class WithSolidFilledImagesAttribute : WithBlankImagesAttribute { /// - /// Triggers passing instances which produce an image of size width * height filled with the requested color. - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which produce an image of size width * height filled with the requested color. + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// /// The width of the requested image /// The height of the requested image @@ -38,8 +38,8 @@ namespace ImageSharp.Tests } /// - /// Triggers passing instances which produce an image of size width * height filled with the requested color. - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which produce an image of size width * height filled with the requested color. + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// /// The width of the requested image /// The height of the requested image diff --git a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImageAttribute.cs b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImageAttribute.cs index 98bc45f5b..f2d2aeb88 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImageAttribute.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Attributes/WithTestPatternImageAttribute.cs @@ -9,13 +9,13 @@ namespace ImageSharp.Tests using System.Reflection; /// - /// Triggers passing instances which produce a blank image of size width * height. - /// One instance will be passed for each the pixel format defined by the pixelTypes parameter + /// Triggers passing instances which produce a blank image of size width * height. + /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// public class WithTestPatternImagesAttribute : ImageDataAttributeBase { /// - /// Triggers passing an that produces a test pattern image of size width * height + /// Triggers passing an that produces a test pattern image of size width * height /// /// The required width /// The required height diff --git a/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs b/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs index c2fe0dc5c..2791c25b1 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs @@ -11,22 +11,22 @@ namespace ImageSharp.Tests /// Utility class to create specialized subclasses of generic classes (eg. ) /// Used as parameter for -based factory methods /// - public class GenericFactory - where TColor : struct, IPixel + public class GenericFactory + where TPixel : struct, IPixel { - public virtual Image CreateImage(int width, int height) + public virtual Image CreateImage(int width, int height) { - return new Image(width, height); + return new Image(width, height); } - public virtual Image CreateImage(byte[] bytes) + public virtual Image CreateImage(byte[] bytes) { - return Image.Load(bytes); + return Image.Load(bytes); } - public virtual Image CreateImage(Image other) + public virtual Image CreateImage(Image other) { - return new Image(other); + return new Image(other); } } } \ No newline at end of file diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs index 6dc0d89c5..e7512cb2d 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs @@ -8,10 +8,10 @@ namespace ImageSharp.Tests using System; using Xunit.Abstractions; - public abstract partial class TestImageProvider - where TColor : struct, IPixel + public abstract partial class TestImageProvider + where TPixel : struct, IPixel { - private class BlankProvider : TestImageProvider, IXunitSerializable + private class BlankProvider : TestImageProvider, IXunitSerializable { public BlankProvider(int width, int height) { @@ -30,7 +30,7 @@ namespace ImageSharp.Tests protected int Width { get; private set; } - public override Image GetImage() => this.Factory.CreateImage(this.Width, this.Height); + public override Image GetImage() => this.Factory.CreateImage(this.Width, this.Height); public override void Deserialize(IXunitSerializationInfo info) diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs index bc18209f3..1b7bbe4e7 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -9,12 +9,12 @@ namespace ImageSharp.Tests using System.Collections.Concurrent; using Xunit.Abstractions; - public abstract partial class TestImageProvider - where TColor : struct, IPixel + public abstract partial class TestImageProvider + where TPixel : struct, IPixel { - private class FileProvider : TestImageProvider, IXunitSerializable + private class FileProvider : TestImageProvider, IXunitSerializable { - // Need PixelTypes in the dictionary key, because result images of TestImageProvider.FileProvider + // Need PixelTypes in the dictionary key, because result images of TestImageProvider.FileProvider // are shared between PixelTypes.Color & PixelTypes.StandardImageClass private class Key : Tuple { @@ -24,8 +24,8 @@ namespace ImageSharp.Tests } } - private static ConcurrentDictionary> cache = - new ConcurrentDictionary>(); + private static ConcurrentDictionary> cache = + new ConcurrentDictionary>(); private string filePath; @@ -40,11 +40,11 @@ namespace ImageSharp.Tests public override string SourceFileOrDescription => this.filePath; - public override Image GetImage() + public override Image GetImage() { Key key = new Key(this.PixelType, this.filePath); - Image cachedImage = cache.GetOrAdd( + Image cachedImage = cache.GetOrAdd( key, fn => { diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs index 9addc8ca6..8739d556d 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs @@ -8,22 +8,22 @@ namespace ImageSharp.Tests using System; /// - /// Provides instances for parametric unit tests. + /// Provides instances for parametric unit tests. /// - /// The pixel format of the image - public abstract partial class TestImageProvider - where TColor : struct, IPixel + /// The pixel format of the image + public abstract partial class TestImageProvider + where TPixel : struct, IPixel { - private class LambdaProvider : TestImageProvider + private class LambdaProvider : TestImageProvider { - private readonly Func, Image> creator; + private readonly Func, Image> creator; - public LambdaProvider(Func, Image> creator) + public LambdaProvider(Func, Image> creator) { this.creator = creator; } - public override Image GetImage() => this.creator(this.Factory); + public override Image GetImage() => this.creator(this.Factory); } } } \ No newline at end of file diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs index 9a6750872..c2c903e9e 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs @@ -9,11 +9,11 @@ namespace ImageSharp.Tests using Xunit.Abstractions; /// - /// Provides instances for parametric unit tests. + /// Provides instances for parametric unit tests. /// - /// The pixel format of the image - public abstract partial class TestImageProvider - where TColor : struct, IPixel + /// The pixel format of the image + public abstract partial class TestImageProvider + where TPixel : struct, IPixel { private class SolidProvider : BlankProvider { @@ -46,10 +46,10 @@ namespace ImageSharp.Tests public override string SourceFileOrDescription => $"Solid{this.Width}x{this.Height}_({this.r},{this.g},{this.b},{this.a})"; - public override Image GetImage() + public override Image GetImage() { - Image image = base.GetImage(); - TColor color = default(TColor); + Image image = base.GetImage(); + TPixel color = default(TPixel); color.PackFromBytes(this.r, this.g, this.b, this.a); return image.Fill(color); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 26192ba1e..643e70617 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -10,13 +10,13 @@ namespace ImageSharp.Tests using Xunit.Abstractions; /// - /// Provides instances for parametric unit tests. + /// Provides instances for parametric unit tests. /// - /// The pixel format of the image - public abstract partial class TestImageProvider - where TColor : struct, IPixel + /// The pixel format of the image + public abstract partial class TestImageProvider + where TPixel : struct, IPixel { - public PixelTypes PixelType { get; private set; } = typeof(TColor).GetPixelType(); + public PixelTypes PixelType { get; private set; } = typeof(TPixel).GetPixelType(); public virtual string SourceFileOrDescription => ""; @@ -25,25 +25,25 @@ namespace ImageSharp.Tests /// public ImagingTestCaseUtility Utility { get; private set; } - public GenericFactory Factory { get; private set; } = new GenericFactory(); + public GenericFactory Factory { get; private set; } = new GenericFactory(); public string TypeName { get; private set; } public string MethodName { get; private set; } - public static TestImageProvider TestPattern( + public static TestImageProvider TestPattern( int width, int height, MethodInfo testMethod = null, PixelTypes pixelTypeOverride = PixelTypes.Undefined) => new TestPatternProvider(width, height).Init(testMethod, pixelTypeOverride); - public static TestImageProvider Blank( + public static TestImageProvider Blank( int width, int height, MethodInfo testMethod = null, PixelTypes pixelTypeOverride = PixelTypes.Undefined) => new BlankProvider(width, height).Init(testMethod, pixelTypeOverride); - public static TestImageProvider File( + public static TestImageProvider File( string filePath, MethodInfo testMethod = null, PixelTypes pixelTypeOverride = PixelTypes.Undefined) @@ -51,13 +51,13 @@ namespace ImageSharp.Tests return new FileProvider(filePath).Init(testMethod, pixelTypeOverride); } - public static TestImageProvider Lambda( - Func, Image> func, + public static TestImageProvider Lambda( + Func, Image> func, MethodInfo testMethod = null, PixelTypes pixelTypeOverride = PixelTypes.Undefined) => new LambdaProvider(func).Init(testMethod, pixelTypeOverride); - public static TestImageProvider Solid( + public static TestImageProvider Solid( int width, int height, byte r, @@ -71,9 +71,9 @@ namespace ImageSharp.Tests } /// - /// Returns an instance to the test case with the necessary traits. + /// Returns an instance to the test case with the necessary traits. /// - public abstract Image GetImage(); + public abstract Image GetImage(); public virtual void Deserialize(IXunitSerializationInfo info) { @@ -91,7 +91,7 @@ namespace ImageSharp.Tests info.AddValue("MethodName", this.MethodName); } - protected TestImageProvider Init(string typeName, string methodName, PixelTypes pixelTypeOverride) + protected TestImageProvider Init(string typeName, string methodName, PixelTypes pixelTypeOverride) { if (pixelTypeOverride != PixelTypes.Undefined) { @@ -102,7 +102,7 @@ namespace ImageSharp.Tests if (pixelTypeOverride == PixelTypes.StandardImageClass) { - this.Factory = new ImageFactory() as GenericFactory; + this.Factory = new ImageFactory() as GenericFactory; } this.Utility = new ImagingTestCaseUtility() @@ -119,7 +119,7 @@ namespace ImageSharp.Tests return this; } - protected TestImageProvider Init(MethodInfo testMethod, PixelTypes pixelTypeOverride) + protected TestImageProvider Init(MethodInfo testMethod, PixelTypes pixelTypeOverride) { return Init(testMethod?.DeclaringType.Name, testMethod?.Name, pixelTypeOverride); } diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs index 518c45a45..fb30e7fe4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs @@ -10,17 +10,17 @@ namespace ImageSharp.Tests using System.Numerics; using Xunit.Abstractions; - public abstract partial class TestImageProvider - where TColor : struct, IPixel + public abstract partial class TestImageProvider + where TPixel : struct, IPixel { /// /// A test image provider that produces test patterns. /// - /// + /// private class TestPatternProvider : BlankProvider { - static Dictionary> testImages = new Dictionary>(); + static Dictionary> testImages = new Dictionary>(); public TestPatternProvider(int width, int height) : base(width, height) @@ -34,29 +34,29 @@ namespace ImageSharp.Tests public override string SourceFileOrDescription => $"TestPattern{this.Width}x{this.Height}"; - public override Image GetImage() + public override Image GetImage() { lock (testImages) { if (!testImages.ContainsKey(this.SourceFileOrDescription)) { - Image image = new Image(this.Width, this.Height); + Image image = new Image(this.Width, this.Height); DrawTestPattern(image); testImages.Add(this.SourceFileOrDescription, image); } } - return new Image(testImages[this.SourceFileOrDescription]); + return new Image(testImages[this.SourceFileOrDescription]); } /// /// Draws the test pattern on an image by drawing 4 other patterns in the for quadrants of the image. /// /// - private static void DrawTestPattern(Image image) + private static void DrawTestPattern(Image image) { // first lets split the image into 4 quadrants - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { BlackWhiteChecker(pixels); // top left VirticalBars(pixels); // top right @@ -68,7 +68,7 @@ namespace ImageSharp.Tests /// Fills the top right quadrant with alternating solid vertical bars. /// /// - private static void VirticalBars(PixelAccessor pixels) + private static void VirticalBars(PixelAccessor pixels) { // topLeft int left = pixels.Width / 2; @@ -76,9 +76,9 @@ namespace ImageSharp.Tests int top = 0; int bottom = pixels.Height / 2; int stride = pixels.Width / 12; - TColor[] c = { - NamedColors.HotPink, - NamedColors.Blue + TPixel[] c = { + NamedColors.HotPink, + NamedColors.Blue }; int p = 0; for (int y = top; y < bottom; y++) @@ -99,7 +99,7 @@ namespace ImageSharp.Tests /// fills the top left quadrant with a black and white checker board. /// /// - private static void BlackWhiteChecker(PixelAccessor pixels) + private static void BlackWhiteChecker(PixelAccessor pixels) { // topLeft int left = 0; @@ -107,9 +107,9 @@ namespace ImageSharp.Tests int top = 0; int bottom = pixels.Height / 2; int stride = pixels.Width / 6; - TColor[] c = { - NamedColors.Black, - NamedColors.White + TPixel[] c = { + NamedColors.Black, + NamedColors.White }; int p = 0; @@ -138,7 +138,7 @@ namespace ImageSharp.Tests /// Fills the bottom left quadrent with 3 horizental bars in Red, Green and Blue with a alpha gradient from left (transparent) to right (solid). /// /// - private static void TransparentGradients(PixelAccessor pixels) + private static void TransparentGradients(PixelAccessor pixels) { // topLeft int left = 0; @@ -151,7 +151,7 @@ namespace ImageSharp.Tests 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); + TPixel c = default(TPixel); for (int x = left; x < right; x++) { @@ -183,7 +183,7 @@ namespace ImageSharp.Tests /// A better algorithm could be used but it works /// /// - private static void Rainbow(PixelAccessor pixels) + private static void Rainbow(PixelAccessor pixels) { int left = pixels.Width / 2; int right = pixels.Width; @@ -192,7 +192,7 @@ namespace ImageSharp.Tests int pixelCount = left * top; uint stepsPerPixel = (uint)(uint.MaxValue / pixelCount); - TColor c = default(TColor); + TPixel c = default(TPixel); Rgba32 t = new Rgba32(0); for (int x = left; x < right; x++) diff --git a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs index 9fd33d90b..43a19040a 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -19,12 +19,12 @@ namespace ImageSharp.Tests public class ImagingTestCaseUtility : TestBase { /// - /// Name of the TColor in the owner + /// Name of the TPixel in the owner /// public string PixelTypeName { get; set; } = string.Empty; /// - /// The name of the file which is provided by + /// The name of the file which is provided by /// Or a short string describing the image in the case of a non-file based image provider. /// public string SourceFileOrDescription { get; set; } = string.Empty; @@ -91,13 +91,13 @@ namespace ImageSharp.Tests /// /// Encodes image by the format matching the required extension, than saves it to the recommended output file. /// - /// The pixel format of the image + /// The pixel format of the image /// The image instance /// The requested extension /// Optional encoder /// Optional encoder options - public void SaveTestOutputFile(Image image, string extension = null, IImageEncoder encoder = null, IEncoderOptions options = null) - where TColor : struct, IPixel + public void SaveTestOutputFile(Image image, string extension = null, IImageEncoder encoder = null, IEncoderOptions options = null) + where TPixel : struct, IPixel { string path = this.GetTestOutputFileName(extension); extension = Path.GetExtension(path); diff --git a/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs b/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs index 88d67f66a..77c13f125 100644 --- a/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs +++ b/tests/ImageSharp.Tests/TestUtilities/PixelTypes.cs @@ -9,7 +9,7 @@ namespace ImageSharp.Tests /// /// Flags that are mapped to PackedPixel types. - /// They trigger the desired parametrization for . + /// They trigger the desired parametrization for . /// [Flags] public enum PixelTypes : uint @@ -53,7 +53,7 @@ namespace ImageSharp.Tests Short4 = 1 << 17, /// - /// Triggers instantiating the subclass of + /// Triggers instantiating the subclass of /// StandardImageClass = 1 << 29, diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs index e2bc2bd2d..2a7ea352b 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs @@ -7,8 +7,8 @@ namespace ImageSharp.Tests public static class TestImageExtensions { - public static void DebugSave(this Image img, TestImageProvider provider, string extension = "png") - where TColor : struct, IPixel + public static void DebugSave(this Image img, TestImageProvider provider, string extension = "png") + where TPixel : struct, IPixel { if(!bool.TryParse(Environment.GetEnvironmentVariable("CI"), out bool isCI) || !isCI) { diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs index a0e92cf8f..2f28896b3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs @@ -47,8 +47,8 @@ namespace ImageSharp.Tests public static bool HasFlag(this PixelTypes pixelTypes, PixelTypes flag) => (pixelTypes & flag) == flag; - public static bool IsEquivalentTo(this Image a, Image b, bool compareAlpha = true) - where TColor : struct, IPixel + public static bool IsEquivalentTo(this Image a, Image b, bool compareAlpha = true) + where TPixel : struct, IPixel { if (a.Width != b.Width || a.Height != b.Height) { @@ -58,16 +58,16 @@ namespace ImageSharp.Tests byte[] bytesA = new byte[3]; byte[] bytesB = new byte[3]; - using (PixelAccessor pixA = a.Lock()) + using (PixelAccessor pixA = a.Lock()) { - using (PixelAccessor pixB = b.Lock()) + using (PixelAccessor pixB = b.Lock()) { for (int y = 0; y < a.Height; y++) { for (int x = 0; x < a.Width; x++) { - TColor ca = pixA[x, y]; - TColor cb = pixB[x, y]; + TPixel ca = pixA[x, y]; + TPixel cb = pixB[x, y]; if (compareAlpha) { diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index 815d46ffc..0f4025ee4 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -21,10 +21,10 @@ namespace ImageSharp.Tests [Theory] [WithBlankImages(42, 666, PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.HalfSingle, "hello")] - public void Use_WithEmptyImageAttribute(TestImageProvider provider, string message) - where TColor : struct, IPixel + public void Use_WithEmptyImageAttribute(TestImageProvider provider, string message) + where TPixel : struct, IPixel { - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.Equal(42, img.Width); Assert.Equal(666, img.Height); @@ -33,12 +33,12 @@ namespace ImageSharp.Tests [Theory] [WithBlankImages(42, 666, PixelTypes.All, "hello")] - public void Use_WithBlankImagesAttribute_WithAllPixelTypes( - TestImageProvider provider, + public void Use_WithBlankImagesAttribute_WithAllPixelTypes( + TestImageProvider provider, string message) - where TColor : struct, IPixel + where TPixel : struct, IPixel { - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.Equal(42, img.Width); Assert.Equal(666, img.Height); @@ -49,8 +49,8 @@ namespace ImageSharp.Tests [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) - where TColor : struct, IPixel + public void PixelType_PropertyValueIsCorrect(TestImageProvider provider, PixelTypes expected) + where TPixel : struct, IPixel { Assert.Equal(expected, provider.PixelType); } @@ -58,11 +58,11 @@ namespace ImageSharp.Tests [Theory] [WithBlankImages(1, 1, PixelTypes.StandardImageClass)] [WithFile(TestImages.Bmp.F, PixelTypes.StandardImageClass)] - public void PixelTypes_ColorWithDefaultImageClass_TriggersCreatingTheNonGenericDerivedImageClass( - TestImageProvider provider) - where TColor : struct, IPixel + public void PixelTypes_ColorWithDefaultImageClass_TriggersCreatingTheNonGenericDerivedImageClass( + TestImageProvider provider) + where TPixel : struct, IPixel { - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.IsType(img); } @@ -70,11 +70,11 @@ namespace ImageSharp.Tests [Theory] [WithFile(TestImages.Bmp.Car, PixelTypes.All, 88)] [WithFile(TestImages.Bmp.F, PixelTypes.All, 88)] - public void Use_WithFileAttribute(TestImageProvider provider, int yo) - where TColor : struct, IPixel + public void Use_WithFileAttribute(TestImageProvider provider, int yo) + where TPixel : struct, IPixel { Assert.NotNull(provider.Utility.SourceFileOrDescription); - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.True(img.Width * img.Height > 0); Assert.Equal(88, yo); @@ -87,26 +87,26 @@ namespace ImageSharp.Tests [Theory] [WithFileCollection(nameof(AllBmpFiles), PixelTypes.Rgba32 | PixelTypes.Argb32)] - public void Use_WithFileCollection(TestImageProvider provider) - where TColor : struct, IPixel + public void Use_WithFileCollection(TestImageProvider provider) + where TPixel : struct, IPixel { Assert.NotNull(provider.Utility.SourceFileOrDescription); - Image image = provider.GetImage(); + Image image = provider.GetImage(); provider.Utility.SaveTestOutputFile(image, "png"); } [Theory] [WithSolidFilledImages(10, 20, 255, 100, 50, 200, PixelTypes.Rgba32 | PixelTypes.Argb32)] - public void Use_WithSolidFilledImagesAttribute(TestImageProvider provider) - where TColor : struct, IPixel + public void Use_WithSolidFilledImagesAttribute(TestImageProvider provider) + where TPixel : struct, IPixel { - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.Equal(img.Width, 10); Assert.Equal(img.Height, 20); byte[] colors = new byte[4]; - using (PixelAccessor pixels = img.Lock()) + using (PixelAccessor pixels = img.Lock()) { for (int y = 0; y < pixels.Height; y++) { @@ -124,23 +124,23 @@ namespace ImageSharp.Tests } /// - /// Need to us to create instance of when pixelType is StandardImageClass + /// Need to us to create instance of when pixelType is StandardImageClass /// - /// + /// /// /// - public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPixel + public static Image CreateTestImage(GenericFactory factory) + where TPixel : struct, IPixel { return factory.CreateImage(3, 3); } [Theory] [WithMemberFactory(nameof(CreateTestImage), PixelTypes.All)] - public void Use_WithMemberFactoryAttribute(TestImageProvider provider) - where TColor : struct, IPixel + public void Use_WithMemberFactoryAttribute(TestImageProvider provider) + where TPixel : struct, IPixel { - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.Equal(img.Width, 3); if (provider.PixelType == PixelTypes.StandardImageClass) { @@ -159,10 +159,10 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(BasicData))] - public void Blank_MemberData(TestImageProvider provider) - where TColor : struct, IPixel + public void Blank_MemberData(TestImageProvider provider) + where TPixel : struct, IPixel { - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.True(img.Width * img.Height > 0); } @@ -177,13 +177,13 @@ namespace ImageSharp.Tests [Theory] [MemberData(nameof(FileData))] - public void File_MemberData(TestImageProvider provider) - where TColor : struct, IPixel + public void File_MemberData(TestImageProvider provider) + where TPixel : struct, IPixel { this.Output.WriteLine("SRC: " + provider.Utility.SourceFileOrDescription); this.Output.WriteLine("OUT: " + provider.Utility.GetTestOutputFileName()); - Image img = provider.GetImage(); + Image img = provider.GetImage(); Assert.True(img.Width * img.Height > 0); } diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs index 3ad4507df..f47123ef7 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs @@ -23,12 +23,12 @@ namespace ImageSharp.Tests private ITestOutputHelper Output { get; } - public static Image CreateTestImage(GenericFactory factory) - where TColor : struct, IPixel + public static Image CreateTestImage(GenericFactory factory) + where TPixel : struct, IPixel { - Image image = factory.CreateImage(10, 10); + Image image = factory.CreateImage(10, 10); - using (PixelAccessor pixels = image.Lock()) + using (PixelAccessor pixels = image.Lock()) { for (int i = 0; i < 10; i++) { @@ -37,7 +37,7 @@ namespace ImageSharp.Tests Vector4 v = new Vector4(i, j, 0, 1); v /= 10; - TColor color = default(TColor); + TPixel color = default(TPixel); color.PackFromVector4(v); pixels[i, j] = color; @@ -61,11 +61,11 @@ namespace ImageSharp.Tests [Theory] [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 + public void IsEquivalentTo_WhenFalse(TestImageProvider provider, bool compareAlpha) + where TPixel : struct, IPixel { - Image a = provider.GetImage(); - Image b = provider.GetImage(); + Image a = provider.GetImage(); + Image b = provider.GetImage(); b = b.OilPaint(3, 2); Assert.False(a.IsEquivalentTo(b, compareAlpha)); @@ -74,11 +74,11 @@ namespace ImageSharp.Tests [Theory] [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 + public void IsEquivalentTo_WhenTrue(TestImageProvider provider, bool compareAlpha) + where TPixel : struct, IPixel { - Image a = provider.GetImage(); - Image b = provider.GetImage(); + Image a = provider.GetImage(); + Image b = provider.GetImage(); Assert.True(a.IsEquivalentTo(b, compareAlpha)); } From c63941377d707c81bb190fd2b467e53a26ef57fa Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 20 Apr 2017 20:17:22 +1000 Subject: [PATCH 4/9] Fix renaming error --- src/ImageSharp/Image/ImageBase{TPixel}.cs | 3 ++- src/ImageSharp/Image/PixelAccessor{TPixel}.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Image/ImageBase{TPixel}.cs b/src/ImageSharp/Image/ImageBase{TPixel}.cs index ec458e676..b55b88f60 100644 --- a/src/ImageSharp/Image/ImageBase{TPixel}.cs +++ b/src/ImageSharp/Image/ImageBase{TPixel}.cs @@ -167,6 +167,7 @@ namespace ImageSharp int newHeight = pixelSource.Height; // Push my memory into the accessor (which in turn unpins the old puffer ready for the images use) + TPixel[] newPixels = pixelSource.ReturnCurrentColorsAndReplaceThemInternally(this.Width, this.Height, this.pixelBuffer); this.Width = newWidth; this.Height = newHeight; this.pixelBuffer = newPixels; @@ -240,4 +241,4 @@ namespace ImageSharp Array.Clear(this.pixelBuffer, 0, this.Width * this.Height); } } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Image/PixelAccessor{TPixel}.cs b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs index 5cb19c2e8..f3f9546fd 100644 --- a/src/ImageSharp/Image/PixelAccessor{TPixel}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs @@ -236,6 +236,7 @@ namespace ImageSharp /// The pixels. /// Returns the old pixel data thats has gust been replaced. /// If is true then caller is responsible for ensuring is called. + internal TPixel[] ReturnCurrentColorsAndReplaceThemInternally(int width, int height, TPixel[] pixels) { TPixel[] oldPixels = this.pixelBuffer.TakeArrayOwnership(); this.SetPixelBufferUnsafe(width, height, pixels); @@ -538,4 +539,4 @@ namespace ImageSharp } } } -} +} \ No newline at end of file From 87182ce45212ee8d78e6c36c28bc66cab15a58db Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 20 Apr 2017 20:18:37 +1000 Subject: [PATCH 5/9] Bump alpha version --- src/ImageSharp.Drawing/ImageSharp.Drawing.csproj | 2 +- src/ImageSharp/ImageSharp.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj index c4515db37..7c483712d 100644 --- a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj +++ b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj @@ -2,7 +2,7 @@ An extension to ImageSharp that allows the drawing of images, paths, and text. ImageSharp.Drawing - 1.0.0-alpha6 + 1.0.0-alpha7 James Jackson-South and contributors netstandard1.1 true diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj index a19bed604..bda5f7c39 100644 --- a/src/ImageSharp/ImageSharp.csproj +++ b/src/ImageSharp/ImageSharp.csproj @@ -2,7 +2,7 @@ A cross-platform library for the processing of image files; written in C# ImageSharp - 1.0.0-alpha6 + 1.0.0-alpha7 James Jackson-South and contributors netstandard1.3;netstandard1.1 true From 1012e57bc429ac67e05c2584b97f6cb7dd499dc4 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 21 Apr 2017 22:28:35 +1000 Subject: [PATCH 6/9] Move SinC to MathF [skip ci] --- src/ImageSharp/Common/Helpers/ImageMaths.cs | 39 +------------------ src/ImageSharp/Common/Helpers/MathF.cs | 38 ++++++++++++++++++ .../Resamplers/Lanczos2Resampler.cs | 2 +- .../Resamplers/Lanczos3Resampler.cs | 2 +- .../Resamplers/Lanczos5Resampler.cs | 2 +- .../Resamplers/Lanczos8Resampler.cs | 2 +- .../Transforms/Resamplers/WelchResampler.cs | 2 +- 7 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index 224b267e4..1be7bd619 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -100,25 +100,6 @@ namespace ImageSharp return 0F; } - /// - /// Gets the result of a sine cardinal function for the given value. - /// - /// The value to calculate the result for. - /// - /// The . - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float SinC(float x) - { - if (MathF.Abs(x) > Constants.Epsilon) - { - x *= MathF.PI; - return Clean(MathF.Sin(x) / x); - } - - return 1.0f; - } - /// /// Returns the given degrees converted to radians. /// @@ -286,23 +267,5 @@ namespace ImageSharp return GetBoundingRectangle(topLeft, bottomRight); } - - /// - /// Ensures that any passed double is correctly rounded to zero - /// - /// The value to clean. - /// - /// The - /// . - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static float Clean(float x) - { - if (MathF.Abs(x) < Constants.Epsilon) - { - return 0F; - } - - return x; - } } -} +} \ No newline at end of file diff --git a/src/ImageSharp/Common/Helpers/MathF.cs b/src/ImageSharp/Common/Helpers/MathF.cs index 2ee700789..1877fe8af 100644 --- a/src/ImageSharp/Common/Helpers/MathF.cs +++ b/src/ImageSharp/Common/Helpers/MathF.cs @@ -126,6 +126,26 @@ namespace ImageSharp return (float)Math.Sin(f); } + /// + /// Returns the result of a normalized sine cardinal function for the given value. + /// SinC(x) = sin(pi*x)/(pi*x). + /// + /// A single-precision floating-point number to calculate the result for. + /// + /// The sine cardinal of . + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static float SinC(float f) + { + if (Abs(f) > Constants.Epsilon) + { + f *= PI; + return Clean(Sin(f) / f); + } + + return 1F; + } + /// Returns the square root of a specified number. /// The number whose square root is to be found. /// @@ -140,5 +160,23 @@ namespace ImageSharp { return (float)Math.Sqrt(f); } + + /// + /// Ensures that any passed float is correctly rounded to zero + /// + /// The value to clean. + /// + /// The + /// . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static float Clean(float x) + { + if (Abs(x) < Constants.Epsilon) + { + return 0F; + } + + return x; + } } } \ No newline at end of file diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs index 05d6c630f..a46f38df4 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs +++ b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Processing if (x < 2F) { - return ImageMaths.SinC(x) * ImageMaths.SinC(x / 2F); + return MathF.SinC(x) * MathF.SinC(x / 2F); } return 0F; diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs index 094e5bd67..3ad01b2b7 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs +++ b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Processing if (x < 3F) { - return ImageMaths.SinC(x) * ImageMaths.SinC(x / 3F); + return MathF.SinC(x) * MathF.SinC(x / 3F); } return 0F; diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs index 9022aaaaf..9bb8bdd16 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs +++ b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Processing if (x < 5F) { - return ImageMaths.SinC(x) * ImageMaths.SinC(x / 5F); + return MathF.SinC(x) * MathF.SinC(x / 5F); } return 0F; diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs index 4769d3847..af8c2c111 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs +++ b/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs @@ -25,7 +25,7 @@ namespace ImageSharp.Processing if (x < 8F) { - return ImageMaths.SinC(x) * ImageMaths.SinC(x / 8F); + return MathF.SinC(x) * MathF.SinC(x / 8F); } return 0F; diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs b/src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs index 6fafd8ebb..33a2cc825 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs +++ b/src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs @@ -24,7 +24,7 @@ namespace ImageSharp.Processing if (x < 3F) { - return ImageMaths.SinC(x) * (1F - (x * x / 9.0F)); + return MathF.SinC(x) * (1F - (x * x / 9F)); } return 0F; From 7d2fe2c7e51eb54b67ab924f8cdfb011c84fe0ca Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 22 Apr 2017 08:21:02 +1000 Subject: [PATCH 7/9] Move IPixel types to PixelFormat namespace --- src/ImageSharp.Drawing/Brushes/Brushes.cs | 2 ++ .../Brushes/Brushes{TPixel}.cs | 2 +- src/ImageSharp.Drawing/Brushes/IBrush.cs | 3 +-- src/ImageSharp.Drawing/Brushes/ImageBrush.cs | 2 ++ .../Brushes/ImageBrush{TPixel}.cs | 2 +- src/ImageSharp.Drawing/Brushes/PatternBrush.cs | 2 ++ .../Brushes/PatternBrush{TPixel}.cs | 2 +- .../Brushes/Processors/BrushApplicator.cs | 2 +- src/ImageSharp.Drawing/Brushes/RecolorBrush.cs | 2 ++ .../Brushes/RecolorBrush{TPixel}.cs | 3 +-- src/ImageSharp.Drawing/Brushes/SolidBrush.cs | 2 ++ .../Brushes/SolidBrush{TPixel}.cs | 3 +-- src/ImageSharp.Drawing/DrawImage.cs | 3 +-- src/ImageSharp.Drawing/DrawPath.cs | 3 +-- src/ImageSharp.Drawing/FillRegion.cs | 3 +-- src/ImageSharp.Drawing/Paths/DrawBeziers.cs | 3 +-- src/ImageSharp.Drawing/Paths/DrawLines.cs | 3 +-- src/ImageSharp.Drawing/Paths/DrawPath.cs | 4 +--- src/ImageSharp.Drawing/Paths/DrawPolygon.cs | 3 +-- src/ImageSharp.Drawing/Paths/DrawRectangle.cs | 3 +-- src/ImageSharp.Drawing/Paths/FillPaths.cs | 4 +--- src/ImageSharp.Drawing/Paths/FillPolygon.cs | 2 +- src/ImageSharp.Drawing/Paths/FillRectangle.cs | 3 +-- src/ImageSharp.Drawing/Pens/IPen.cs | 2 +- src/ImageSharp.Drawing/Pens/Pen.cs | 2 ++ src/ImageSharp.Drawing/Pens/Pens.cs | 2 ++ src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs | 2 ++ src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs | 2 +- .../Pens/Processors/ColoredPointInfo.cs | 2 +- .../Pens/Processors/PenApplicator.cs | 2 +- .../Processors/DrawImageProcessor.cs | 2 +- .../Processors/DrawPathProcessor.cs | 2 +- .../Processors/FillProcessor.cs | 1 + .../Processors/FillRegionProcessor.cs | 3 +-- src/ImageSharp.Drawing/Text/DrawText.cs | 2 +- src/ImageSharp/Colors/Spaces/Bgra32.cs | 1 + src/ImageSharp/Colors/Spaces/CieLab.cs | 1 + src/ImageSharp/Colors/Spaces/CieXyz.cs | 1 + src/ImageSharp/Colors/Spaces/Cmyk.cs | 1 + src/ImageSharp/Colors/Spaces/Hsl.cs | 1 + src/ImageSharp/Colors/Spaces/Hsv.cs | 1 + src/ImageSharp/Colors/Spaces/YCbCr.cs | 1 + .../Common/Extensions/Vector4Extensions.cs | 1 + src/ImageSharp/Common/Helpers/ImageMaths.cs | 2 ++ src/ImageSharp/Common/Memory/PixelDataPool{T}.cs | 2 ++ .../Dithering/ErrorDiffusion/ErrorDiffuser.cs | 2 ++ .../Dithering/ErrorDiffusion/IErrorDiffuser.cs | 2 +- .../Dithering/Ordered/IOrderedDither.cs | 2 ++ .../Dithering/Ordered/OrderedDither4x4.cs | 2 ++ src/ImageSharp/Formats/Bmp/BmpDecoder.cs | 2 ++ src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 2 ++ src/ImageSharp/Formats/Bmp/BmpEncoder.cs | 2 ++ src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs | 2 ++ src/ImageSharp/Formats/Bmp/ImageExtensions.cs | 2 ++ src/ImageSharp/Formats/Gif/GifDecoder.cs | 2 ++ src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 2 ++ src/ImageSharp/Formats/Gif/GifEncoder.cs | 2 ++ src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 2 ++ src/ImageSharp/Formats/Gif/ImageExtensions.cs | 2 ++ src/ImageSharp/Formats/IImageDecoder.cs | 2 ++ src/ImageSharp/Formats/IImageEncoder.cs | 2 ++ src/ImageSharp/Formats/Jpeg/ImageExtensions.cs | 2 ++ src/ImageSharp/Formats/Jpeg/JpegDecoder.cs | 2 ++ src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs | 1 + src/ImageSharp/Formats/Jpeg/JpegEncoder.cs | 2 ++ src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs | 1 + src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs | 2 ++ src/ImageSharp/Formats/Png/ImageExtensions.cs | 2 ++ src/ImageSharp/Formats/Png/PngDecoder.cs | 2 ++ src/ImageSharp/Formats/Png/PngDecoderCore.cs | 2 ++ src/ImageSharp/Formats/Png/PngEncoder.cs | 2 ++ src/ImageSharp/Formats/Png/PngEncoderCore.cs | 2 ++ src/ImageSharp/Image.Create.cs | 2 ++ src/ImageSharp/Image.Decode.cs | 2 ++ src/ImageSharp/Image.FromBytes.cs | 2 ++ src/ImageSharp/Image.FromFile.cs | 1 + src/ImageSharp/Image.FromStream.cs | 3 +++ src/ImageSharp/Image.cs | 1 + src/ImageSharp/Image/IImageBase{TPixel}.cs | 1 + src/ImageSharp/Image/IImageProcessor.cs | 2 ++ src/ImageSharp/Image/ImageBase{TPixel}.cs | 1 + src/ImageSharp/Image/ImageFrame{TPixel}.cs | 1 + .../Image/ImageProcessingExtensions.cs | 2 ++ src/ImageSharp/Image/Image{TPixel}.cs | 1 + src/ImageSharp/Image/PixelAccessor{TPixel}.cs | 1 + src/ImageSharp/Image/PixelArea{TPixel}.cs | 2 +- src/ImageSharp/ImageProcessor.cs | 2 ++ .../MetaData/Profiles/Exif/ExifProfile.cs | 2 ++ .../PackedPixel => PixelFormats}/Alpha8.cs | 2 +- .../PackedPixel => PixelFormats}/Argb32.cs | 3 +-- .../PackedPixel => PixelFormats}/Bgr565.cs | 2 +- .../PackedPixel => PixelFormats}/Bgra4444.cs | 2 +- .../PackedPixel => PixelFormats}/Bgra5551.cs | 2 +- .../BulkPixelOperations{TPixel}.cs | 2 +- .../PackedPixel => PixelFormats}/Byte4.cs | 2 +- .../ColorBuilder{TPixel}.cs | 2 +- .../{Colors => PixelFormats}/ColorConstants.cs | 2 +- .../{Colors => PixelFormats}/ComponentOrder.cs | 2 +- .../PackedPixel => PixelFormats}/HalfSingle.cs | 3 +-- .../HalfTypeHelper.cs | 2 +- .../PackedPixel => PixelFormats}/HalfVector2.cs | 3 +-- .../PackedPixel => PixelFormats}/HalfVector4.cs | 3 +-- .../IPackedVector{TPacked}.cs | 3 +-- .../PackedPixel => PixelFormats}/IPixel.cs | 2 +- .../NamedColors{TPixel}.cs | 2 +- .../NormalizedByte2.cs | 2 +- .../NormalizedByte4.cs | 2 +- .../NormalizedShort2.cs | 3 +-- .../NormalizedShort4.cs | 3 +-- .../PackedPixelConverterHelper.cs | 2 +- .../PackedPixel => PixelFormats}/README.md | 0 .../{Colors/PackedPixel => PixelFormats}/Rg32.cs | 2 +- .../PackedPixel => PixelFormats}/Rgba1010102.cs | 2 +- .../Rgba32.BulkOperations.cs | 2 +- .../Rgba32.ColorspaceTransforms.cs | 2 +- .../Rgba32.Definitions.cs | 2 +- .../Rgba32.Transforms.cs | 2 +- .../{Colors => PixelFormats}/Rgba32.cs | 2 +- .../PackedPixel => PixelFormats}/Rgba64.cs | 2 +- .../{Colors => PixelFormats}/RgbaComponent.cs | 0 .../RgbaVector.BulkOperations.cs | 2 +- .../RgbaVector.Definitions.cs | 2 +- .../RgbaVector.Transforms.cs | 2 +- .../{Colors => PixelFormats}/RgbaVector.cs | 2 +- .../PackedPixel => PixelFormats}/Short2.cs | 2 +- .../PackedPixel => PixelFormats}/Short4.cs | 2 +- .../Vector4BlendTransforms.cs | 2 +- .../Processing/Binarization/BinaryThreshold.cs | 2 ++ src/ImageSharp/Processing/Binarization/Dither.cs | 1 + .../Processing/ColorMatrix/BlackWhite.cs | 2 ++ .../Processing/ColorMatrix/ColorBlindness.cs | 2 ++ .../Processing/ColorMatrix/Grayscale.cs | 2 ++ src/ImageSharp/Processing/ColorMatrix/Hue.cs | 2 ++ .../Processing/ColorMatrix/Kodachrome.cs | 2 ++ .../Processing/ColorMatrix/Lomograph.cs | 2 ++ .../Processing/ColorMatrix/Polaroid.cs | 2 ++ .../Processing/ColorMatrix/Saturation.cs | 2 ++ src/ImageSharp/Processing/ColorMatrix/Sepia.cs | 2 ++ src/ImageSharp/Processing/Convolution/BoxBlur.cs | 2 ++ .../Processing/Convolution/DetectEdges.cs | 2 ++ .../Processing/Convolution/GaussianBlur.cs | 2 ++ .../Processing/Convolution/GaussianSharpen.cs | 2 ++ src/ImageSharp/Processing/Effects/Alpha.cs | 2 ++ .../Processing/Effects/BackgroundColor.cs | 2 ++ src/ImageSharp/Processing/Effects/Brightness.cs | 2 ++ src/ImageSharp/Processing/Effects/Contrast.cs | 2 ++ src/ImageSharp/Processing/Effects/Invert.cs | 2 ++ src/ImageSharp/Processing/Effects/OilPainting.cs | 2 ++ src/ImageSharp/Processing/Effects/Pixelate.cs | 2 ++ src/ImageSharp/Processing/Overlays/Glow.cs | 2 ++ src/ImageSharp/Processing/Overlays/Vignette.cs | 2 ++ .../Binarization/BinaryThresholdProcessor.cs | 2 ++ .../ErrorDiffusionDitherProcessor.cs | 1 + .../Binarization/OrderedDitherProcessor.cs | 1 + .../ColorMatrix/BlackWhiteProcessor.cs | 2 ++ .../ColorBlindness/AchromatomalyProcessor.cs | 2 ++ .../ColorBlindness/AchromatopsiaProcessor.cs | 2 ++ .../ColorBlindness/DeuteranomalyProcessor.cs | 2 ++ .../ColorBlindness/DeuteranopiaProcessor.cs | 2 ++ .../ColorBlindness/ProtanomalyProcessor.cs | 2 ++ .../ColorBlindness/ProtanopiaProcessor.cs | 2 ++ .../ColorBlindness/TritanomalyProcessor.cs | 2 ++ .../ColorBlindness/TritanopiaProcessor.cs | 2 ++ .../ColorMatrix/ColorMatrixProcessor.cs | 2 ++ .../ColorMatrix/GrayscaleBt601Processor.cs | 2 ++ .../ColorMatrix/GrayscaleBt709Processor.cs | 2 ++ .../Processors/ColorMatrix/HueProcessor.cs | 2 ++ .../Processors/ColorMatrix/IColorMatrixFilter.cs | 2 ++ .../ColorMatrix/KodachromeProcessor.cs | 2 ++ .../Processors/ColorMatrix/LomographProcessor.cs | 2 ++ .../Processors/ColorMatrix/PolaroidProcessor.cs | 2 ++ .../ColorMatrix/SaturationProcessor.cs | 2 ++ .../Processors/ColorMatrix/SepiaProcessor.cs | 2 ++ .../Processors/Convolution/BoxBlurProcessor.cs | 2 ++ .../Convolution/Convolution2DProcessor.cs | 2 ++ .../Convolution/Convolution2PassProcessor.cs | 2 ++ .../Convolution/ConvolutionProcessor.cs | 2 ++ .../EdgeDetection/EdgeDetector2DProcessor.cs | 2 ++ .../EdgeDetectorCompassProcessor.cs | 2 ++ .../EdgeDetection/EdgeDetectorProcessor.cs | 2 ++ .../EdgeDetection/IEdgeDetectorProcessor.cs | 2 ++ .../EdgeDetection/KayyaliProcessor.cs | 2 ++ .../Convolution/EdgeDetection/KirschProcessor.cs | 2 ++ .../EdgeDetection/Laplacian3X3Processor.cs | 2 ++ .../EdgeDetection/Laplacian5X5Processor.cs | 2 ++ .../LaplacianOfGaussianProcessor.cs | 2 ++ .../EdgeDetection/PrewittProcessor.cs | 2 ++ .../EdgeDetection/RobertsCrossProcessor.cs | 2 ++ .../EdgeDetection/RobinsonProcessor.cs | 2 ++ .../Convolution/EdgeDetection/ScharrProcessor.cs | 2 ++ .../Convolution/EdgeDetection/SobelProcessor.cs | 2 ++ .../Convolution/GaussianBlurProcessor.cs | 2 ++ .../Convolution/GaussianSharpenProcessor.cs | 2 ++ .../Processors/Effects/AlphaProcessor.cs | 2 ++ .../Effects/BackgroundColorProcessor.cs | 2 ++ .../Processors/Effects/BrightnessProcessor.cs | 2 ++ .../Processors/Effects/ContrastProcessor.cs | 2 ++ .../Processors/Effects/InvertProcessor.cs | 2 ++ .../Processors/Effects/OilPaintingProcessor.cs | 2 ++ .../Processors/Effects/PixelateProcessor.cs | 2 ++ .../Processors/Overlays/GlowProcessor.cs | 2 ++ .../Processors/Overlays/VignetteProcessor.cs | 2 ++ .../Processors/Transforms/CropProcessor.cs | 2 ++ .../Transforms/EntropyCropProcessor.cs | 2 ++ .../Processors/Transforms/FlipProcessor.cs | 2 ++ .../Processors/Transforms/Matrix3x2Processor.cs | 2 ++ .../Transforms/ResamplingWeightedProcessor.cs | 2 ++ .../Processors/Transforms/ResizeProcessor.cs | 2 ++ .../Processors/Transforms/RotateProcessor.cs | 2 ++ .../Processors/Transforms/SkewProcessor.cs | 2 ++ .../Processing/Transforms/AutoOrient.cs | 3 +++ src/ImageSharp/Processing/Transforms/Crop.cs | 2 ++ .../Processing/Transforms/EntropyCrop.cs | 2 ++ src/ImageSharp/Processing/Transforms/Flip.cs | 2 ++ .../Transforms/Options/ResizeHelper.cs | 2 ++ src/ImageSharp/Processing/Transforms/Pad.cs | 2 ++ src/ImageSharp/Processing/Transforms/Resize.cs | 2 ++ src/ImageSharp/Processing/Transforms/Rotate.cs | 2 ++ .../Processing/Transforms/RotateFlip.cs | 3 +++ src/ImageSharp/Processing/Transforms/Skew.cs | 2 ++ src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs | 1 + .../Quantizers/OctreeQuantizer{TPixel}.cs | 1 + .../Quantizers/PaletteQuantizer{TPixel}.cs | 1 + src/ImageSharp/Quantizers/Quantize.cs | 1 + .../Quantizers/QuantizedImage{TPixel}.cs | 1 + src/ImageSharp/Quantizers/Quantizer{TPixel}.cs | 2 +- src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs | 1 + .../Bulk/PackFromVector4ReferenceVsPointer.cs | 11 ++++++----- .../Color/Bulk/PackFromXyzw.cs | 2 +- .../Color/Bulk/ToVector4.cs | 4 +++- tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs | 2 +- tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs | 3 +-- .../ImageSharp.Benchmarks/Color/ColorEquality.cs | 5 +++-- .../ImageSharp.Benchmarks/Drawing/DrawBeziers.cs | 5 +++-- tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs | 5 +++-- .../ImageSharp.Benchmarks/Drawing/DrawPolygon.cs | 5 +++-- .../ImageSharp.Benchmarks/Drawing/FillPolygon.cs | 7 ++++--- .../Drawing/FillRectangle.cs | 7 ++++--- .../Drawing/FillWithPattern.cs | 6 ++++-- .../ImageSharp.Benchmarks/General/ClearBuffer.cs | 4 ++-- tests/ImageSharp.Benchmarks/Image/CopyPixels.cs | 9 +++++---- .../Image/EncodeIndexedPng.cs | 1 + tests/ImageSharp.Benchmarks/Image/EncodePng.cs | 9 +++++---- tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs | 9 +++++---- tests/ImageSharp.Benchmarks/Samplers/Resize.cs | 8 +++++--- .../Colors/BulkPixelOperationsTests.cs | 16 +++++++++------- .../Colors/ColorConstructorTests.cs | 3 +++ .../Colors/ColorConversionTests.cs | 1 + .../Colors/ColorDefinitionTests.cs | 2 ++ .../Colors/ColorEqualityTests.cs | 2 ++ .../ImageSharp.Tests/Colors/ColorPackingTests.cs | 3 +++ tests/ImageSharp.Tests/Colors/ColorTests.cs | 2 ++ .../Colors/ColorTransformTests.cs | 2 ++ .../ImageSharp.Tests/Colors/ColorVectorTests.cs | 2 ++ .../Colors/ColorVectorTransformTests.cs | 1 + .../ImageSharp.Tests/Colors/PackedPixelTests.cs | 2 ++ .../Colors/UnPackedPixelTests.cs | 2 ++ tests/ImageSharp.Tests/Common/BufferSpanTests.cs | 2 ++ .../Common/PixelDataPoolTests.cs | 2 ++ tests/ImageSharp.Tests/Drawing/BeziersTests.cs | 3 +++ tests/ImageSharp.Tests/Drawing/DrawPathTests.cs | 6 ++---- .../ImageSharp.Tests/Drawing/FillPatternTests.cs | 2 +- .../Drawing/FillRegionProcessorTests.cs | 11 ++--------- .../Drawing/FillSolidBrushTests.cs | 3 +++ .../Drawing/LineComplexPolygonTests.cs | 1 + tests/ImageSharp.Tests/Drawing/LineTests.cs | 3 +++ .../Drawing/Paths/DrawBeziersTests.cs | 7 +++---- .../Drawing/Paths/DrawLinesTests.cs | 6 ++---- tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs | 7 +++---- .../Drawing/Paths/DrawPolygon.cs | 7 +++---- .../Drawing/Paths/DrawRectangle.cs | 6 +----- tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs | 5 +---- .../Drawing/Paths/FillPolygon.cs | 5 +---- .../Drawing/Paths/FillRectangle.cs | 10 +++------- .../Drawing/Paths/ProcessorWatchingImage.cs | 4 ++-- tests/ImageSharp.Tests/Drawing/PolygonTests.cs | 2 ++ .../ImageSharp.Tests/Drawing/RecolorImageTest.cs | 2 ++ .../ImageSharp.Tests/Drawing/SolidBezierTests.cs | 2 ++ .../Drawing/SolidComplexPolygonTests.cs | 2 ++ .../Drawing/SolidPolygonTests.cs | 2 ++ tests/ImageSharp.Tests/Drawing/Text/DrawText.cs | 1 + .../ImageSharp.Tests/Drawing/Text/OutputText.cs | 2 ++ .../Formats/Jpg/BadEofJpegTests.cs | 1 + .../Formats/Jpg/JpegDecoderTests.cs | 1 + .../Formats/Jpg/JpegEncoderTests.cs | 1 + .../Formats/Jpg/JpegProfilingBenchmarks.cs | 1 + .../Formats/Jpg/JpegUtilsTests.cs | 1 + .../Formats/Png/PngEncoderTests.cs | 2 ++ .../Formats/Png/PngSmokeTests.cs | 2 ++ tests/ImageSharp.Tests/Image/ImageLoadTests.cs | 3 ++- tests/ImageSharp.Tests/Image/ImageSaveTests.cs | 2 ++ .../ImageSharp.Tests/Image/PixelAccessorTests.cs | 2 ++ tests/ImageSharp.Tests/ImageComparer.cs | 2 ++ .../MetaData/Profiles/Exif/ExifProfileTests.cs | 3 +++ .../Processors/Filters/BackgroundColorTest.cs | 2 ++ .../Processors/Filters/GlowTest.cs | 2 ++ .../Processors/Filters/GrayscaleTest.cs | 2 ++ .../Filters/ResizeProfilingBenchmarks.cs | 1 + .../Processors/Filters/VignetteTest.cs | 2 ++ tests/ImageSharp.Tests/TestFormat.cs | 2 ++ .../TestUtilities/Factories/GenericFactory.cs | 2 ++ .../TestUtilities/Factories/ImageFactory.cs | 2 ++ .../ImageProviders/BlankProvider.cs | 3 +++ .../TestUtilities/ImageProviders/FileProvider.cs | 3 +++ .../ImageProviders/LambdaProvider.cs | 2 ++ .../ImageProviders/SolidProvider.cs | 3 +++ .../ImageProviders/TestImageProvider.cs | 3 +++ .../ImageProviders/TestPatternProvider.cs | 3 +++ .../TestUtilities/ImagingTestCaseUtility.cs | 1 + .../TestUtilities/TestImageExtensions.cs | 2 ++ .../TestUtilities/TestUtilityExtensions.cs | 2 ++ .../Tests/TestImageProviderTests.cs | 2 ++ .../Tests/TestUtilityExtensionsTests.cs | 4 +++- 313 files changed, 563 insertions(+), 193 deletions(-) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Alpha8.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Argb32.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Bgr565.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Bgra4444.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Bgra5551.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/BulkPixelOperations{TPixel}.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Byte4.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/ColorBuilder{TPixel}.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/ColorConstants.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/ComponentOrder.cs (96%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/HalfSingle.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/HalfTypeHelper.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/HalfVector2.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/HalfVector4.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/IPackedVector{TPacked}.cs (94%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/IPixel.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/NamedColors{TPixel}.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/NormalizedByte2.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/NormalizedByte4.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/NormalizedShort2.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/NormalizedShort4.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/PackedPixelConverterHelper.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/README.md (100%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Rg32.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Rgba1010102.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/Rgba32.BulkOperations.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/Rgba32.ColorspaceTransforms.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/Rgba32.Definitions.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/Rgba32.Transforms.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/Rgba32.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Rgba64.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/RgbaComponent.cs (100%) rename src/ImageSharp/{Colors => PixelFormats}/RgbaVector.BulkOperations.cs (97%) rename src/ImageSharp/{Colors => PixelFormats}/RgbaVector.Definitions.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/RgbaVector.Transforms.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/RgbaVector.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Short2.cs (99%) rename src/ImageSharp/{Colors/PackedPixel => PixelFormats}/Short4.cs (99%) rename src/ImageSharp/{Colors => PixelFormats}/Vector4BlendTransforms.cs (99%) diff --git a/src/ImageSharp.Drawing/Brushes/Brushes.cs b/src/ImageSharp.Drawing/Brushes/Brushes.cs index d7b10c32a..8998c60f6 100644 --- a/src/ImageSharp.Drawing/Brushes/Brushes.cs +++ b/src/ImageSharp.Drawing/Brushes/Brushes.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Brushes { + using ImageSharp.PixelFormats; + /// /// A collection of methods for creating brushes. Brushes use for painting. /// diff --git a/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs index d56e9e6eb..4b2f6c026 100644 --- a/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/Brushes{TPixel}.cs @@ -5,7 +5,7 @@ namespace ImageSharp.Drawing.Brushes { - using System; + using ImageSharp.PixelFormats; /// /// A collection of methods for creating generic brushes. diff --git a/src/ImageSharp.Drawing/Brushes/IBrush.cs b/src/ImageSharp.Drawing/Brushes/IBrush.cs index a19c55169..e16f22028 100644 --- a/src/ImageSharp.Drawing/Brushes/IBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/IBrush.cs @@ -5,8 +5,7 @@ namespace ImageSharp.Drawing { - using System; - + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs index 84004a48d..6a3ff1d9d 100644 --- a/src/ImageSharp.Drawing/Brushes/ImageBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/ImageBrush.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Brushes { + using ImageSharp.PixelFormats; + /// /// Provides an implementation of a solid brush for painting with repeating images. The brush uses for painting. /// diff --git a/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs index e7ae27b60..3e2da040f 100644 --- a/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/ImageBrush{TPixel}.cs @@ -6,7 +6,7 @@ namespace ImageSharp.Drawing.Brushes { using System.Numerics; - + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs index 8884d1e02..f00862fe7 100644 --- a/src/ImageSharp.Drawing/Brushes/PatternBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/PatternBrush.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Brushes { + using ImageSharp.PixelFormats; + /// /// Provides an implementation of a pattern brush for painting patterns. The brush use for painting. /// diff --git a/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs index 4f3240247..ad37f4d28 100644 --- a/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/PatternBrush{TPixel}.cs @@ -7,7 +7,7 @@ namespace ImageSharp.Drawing.Brushes { using System; using System.Numerics; - + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs index 0116a13ae..5dd6dad76 100644 --- a/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs +++ b/src/ImageSharp.Drawing/Brushes/Processors/BrushApplicator.cs @@ -7,7 +7,7 @@ namespace ImageSharp.Drawing.Processors { using System; using System.Numerics; - using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; /// /// primitive that converts a point in to a color for discovering the fill color based on an implementation diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs index 3041d0edf..bfe5c01e6 100644 --- a/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Brushes { + using ImageSharp.PixelFormats; + /// /// Provides an implementation of a recolor brush for painting color changes. /// diff --git a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs index aa1b5cb82..7c192b2d3 100644 --- a/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/RecolorBrush{TPixel}.cs @@ -5,9 +5,8 @@ namespace ImageSharp.Drawing.Brushes { - using System; using System.Numerics; - + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs index 7c65d782a..8a3ad50e7 100644 --- a/src/ImageSharp.Drawing/Brushes/SolidBrush.cs +++ b/src/ImageSharp.Drawing/Brushes/SolidBrush.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Brushes { + using ImageSharp.PixelFormats; + /// /// Provides an implementation of a solid brush for painting solid color areas. The brush uses for painting. /// diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs index 4d9b6adb3..634a2b70d 100644 --- a/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs @@ -5,9 +5,8 @@ namespace ImageSharp.Drawing.Brushes { - using System; using System.Numerics; - + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/DrawImage.cs b/src/ImageSharp.Drawing/DrawImage.cs index 7f4fb3392..6a4f49337 100644 --- a/src/ImageSharp.Drawing/DrawImage.cs +++ b/src/ImageSharp.Drawing/DrawImage.cs @@ -5,9 +5,8 @@ namespace ImageSharp { - using System; - using Drawing.Processors; + using ImageSharp.PixelFormats; /// /// Extension methods for the type. diff --git a/src/ImageSharp.Drawing/DrawPath.cs b/src/ImageSharp.Drawing/DrawPath.cs index 64f69c4db..09d3dbb02 100644 --- a/src/ImageSharp.Drawing/DrawPath.cs +++ b/src/ImageSharp.Drawing/DrawPath.cs @@ -5,12 +5,11 @@ namespace ImageSharp { - using System; - using Drawing; using Drawing.Brushes; using Drawing.Pens; using Drawing.Processors; + using ImageSharp.PixelFormats; /// /// Extension methods for the type. diff --git a/src/ImageSharp.Drawing/FillRegion.cs b/src/ImageSharp.Drawing/FillRegion.cs index fda5c2c26..f29c37a67 100644 --- a/src/ImageSharp.Drawing/FillRegion.cs +++ b/src/ImageSharp.Drawing/FillRegion.cs @@ -5,11 +5,10 @@ namespace ImageSharp { - using System; - using Drawing; using Drawing.Brushes; using Drawing.Processors; + using ImageSharp.PixelFormats; /// /// Extension methods for the type. diff --git a/src/ImageSharp.Drawing/Paths/DrawBeziers.cs b/src/ImageSharp.Drawing/Paths/DrawBeziers.cs index af96ef50e..c4ea8c378 100644 --- a/src/ImageSharp.Drawing/Paths/DrawBeziers.cs +++ b/src/ImageSharp.Drawing/Paths/DrawBeziers.cs @@ -5,12 +5,11 @@ namespace ImageSharp { - using System; using System.Numerics; using Drawing; using Drawing.Brushes; using Drawing.Pens; - + using ImageSharp.PixelFormats; using SixLabors.Shapes; /// diff --git a/src/ImageSharp.Drawing/Paths/DrawLines.cs b/src/ImageSharp.Drawing/Paths/DrawLines.cs index c0c49a77a..e8c463638 100644 --- a/src/ImageSharp.Drawing/Paths/DrawLines.cs +++ b/src/ImageSharp.Drawing/Paths/DrawLines.cs @@ -5,12 +5,11 @@ namespace ImageSharp { - using System; using System.Numerics; using Drawing; using Drawing.Brushes; using Drawing.Pens; - + using ImageSharp.PixelFormats; using SixLabors.Shapes; /// diff --git a/src/ImageSharp.Drawing/Paths/DrawPath.cs b/src/ImageSharp.Drawing/Paths/DrawPath.cs index f25c15336..176539663 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPath.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPath.cs @@ -5,12 +5,10 @@ namespace ImageSharp { - using System; - using Drawing; using Drawing.Brushes; using Drawing.Pens; - + using ImageSharp.PixelFormats; using SixLabors.Shapes; /// diff --git a/src/ImageSharp.Drawing/Paths/DrawPolygon.cs b/src/ImageSharp.Drawing/Paths/DrawPolygon.cs index 5f62759ce..4b99e60c0 100644 --- a/src/ImageSharp.Drawing/Paths/DrawPolygon.cs +++ b/src/ImageSharp.Drawing/Paths/DrawPolygon.cs @@ -5,12 +5,11 @@ namespace ImageSharp { - using System; using System.Numerics; using Drawing; using Drawing.Brushes; using Drawing.Pens; - + using ImageSharp.PixelFormats; using SixLabors.Shapes; /// diff --git a/src/ImageSharp.Drawing/Paths/DrawRectangle.cs b/src/ImageSharp.Drawing/Paths/DrawRectangle.cs index 5514217ff..0fefc6cab 100644 --- a/src/ImageSharp.Drawing/Paths/DrawRectangle.cs +++ b/src/ImageSharp.Drawing/Paths/DrawRectangle.cs @@ -5,11 +5,10 @@ namespace ImageSharp { - using System; - using Drawing; using Drawing.Brushes; using Drawing.Pens; + using ImageSharp.PixelFormats; /// /// Extension methods for the type. diff --git a/src/ImageSharp.Drawing/Paths/FillPaths.cs b/src/ImageSharp.Drawing/Paths/FillPaths.cs index b4d0b14cb..f579c4ad0 100644 --- a/src/ImageSharp.Drawing/Paths/FillPaths.cs +++ b/src/ImageSharp.Drawing/Paths/FillPaths.cs @@ -5,11 +5,9 @@ namespace ImageSharp { - using System; - using Drawing; using Drawing.Brushes; - + using ImageSharp.PixelFormats; using SixLabors.Shapes; /// diff --git a/src/ImageSharp.Drawing/Paths/FillPolygon.cs b/src/ImageSharp.Drawing/Paths/FillPolygon.cs index dfc56c5d2..3360cff13 100644 --- a/src/ImageSharp.Drawing/Paths/FillPolygon.cs +++ b/src/ImageSharp.Drawing/Paths/FillPolygon.cs @@ -9,7 +9,7 @@ namespace ImageSharp using System.Numerics; using Drawing; using Drawing.Brushes; - + using ImageSharp.PixelFormats; using SixLabors.Shapes; /// diff --git a/src/ImageSharp.Drawing/Paths/FillRectangle.cs b/src/ImageSharp.Drawing/Paths/FillRectangle.cs index b20cb8971..07ff4c69c 100644 --- a/src/ImageSharp.Drawing/Paths/FillRectangle.cs +++ b/src/ImageSharp.Drawing/Paths/FillRectangle.cs @@ -5,10 +5,9 @@ namespace ImageSharp { - using System; - using Drawing; using Drawing.Brushes; + using ImageSharp.PixelFormats; /// /// Extension methods for the type. diff --git a/src/ImageSharp.Drawing/Pens/IPen.cs b/src/ImageSharp.Drawing/Pens/IPen.cs index 573a126de..31a609c8e 100644 --- a/src/ImageSharp.Drawing/Pens/IPen.cs +++ b/src/ImageSharp.Drawing/Pens/IPen.cs @@ -5,7 +5,7 @@ namespace ImageSharp.Drawing.Pens { - using System; + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/Pens/Pen.cs b/src/ImageSharp.Drawing/Pens/Pen.cs index c3a530964..a3cc3cbdf 100644 --- a/src/ImageSharp.Drawing/Pens/Pen.cs +++ b/src/ImageSharp.Drawing/Pens/Pen.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Pens { + using ImageSharp.PixelFormats; + /// /// Represents a in the color space. /// diff --git a/src/ImageSharp.Drawing/Pens/Pens.cs b/src/ImageSharp.Drawing/Pens/Pens.cs index 532774f22..5c91df226 100644 --- a/src/ImageSharp.Drawing/Pens/Pens.cs +++ b/src/ImageSharp.Drawing/Pens/Pens.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Pens { + using ImageSharp.PixelFormats; + /// /// Common Pen styles /// diff --git a/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs b/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs index 096262f44..5eb78dc44 100644 --- a/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs +++ b/src/ImageSharp.Drawing/Pens/Pens{TPixel}.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Drawing.Pens { + using ImageSharp.PixelFormats; + /// /// Common Pen styles /// diff --git a/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs b/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs index 05af44ca3..f49d03cbc 100644 --- a/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs +++ b/src/ImageSharp.Drawing/Pens/Pen{TPixel}.cs @@ -5,10 +5,10 @@ namespace ImageSharp.Drawing.Pens { - using System; using System.Numerics; using ImageSharp.Drawing.Brushes; + using ImageSharp.PixelFormats; using Processors; /// diff --git a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs index edee5bb19..65a8a6131 100644 --- a/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs +++ b/src/ImageSharp.Drawing/Pens/Processors/ColoredPointInfo.cs @@ -5,7 +5,7 @@ namespace ImageSharp.Drawing.Processors { - using System; + using ImageSharp.PixelFormats; /// /// Returns details about how far away from the inside of a shape and the color the pixel could be. diff --git a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs index 7e9671cac..ac1889068 100644 --- a/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs +++ b/src/ImageSharp.Drawing/Pens/Processors/PenApplicator.cs @@ -6,7 +6,7 @@ namespace ImageSharp.Drawing.Processors { using System; - using System.Numerics; + using ImageSharp.PixelFormats; /// /// primitive that converts a into a color and a distance away from the drawable part of the path. diff --git a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs index 9bb452f19..e2a9ef024 100644 --- a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Drawing.Processors using System; using System.Numerics; using System.Threading.Tasks; - + using ImageSharp.PixelFormats; using ImageSharp.Processing; /// diff --git a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs index 32e44bce9..62e366d2a 100644 --- a/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawPathProcessor.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Drawing.Processors using System; using System.Numerics; using System.Threading.Tasks; - + using ImageSharp.PixelFormats; using ImageSharp.Processing; using Pens; diff --git a/src/ImageSharp.Drawing/Processors/FillProcessor.cs b/src/ImageSharp.Drawing/Processors/FillProcessor.cs index d0ad0cc1d..ca2dc9982 100644 --- a/src/ImageSharp.Drawing/Processors/FillProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillProcessor.cs @@ -10,6 +10,7 @@ namespace ImageSharp.Drawing.Processors using System.Threading.Tasks; using Drawing; + using ImageSharp.PixelFormats; using ImageSharp.Processing; /// diff --git a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs index 88830f094..af1e6fa89 100644 --- a/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillRegionProcessor.cs @@ -7,9 +7,8 @@ namespace ImageSharp.Drawing.Processors { using System; using System.Buffers; - using System.Numerics; - using System.Threading.Tasks; using Drawing; + using ImageSharp.PixelFormats; using ImageSharp.Processing; /// diff --git a/src/ImageSharp.Drawing/Text/DrawText.cs b/src/ImageSharp.Drawing/Text/DrawText.cs index 93486e2bb..876d17aca 100644 --- a/src/ImageSharp.Drawing/Text/DrawText.cs +++ b/src/ImageSharp.Drawing/Text/DrawText.cs @@ -10,7 +10,7 @@ namespace ImageSharp using Drawing; using Drawing.Brushes; using Drawing.Pens; - + using ImageSharp.PixelFormats; using SixLabors.Fonts; /// diff --git a/src/ImageSharp/Colors/Spaces/Bgra32.cs b/src/ImageSharp/Colors/Spaces/Bgra32.cs index e498bd792..b1f72033d 100644 --- a/src/ImageSharp/Colors/Spaces/Bgra32.cs +++ b/src/ImageSharp/Colors/Spaces/Bgra32.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents an BGRA (blue, green, red, alpha) color. diff --git a/src/ImageSharp/Colors/Spaces/CieLab.cs b/src/ImageSharp/Colors/Spaces/CieLab.cs index dda211a2c..c1e5cba5a 100644 --- a/src/ImageSharp/Colors/Spaces/CieLab.cs +++ b/src/ImageSharp/Colors/Spaces/CieLab.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents an CIE LAB 1976 color. diff --git a/src/ImageSharp/Colors/Spaces/CieXyz.cs b/src/ImageSharp/Colors/Spaces/CieXyz.cs index 6b73d82f9..9c6c9bf60 100644 --- a/src/ImageSharp/Colors/Spaces/CieXyz.cs +++ b/src/ImageSharp/Colors/Spaces/CieXyz.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents an CIE 1931 color diff --git a/src/ImageSharp/Colors/Spaces/Cmyk.cs b/src/ImageSharp/Colors/Spaces/Cmyk.cs index 1d6e83142..4ca9f018c 100644 --- a/src/ImageSharp/Colors/Spaces/Cmyk.cs +++ b/src/ImageSharp/Colors/Spaces/Cmyk.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents an CMYK (cyan, magenta, yellow, keyline) color. diff --git a/src/ImageSharp/Colors/Spaces/Hsl.cs b/src/ImageSharp/Colors/Spaces/Hsl.cs index 220234537..de706c350 100644 --- a/src/ImageSharp/Colors/Spaces/Hsl.cs +++ b/src/ImageSharp/Colors/Spaces/Hsl.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents a Hsl (hue, saturation, lightness) color. diff --git a/src/ImageSharp/Colors/Spaces/Hsv.cs b/src/ImageSharp/Colors/Spaces/Hsv.cs index 1b9aa4777..2b3d79afe 100644 --- a/src/ImageSharp/Colors/Spaces/Hsv.cs +++ b/src/ImageSharp/Colors/Spaces/Hsv.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents a HSV (hue, saturation, value) color. Also known as HSB (hue, saturation, brightness). diff --git a/src/ImageSharp/Colors/Spaces/YCbCr.cs b/src/ImageSharp/Colors/Spaces/YCbCr.cs index f483c0827..06696af9e 100644 --- a/src/ImageSharp/Colors/Spaces/YCbCr.cs +++ b/src/ImageSharp/Colors/Spaces/YCbCr.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Colors.Spaces using System; using System.ComponentModel; using System.Numerics; + using ImageSharp.PixelFormats; /// /// Represents an YCbCr (luminance, blue chroma, red chroma) color conforming to the full range standard used in digital imaging systems. diff --git a/src/ImageSharp/Common/Extensions/Vector4Extensions.cs b/src/ImageSharp/Common/Extensions/Vector4Extensions.cs index d9e30e654..31f3f32ae 100644 --- a/src/ImageSharp/Common/Extensions/Vector4Extensions.cs +++ b/src/ImageSharp/Common/Extensions/Vector4Extensions.cs @@ -8,6 +8,7 @@ namespace ImageSharp using System; using System.Numerics; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; /// /// Extension methods for the struct. diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs index 6583fb724..cf0ac5c29 100644 --- a/src/ImageSharp/Common/Helpers/ImageMaths.cs +++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs @@ -10,6 +10,8 @@ namespace ImageSharp using System.Numerics; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; + /// /// Provides common mathematical methods. /// diff --git a/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs b/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs index 8bb446535..0ec367d24 100644 --- a/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs +++ b/src/ImageSharp/Common/Memory/PixelDataPool{T}.cs @@ -8,6 +8,8 @@ namespace ImageSharp using System; using System.Buffers; + using ImageSharp.PixelFormats; + /// /// Provides a resource pool that enables reusing instances of value type arrays for image data . /// diff --git a/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs b/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs index af78c8f86..5d0ecde6b 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs +++ b/src/ImageSharp/Dithering/ErrorDiffusion/ErrorDiffuser.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Dithering using System.Numerics; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; + /// /// The base class for performing error diffusion based dithering. /// diff --git a/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs b/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs index f7a13984a..f49e7e62d 100644 --- a/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs +++ b/src/ImageSharp/Dithering/ErrorDiffusion/IErrorDiffuser.cs @@ -5,7 +5,7 @@ namespace ImageSharp.Dithering { - using System; + using ImageSharp.PixelFormats; /// /// Encapsulates properties and methods required to perfom diffused error dithering on an image. diff --git a/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs b/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs index 0762f61a7..3f7cf4988 100644 --- a/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs +++ b/src/ImageSharp/Dithering/Ordered/IOrderedDither.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Dithering { + using ImageSharp.PixelFormats; + /// /// Encapsulates properties and methods required to perfom ordered dithering on an image. /// diff --git a/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs b/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs index ce0ae1d97..917f57318 100644 --- a/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs +++ b/src/ImageSharp/Dithering/Ordered/OrderedDither4x4.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Dithering.Ordered { + using ImageSharp.PixelFormats; + /// /// The base class for performing ordered ditheroing using a 4x4 matrix. /// diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs index 94f045efa..9090e9a8c 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Image decoder for generating an image out of a Windows bitmap stream. /// diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 9f15bf0b2..a9aac5efa 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Performs the bmp decoding operation. /// diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoder.cs b/src/ImageSharp/Formats/Bmp/BmpEncoder.cs index deca6cf2c..dc2bc0e97 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoder.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Image encoder for writing an image to a stream as a Windows bitmap. /// diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs index 634b3a784..617edde8e 100644 --- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + using IO; /// diff --git a/src/ImageSharp/Formats/Bmp/ImageExtensions.cs b/src/ImageSharp/Formats/Bmp/ImageExtensions.cs index 14d657c32..aba24f999 100644 --- a/src/ImageSharp/Formats/Bmp/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Bmp/ImageExtensions.cs @@ -10,6 +10,8 @@ namespace ImageSharp using Formats; + using ImageSharp.PixelFormats; + /// /// Extension methods for the type. /// diff --git a/src/ImageSharp/Formats/Gif/GifDecoder.cs b/src/ImageSharp/Formats/Gif/GifDecoder.cs index 4ba06efe8..88aaccf6a 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoder.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Decoder for generating an image out of a gif encoded stream. /// diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index 1ee2d152a..93d0bcaf1 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -10,6 +10,8 @@ namespace ImageSharp.Formats using System.IO; using System.Text; + using ImageSharp.PixelFormats; + /// /// Performs the gif decoding operation. /// diff --git a/src/ImageSharp/Formats/Gif/GifEncoder.cs b/src/ImageSharp/Formats/Gif/GifEncoder.cs index 005ec1ee2..b5cadd834 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoder.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Image encoder for writing image data to a stream in gif format. /// diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index dec0dc411..82f32323e 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -10,6 +10,8 @@ namespace ImageSharp.Formats using System.IO; using System.Linq; + using ImageSharp.PixelFormats; + using IO; using Quantizers; diff --git a/src/ImageSharp/Formats/Gif/ImageExtensions.cs b/src/ImageSharp/Formats/Gif/ImageExtensions.cs index 523086ded..d64203f6c 100644 --- a/src/ImageSharp/Formats/Gif/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Gif/ImageExtensions.cs @@ -10,6 +10,8 @@ namespace ImageSharp using Formats; + using ImageSharp.PixelFormats; + /// /// Extension methods for the type. /// diff --git a/src/ImageSharp/Formats/IImageDecoder.cs b/src/ImageSharp/Formats/IImageDecoder.cs index 2f71108a7..4fd25df13 100644 --- a/src/ImageSharp/Formats/IImageDecoder.cs +++ b/src/ImageSharp/Formats/IImageDecoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Encapsulates properties and methods required for decoding an image from a stream. /// diff --git a/src/ImageSharp/Formats/IImageEncoder.cs b/src/ImageSharp/Formats/IImageEncoder.cs index 222fb6ed6..a28511c17 100644 --- a/src/ImageSharp/Formats/IImageEncoder.cs +++ b/src/ImageSharp/Formats/IImageEncoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Encapsulates properties and methods required for encoding an image to a stream. /// diff --git a/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs b/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs index e52d43625..420af6b74 100644 --- a/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Jpeg/ImageExtensions.cs @@ -10,6 +10,8 @@ namespace ImageSharp using Formats; + using ImageSharp.PixelFormats; + /// /// Extension methods for the type. /// diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs index 97593a0a3..56d025504 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Image decoder for generating an image out of a jpg stream. /// diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs index ccc6b91bb..186c1e528 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs @@ -11,6 +11,7 @@ namespace ImageSharp.Formats using System.Threading.Tasks; using ImageSharp.Formats.Jpg; + using ImageSharp.PixelFormats; /// /// Performs the jpeg decoding operation. diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs index dd467462b..152fd2c64 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoder.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Formats { using System.IO; + using ImageSharp.PixelFormats; + /// /// Encoder for writing the data image to a stream in jpeg format. /// diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs index e29b5474b..eb083c35d 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs @@ -12,6 +12,7 @@ namespace ImageSharp.Formats using ImageSharp.Formats.Jpg; using ImageSharp.Formats.Jpg.Components; + using ImageSharp.PixelFormats; /// /// Image encoder for writing an image to a stream as a jpeg. diff --git a/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs b/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs index 73918c060..afb8e0700 100644 --- a/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs +++ b/src/ImageSharp/Formats/Jpeg/Utils/JpegUtils.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats.Jpg using System.Runtime.CompilerServices; using System.Runtime.InteropServices; + using ImageSharp.PixelFormats; + /// /// Jpeg specific utilities and extension methods /// diff --git a/src/ImageSharp/Formats/Png/ImageExtensions.cs b/src/ImageSharp/Formats/Png/ImageExtensions.cs index 277a3397e..44f242b3f 100644 --- a/src/ImageSharp/Formats/Png/ImageExtensions.cs +++ b/src/ImageSharp/Formats/Png/ImageExtensions.cs @@ -9,6 +9,8 @@ namespace ImageSharp using Formats; + using ImageSharp.PixelFormats; + /// /// Extension methods for the type. /// diff --git a/src/ImageSharp/Formats/Png/PngDecoder.cs b/src/ImageSharp/Formats/Png/PngDecoder.cs index 8dd9168f4..3a34147e2 100644 --- a/src/ImageSharp/Formats/Png/PngDecoder.cs +++ b/src/ImageSharp/Formats/Png/PngDecoder.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Formats using System; using System.IO; + using ImageSharp.PixelFormats; + /// /// Encoder for generating an image out of a png encoded stream. /// diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index d64978385..58cfa6a70 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -12,6 +12,8 @@ namespace ImageSharp.Formats using System.Linq; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; + using static ComparableExtensions; /// diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs index a74916f2f..e7b6bf30e 100644 --- a/src/ImageSharp/Formats/Png/PngEncoder.cs +++ b/src/ImageSharp/Formats/Png/PngEncoder.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Formats { using System.IO; + using ImageSharp.PixelFormats; + /// /// Image encoder for writing image data to a stream in png format. /// diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index e17902b5a..e30f9791e 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -10,6 +10,8 @@ namespace ImageSharp.Formats using System.IO; using System.Linq; + using ImageSharp.PixelFormats; + using Quantizers; using static ComparableExtensions; diff --git a/src/ImageSharp/Image.Create.cs b/src/ImageSharp/Image.Create.cs index 5fcb2fa21..3d92cd66b 100644 --- a/src/ImageSharp/Image.Create.cs +++ b/src/ImageSharp/Image.Create.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using ImageSharp.PixelFormats; + /// /// 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. diff --git a/src/ImageSharp/Image.Decode.cs b/src/ImageSharp/Image.Decode.cs index 5e060ab6b..b0e476280 100644 --- a/src/ImageSharp/Image.Decode.cs +++ b/src/ImageSharp/Image.Decode.cs @@ -10,6 +10,8 @@ namespace ImageSharp using System.Linq; using Formats; + using ImageSharp.PixelFormats; + /// /// 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. diff --git a/src/ImageSharp/Image.FromBytes.cs b/src/ImageSharp/Image.FromBytes.cs index b2f39aae6..540eb6016 100644 --- a/src/ImageSharp/Image.FromBytes.cs +++ b/src/ImageSharp/Image.FromBytes.cs @@ -9,6 +9,8 @@ namespace ImageSharp using System.IO; using Formats; + using ImageSharp.PixelFormats; + /// /// 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. diff --git a/src/ImageSharp/Image.FromFile.cs b/src/ImageSharp/Image.FromFile.cs index b21307aba..8f4c9138b 100644 --- a/src/ImageSharp/Image.FromFile.cs +++ b/src/ImageSharp/Image.FromFile.cs @@ -9,6 +9,7 @@ namespace ImageSharp using System; using System.IO; using Formats; + using ImageSharp.PixelFormats; /// /// Represents an image. Each pixel is a made up four 8-bit components red, green, blue, and alpha diff --git a/src/ImageSharp/Image.FromStream.cs b/src/ImageSharp/Image.FromStream.cs index 8fb1fac4e..a34c6b7b3 100644 --- a/src/ImageSharp/Image.FromStream.cs +++ b/src/ImageSharp/Image.FromStream.cs @@ -7,9 +7,12 @@ namespace ImageSharp { using System; using System.IO; + using System.Numerics; using System.Text; using Formats; + using ImageSharp.PixelFormats; + /// /// 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. diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs index 2562246a9..3d33e6263 100644 --- a/src/ImageSharp/Image.cs +++ b/src/ImageSharp/Image.cs @@ -6,6 +6,7 @@ namespace ImageSharp { using System.Diagnostics; + using ImageSharp.PixelFormats; /// /// Represents an image. Each pixel is a made up four 8-bit components red, green, blue, and alpha diff --git a/src/ImageSharp/Image/IImageBase{TPixel}.cs b/src/ImageSharp/Image/IImageBase{TPixel}.cs index d95e52337..08d25709b 100644 --- a/src/ImageSharp/Image/IImageBase{TPixel}.cs +++ b/src/ImageSharp/Image/IImageBase{TPixel}.cs @@ -6,6 +6,7 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; /// /// Encapsulates the basic properties and methods required to manipulate images in varying formats. diff --git a/src/ImageSharp/Image/IImageProcessor.cs b/src/ImageSharp/Image/IImageProcessor.cs index cf442cd6c..c4fa9afa2 100644 --- a/src/ImageSharp/Image/IImageProcessor.cs +++ b/src/ImageSharp/Image/IImageProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing using System; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Encapsulates methods to alter the pixels of an image. /// diff --git a/src/ImageSharp/Image/ImageBase{TPixel}.cs b/src/ImageSharp/Image/ImageBase{TPixel}.cs index b55b88f60..7bad03cc8 100644 --- a/src/ImageSharp/Image/ImageBase{TPixel}.cs +++ b/src/ImageSharp/Image/ImageBase{TPixel}.cs @@ -7,6 +7,7 @@ namespace ImageSharp { using System; using System.Diagnostics; + using ImageSharp.PixelFormats; using Processing; /// diff --git a/src/ImageSharp/Image/ImageFrame{TPixel}.cs b/src/ImageSharp/Image/ImageFrame{TPixel}.cs index e85177f59..e502950d0 100644 --- a/src/ImageSharp/Image/ImageFrame{TPixel}.cs +++ b/src/ImageSharp/Image/ImageFrame{TPixel}.cs @@ -8,6 +8,7 @@ namespace ImageSharp using System; using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; /// /// Represents a single frame in a animation. diff --git a/src/ImageSharp/Image/ImageProcessingExtensions.cs b/src/ImageSharp/Image/ImageProcessingExtensions.cs index 405cb48b4..c9577ac15 100644 --- a/src/ImageSharp/Image/ImageProcessingExtensions.cs +++ b/src/ImageSharp/Image/ImageProcessingExtensions.cs @@ -5,6 +5,8 @@ namespace ImageSharp { + using ImageSharp.PixelFormats; + using Processing; /// diff --git a/src/ImageSharp/Image/Image{TPixel}.cs b/src/ImageSharp/Image/Image{TPixel}.cs index 88fb04226..f49943b53 100644 --- a/src/ImageSharp/Image/Image{TPixel}.cs +++ b/src/ImageSharp/Image/Image{TPixel}.cs @@ -14,6 +14,7 @@ namespace ImageSharp using System.Threading.Tasks; using Formats; + using ImageSharp.PixelFormats; using Processing; /// diff --git a/src/ImageSharp/Image/PixelAccessor{TPixel}.cs b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs index f3f9546fd..3c6763886 100644 --- a/src/ImageSharp/Image/PixelAccessor{TPixel}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs @@ -9,6 +9,7 @@ namespace ImageSharp using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading.Tasks; + using ImageSharp.PixelFormats; /// /// Provides per-pixel access to generic pixels. diff --git a/src/ImageSharp/Image/PixelArea{TPixel}.cs b/src/ImageSharp/Image/PixelArea{TPixel}.cs index 936fc16b3..3dd187768 100644 --- a/src/ImageSharp/Image/PixelArea{TPixel}.cs +++ b/src/ImageSharp/Image/PixelArea{TPixel}.cs @@ -8,7 +8,7 @@ namespace ImageSharp using System; using System.Diagnostics; using System.IO; - using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; /// /// Represents an area of generic pixels. diff --git a/src/ImageSharp/ImageProcessor.cs b/src/ImageSharp/ImageProcessor.cs index fd577ed22..7b9f74547 100644 --- a/src/ImageSharp/ImageProcessor.cs +++ b/src/ImageSharp/ImageProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing using System; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Allows the application of processors to images. /// diff --git a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs index 89c0b9c5c..f65c02043 100644 --- a/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs +++ b/src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs @@ -10,6 +10,8 @@ namespace ImageSharp using System.Collections.ObjectModel; using System.IO; + using ImageSharp.PixelFormats; + /// /// Represents an EXIF profile providing access to the collection of values. /// diff --git a/src/ImageSharp/Colors/PackedPixel/Alpha8.cs b/src/ImageSharp/PixelFormats/Alpha8.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Alpha8.cs rename to src/ImageSharp/PixelFormats/Alpha8.cs index 9a340544c..a7b464b1a 100644 --- a/src/ImageSharp/Colors/PackedPixel/Alpha8.cs +++ b/src/ImageSharp/PixelFormats/Alpha8.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/Argb32.cs b/src/ImageSharp/PixelFormats/Argb32.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Argb32.cs rename to src/ImageSharp/PixelFormats/Argb32.cs index 64255a53b..3cad9e957 100644 --- a/src/ImageSharp/Colors/PackedPixel/Argb32.cs +++ b/src/ImageSharp/PixelFormats/Argb32.cs @@ -3,9 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { - using System; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/Bgr565.cs b/src/ImageSharp/PixelFormats/Bgr565.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Bgr565.cs rename to src/ImageSharp/PixelFormats/Bgr565.cs index 2975d4ad9..f99b55816 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgr565.cs +++ b/src/ImageSharp/PixelFormats/Bgr565.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs b/src/ImageSharp/PixelFormats/Bgra4444.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Bgra4444.cs rename to src/ImageSharp/PixelFormats/Bgra4444.cs index 1346a54ef..ea188e7c5 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgra4444.cs +++ b/src/ImageSharp/PixelFormats/Bgra4444.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs b/src/ImageSharp/PixelFormats/Bgra5551.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Bgra5551.cs rename to src/ImageSharp/PixelFormats/Bgra5551.cs index 7989804cf..8ae1cd430 100644 --- a/src/ImageSharp/Colors/PackedPixel/Bgra5551.cs +++ b/src/ImageSharp/PixelFormats/Bgra5551.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TPixel}.cs b/src/ImageSharp/PixelFormats/BulkPixelOperations{TPixel}.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TPixel}.cs rename to src/ImageSharp/PixelFormats/BulkPixelOperations{TPixel}.cs index d58e48ffd..9a3d266c1 100644 --- a/src/ImageSharp/Colors/PackedPixel/BulkPixelOperations{TPixel}.cs +++ b/src/ImageSharp/PixelFormats/BulkPixelOperations{TPixel}.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/Byte4.cs b/src/ImageSharp/PixelFormats/Byte4.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Byte4.cs rename to src/ImageSharp/PixelFormats/Byte4.cs index 11ec5eaf4..884f8331b 100644 --- a/src/ImageSharp/Colors/PackedPixel/Byte4.cs +++ b/src/ImageSharp/PixelFormats/Byte4.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/ColorBuilder{TPixel}.cs b/src/ImageSharp/PixelFormats/ColorBuilder{TPixel}.cs similarity index 99% rename from src/ImageSharp/Colors/ColorBuilder{TPixel}.cs rename to src/ImageSharp/PixelFormats/ColorBuilder{TPixel}.cs index 3021cb39e..4b21130c0 100644 --- a/src/ImageSharp/Colors/ColorBuilder{TPixel}.cs +++ b/src/ImageSharp/PixelFormats/ColorBuilder{TPixel}.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Globalization; diff --git a/src/ImageSharp/Colors/ColorConstants.cs b/src/ImageSharp/PixelFormats/ColorConstants.cs similarity index 99% rename from src/ImageSharp/Colors/ColorConstants.cs rename to src/ImageSharp/PixelFormats/ColorConstants.cs index 3dba721aa..236d3a889 100644 --- a/src/ImageSharp/Colors/ColorConstants.cs +++ b/src/ImageSharp/PixelFormats/ColorConstants.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Collections.Generic; diff --git a/src/ImageSharp/Colors/ComponentOrder.cs b/src/ImageSharp/PixelFormats/ComponentOrder.cs similarity index 96% rename from src/ImageSharp/Colors/ComponentOrder.cs rename to src/ImageSharp/PixelFormats/ComponentOrder.cs index c3e70b957..8f151b41d 100644 --- a/src/ImageSharp/Colors/ComponentOrder.cs +++ b/src/ImageSharp/PixelFormats/ComponentOrder.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { /// /// Enumerates the various component orders. diff --git a/src/ImageSharp/Colors/PackedPixel/HalfSingle.cs b/src/ImageSharp/PixelFormats/HalfSingle.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/HalfSingle.cs rename to src/ImageSharp/PixelFormats/HalfSingle.cs index 4c785a863..c9a27382a 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfSingle.cs +++ b/src/ImageSharp/PixelFormats/HalfSingle.cs @@ -3,9 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { - using System; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs b/src/ImageSharp/PixelFormats/HalfTypeHelper.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs rename to src/ImageSharp/PixelFormats/HalfTypeHelper.cs index a19b51323..740795adc 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs +++ b/src/ImageSharp/PixelFormats/HalfTypeHelper.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/ImageSharp/Colors/PackedPixel/HalfVector2.cs b/src/ImageSharp/PixelFormats/HalfVector2.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/HalfVector2.cs rename to src/ImageSharp/PixelFormats/HalfVector2.cs index d06ab6ba0..85feea582 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfVector2.cs +++ b/src/ImageSharp/PixelFormats/HalfVector2.cs @@ -3,9 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { - using System; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/HalfVector4.cs b/src/ImageSharp/PixelFormats/HalfVector4.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/HalfVector4.cs rename to src/ImageSharp/PixelFormats/HalfVector4.cs index a5fa796e1..ef844253b 100644 --- a/src/ImageSharp/Colors/PackedPixel/HalfVector4.cs +++ b/src/ImageSharp/PixelFormats/HalfVector4.cs @@ -3,9 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { - using System; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/IPackedVector{TPacked}.cs b/src/ImageSharp/PixelFormats/IPackedVector{TPacked}.cs similarity index 94% rename from src/ImageSharp/Colors/PackedPixel/IPackedVector{TPacked}.cs rename to src/ImageSharp/PixelFormats/IPackedVector{TPacked}.cs index 0450fb8fb..ec283e6f2 100644 --- a/src/ImageSharp/Colors/PackedPixel/IPackedVector{TPacked}.cs +++ b/src/ImageSharp/PixelFormats/IPackedVector{TPacked}.cs @@ -3,10 +3,9 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; - using System.Numerics; /// /// This interface exists for ensuring signature compatibility to MonoGame and XNA packed color types. diff --git a/src/ImageSharp/Colors/PackedPixel/IPixel.cs b/src/ImageSharp/PixelFormats/IPixel.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/IPixel.cs rename to src/ImageSharp/PixelFormats/IPixel.cs index 08f2eafb0..43fe81e95 100644 --- a/src/ImageSharp/Colors/PackedPixel/IPixel.cs +++ b/src/ImageSharp/PixelFormats/IPixel.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/NamedColors{TPixel}.cs b/src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs similarity index 99% rename from src/ImageSharp/Colors/NamedColors{TPixel}.cs rename to src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs index ee87dd00f..0b55dcbf9 100644 --- a/src/ImageSharp/Colors/NamedColors{TPixel}.cs +++ b/src/ImageSharp/PixelFormats/NamedColors{TPixel}.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { /// /// A set of named colors mapped to the provided color space. diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs b/src/ImageSharp/PixelFormats/NormalizedByte2.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs rename to src/ImageSharp/PixelFormats/NormalizedByte2.cs index 56be64a86..779b26a7a 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedByte2.cs +++ b/src/ImageSharp/PixelFormats/NormalizedByte2.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs b/src/ImageSharp/PixelFormats/NormalizedByte4.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs rename to src/ImageSharp/PixelFormats/NormalizedByte4.cs index a1f9b8d84..f7fe36cea 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedByte4.cs +++ b/src/ImageSharp/PixelFormats/NormalizedByte4.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs b/src/ImageSharp/PixelFormats/NormalizedShort2.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs rename to src/ImageSharp/PixelFormats/NormalizedShort2.cs index 46c24be6f..f0fba66e5 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedShort2.cs +++ b/src/ImageSharp/PixelFormats/NormalizedShort2.cs @@ -3,9 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { - using System; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs b/src/ImageSharp/PixelFormats/NormalizedShort4.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs rename to src/ImageSharp/PixelFormats/NormalizedShort4.cs index 74229a914..6701aab03 100644 --- a/src/ImageSharp/Colors/PackedPixel/NormalizedShort4.cs +++ b/src/ImageSharp/PixelFormats/NormalizedShort4.cs @@ -3,9 +3,8 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { - using System; using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs b/src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs rename to src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs index 16d73f785..29ef5675e 100644 --- a/src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs +++ b/src/ImageSharp/PixelFormats/PackedPixelConverterHelper.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/README.md b/src/ImageSharp/PixelFormats/README.md similarity index 100% rename from src/ImageSharp/Colors/PackedPixel/README.md rename to src/ImageSharp/PixelFormats/README.md diff --git a/src/ImageSharp/Colors/PackedPixel/Rg32.cs b/src/ImageSharp/PixelFormats/Rg32.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Rg32.cs rename to src/ImageSharp/PixelFormats/Rg32.cs index f8486f7f2..b0134d9b6 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rg32.cs +++ b/src/ImageSharp/PixelFormats/Rg32.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs b/src/ImageSharp/PixelFormats/Rgba1010102.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs rename to src/ImageSharp/PixelFormats/Rgba1010102.cs index 65a5e7a5f..f014dbb8d 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rgba1010102.cs +++ b/src/ImageSharp/PixelFormats/Rgba1010102.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/Rgba32.BulkOperations.cs b/src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs similarity index 99% rename from src/ImageSharp/Colors/Rgba32.BulkOperations.cs rename to src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs index e35de0ad5..42b37bebd 100644 --- a/src/ImageSharp/Colors/Rgba32.BulkOperations.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs b/src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs similarity index 99% rename from src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs rename to src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs index 0e5029920..f896eb69b 100644 --- a/src/ImageSharp/Colors/Rgba32.ColorspaceTransforms.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/Rgba32.Definitions.cs b/src/ImageSharp/PixelFormats/Rgba32.Definitions.cs similarity index 99% rename from src/ImageSharp/Colors/Rgba32.Definitions.cs rename to src/ImageSharp/PixelFormats/Rgba32.Definitions.cs index 28eb9fa0c..3ba5f6133 100644 --- a/src/ImageSharp/Colors/Rgba32.Definitions.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.Definitions.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { /// /// Packed vector type containing four 8-bit unsigned normalized values ranging from 0 to 255. diff --git a/src/ImageSharp/Colors/Rgba32.Transforms.cs b/src/ImageSharp/PixelFormats/Rgba32.Transforms.cs similarity index 99% rename from src/ImageSharp/Colors/Rgba32.Transforms.cs rename to src/ImageSharp/PixelFormats/Rgba32.Transforms.cs index 51c130a6c..86638b814 100644 --- a/src/ImageSharp/Colors/Rgba32.Transforms.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.Transforms.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/Rgba32.cs b/src/ImageSharp/PixelFormats/Rgba32.cs similarity index 99% rename from src/ImageSharp/Colors/Rgba32.cs rename to src/ImageSharp/PixelFormats/Rgba32.cs index f04fe2560..18759bce0 100644 --- a/src/ImageSharp/Colors/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/Rgba64.cs b/src/ImageSharp/PixelFormats/Rgba64.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Rgba64.cs rename to src/ImageSharp/PixelFormats/Rgba64.cs index becc4d072..a5f3e087c 100644 --- a/src/ImageSharp/Colors/PackedPixel/Rgba64.cs +++ b/src/ImageSharp/PixelFormats/Rgba64.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/RgbaComponent.cs b/src/ImageSharp/PixelFormats/RgbaComponent.cs similarity index 100% rename from src/ImageSharp/Colors/RgbaComponent.cs rename to src/ImageSharp/PixelFormats/RgbaComponent.cs diff --git a/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs b/src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs similarity index 97% rename from src/ImageSharp/Colors/RgbaVector.BulkOperations.cs rename to src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs index e26048fc4..353412dd1 100644 --- a/src/ImageSharp/Colors/RgbaVector.BulkOperations.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; diff --git a/src/ImageSharp/Colors/RgbaVector.Definitions.cs b/src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs similarity index 99% rename from src/ImageSharp/Colors/RgbaVector.Definitions.cs rename to src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs index b0fe0faf0..61d24d191 100644 --- a/src/ImageSharp/Colors/RgbaVector.Definitions.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { /// /// Unpacked pixel type containing four 16-bit floating-point values typically ranging from 0 to 1. diff --git a/src/ImageSharp/Colors/RgbaVector.Transforms.cs b/src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs similarity index 99% rename from src/ImageSharp/Colors/RgbaVector.Transforms.cs rename to src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs index a2408dcc8..03b344721 100644 --- a/src/ImageSharp/Colors/RgbaVector.Transforms.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/RgbaVector.cs b/src/ImageSharp/PixelFormats/RgbaVector.cs similarity index 99% rename from src/ImageSharp/Colors/RgbaVector.cs rename to src/ImageSharp/PixelFormats/RgbaVector.cs index 03fd25ded..df5b231f3 100644 --- a/src/ImageSharp/Colors/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Colors/PackedPixel/Short2.cs b/src/ImageSharp/PixelFormats/Short2.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Short2.cs rename to src/ImageSharp/PixelFormats/Short2.cs index 167a1e786..0721718ff 100644 --- a/src/ImageSharp/Colors/PackedPixel/Short2.cs +++ b/src/ImageSharp/PixelFormats/Short2.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/PackedPixel/Short4.cs b/src/ImageSharp/PixelFormats/Short4.cs similarity index 99% rename from src/ImageSharp/Colors/PackedPixel/Short4.cs rename to src/ImageSharp/PixelFormats/Short4.cs index e1a559c32..b5b4287df 100644 --- a/src/ImageSharp/Colors/PackedPixel/Short4.cs +++ b/src/ImageSharp/PixelFormats/Short4.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System; using System.Numerics; diff --git a/src/ImageSharp/Colors/Vector4BlendTransforms.cs b/src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs similarity index 99% rename from src/ImageSharp/Colors/Vector4BlendTransforms.cs rename to src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs index a7e2e0e91..17e1c7db5 100644 --- a/src/ImageSharp/Colors/Vector4BlendTransforms.cs +++ b/src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp +namespace ImageSharp.PixelFormats { using System.Numerics; diff --git a/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs b/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs index a704acc30..f50616aa3 100644 --- a/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs +++ b/src/ImageSharp/Processing/Binarization/BinaryThreshold.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Binarization/Dither.cs b/src/ImageSharp/Processing/Binarization/Dither.cs index eb58fe33f..617883d6a 100644 --- a/src/ImageSharp/Processing/Binarization/Dither.cs +++ b/src/ImageSharp/Processing/Binarization/Dither.cs @@ -8,6 +8,7 @@ namespace ImageSharp using System; using ImageSharp.Dithering; + using ImageSharp.PixelFormats; using ImageSharp.Processing.Processors; /// diff --git a/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs b/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs index 767c72eea..76977455a 100644 --- a/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs +++ b/src/ImageSharp/Processing/ColorMatrix/BlackWhite.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs b/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs index 784d52cce..d012d6fe2 100644 --- a/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs +++ b/src/ImageSharp/Processing/ColorMatrix/ColorBlindness.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs b/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs index 10888da44..8700b63e8 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Grayscale.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Hue.cs b/src/ImageSharp/Processing/ColorMatrix/Hue.cs index 5e6a20523..8dbc55530 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Hue.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Hue.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs b/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs index 2fca3f1c2..13a71a71e 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Kodachrome.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs b/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs index 1e486ce30..3299add7f 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Lomograph.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs b/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs index 798a2ab3f..194800ec7 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Polaroid.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Saturation.cs b/src/ImageSharp/Processing/ColorMatrix/Saturation.cs index faca73fc6..c41f304b4 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Saturation.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Saturation.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/ColorMatrix/Sepia.cs b/src/ImageSharp/Processing/ColorMatrix/Sepia.cs index 96c82c259..d60ec7165 100644 --- a/src/ImageSharp/Processing/ColorMatrix/Sepia.cs +++ b/src/ImageSharp/Processing/ColorMatrix/Sepia.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Convolution/BoxBlur.cs b/src/ImageSharp/Processing/Convolution/BoxBlur.cs index 6912d4885..46c134ee2 100644 --- a/src/ImageSharp/Processing/Convolution/BoxBlur.cs +++ b/src/ImageSharp/Processing/Convolution/BoxBlur.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Convolution/DetectEdges.cs b/src/ImageSharp/Processing/Convolution/DetectEdges.cs index 6ffeaa63d..3aa1d0b51 100644 --- a/src/ImageSharp/Processing/Convolution/DetectEdges.cs +++ b/src/ImageSharp/Processing/Convolution/DetectEdges.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Convolution/GaussianBlur.cs b/src/ImageSharp/Processing/Convolution/GaussianBlur.cs index 3472ceadb..72abec6df 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianBlur.cs +++ b/src/ImageSharp/Processing/Convolution/GaussianBlur.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs b/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs index 196bda837..2ed99ea26 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs +++ b/src/ImageSharp/Processing/Convolution/GaussianSharpen.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Effects/Alpha.cs b/src/ImageSharp/Processing/Effects/Alpha.cs index f38953e38..a54bde675 100644 --- a/src/ImageSharp/Processing/Effects/Alpha.cs +++ b/src/ImageSharp/Processing/Effects/Alpha.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Effects/BackgroundColor.cs b/src/ImageSharp/Processing/Effects/BackgroundColor.cs index e1107258f..cb189338e 100644 --- a/src/ImageSharp/Processing/Effects/BackgroundColor.cs +++ b/src/ImageSharp/Processing/Effects/BackgroundColor.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Effects/Brightness.cs b/src/ImageSharp/Processing/Effects/Brightness.cs index 585db7346..6b7477488 100644 --- a/src/ImageSharp/Processing/Effects/Brightness.cs +++ b/src/ImageSharp/Processing/Effects/Brightness.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Effects/Contrast.cs b/src/ImageSharp/Processing/Effects/Contrast.cs index 99a90455f..8f226d08e 100644 --- a/src/ImageSharp/Processing/Effects/Contrast.cs +++ b/src/ImageSharp/Processing/Effects/Contrast.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Effects/Invert.cs b/src/ImageSharp/Processing/Effects/Invert.cs index 3bb1124ce..113d8289e 100644 --- a/src/ImageSharp/Processing/Effects/Invert.cs +++ b/src/ImageSharp/Processing/Effects/Invert.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Effects/OilPainting.cs b/src/ImageSharp/Processing/Effects/OilPainting.cs index 62e6aeda7..d4528b55b 100644 --- a/src/ImageSharp/Processing/Effects/OilPainting.cs +++ b/src/ImageSharp/Processing/Effects/OilPainting.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Effects/Pixelate.cs b/src/ImageSharp/Processing/Effects/Pixelate.cs index a57f30c96..eeffff092 100644 --- a/src/ImageSharp/Processing/Effects/Pixelate.cs +++ b/src/ImageSharp/Processing/Effects/Pixelate.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Overlays/Glow.cs b/src/ImageSharp/Processing/Overlays/Glow.cs index 562012f97..1be15ad65 100644 --- a/src/ImageSharp/Processing/Overlays/Glow.cs +++ b/src/ImageSharp/Processing/Overlays/Glow.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Overlays/Vignette.cs b/src/ImageSharp/Processing/Overlays/Vignette.cs index 424200fdd..f805dd07a 100644 --- a/src/ImageSharp/Processing/Overlays/Vignette.cs +++ b/src/ImageSharp/Processing/Overlays/Vignette.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs index f187cfcff..566449b27 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to perform binary threshold filtering against an /// . The image will be converted to grayscale before thresholding occurs. diff --git a/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs index 0fd73a84a..af2d9f760 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/ErrorDiffusionDitherProcessor.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Processing.Processors using System; using ImageSharp.Dithering; + using ImageSharp.PixelFormats; /// /// An that dithers an image using error diffusion. diff --git a/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs index 08f653271..c4d71d9af 100644 --- a/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/OrderedDitherProcessor.cs @@ -9,6 +9,7 @@ namespace ImageSharp.Processing.Processors using System.Buffers; using ImageSharp.Dithering; + using ImageSharp.PixelFormats; /// /// An that dithers an image using error diffusion. diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs index 6676d89ba..d37d119a4 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/BlackWhiteProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image to their black and white equivalent. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs index 3bad624ba..a91bd1946 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatomalyProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Achromatomaly (Color desensitivity) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs index 246a57481..d543c4edc 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/AchromatopsiaProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Achromatopsia (Monochrome) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs index a79716859..ea73d0c66 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranomalyProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Deuteranomaly (Green-Weak) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs index c8cc1a962..4b5129a8b 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/DeuteranopiaProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Deuteranopia (Green-Blind) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs index 618c6deae..14eea0812 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanomalyProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Protanopia (Red-Weak) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs index de87ede0c..39cb715bd 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/ProtanopiaProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Protanopia (Red-Blind) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs index dd2a6067c..2b402197b 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanomalyProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Tritanomaly (Blue-Weak) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs index 5d8098c62..5d228afa7 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorBlindness/TritanopiaProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating Tritanopia (Blue-Blind) color blindness. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs index 7f5d4465a..b38093d63 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/ColorMatrixProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// The color matrix filter. Inherit from this class to perform operation involving color matrices. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs index add3e266b..65de8a66d 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt601Processor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image to Grayscale applying the formula as specified by ITU-R Recommendation BT.601 /// . diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs index 8e7956e5d..5f71e357b 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/GrayscaleBt709Processor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image to Grayscale applying the formula as specified by ITU-R Recommendation BT.709 /// . diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs index e5fd0318c..8995663a3 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/HueProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// An to change the hue of an . /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs index ca57f6633..0c29c65a1 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/IColorMatrixFilter.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Encapsulates properties and methods for creating processors that utilize a matrix to /// alter the image pixels. diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs index fe6b07c03..18514236f 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/KodachromeProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating an old Kodachrome camera effect. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs index 2071fc7bb..70b997997 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/LomographProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating an old Lomograph effect. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs index d625b641d..ccc3c0060 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/PolaroidProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image recreating an old Polaroid effect. /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs index cd8947d05..3adfb8311 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/SaturationProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// An to change the saturation of an . /// diff --git a/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs b/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs index 8d9ef17d0..89be3acad 100644 --- a/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/ColorMatrix/SepiaProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Converts the colors of the image to their sepia equivalent. /// The formula used matches the svg specification. diff --git a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs index 26a531d0c..652442388 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Applies a Box blur sampler to the image. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs index 8ca06b359..ac96c40ae 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Defines a sampler that uses two one-dimensional matrices to perform convolution against an image. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs index ca114b10a..9b95cb1a3 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Defines a sampler that uses two one-dimensional matrices to perform two-pass convolution against an image. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs index d3b11d781..a0c140028 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Defines a sampler that uses a 2 dimensional matrix to perform convolution against an image. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs index 855820f18..457854a31 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetector2DProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Defines a sampler that detects edges within an image using two one-dimensional matrices. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs index 43a0942b8..a4d1d5409 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorCompassProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Defines a sampler that detects edges within an image using a eight two dimensional matrices. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs index 8fbf2fe0b..e7670dd1d 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/EdgeDetectorProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Defines a sampler that detects edges within an image using a single two dimensional matrix. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs index 39d11a485..c7c126794 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/IEdgeDetectorProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Provides properties and methods allowing the detection of edges within an image. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs index 56d5ac01d..d72816a76 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KayyaliProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Kayyali operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs index f1f504f26..d882bdb16 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/KirschProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Kirsch operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs index 61a8858b7..39f64fb5a 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian3X3Processor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Laplacian 3 x 3 operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs index 2c3929712..c65cb5bd7 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/Laplacian5X5Processor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Laplacian 5 x 5 operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs index aa9b4b9f2..57ab4dce6 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/LaplacianOfGaussianProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Laplacian of Gaussian operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs index 24faf20d0..d1515dee8 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/PrewittProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Prewitt operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs index efbdc7ffa..bab9ff622 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobertsCrossProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Roberts Cross operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs index f6ab60fd3..4afca0f01 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/RobinsonProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Kirsch operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs index 41e3d16f4..a583d3c0d 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/ScharrProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Scharr operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs index 245df5afd..1c2a6a18f 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetection/SobelProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Diagnostics.CodeAnalysis; + using ImageSharp.PixelFormats; + /// /// The Sobel operator filter. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs index c0f025630..87de922a1 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Applies a Gaussian blur sampler to the image. /// diff --git a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs index 353763843..34d099033 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Applies a Gaussian sharpening sampler to the image. /// diff --git a/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs index 48b8a64b2..a60106546 100644 --- a/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/AlphaProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to change the alpha component of an . /// diff --git a/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs index 368986b5d..21973de3e 100644 --- a/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/BackgroundColorProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Sets the background color of the image. /// diff --git a/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs index 5647a6453..f9f1585ea 100644 --- a/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/BrightnessProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to change the brightness of an . /// diff --git a/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs index c6abd250b..8308c57e2 100644 --- a/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/ContrastProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to change the contrast of an . /// diff --git a/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs index 9eaa99c71..a0348970e 100644 --- a/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/InvertProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to invert the colors of an . /// diff --git a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs index 3ef56b745..73d956907 100644 --- a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to apply an oil painting effect to an . /// diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs index 006ae8e60..7a57daa4e 100644 --- a/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Collections.Generic; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An to pixelate the colors of an . /// diff --git a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs index 223da64ac..049378256 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An that applies a radial glow effect an . /// diff --git a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs index 9be0cfde2..31e813564 100644 --- a/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// An that applies a radial vignette effect to an . /// diff --git a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs index 1b96e098e..b67ef5bf1 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Provides methods to allow the cropping of an image. /// diff --git a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs index 67259477c..571c40939 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Processing.Processors { using System; + using ImageSharp.PixelFormats; + /// /// Provides methods to allow the cropping of an image to preserve areas of highest /// entropy. diff --git a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs index 86dc8bb15..2faf77905 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Provides methods that allow the flipping of an image around its center point. /// diff --git a/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs b/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs index a8cd71003..3135551f8 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Matrix3x2Processor.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing.Processors using System; using System.Numerics; + using ImageSharp.PixelFormats; + /// /// Provides methods to transform an image using a . /// diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs index bd7ca3f60..e2f77d812 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResamplingWeightedProcessor.cs @@ -10,6 +10,8 @@ namespace ImageSharp.Processing.Processors using System.Runtime.CompilerServices; using System.Runtime.InteropServices; + using ImageSharp.PixelFormats; + /// /// Provides methods that allow the resizing of images using various algorithms. /// Adapted from diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs index 9601cc7bb..23166fd3a 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Provides methods that allow the resizing of images using various algorithms. /// diff --git a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs index 7d0afce26..fc5d29b06 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Provides methods that allow the rotating of images. /// diff --git a/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs index e5b6f12bf..40ea6a94e 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Processing.Processors using System.Numerics; using System.Threading.Tasks; + using ImageSharp.PixelFormats; + /// /// Provides methods that allow the skewing of images. /// diff --git a/src/ImageSharp/Processing/Transforms/AutoOrient.cs b/src/ImageSharp/Processing/Transforms/AutoOrient.cs index 5634c3299..de736092d 100644 --- a/src/ImageSharp/Processing/Transforms/AutoOrient.cs +++ b/src/ImageSharp/Processing/Transforms/AutoOrient.cs @@ -6,6 +6,9 @@ namespace ImageSharp { using System; + + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Transforms/Crop.cs b/src/ImageSharp/Processing/Transforms/Crop.cs index 59c1209f9..073e8136d 100644 --- a/src/ImageSharp/Processing/Transforms/Crop.cs +++ b/src/ImageSharp/Processing/Transforms/Crop.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Transforms/EntropyCrop.cs b/src/ImageSharp/Processing/Transforms/EntropyCrop.cs index 59d0211a1..aaafd396f 100644 --- a/src/ImageSharp/Processing/Transforms/EntropyCrop.cs +++ b/src/ImageSharp/Processing/Transforms/EntropyCrop.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Processing/Transforms/Flip.cs b/src/ImageSharp/Processing/Transforms/Flip.cs index 1cc79f888..41f2e5616 100644 --- a/src/ImageSharp/Processing/Transforms/Flip.cs +++ b/src/ImageSharp/Processing/Transforms/Flip.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs b/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs index 1e7d7e24f..c87688266 100644 --- a/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs +++ b/src/ImageSharp/Processing/Transforms/Options/ResizeHelper.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Processing using System; using System.Linq; + using ImageSharp.PixelFormats; + /// /// Provides methods to help calculate the target rectangle when resizing using the /// enumeration. diff --git a/src/ImageSharp/Processing/Transforms/Pad.cs b/src/ImageSharp/Processing/Transforms/Pad.cs index 3aebe2304..42851e205 100644 --- a/src/ImageSharp/Processing/Transforms/Pad.cs +++ b/src/ImageSharp/Processing/Transforms/Pad.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Transforms/Resize.cs b/src/ImageSharp/Processing/Transforms/Resize.cs index 82c4b16c3..543b98297 100644 --- a/src/ImageSharp/Processing/Transforms/Resize.cs +++ b/src/ImageSharp/Processing/Transforms/Resize.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Transforms/Rotate.cs b/src/ImageSharp/Processing/Transforms/Rotate.cs index 09fcb3534..b335a3c76 100644 --- a/src/ImageSharp/Processing/Transforms/Rotate.cs +++ b/src/ImageSharp/Processing/Transforms/Rotate.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing; using Processing.Processors; diff --git a/src/ImageSharp/Processing/Transforms/RotateFlip.cs b/src/ImageSharp/Processing/Transforms/RotateFlip.cs index 2f59438e9..396590359 100644 --- a/src/ImageSharp/Processing/Transforms/RotateFlip.cs +++ b/src/ImageSharp/Processing/Transforms/RotateFlip.cs @@ -6,6 +6,9 @@ namespace ImageSharp { using System; + + using ImageSharp.PixelFormats; + using Processing; /// diff --git a/src/ImageSharp/Processing/Transforms/Skew.cs b/src/ImageSharp/Processing/Transforms/Skew.cs index b74660efc..0c9cfbc8e 100644 --- a/src/ImageSharp/Processing/Transforms/Skew.cs +++ b/src/ImageSharp/Processing/Transforms/Skew.cs @@ -7,6 +7,8 @@ namespace ImageSharp { using System; + using ImageSharp.PixelFormats; + using Processing.Processors; /// diff --git a/src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs b/src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs index 566ddf6b5..f3bf9b56d 100644 --- a/src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs +++ b/src/ImageSharp/Quantizers/IQuantizer{TPixel}.cs @@ -6,6 +6,7 @@ namespace ImageSharp.Quantizers { using ImageSharp.Dithering; + using ImageSharp.PixelFormats; /// /// Provides methods for allowing quantization of images pixels. diff --git a/src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs index 2296e589c..d57d297fc 100644 --- a/src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Quantizers/OctreeQuantizer{TPixel}.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Quantizers using System; using System.Collections.Generic; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; /// /// Encapsulates methods to calculate the color palette if an image using an Octree pattern. diff --git a/src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs index 1c588b842..b5e5ccb25 100644 --- a/src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs +++ b/src/ImageSharp/Quantizers/PaletteQuantizer{TPixel}.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Quantizers using System; using System.Collections.Generic; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; /// /// Encapsulates methods to create a quantized image based upon the given palette. diff --git a/src/ImageSharp/Quantizers/Quantize.cs b/src/ImageSharp/Quantizers/Quantize.cs index 44be039f4..a23509278 100644 --- a/src/ImageSharp/Quantizers/Quantize.cs +++ b/src/ImageSharp/Quantizers/Quantize.cs @@ -8,6 +8,7 @@ namespace ImageSharp using System; using System.Threading.Tasks; + using ImageSharp.PixelFormats; using ImageSharp.Quantizers; /// diff --git a/src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs b/src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs index 927128065..c8b2c7df6 100644 --- a/src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs +++ b/src/ImageSharp/Quantizers/QuantizedImage{TPixel}.cs @@ -6,6 +6,7 @@ namespace ImageSharp.Quantizers { using System; + using ImageSharp.PixelFormats; /// /// Represents a quantized image where the pixels indexed by a color palette. diff --git a/src/ImageSharp/Quantizers/Quantizer{TPixel}.cs b/src/ImageSharp/Quantizers/Quantizer{TPixel}.cs index 1cf620bf9..02447062e 100644 --- a/src/ImageSharp/Quantizers/Quantizer{TPixel}.cs +++ b/src/ImageSharp/Quantizers/Quantizer{TPixel}.cs @@ -5,11 +5,11 @@ namespace ImageSharp.Quantizers { - using System; using System.Collections.Generic; using System.Numerics; using System.Runtime.CompilerServices; using ImageSharp.Dithering; + using ImageSharp.PixelFormats; /// /// Encapsulates methods to calculate the color palette of an image. diff --git a/src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs b/src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs index 16ab64f3c..482481c71 100644 --- a/src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs +++ b/src/ImageSharp/Quantizers/WuQuantizer{TPixel}.cs @@ -10,6 +10,7 @@ namespace ImageSharp.Quantizers using System.Collections.Generic; using System.Numerics; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; /// /// An implementation of Wu's color quantizer with alpha channel. diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs index 2f3f61cce..65c4a235d 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4ReferenceVsPointer.cs @@ -6,6 +6,7 @@ using BenchmarkDotNet.Attributes; using ImageSharp; + using ImageSharp.PixelFormats; /// /// Compares two implementation candidates for general BulkPixelOperations.ToVector4(): @@ -14,7 +15,7 @@ /// public unsafe class PackFromVector4ReferenceVsPointer { - private Buffer destination; + private Buffer destination; private Buffer source; @@ -24,7 +25,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 +44,12 @@ Vector4* sp = (Vector4*)this.source.Pin(); byte* dp = (byte*)this.destination.Pin(); int count = this.Count; - int size = sizeof(ImageSharp.Rgba32); + int size = sizeof(Rgba32); for (int i = 0; i < count; i++) { Vector4 v = Unsafe.Read(sp); - ImageSharp.Rgba32 c = default(ImageSharp.Rgba32); + Rgba32 c = default(Rgba32); c.PackFromVector4(v); Unsafe.Write(dp, c); @@ -61,7 +62,7 @@ public void PackUsingReferences() { ref Vector4 sp = ref this.source.Array[0]; - ref ImageSharp.Rgba32 dp = ref this.destination.Array[0]; + ref 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 00b0b503c..2a370bc00 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 Rgba32 = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; public abstract class PackFromXyzw where TPixel : struct, IPixel diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs index b3a23147e..1234a9946 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Benchmarks.Color.Bulk using BenchmarkDotNet.Attributes; + using ImageSharp.PixelFormats; + public abstract class ToVector4 where TPixel : struct, IPixel { @@ -55,7 +57,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 ad7e2a9cf..fe201549b 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 Rgba32 = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; public abstract class ToXyz where TPixel : struct, IPixel diff --git a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs index 75e0f247c..f7406d0f6 100644 --- a/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs +++ b/tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs @@ -7,8 +7,7 @@ using System.Threading.Tasks; namespace ImageSharp.Benchmarks.Color.Bulk { using BenchmarkDotNet.Attributes; - - using Rgba32 = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; public abstract class ToXyzw where TPixel : struct, IPixel diff --git a/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs b/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs index efc7c130f..a641baafe 100644 --- a/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs +++ b/tests/ImageSharp.Benchmarks/Color/ColorEquality.cs @@ -7,7 +7,8 @@ namespace ImageSharp.Benchmarks { using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; + using SystemColor = System.Drawing.Color; public class ColorEquality @@ -21,7 +22,7 @@ namespace ImageSharp.Benchmarks [Benchmark(Description = "ImageSharp Color Equals")] public bool ColorEqual() { - return new CoreColor(128, 128, 128, 128).Equals(new CoreColor(128, 128, 128, 128)); + return new Rgba32(128, 128, 128, 128).Equals(new Rgba32(128, 128, 128, 128)); } } } diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs index 10c5584aa..d0bd9f208 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs @@ -12,7 +12,8 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; + using CoreImage = ImageSharp.Image; using CorePoint = ImageSharp.Point; @@ -50,7 +51,7 @@ namespace ImageSharp.Benchmarks using (CoreImage image = new CoreImage(800, 800)) { image.DrawBeziers( - CoreColor.HotPink, + Rgba32.HotPink, 10, new[] { new Vector2(10, 500), diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs index 3561661b6..2bd3f4a6a 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs @@ -12,7 +12,8 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; + using CoreImage = ImageSharp.Image; using CorePoint = ImageSharp.Point; @@ -49,7 +50,7 @@ namespace ImageSharp.Benchmarks using (CoreImage image = new CoreImage(800, 800)) { image.DrawLines( - CoreColor.HotPink, + Rgba32.HotPink, 10, new[] { new Vector2(10, 10), diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs index 8f7255e80..a0f8b21d8 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs @@ -11,10 +11,11 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using CoreImage = ImageSharp.Image; using CorePoint = ImageSharp.Point; - using CoreColor = ImageSharp.Rgba32; using System.IO; using System.Numerics; + using ImageSharp.PixelFormats; + public class DrawPolygon : BenchmarkBase { [Benchmark(Baseline = true, Description = "System.Drawing Draw Polygon")] @@ -48,7 +49,7 @@ namespace ImageSharp.Benchmarks using (CoreImage image = new CoreImage(800, 800)) { image.DrawPolygon( - CoreColor.HotPink, + Rgba32.HotPink, 10, new[] { new Vector2(10, 10), diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs index dfcc6db0a..ac1082697 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs @@ -13,7 +13,8 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; + using CoreImage = ImageSharp.Image; public class FillPolygon : BenchmarkBase @@ -57,7 +58,7 @@ namespace ImageSharp.Benchmarks using (CoreImage image = new CoreImage(800, 800)) { image.FillPolygon( - CoreColor.HotPink, + Rgba32.HotPink, new[] { new Vector2(10, 10), new Vector2(550, 50), @@ -77,7 +78,7 @@ namespace ImageSharp.Benchmarks using (CoreImage image = new CoreImage(800, 800)) { image.Fill( - CoreColor.HotPink, + Rgba32.HotPink, this.shape); using (MemoryStream ms = new MemoryStream()) diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs index 161923178..7b21dbdc6 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs @@ -11,11 +11,12 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using CoreImage = ImageSharp.Image; using CoreRectangle = ImageSharp.Rectangle; - using CoreColor = ImageSharp.Rgba32; using CoreSize = ImageSharp.Size; using System.Numerics; + using ImageSharp.PixelFormats; + public class FillRectangle : BenchmarkBase { [Benchmark(Baseline = true, Description = "System.Drawing Fill Rectangle")] @@ -39,7 +40,7 @@ namespace ImageSharp.Benchmarks { using (CoreImage image = new CoreImage(800, 800)) { - image.Fill(CoreColor.HotPink, new CoreRectangle(10, 10, 190, 140)); + image.Fill(Rgba32.HotPink, new CoreRectangle(10, 10, 190, 140)); return new CoreSize(image.Width, image.Height); } @@ -51,7 +52,7 @@ namespace ImageSharp.Benchmarks using (CoreImage image = new CoreImage(800, 800)) { image.FillPolygon( - CoreColor.HotPink, + Rgba32.HotPink, new[] { new Vector2(10, 10), new Vector2(200, 10), diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs index bc2330848..580120abd 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs @@ -11,8 +11,10 @@ namespace ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; + using ImageSharp.PixelFormats; + using CoreBrushes = ImageSharp.Drawing.Brushes.Brushes; - using CoreColor = ImageSharp.Rgba32; + using CoreImage = ImageSharp.Image; public class FillWithPattern @@ -40,7 +42,7 @@ namespace ImageSharp.Benchmarks { using (CoreImage image = new CoreImage(800, 800)) { - image.Fill(CoreBrushes.BackwardDiagonal(CoreColor.HotPink)); + image.Fill(CoreBrushes.BackwardDiagonal(Rgba32.HotPink)); using (MemoryStream ms = new MemoryStream()) { diff --git a/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs b/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs index 99640fe58..97deb72c5 100644 --- a/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs +++ b/tests/ImageSharp.Benchmarks/General/ClearBuffer.cs @@ -7,7 +7,7 @@ namespace ImageSharp.Benchmarks.General using BenchmarkDotNet.Attributes; - using Rgba32 = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; public unsafe class ClearBuffer { @@ -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 1e7745de1..aade8a8de 100644 --- a/tests/ImageSharp.Benchmarks/Image/CopyPixels.cs +++ b/tests/ImageSharp.Benchmarks/Image/CopyPixels.cs @@ -9,19 +9,20 @@ namespace ImageSharp.Benchmarks.Image using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; + using CoreImage = ImageSharp.Image; public class CopyPixels : BenchmarkBase { [Benchmark(Description = "Copy by Pixel")] - public CoreColor CopyByPixel() + public Rgba32 CopyByPixel() { using (CoreImage source = new CoreImage(1024, 768)) using (CoreImage target = new CoreImage(1024, 768)) { - using (PixelAccessor sourcePixels = source.Lock()) - using (PixelAccessor targetPixels = target.Lock()) + using (PixelAccessor sourcePixels = source.Lock()) + using (PixelAccessor targetPixels = target.Lock()) { Parallel.For( 0, diff --git a/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs b/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs index 1d18498c8..b27ad5fcc 100644 --- a/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs +++ b/tests/ImageSharp.Benchmarks/Image/EncodeIndexedPng.cs @@ -11,6 +11,7 @@ namespace ImageSharp.Benchmarks.Image using ImageSharp; using ImageSharp.Formats; + using ImageSharp.PixelFormats; using ImageSharp.Quantizers; /// diff --git a/tests/ImageSharp.Benchmarks/Image/EncodePng.cs b/tests/ImageSharp.Benchmarks/Image/EncodePng.cs index 2bf2c0fef..6158e5aac 100644 --- a/tests/ImageSharp.Benchmarks/Image/EncodePng.cs +++ b/tests/ImageSharp.Benchmarks/Image/EncodePng.cs @@ -12,6 +12,7 @@ namespace ImageSharp.Benchmarks.Image using BenchmarkDotNet.Attributes; using ImageSharp.Formats; + using ImageSharp.PixelFormats; using ImageSharp.Quantizers; using CoreImage = ImageSharp.Image; @@ -66,10 +67,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 31cd7c232..21927c915 100644 --- a/tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs +++ b/tests/ImageSharp.Benchmarks/Image/GetSetPixel.cs @@ -9,7 +9,8 @@ namespace ImageSharp.Benchmarks.Image using BenchmarkDotNet.Attributes; - using CoreColor = ImageSharp.Rgba32; + using ImageSharp.PixelFormats; + using CoreImage = ImageSharp.Image; using SystemColor = System.Drawing.Color; @@ -26,13 +27,13 @@ namespace ImageSharp.Benchmarks.Image } [Benchmark(Description = "ImageSharp GetSet pixel")] - public CoreColor ResizeCore() + public Rgba32 ResizeCore() { using (CoreImage image = new CoreImage(400, 400)) { - using (PixelAccessor imagePixels = image.Lock()) + using (PixelAccessor imagePixels = image.Lock()) { - imagePixels[200, 200] = CoreColor.White; + imagePixels[200, 200] = Rgba32.White; return imagePixels[200, 200]; } } diff --git a/tests/ImageSharp.Benchmarks/Samplers/Resize.cs b/tests/ImageSharp.Benchmarks/Samplers/Resize.cs index a51dcc45a..638a56bf3 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/Resize.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/Resize.cs @@ -9,9 +9,11 @@ namespace ImageSharp.Benchmarks using System.Drawing.Drawing2D; using BenchmarkDotNet.Attributes; + + using ImageSharp.PixelFormats; + using CoreSize = ImageSharp.Size; using CoreImage = ImageSharp.Image; - using CoreVectorImage = ImageSharp.Image; public class Resize : BenchmarkBase { @@ -48,7 +50,7 @@ namespace ImageSharp.Benchmarks [Benchmark(Description = "ImageSharp Vector Resize")] public CoreSize ResizeCoreVector() { - using (CoreVectorImage image = new CoreVectorImage(2000, 2000)) + using (CoreImage image = new CoreImage(2000, 2000)) { image.Resize(400, 400); return new CoreSize(image.Width, image.Height); @@ -68,7 +70,7 @@ namespace ImageSharp.Benchmarks [Benchmark(Description = "ImageSharp Vector Compand Resize")] public CoreSize ResizeCoreVectorCompand() { - using (CoreVectorImage image = new CoreVectorImage(2000, 2000)) + using (CoreImage image = new CoreImage(2000, 2000)) { image.Resize(400, 400, true); return new CoreSize(image.Width, image.Height); diff --git a/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs b/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs index 19aefd06b..b498c93ac 100644 --- a/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/Colors/BulkPixelOperationsTests.cs @@ -5,12 +5,14 @@ namespace ImageSharp.Tests.Colors using System; using System.Numerics; + using ImageSharp.PixelFormats; + using Xunit; using Xunit.Abstractions; public class BulkPixelOperationsTests { - public class Color32 : BulkPixelOperationsTests + public class Color32 : BulkPixelOperationsTests { public Color32(ITestOutputHelper output) : base(output) @@ -23,19 +25,19 @@ namespace ImageSharp.Tests.Colors [Fact] public void IsSpecialImplementation() { - Assert.IsType(BulkPixelOperations.Instance); + Assert.IsType(BulkPixelOperations.Instance); } [Fact] public void ToVector4SimdAligned() { - ImageSharp.Rgba32[] source = CreatePixelTestData(64); + Rgba32[] source = CreatePixelTestData(64); Vector4[] expected = CreateExpectedVector4Data(source); TestOperation( source, expected, - (s, d) => ImageSharp.Rgba32.BulkOperations.ToVector4SimdAligned(s, d, 64) + (s, d) => Rgba32.BulkOperations.ToVector4SimdAligned(s, d, 64) ); } @@ -45,20 +47,20 @@ 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); }); } } } - public class Argb : BulkPixelOperationsTests + public class Argb : BulkPixelOperationsTests { // For 4.6 test runner MemberData does not work without redeclaring the public field in the derived test class: public Argb(ITestOutputHelper output) diff --git a/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs b/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs index d2c5cf845..eac0644d9 100644 --- a/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorConstructorTests.cs @@ -7,6 +7,9 @@ namespace ImageSharp.Tests.Colors { using System.Collections.Generic; using System.Numerics; + + using ImageSharp.PixelFormats; + using Xunit; public class ColorConstructorTests diff --git a/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs b/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs index 09a150ab2..4b45d0ab4 100644 --- a/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorConversionTests.cs @@ -8,6 +8,7 @@ namespace ImageSharp.Tests using System; using System.Diagnostics.CodeAnalysis; using ImageSharp.Colors.Spaces; + using ImageSharp.PixelFormats; using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs b/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs index 1f80aa7d5..f2113852f 100644 --- a/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorDefinitionTests.cs @@ -12,6 +12,8 @@ namespace ImageSharp.Tests using System.Reflection; using ImageSharp.Colors.Spaces; + using ImageSharp.PixelFormats; + using Xunit; public class ColorDefinitionTests { diff --git a/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs b/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs index 18d6d6e71..efec4ea38 100644 --- a/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorEqualityTests.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Tests.Colors using System; using System.Numerics; using ImageSharp.Colors.Spaces; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs b/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs index 5fbb42b2a..563b6be3c 100644 --- a/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorPackingTests.cs @@ -7,6 +7,9 @@ namespace ImageSharp.Tests.Colors { using System.Collections.Generic; using System.Numerics; + + using ImageSharp.PixelFormats; + using Xunit; public class ColorPackingTests diff --git a/tests/ImageSharp.Tests/Colors/ColorTests.cs b/tests/ImageSharp.Tests/Colors/ColorTests.cs index 4bfdc883f..da63025c4 100644 --- a/tests/ImageSharp.Tests/Colors/ColorTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorTests.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Tests using System; using System.Numerics; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs b/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs index 7a6f2bdf4..8d5e973b1 100644 --- a/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorTransformTests.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Tests.Colors { + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs b/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs index 135490f40..492817015 100644 --- a/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorVectorTests.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Tests using System.Numerics; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs b/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs index 3b4db9cc5..e670944f5 100644 --- a/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs +++ b/tests/ImageSharp.Tests/Colors/ColorVectorTransformTests.cs @@ -5,6 +5,7 @@ namespace ImageSharp.Tests.Colors { + using ImageSharp.PixelFormats; using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs b/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs index 14bd38063..5ec7c21bb 100644 --- a/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs +++ b/tests/ImageSharp.Tests/Colors/PackedPixelTests.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Tests.Colors using System.Diagnostics; using System.Numerics; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs b/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs index e130d7399..25a61453b 100644 --- a/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs +++ b/tests/ImageSharp.Tests/Colors/UnPackedPixelTests.cs @@ -2,6 +2,8 @@ { using System.Numerics; + using ImageSharp.PixelFormats; + using Xunit; public class UnPackedPixelTests diff --git a/tests/ImageSharp.Tests/Common/BufferSpanTests.cs b/tests/ImageSharp.Tests/Common/BufferSpanTests.cs index 094b440ee..3bc59df64 100644 --- a/tests/ImageSharp.Tests/Common/BufferSpanTests.cs +++ b/tests/ImageSharp.Tests/Common/BufferSpanTests.cs @@ -6,6 +6,8 @@ namespace ImageSharp.Tests.Common using System; using System.Runtime.CompilerServices; + using ImageSharp.PixelFormats; + using Xunit; using static TestStructs; diff --git a/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs b/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs index 077c011bb..e673b28f1 100644 --- a/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs +++ b/tests/ImageSharp.Tests/Common/PixelDataPoolTests.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Tests { using System.Linq; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs index 9c7a76738..eb3a5de86 100644 --- a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs @@ -11,6 +11,9 @@ namespace ImageSharp.Tests.Drawing using System.Diagnostics.CodeAnalysis; using System.IO; using System.Numerics; + + using ImageSharp.PixelFormats; + using Xunit; public class Beziers : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs index 0588c69ed..674823d3a 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs @@ -5,15 +5,13 @@ namespace ImageSharp.Tests.Drawing { - using Drawing; - using ImageSharp.Drawing; using ShapePath = SixLabors.Shapes.Path; using SixLabors.Shapes; - using System; - using System.Diagnostics.CodeAnalysis; using System.IO; using System.Numerics; + using ImageSharp.PixelFormats; + using Xunit; public class DrawPathTests : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs index 130719ed7..493bab347 100644 --- a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs @@ -10,7 +10,7 @@ namespace ImageSharp.Tests.Drawing using ImageSharp.Drawing; using ImageSharp.Drawing.Brushes; - + using ImageSharp.PixelFormats; using Xunit; public class FillPatternBrushTests : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs index 7ec9925a2..9661a41bb 100644 --- a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs @@ -1,20 +1,13 @@  namespace ImageSharp.Tests.Drawing { - using System; - using System.IO; using ImageSharp; - using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; using Xunit; using ImageSharp.Drawing; - using System.Numerics; - using SixLabors.Shapes; using ImageSharp.Drawing.Processors; - using ImageSharp.Drawing.Pens; using Moq; - using System.Collections.Immutable; + + using ImageSharp.PixelFormats; public class FillRegionProcessorTests { diff --git a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs index cfcc10738..4a3c8e305 100644 --- a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs @@ -11,6 +11,9 @@ namespace ImageSharp.Tests.Drawing using System.Diagnostics.CodeAnalysis; using System.IO; using System.Numerics; + + using ImageSharp.PixelFormats; + using Xunit; public class FillSolidBrushTests: FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs index 0d8b85729..bded40f32 100644 --- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs @@ -11,6 +11,7 @@ namespace ImageSharp.Tests.Drawing using ImageSharp.Drawing; using System.Numerics; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; using SixLabors.Shapes; diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs index 0671ee00a..87bda30be 100644 --- a/tests/ImageSharp.Tests/Drawing/LineTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs @@ -10,6 +10,9 @@ namespace ImageSharp.Tests.Drawing using System.IO; using System.Numerics; + + using ImageSharp.PixelFormats; + using Xunit; public class LineTests : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs index 7c32c344d..008df9091 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawBeziersTests.cs @@ -2,17 +2,16 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; - using ImageSharp; + using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; + using Xunit; using ImageSharp.Drawing; using System.Numerics; using SixLabors.Shapes; using ImageSharp.Drawing.Processors; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class DrawBeziersTests : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs index 61ef16805..221cf7f29 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawLinesTests.cs @@ -2,17 +2,15 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; - using ImageSharp; + using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; using Xunit; using ImageSharp.Drawing; using System.Numerics; using SixLabors.Shapes; using ImageSharp.Drawing.Processors; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class DrawLinesTests : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs index 75486cb66..07be85b85 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPath.cs @@ -2,17 +2,16 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; - using ImageSharp; + using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; + using Xunit; using ImageSharp.Drawing; using System.Numerics; using SixLabors.Shapes; using ImageSharp.Drawing.Processors; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class DrawPath : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs index 995e2ff1f..bd90a460d 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPolygon.cs @@ -2,17 +2,16 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; - using ImageSharp; + using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; + using Xunit; using ImageSharp.Drawing; using System.Numerics; using SixLabors.Shapes; using ImageSharp.Drawing.Processors; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class DrawPolygon : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs index a6d978d80..7ebc6b14f 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawRectangle.cs @@ -2,17 +2,13 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; using ImageSharp; using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; using Xunit; using ImageSharp.Drawing; - using System.Numerics; - using SixLabors.Shapes; using ImageSharp.Drawing.Processors; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class DrawRectangle : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index e55e78739..a639a70cf 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs @@ -2,17 +2,14 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; using ImageSharp; using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; using Xunit; using ImageSharp.Drawing; using System.Numerics; using SixLabors.Shapes; using ImageSharp.Drawing.Processors; - using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class FillPath : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index 6145f9c01..2935c43a0 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs @@ -2,17 +2,14 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; using ImageSharp; using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; using Xunit; using ImageSharp.Drawing; using System.Numerics; using SixLabors.Shapes; using ImageSharp.Drawing.Processors; - using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class FillPolygon : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs index 3204a0a2a..4657db988 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs @@ -2,17 +2,13 @@ namespace ImageSharp.Tests.Drawing.Paths { using System; - using System.IO; - using ImageSharp; + using ImageSharp.Drawing.Brushes; - using Processing; - using System.Collections.Generic; + using Xunit; using ImageSharp.Drawing; - using System.Numerics; - using SixLabors.Shapes; using ImageSharp.Drawing.Processors; - using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; public class FillRectangle : IDisposable { diff --git a/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs b/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs index b53811073..d961a5994 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/ProcessorWatchingImage.cs @@ -6,12 +6,12 @@ namespace ImageSharp.Tests.Drawing.Paths using ImageSharp; using Processing; using System.Collections.Generic; - using ImageSharp.Formats; + using ImageSharp.PixelFormats; /// /// Watches but does not actually run the processors against the image. /// - /// + /// public class ProcessorWatchingImage : Image { public List ProcessorApplications { get; } = new List(); diff --git a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs index 81b31a9c3..554c5a32e 100644 --- a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs @@ -13,6 +13,8 @@ namespace ImageSharp.Tests.Drawing using ImageSharp.Drawing; using System.Numerics; + using ImageSharp.PixelFormats; + public class PolygonTests : FileTestBase { [Fact] diff --git a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs index ef6d321ec..d3236ae00 100644 --- a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs +++ b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs @@ -9,6 +9,8 @@ namespace ImageSharp.Tests using System.IO; using System.Linq; + using ImageSharp.PixelFormats; + using Xunit; public class RecolorImageTest : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs index 3b9411fe3..0886aa15a 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Tests.Drawing using System.IO; using System.Numerics; + using ImageSharp.PixelFormats; + using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs index 864e96099..1de7e2144 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Tests.Drawing using ImageSharp.Drawing; using System.Numerics; + using ImageSharp.PixelFormats; + using SixLabors.Shapes; public class SolidComplexPolygonTests : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs index 3bd25050a..d76dcf023 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs @@ -13,6 +13,8 @@ namespace ImageSharp.Tests.Drawing using System.Numerics; using Xunit; using ImageSharp.Drawing.Brushes; + using ImageSharp.PixelFormats; + using SixLabors.Shapes; public class SolidPolygonTests : FileTestBase diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 6618c3fb7..bce493a69 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs @@ -12,6 +12,7 @@ namespace ImageSharp.Tests.Drawing.Text using ImageSharp.Drawing.Brushes; using ImageSharp.Drawing.Pens; using ImageSharp.Drawing.Processors; + using ImageSharp.PixelFormats; using ImageSharp.Tests.Drawing.Paths; using SixLabors.Fonts; diff --git a/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs b/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs index d3c34ce8f..1dbc93b9b 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs @@ -13,6 +13,8 @@ namespace ImageSharp.Tests.Drawing.Text using SixLabors.Shapes; using ImageSharp.Drawing.Processors; using ImageSharp.Drawing.Pens; + using ImageSharp.PixelFormats; + using SixLabors.Fonts; public class OutputText : FileTestBase diff --git a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs index 453f689f2..dc6985dd3 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs @@ -17,6 +17,7 @@ namespace ImageSharp.Tests using System.Numerics; using ImageSharp.Formats.Jpg; + using ImageSharp.PixelFormats; using ImageSharp.Processing; public class BadEOFJpegTests : MeasureFixture diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 60f310bbd..1bcc72c43 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -10,6 +10,7 @@ namespace ImageSharp.Tests using System.IO; using ImageSharp.Formats; + using ImageSharp.PixelFormats; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs index 5bc5e780c..d5f7c2ea3 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs @@ -15,6 +15,7 @@ using Xunit.Abstractions; namespace ImageSharp.Tests { using ImageSharp.Formats.Jpg; + using ImageSharp.PixelFormats; using ImageSharp.Processing; public class JpegEncoderTests : MeasureFixture diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs index dfe132485..5150925b4 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegProfilingBenchmarks.cs @@ -11,6 +11,7 @@ namespace ImageSharp.Tests using System.Numerics; using ImageSharp.Formats; + using ImageSharp.PixelFormats; using Xunit; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs index 117a5354f..f242faf12 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegUtilsTests.cs @@ -10,6 +10,7 @@ namespace ImageSharp.Tests using System.Numerics; using ImageSharp.Formats.Jpg; + using ImageSharp.PixelFormats; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index b70df9c17..ae4dfc1e9 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Tests using System.Linq; using System.Threading.Tasks; using ImageSharp.IO; + using ImageSharp.PixelFormats; + using Xunit; public class PngEncoderTests : FileTestBase diff --git a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs index 1e3879a93..46ade9f9a 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs @@ -15,6 +15,8 @@ namespace ImageSharp.Tests.Formats.Png using ImageSharp.IO; using System.Numerics; + using ImageSharp.PixelFormats; + public class PngSmokeTests { [Theory] diff --git a/tests/ImageSharp.Tests/Image/ImageLoadTests.cs b/tests/ImageSharp.Tests/Image/ImageLoadTests.cs index bcec99573..505074a6a 100644 --- a/tests/ImageSharp.Tests/Image/ImageLoadTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageLoadTests.cs @@ -7,9 +7,10 @@ namespace ImageSharp.Tests { using System; using System.IO; - using System.Linq; + using ImageSharp.Formats; using ImageSharp.IO; + using ImageSharp.PixelFormats; using Moq; using Xunit; diff --git a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs index 9f2a6f8c2..902bedb5e 100644 --- a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs @@ -10,6 +10,8 @@ namespace ImageSharp.Tests using System.Linq; using ImageSharp.Formats; using ImageSharp.IO; + using ImageSharp.PixelFormats; + using Moq; using Xunit; diff --git a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs index b48ffd7e9..a6c4b4545 100644 --- a/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs +++ b/tests/ImageSharp.Tests/Image/PixelAccessorTests.cs @@ -8,6 +8,8 @@ namespace ImageSharp.Tests using System; using System.Numerics; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/ImageComparer.cs b/tests/ImageSharp.Tests/ImageComparer.cs index 37b367931..7d0a8377d 100644 --- a/tests/ImageSharp.Tests/ImageComparer.cs +++ b/tests/ImageSharp.Tests/ImageComparer.cs @@ -2,6 +2,8 @@ { using System; using ImageSharp; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs index f7490473d..6a832859a 100644 --- a/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs +++ b/tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs @@ -10,6 +10,9 @@ namespace ImageSharp.Tests using System.IO; using System.Linq; using System.Text; + + using ImageSharp.PixelFormats; + using Xunit; public class ExifProfileTests diff --git a/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs index e4f348203..eccfc13af 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/BackgroundColorTest.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Tests { using System.IO; + using ImageSharp.PixelFormats; + using Xunit; public class BackgroundColorTest : FileTestBase diff --git a/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs b/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs index 4fee996e6..ad1048845 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/GlowTest.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Tests { using System.IO; + using ImageSharp.PixelFormats; + using Xunit; public class GlowTest : FileTestBase diff --git a/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs index f4b3c31ef..2b717a0b7 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/GrayscaleTest.cs @@ -12,6 +12,8 @@ namespace ImageSharp.Tests using ImageSharp.Tests; using System.Numerics; + using ImageSharp.PixelFormats; + public class GrayscaleTest : FileTestBase { /// diff --git a/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs b/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs index f5c627d92..917bb895c 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/ResizeProfilingBenchmarks.cs @@ -3,6 +3,7 @@ namespace ImageSharp.Tests using System.IO; using System.Text; + using ImageSharp.PixelFormats; using ImageSharp.Processing; using ImageSharp.Processing.Processors; diff --git a/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs b/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs index 1519678ac..89794aeaf 100644 --- a/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs +++ b/tests/ImageSharp.Tests/Processors/Filters/VignetteTest.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Tests { using System.IO; + using ImageSharp.PixelFormats; + using Xunit; public class VignetteTest : FileTestBase diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs index 3c4edb7b0..318df5ead 100644 --- a/tests/ImageSharp.Tests/TestFormat.cs +++ b/tests/ImageSharp.Tests/TestFormat.cs @@ -12,6 +12,8 @@ namespace ImageSharp.Tests using System.Linq; using System.Reflection; using ImageSharp.Formats; + using ImageSharp.PixelFormats; + using Xunit; /// diff --git a/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs b/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs index 2791c25b1..4a0950788 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Tests { using System; + using ImageSharp.PixelFormats; + /// /// Utility class to create specialized subclasses of generic classes (eg. ) /// Used as parameter for -based factory methods diff --git a/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs b/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs index 6e82e628c..c4d758bd6 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Tests { + using ImageSharp.PixelFormats; + public class ImageFactory : GenericFactory { public override Image CreateImage(byte[] bytes) => Image.Load(bytes); diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs index e7512cb2d..4252a60b5 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/BlankProvider.cs @@ -6,6 +6,9 @@ namespace ImageSharp.Tests { using System; + + using ImageSharp.PixelFormats; + using Xunit.Abstractions; public abstract partial class TestImageProvider diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs index 1b7bbe4e7..4217d52b0 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -7,6 +7,9 @@ namespace ImageSharp.Tests { using System; using System.Collections.Concurrent; + + using ImageSharp.PixelFormats; + using Xunit.Abstractions; public abstract partial class TestImageProvider diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs index 8739d556d..30e7a63b5 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/LambdaProvider.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Tests { using System; + using ImageSharp.PixelFormats; + /// /// Provides instances for parametric unit tests. /// diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs index c2c903e9e..65d55da55 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs @@ -6,6 +6,9 @@ namespace ImageSharp.Tests { using System; + + using ImageSharp.PixelFormats; + using Xunit.Abstractions; /// diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 643e70617..9d6f46b72 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -7,6 +7,9 @@ namespace ImageSharp.Tests { using System; using System.Reflection; + + using ImageSharp.PixelFormats; + using Xunit.Abstractions; /// diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs index fb30e7fe4..96d38fc40 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs @@ -8,6 +8,9 @@ namespace ImageSharp.Tests using System; using System.Collections.Generic; using System.Numerics; + + using ImageSharp.PixelFormats; + using Xunit.Abstractions; public abstract partial class TestImageProvider diff --git a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs index 43a19040a..6476c4ecf 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -11,6 +11,7 @@ namespace ImageSharp.Tests using System.Reflection; using ImageSharp.Formats; + using ImageSharp.PixelFormats; /// /// Utility class to provide information about the test image & the test case for the test code, diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs index 2a7ea352b..5408d5362 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs @@ -5,6 +5,8 @@ namespace ImageSharp.Tests using System.Collections.Generic; using System.Text; + using ImageSharp.PixelFormats; + public static class TestImageExtensions { public static void DebugSave(this Image img, TestImageProvider provider, string extension = "png") diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs index 2f28896b3..de05e83a9 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestUtilityExtensions.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Tests using System.Linq; using System.Reflection; + using ImageSharp.PixelFormats; + /// /// Extension methods for TestUtilities /// diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs index 0f4025ee4..7d176c1e3 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs @@ -7,6 +7,8 @@ namespace ImageSharp.Tests { using System; + using ImageSharp.PixelFormats; + using Xunit; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs index f47123ef7..29623e1b5 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Tests using System.Numerics; using System.Reflection; + using ImageSharp.PixelFormats; + using Xunit; using Xunit.Abstractions; @@ -51,7 +53,7 @@ namespace ImageSharp.Tests [Fact] public void Baz() { - Type type = typeof(Rgba32).GetTypeInfo().Assembly.GetType("ImageSharp.Rgba32"); + Type type = typeof(Rgba32).GetTypeInfo().Assembly.GetType("ImageSharp.PixelFormats.Rgba32"); this.Output.WriteLine(type.ToString()); Type fake = typeof(Rgba32).GetTypeInfo().Assembly.GetType("ImageSharp.dsaada_DASqewrr"); From 4d0ef94e834487c530d13e8517b9245bf8687c79 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 22 Apr 2017 08:33:51 +1000 Subject: [PATCH 8/9] Update readme and features --- README.md | 7 ++++--- features.md | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d62d430f6..4d079de39 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The **ImageSharp** library is made up of multiple packages. Packages include: - **ImageSharp** - - Contains the Image classes, Colors, Primitives, Configuration, and other core functionality. + - Contains the Image classes, PixelFormats, Primitives, Configuration, and other core functionality. - The IImageFormat interface, Jpeg, Png, Bmp, and Gif formats. - Transform methods like Resize, Crop, Skew, Rotate - Anything that alters the dimensions of the image. - Non-transform methods like Gaussian Blur, Pixelate, Edge Detection - Anything that maintains the original image dimensions. @@ -108,7 +108,8 @@ Setting individual pixel values is perfomed as follows: using (image = new Image(400, 400) using (var pixels = image.Lock()) { - pixels[200, 200] = Color.White; + // Rgba32 is our default PixelFormat, equivalent to System.Drawing Color + pixels[200, 200] = Rgba32.White; } ``` @@ -204,4 +205,4 @@ Become a sponsor and get your logo on our README on Github with a link to your s - + \ No newline at end of file diff --git a/features.md b/features.md index 6bc5630ee..1e35b88e0 100644 --- a/features.md +++ b/features.md @@ -13,6 +13,7 @@ We've achieved a lot so far and hope to do a lot more in the future. We're alway - [ ] Tiff (Help needed) - **Metadata** - [x] EXIF Read/Write (Jpeg just now) + - [ ] ICC (In Progress) - **Quantizers (IQuantizer with alpha channel support, dithering, and thresholding)** - [x] Octree - [x] Xiaolin Wu @@ -28,7 +29,6 @@ We've achieved a lot so far and hope to do a lot more in the future. We're alway - [x] Bayer - [x] Ordered - **Basic color structs with implicit operators.** - - [x] Color - 32bit color in RGBA order (IPackedPixel\). - [x] Bgra32 - [x] CIE Lab - [x] CIE XYZ @@ -38,7 +38,7 @@ We've achieved a lot so far and hope to do a lot more in the future. We're alway - [x] YCbCr - **IPackedPixel representations of color models. Compatible with Microsoft XNA Game Studio and MonoGame IPackedVector\.** - [x] Alpha8 - - [x] Argb + - [x] Argb32 - [x] Bgr565 - [x] Bgra444 - [x] Bgra565 @@ -52,7 +52,9 @@ We've achieved a lot so far and hope to do a lot more in the future. We're alway - [x] NormalizedShort4 - [x] Rg32 - [x] Rgba1010102 + - [x] Rgba32 - 32bit color in RGBA order - Our default pixel format. - [x] Rgba64 + - [x] RgbaVector - [x] Short2 - [x] Short4 - **Basic shape primitives.** From ba2e3e1a153d7f3f9528a5dda5d180eecf91fd8e Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 22 Apr 2017 09:18:18 +1000 Subject: [PATCH 9/9] Fix pixel xml docs to add ranges and remove duplication --- src/ImageSharp/PixelFormats/Alpha8.cs | 3 ++- src/ImageSharp/PixelFormats/Argb32.cs | 1 + src/ImageSharp/PixelFormats/Bgr565.cs | 1 + src/ImageSharp/PixelFormats/Bgra4444.cs | 1 + src/ImageSharp/PixelFormats/Byte4.cs | 1 + src/ImageSharp/PixelFormats/HalfSingle.cs | 1 + src/ImageSharp/PixelFormats/HalfVector2.cs | 1 + src/ImageSharp/PixelFormats/HalfVector4.cs | 1 + src/ImageSharp/PixelFormats/NormalizedByte2.cs | 1 + src/ImageSharp/PixelFormats/NormalizedByte4.cs | 1 + src/ImageSharp/PixelFormats/NormalizedShort2.cs | 1 + src/ImageSharp/PixelFormats/NormalizedShort4.cs | 1 + src/ImageSharp/PixelFormats/Rg32.cs | 1 + src/ImageSharp/PixelFormats/Rgba1010102.cs | 1 + src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs | 11 +++-------- .../PixelFormats/Rgba32.ColorspaceTransforms.cs | 11 +++-------- src/ImageSharp/PixelFormats/Rgba32.Definitions.cs | 11 +++-------- src/ImageSharp/PixelFormats/Rgba32.Transforms.cs | 11 +++-------- src/ImageSharp/PixelFormats/Rgba32.cs | 1 + src/ImageSharp/PixelFormats/Rgba64.cs | 1 + .../PixelFormats/RgbaVector.BulkOperations.cs | 11 +++-------- src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs | 11 +++-------- src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs | 11 +++-------- src/ImageSharp/PixelFormats/RgbaVector.cs | 1 + src/ImageSharp/PixelFormats/Short2.cs | 1 + src/ImageSharp/PixelFormats/Short4.cs | 1 + src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs | 2 +- 27 files changed, 42 insertions(+), 58 deletions(-) diff --git a/src/ImageSharp/PixelFormats/Alpha8.cs b/src/ImageSharp/PixelFormats/Alpha8.cs index a7b464b1a..5e2fff5d0 100644 --- a/src/ImageSharp/PixelFormats/Alpha8.cs +++ b/src/ImageSharp/PixelFormats/Alpha8.cs @@ -10,7 +10,8 @@ namespace ImageSharp.PixelFormats using System.Runtime.CompilerServices; /// - /// Packed pixel type containing a single 8 bit normalized W values ranging from 0 to 1. + /// Packed pixel type containing a single 8 bit normalized W values. + /// Ranges from <0, 0, 0, 0> to <0, 0, 0, 1> in vector form. /// public struct Alpha8 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Argb32.cs b/src/ImageSharp/PixelFormats/Argb32.cs index 3cad9e957..a6db505bb 100644 --- a/src/ImageSharp/PixelFormats/Argb32.cs +++ b/src/ImageSharp/PixelFormats/Argb32.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 8-bit unsigned normalized values ranging from 0 to 255. /// The color components are stored in alpha, red, green, and blue order. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// /// /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, diff --git a/src/ImageSharp/PixelFormats/Bgr565.cs b/src/ImageSharp/PixelFormats/Bgr565.cs index f99b55816..a3d8cbcf2 100644 --- a/src/ImageSharp/PixelFormats/Bgr565.cs +++ b/src/ImageSharp/PixelFormats/Bgr565.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing unsigned normalized values ranging from 0 to 1. The x and z components use 5 bits, and the y component uses 6 bits. + /// Ranges from <0, 0, 0, 1> to <1, 1, 1, 1> in vector form. /// public struct Bgr565 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Bgra4444.cs b/src/ImageSharp/PixelFormats/Bgra4444.cs index ea188e7c5..8d4e9b4f4 100644 --- a/src/ImageSharp/PixelFormats/Bgra4444.cs +++ b/src/ImageSharp/PixelFormats/Bgra4444.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing unsigned normalized values, ranging from 0 to 1, using 4 bits each for x, y, z, and w. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// public struct Bgra4444 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Byte4.cs b/src/ImageSharp/PixelFormats/Byte4.cs index 884f8331b..acb73dd1c 100644 --- a/src/ImageSharp/PixelFormats/Byte4.cs +++ b/src/ImageSharp/PixelFormats/Byte4.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 8-bit unsigned integer values, ranging from 0 to 255. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// public struct Byte4 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/HalfSingle.cs b/src/ImageSharp/PixelFormats/HalfSingle.cs index c9a27382a..893667fc7 100644 --- a/src/ImageSharp/PixelFormats/HalfSingle.cs +++ b/src/ImageSharp/PixelFormats/HalfSingle.cs @@ -10,6 +10,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing a single 16 bit floating point value. + /// Ranges from <0, 0, 0, 1> to <1, 0, 0, 1> in vector form. /// public struct HalfSingle : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/HalfVector2.cs b/src/ImageSharp/PixelFormats/HalfVector2.cs index 85feea582..bd3cda55d 100644 --- a/src/ImageSharp/PixelFormats/HalfVector2.cs +++ b/src/ImageSharp/PixelFormats/HalfVector2.cs @@ -10,6 +10,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing two 16-bit floating-point values. + /// Ranges from <0, 0, 0, 1> to <1, 0, 0, 1> in vector form. /// public struct HalfVector2 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/HalfVector4.cs b/src/ImageSharp/PixelFormats/HalfVector4.cs index ef844253b..03e4326b7 100644 --- a/src/ImageSharp/PixelFormats/HalfVector4.cs +++ b/src/ImageSharp/PixelFormats/HalfVector4.cs @@ -10,6 +10,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 16-bit floating-point values. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// public struct HalfVector4 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/NormalizedByte2.cs b/src/ImageSharp/PixelFormats/NormalizedByte2.cs index 779b26a7a..dab113ae7 100644 --- a/src/ImageSharp/PixelFormats/NormalizedByte2.cs +++ b/src/ImageSharp/PixelFormats/NormalizedByte2.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed packed pixel type containing two 8-bit signed normalized values, ranging from −1 to 1. + /// Ranges from <-1, -1, 0, 1> to <1, 1, 0, 1> in vector form. /// public struct NormalizedByte2 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/NormalizedByte4.cs b/src/ImageSharp/PixelFormats/NormalizedByte4.cs index f7fe36cea..0cb5c756b 100644 --- a/src/ImageSharp/PixelFormats/NormalizedByte4.cs +++ b/src/ImageSharp/PixelFormats/NormalizedByte4.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 8-bit signed normalized values, ranging from −1 to 1. + /// Ranges from <-1, -1, -1, -1> to <1, 1, 1, 1> in vector form. /// public struct NormalizedByte4 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/NormalizedShort2.cs b/src/ImageSharp/PixelFormats/NormalizedShort2.cs index f0fba66e5..86d80cbad 100644 --- a/src/ImageSharp/PixelFormats/NormalizedShort2.cs +++ b/src/ImageSharp/PixelFormats/NormalizedShort2.cs @@ -10,6 +10,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing two 16-bit signed normalized values, ranging from −1 to 1. + /// Ranges from <-1, -1, 0, 1> to <1, 1, 0, 1> in vector form. /// public struct NormalizedShort2 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/NormalizedShort4.cs b/src/ImageSharp/PixelFormats/NormalizedShort4.cs index 6701aab03..8512d4131 100644 --- a/src/ImageSharp/PixelFormats/NormalizedShort4.cs +++ b/src/ImageSharp/PixelFormats/NormalizedShort4.cs @@ -10,6 +10,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 16-bit signed normalized values, ranging from −1 to 1. + /// Ranges from <-1, -1, -1, -1> to <1, 1, 1, 1> in vector form. /// public struct NormalizedShort4 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Rg32.cs b/src/ImageSharp/PixelFormats/Rg32.cs index b0134d9b6..a4bfc5823 100644 --- a/src/ImageSharp/PixelFormats/Rg32.cs +++ b/src/ImageSharp/PixelFormats/Rg32.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing two 16-bit unsigned normalized values ranging from 0 to 1. + /// Ranges from <0, 0, 0, 1> to <1, 1, 0, 1> in vector form. /// public struct Rg32 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Rgba1010102.cs b/src/ImageSharp/PixelFormats/Rgba1010102.cs index f014dbb8d..cfd60f410 100644 --- a/src/ImageSharp/PixelFormats/Rgba1010102.cs +++ b/src/ImageSharp/PixelFormats/Rgba1010102.cs @@ -12,6 +12,7 @@ namespace ImageSharp.PixelFormats /// /// Packed vector type containing unsigned normalized values ranging from 0 to 1. /// The x, y and z components use 10 bits, and the w component uses 2 bits. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// public struct Rgba1010102 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs b/src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs index 42b37bebd..df21cdc70 100644 --- a/src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.BulkOperations.cs @@ -10,14 +10,9 @@ namespace ImageSharp.PixelFormats using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - /// - /// Unpacked pixel 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. - /// + /// + /// Provides optimized overrides for bulk operations. + /// public partial struct Rgba32 { /// diff --git a/src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs b/src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs index f896eb69b..45d3489b7 100644 --- a/src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.ColorspaceTransforms.cs @@ -9,14 +9,9 @@ namespace ImageSharp.PixelFormats using System.Numerics; using Colors.Spaces; - /// - /// Packed pixel 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. - /// + /// + /// Provides implicit colorspace transformation. + /// public partial struct Rgba32 { /// diff --git a/src/ImageSharp/PixelFormats/Rgba32.Definitions.cs b/src/ImageSharp/PixelFormats/Rgba32.Definitions.cs index 3ba5f6133..be02d0875 100644 --- a/src/ImageSharp/PixelFormats/Rgba32.Definitions.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.Definitions.cs @@ -5,14 +5,9 @@ namespace ImageSharp.PixelFormats { - /// - /// 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. - /// + /// + /// Provides standardized deifinitions for named colors. + /// public partial struct Rgba32 { /// diff --git a/src/ImageSharp/PixelFormats/Rgba32.Transforms.cs b/src/ImageSharp/PixelFormats/Rgba32.Transforms.cs index 86638b814..bd13a2de1 100644 --- a/src/ImageSharp/PixelFormats/Rgba32.Transforms.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.Transforms.cs @@ -8,14 +8,9 @@ namespace ImageSharp.PixelFormats using System.Numerics; using System.Runtime.CompilerServices; - /// - /// Packed pixel 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. - /// + /// + /// Provides operators and composition algorithms. + /// public partial struct Rgba32 { /// diff --git a/src/ImageSharp/PixelFormats/Rgba32.cs b/src/ImageSharp/PixelFormats/Rgba32.cs index 18759bce0..d668be76f 100644 --- a/src/ImageSharp/PixelFormats/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/Rgba32.cs @@ -12,6 +12,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel 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. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// /// /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, diff --git a/src/ImageSharp/PixelFormats/Rgba64.cs b/src/ImageSharp/PixelFormats/Rgba64.cs index a5f3e087c..20bba9f41 100644 --- a/src/ImageSharp/PixelFormats/Rgba64.cs +++ b/src/ImageSharp/PixelFormats/Rgba64.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 16-bit unsigned normalized values ranging from 0 to 1. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// public struct Rgba64 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs b/src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs index 353412dd1..9dcfc9074 100644 --- a/src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.BulkOperations.cs @@ -7,14 +7,9 @@ namespace ImageSharp.PixelFormats { using System.Numerics; - /// - /// Unpacked pixel type containing four 16-bit unsigned normalized 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. - /// + /// + /// Provides optimized overrides for bulk operations. + /// public partial struct RgbaVector { /// diff --git a/src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs b/src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs index 61d24d191..dc965f9ff 100644 --- a/src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.Definitions.cs @@ -5,14 +5,9 @@ namespace ImageSharp.PixelFormats { - /// - /// 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. - /// + /// + /// Provides operators and composition algorithms. + /// public partial struct RgbaVector { /// diff --git a/src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs b/src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs index 03b344721..fec1aa346 100644 --- a/src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.Transforms.cs @@ -8,14 +8,9 @@ namespace ImageSharp.PixelFormats using System.Numerics; using System.Runtime.CompilerServices; - /// - /// 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. - /// + /// + /// Provides operators and composition algorithms. + /// public partial struct RgbaVector { /// diff --git a/src/ImageSharp/PixelFormats/RgbaVector.cs b/src/ImageSharp/PixelFormats/RgbaVector.cs index df5b231f3..c59e93259 100644 --- a/src/ImageSharp/PixelFormats/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/RgbaVector.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// 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. + /// Ranges from <0, 0, 0, 0> to <1, 1, 1, 1> in vector form. /// /// /// This struct is fully mutable. This is done (against the guidelines) for the sake of performance, diff --git a/src/ImageSharp/PixelFormats/Short2.cs b/src/ImageSharp/PixelFormats/Short2.cs index 0721718ff..60fbb5b35 100644 --- a/src/ImageSharp/PixelFormats/Short2.cs +++ b/src/ImageSharp/PixelFormats/Short2.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing two 16-bit signed integer values. + /// Ranges from <-32767, -32767, 0, 1> to <32767, 32767, 0, 1> in vector form. /// public struct Short2 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Short4.cs b/src/ImageSharp/PixelFormats/Short4.cs index b5b4287df..65ce51eb2 100644 --- a/src/ImageSharp/PixelFormats/Short4.cs +++ b/src/ImageSharp/PixelFormats/Short4.cs @@ -11,6 +11,7 @@ namespace ImageSharp.PixelFormats /// /// Packed pixel type containing four 16-bit signed integer values. + /// Ranges from <-37267, -37267, -37267, -37267> to <37267, 37267, 37267, 37267> in vector form. /// public struct Short4 : IPixel, IPackedVector { diff --git a/src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs b/src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs index 17e1c7db5..87c7a289e 100644 --- a/src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs +++ b/src/ImageSharp/PixelFormats/Vector4BlendTransforms.cs @@ -289,4 +289,4 @@ namespace ImageSharp.PixelFormats return b + s - (2F * b * s); } } -} +} \ No newline at end of file