diff --git a/src/ImageSharp/ColorSpaces/CieLch.cs b/src/ImageSharp/ColorSpaces/CieLch.cs
index 1b9cf9c2b..57ed5f48d 100644
--- a/src/ImageSharp/ColorSpaces/CieLch.cs
+++ b/src/ImageSharp/ColorSpaces/CieLch.cs
@@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has L, C, H values set to zero.
///
- public static readonly CieLch Empty = default(CieLch);
+ public static readonly CieLch Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/CieLchuv.cs b/src/ImageSharp/ColorSpaces/CieLchuv.cs
index 7ec27806d..a378aae86 100644
--- a/src/ImageSharp/ColorSpaces/CieLchuv.cs
+++ b/src/ImageSharp/ColorSpaces/CieLchuv.cs
@@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has L, C, H values set to zero.
///
- public static readonly CieLchuv Empty = default(CieLchuv);
+ public static readonly CieLchuv Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/CieLuv.cs b/src/ImageSharp/ColorSpaces/CieLuv.cs
index e46b736a7..f93e1fd46 100644
--- a/src/ImageSharp/ColorSpaces/CieLuv.cs
+++ b/src/ImageSharp/ColorSpaces/CieLuv.cs
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has L, U, and V values set to zero.
///
- public static readonly CieLuv Empty = default(CieLuv);
+ public static readonly CieLuv Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
index d54de43bb..6716b1bad 100644
--- a/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyChromaticityCoordinates.cs
@@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has X, Y values set to zero.
///
- public static readonly CieXyChromaticityCoordinates Empty = default(CieXyChromaticityCoordinates);
+ public static readonly CieXyChromaticityCoordinates Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/CieXyy.cs b/src/ImageSharp/ColorSpaces/CieXyy.cs
index 9633f83ad..71ad4701a 100644
--- a/src/ImageSharp/ColorSpaces/CieXyy.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyy.cs
@@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has X, Y, and Y values set to zero.
///
- public static readonly CieXyy Empty = default(CieXyy);
+ public static readonly CieXyy Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/CieXyz.cs b/src/ImageSharp/ColorSpaces/CieXyz.cs
index eedfed079..79676bb08 100644
--- a/src/ImageSharp/ColorSpaces/CieXyz.cs
+++ b/src/ImageSharp/ColorSpaces/CieXyz.cs
@@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has X, Y, and Z values set to zero.
///
- public static readonly CieXyz Empty = default(CieXyz);
+ public static readonly CieXyz Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/Cmyk.cs b/src/ImageSharp/ColorSpaces/Cmyk.cs
index 2e44ea920..989d512bb 100644
--- a/src/ImageSharp/ColorSpaces/Cmyk.cs
+++ b/src/ImageSharp/ColorSpaces/Cmyk.cs
@@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has C, M, Y, and K values set to zero.
///
- public static readonly Cmyk Empty = default(Cmyk);
+ public static readonly Cmyk Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs
index 9268f3a70..3f5c2e246 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.CieLabColorSapce;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.CieLchColorSapce;
@@ -45,8 +44,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -58,8 +55,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -71,8 +66,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -92,7 +85,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
: color;
// Conversion
- CieXyzToCieLabConverter converter = new CieXyzToCieLabConverter(this.TargetLabWhitePoint);
+ var converter = new CieXyzToCieLabConverter(this.TargetLabWhitePoint);
return converter.Convert(adapted);
}
@@ -116,8 +109,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -142,8 +133,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -155,8 +144,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -168,8 +155,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -181,8 +166,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
@@ -194,8 +177,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLab ToCieLab(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLab(xyzColor);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs
index 13dae4b17..469875c02 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs
@@ -22,8 +22,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
// Adaptation
CieLab adapted = this.IsChromaticAdaptationPerformed ? this.Adapt(color) : color;
@@ -38,8 +36,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -51,8 +47,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -64,8 +58,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -77,8 +69,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
CieLab labColor = this.ToCieLab(color);
return this.ToCieLch(labColor);
}
@@ -103,8 +93,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -116,8 +104,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -129,8 +115,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -142,8 +126,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -155,8 +137,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -168,8 +148,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
@@ -181,8 +159,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLch ToCieLch(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLch(xyzColor);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs
index cef63e73d..a5b5220b9 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs
@@ -22,8 +22,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -35,8 +33,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -48,8 +44,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
// Adaptation
CieLuv adapted = this.IsChromaticAdaptationPerformed ? this.Adapt(color) : color;
@@ -64,8 +58,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -77,8 +69,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
CieLab labColor = this.ToCieLab(color);
return this.ToCieLchuv(labColor);
}
@@ -90,8 +80,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -103,8 +91,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -116,8 +102,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -129,8 +113,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -142,8 +124,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -155,8 +135,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -168,8 +146,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
@@ -181,8 +157,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLchuv ToCieLchuv(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
CieXyz xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(xyzColor);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs
index 04aee4897..7260a818f 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs
@@ -21,8 +21,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -34,8 +32,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -47,8 +43,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion (perserving white point)
CieLuv unadapted = CieLchuvToCieLuvConverter.Convert(color);
@@ -68,8 +62,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -81,8 +73,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
// Adaptation
CieXyz adapted = !this.WhitePoint.Equals(this.TargetLabWhitePoint) && this.IsChromaticAdaptationPerformed
? this.ChromaticAdaptation.Transform(color, this.WhitePoint, this.TargetLabWhitePoint)
@@ -100,8 +90,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -113,8 +101,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -126,8 +112,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -139,8 +123,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -152,8 +134,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -165,8 +145,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -178,8 +156,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
@@ -191,8 +167,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public CieLuv ToCieLuv(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs
index 637c121ea..708c2eac0 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.CmykColorSapce;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion
@@ -20,8 +19,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -34,8 +31,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -48,8 +43,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -62,8 +55,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -76,8 +67,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -90,8 +79,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return CmykAndRgbConverter.Convert(rgb);
@@ -104,8 +91,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return CmykAndRgbConverter.Convert(rgb);
@@ -118,8 +103,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return CmykAndRgbConverter.Convert(rgb);
@@ -132,8 +115,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -146,8 +127,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return CmykAndRgbConverter.Convert(rgb);
@@ -160,8 +139,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToCmyk(xyzColor);
@@ -174,8 +151,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
return CmykAndRgbConverter.Convert(color);
}
@@ -186,8 +161,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Cmyk ToCmyk(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return CmykAndRgbConverter.Convert(rgb);
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs
index dbc31c52b..909658a06 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HslColorSapce;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion
@@ -20,8 +19,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -34,8 +31,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -48,8 +43,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -62,8 +55,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -76,8 +67,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -90,8 +79,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return HslAndRgbConverter.Convert(rgb);
@@ -104,8 +91,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return HslAndRgbConverter.Convert(rgb);
@@ -118,8 +103,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return HslAndRgbConverter.Convert(rgb);
@@ -132,8 +115,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -146,8 +127,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return HslAndRgbConverter.Convert(rgb);
@@ -160,8 +139,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHsl(xyzColor);
@@ -174,8 +151,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
return HslAndRgbConverter.Convert(color);
}
@@ -186,8 +161,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Hsl ToHsl(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return HslAndRgbConverter.Convert(rgb);
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs
index f5ab4d645..880a91551 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs
@@ -17,8 +17,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -30,8 +28,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -43,8 +39,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -56,8 +50,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -69,8 +61,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -82,8 +72,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
// Adaptation
CieXyz adapted = !this.WhitePoint.Equals(this.TargetHunterLabWhitePoint) && this.IsChromaticAdaptationPerformed
? this.ChromaticAdaptation.Transform(color, this.WhitePoint, this.TargetHunterLabWhitePoint)
@@ -100,8 +88,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -113,8 +99,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -126,8 +110,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -139,8 +121,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -152,8 +132,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -165,8 +143,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
@@ -178,8 +154,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public HunterLab ToHunterLab(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToHunterLab(xyzColor);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs
index 7b45704af..91c78b3ea 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs
@@ -21,8 +21,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -34,8 +32,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -47,8 +43,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -60,8 +54,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -73,8 +65,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -86,8 +76,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
// Adaptation
CieXyz adapted = this.TargetRgbWorkingSpace.WhitePoint.Equals(this.WhitePoint) || !this.IsChromaticAdaptationPerformed
? color
@@ -105,8 +93,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return this.ToLinearRgb(rgb);
}
@@ -118,8 +104,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return this.ToLinearRgb(rgb);
}
@@ -144,8 +128,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -157,8 +139,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLinearRgb(xyzColor);
}
@@ -170,8 +150,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion
return RgbToLinearRgbConverter.Convert(color);
}
@@ -183,8 +161,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public LinearRgb ToLinearRgb(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return this.ToLinearRgb(rgb);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs
index ac3adee63..1de0d70d3 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs
@@ -17,8 +17,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -30,8 +28,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -43,8 +39,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -56,8 +50,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -69,8 +61,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -82,9 +72,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
- // Conversion
return this.cachedCieXyzAndLmsConverter.Convert(color);
}
@@ -95,8 +82,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -108,8 +93,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -121,8 +104,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -134,8 +115,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -147,8 +126,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -160,8 +137,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
@@ -173,8 +148,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Lms ToLms(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToLms(xyzColor);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs
index 6844e3a3c..45beecf66 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs
@@ -19,8 +19,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -32,8 +30,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -45,8 +41,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -58,8 +52,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -71,8 +63,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -84,8 +74,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion
var linear = this.ToLinearRgb(color);
@@ -100,8 +88,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion
return CmykAndRgbConverter.Convert(color);
}
@@ -113,8 +99,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion
return HsvAndRgbConverter.Convert(color);
}
@@ -139,8 +123,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -152,8 +134,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion
return LinearRgbToRgbConverter.Convert(color);
}
@@ -165,8 +145,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToRgb(xyzColor);
}
@@ -178,8 +156,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public Rgb ToRgb(YCbCr color)
{
- Guard.NotNull(color, nameof(color));
-
// Conversion
Rgb rgb = YCbCrAndRgbConverter.Convert(color);
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs
index 8da7dcb7e..97d9f3818 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.YCbCrColorSapce;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion
@@ -20,8 +19,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(CieLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -34,8 +31,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(CieLch color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -48,8 +43,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(CieLchuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -62,8 +55,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(CieLuv color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -76,8 +67,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(CieXyy color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -90,8 +79,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(CieXyz color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return YCbCrAndRgbConverter.Convert(rgb);
@@ -104,8 +91,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(Cmyk color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return YCbCrAndRgbConverter.Convert(rgb);
@@ -118,8 +103,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(Hsl color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return YCbCrAndRgbConverter.Convert(rgb);
@@ -132,8 +115,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(Hsv color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return YCbCrAndRgbConverter.Convert(rgb);
@@ -146,8 +127,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(HunterLab color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -160,8 +139,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(LinearRgb color)
{
- Guard.NotNull(color, nameof(color));
-
var rgb = this.ToRgb(color);
return YCbCrAndRgbConverter.Convert(rgb);
@@ -174,8 +151,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(Lms color)
{
- Guard.NotNull(color, nameof(color));
-
var xyzColor = this.ToCieXyz(color);
return this.ToYCbCr(xyzColor);
@@ -188,8 +163,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
/// The
public YCbCr ToYCbCr(Rgb color)
{
- Guard.NotNull(color, nameof(color));
-
return YCbCrAndRgbConverter.Convert(color);
}
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs
index 64fc84b1d..bb7d6bb3f 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/CieXyy/CieXyzAndCieXyyConverter.cs
@@ -3,7 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.CieXyyColorSapce
{
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs
index 404bc811f..ed86ec9a5 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Cmyk/CmykAndRgbConverter.cs
@@ -3,7 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.CmykColorSapce
{
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs
index 3de3baddd..2bdbbceca 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsl/HslAndRgbConverter.cs
@@ -3,7 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HslColorSapce
{
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsv/HsvAndRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsv/HsvAndRgbConverter.cs
index 6219533ca..981b8f3ab 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsv/HsvAndRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Hsv/HsvAndRgbConverter.cs
@@ -3,7 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HsvColorSapce
{
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs
index 85b0efd16..2d4e3b0e7 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzAndHunterLabConverterBase.cs
@@ -18,8 +18,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HunterLabCo
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float ComputeKa(CieXyz whitePoint)
{
- DebugGuard.NotNull(whitePoint, nameof(whitePoint));
-
if (whitePoint.Equals(Illuminants.C))
{
return 175F;
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs
index 7faf03c9a..309663796 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/CieXyzToHunterLabConverter.cs
@@ -3,7 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HunterLabColorSapce
{
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs
index 7e7c536e3..228d7362b 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/HunterLab/HunterLabToCieXyzConverter.cs
@@ -3,7 +3,6 @@
using System;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HunterLabColorSapce
{
@@ -16,8 +15,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.HunterLabCo
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz Convert(HunterLab input)
{
- DebugGuard.NotNull(input, nameof(input));
-
// Conversion algorithm described here: http://en.wikipedia.org/wiki/Lab_color_space#Hunter_Lab
float l = input.L, a = input.A, b = input.B;
float xn = input.WhitePoint.X, yn = input.WhitePoint.Y, zn = input.WhitePoint.Z;
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs
index 780c9e5a6..5241b62f9 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Lms/CieXyzAndLmsConverter.cs
@@ -3,7 +3,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.LmsColorSapce
{
@@ -63,8 +62,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.LmsColorSap
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Lms Convert(CieXyz input)
{
- DebugGuard.NotNull(input, nameof(input));
-
Vector3 vector = Vector3.Transform(input.Vector, this.transformationMatrix);
return new Lms(vector);
}
@@ -73,8 +70,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.LmsColorSap
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieXyz Convert(Lms input)
{
- DebugGuard.NotNull(input, nameof(input));
-
Vector3 vector = Vector3.Transform(input.Vector, this.inverseTransformationMatrix);
return new CieXyz(vector);
}
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LCompanding.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LCompanding.cs
index 30cd8dc51..309ae2183 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LCompanding.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LCompanding.cs
@@ -32,4 +32,4 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.RgbColorSap
: MathF.Pow(1.16F * channel, 0.3333333F) - 0.16F;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LinearRgbAndCieXyzConverterBase.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LinearRgbAndCieXyzConverterBase.cs
index b40a02af7..a0da2bc26 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LinearRgbAndCieXyzConverterBase.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/LinearRgbAndCieXyzConverterBase.cs
@@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.RgbColorSap
const float Yb = 1;
float mZb = (1 - xb - yb) / yb;
- Matrix4x4 xyzMatrix = new Matrix4x4
+ var xyzMatrix = new Matrix4x4
{
M11 = mXr, M21 = mXg, M31 = mXb,
M12 = Yr, M22 = Yg, M32 = Yb,
@@ -48,8 +48,7 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.RgbColorSap
M44 = 1F
};
- Matrix4x4 inverseXyzMatrix;
- Matrix4x4.Invert(xyzMatrix, out inverseXyzMatrix);
+ Matrix4x4.Invert(xyzMatrix, out Matrix4x4 inverseXyzMatrix);
Vector3 vector = Vector3.Transform(workingSpace.WhitePoint.Vector, inverseXyzMatrix);
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/RgbToLinearRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/RgbToLinearRgbConverter.cs
index e40ecc192..ed415df8c 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/RgbToLinearRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/Rgb/RgbToLinearRgbConverter.cs
@@ -13,8 +13,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.RgbColorSap
///
public LinearRgb Convert(Rgb input)
{
- Guard.NotNull(input, nameof(input));
-
Vector3 vector = input.Vector;
vector.X = input.WorkingSpace.Companding.Expand(vector.X);
vector.Y = input.WorkingSpace.Companding.Expand(vector.Y);
diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/YCbCr/YCbCrAndRgbConverter.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/YCbCr/YCbCrAndRgbConverter.cs
index f552acbb4..aa9668b82 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/YCbCr/YCbCrAndRgbConverter.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/YCbCr/YCbCrAndRgbConverter.cs
@@ -4,7 +4,6 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
-using SixLabors.ImageSharp.ColorSpaces;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.YCbCrColorSapce
{
diff --git a/src/ImageSharp/ColorSpaces/Conversion/VonKriesChromaticAdaptation.cs b/src/ImageSharp/ColorSpaces/Conversion/VonKriesChromaticAdaptation.cs
index 6edae9301..22ba5928e 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/VonKriesChromaticAdaptation.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/VonKriesChromaticAdaptation.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation.LmsColorSapce;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion
@@ -50,10 +49,6 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
///
public CieXyz Transform(CieXyz sourceColor, CieXyz sourceWhitePoint, CieXyz targetWhitePoint)
{
- Guard.NotNull(sourceColor, nameof(sourceColor));
- Guard.NotNull(sourceWhitePoint, nameof(sourceWhitePoint));
- Guard.NotNull(targetWhitePoint, nameof(targetWhitePoint));
-
if (sourceWhitePoint.Equals(targetWhitePoint))
{
return sourceColor;
diff --git a/src/ImageSharp/ColorSpaces/Hsl.cs b/src/ImageSharp/ColorSpaces/Hsl.cs
index 3b2ceae27..88b14fa97 100644
--- a/src/ImageSharp/ColorSpaces/Hsl.cs
+++ b/src/ImageSharp/ColorSpaces/Hsl.cs
@@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has H, S, and L values set to zero.
///
- public static readonly Hsl Empty = default(Hsl);
+ public static readonly Hsl Empty = default;
///
/// Max range used for clamping
diff --git a/src/ImageSharp/ColorSpaces/Hsv.cs b/src/ImageSharp/ColorSpaces/Hsv.cs
index f646eb29d..1f6c8d5eb 100644
--- a/src/ImageSharp/ColorSpaces/Hsv.cs
+++ b/src/ImageSharp/ColorSpaces/Hsv.cs
@@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has H, S, and V values set to zero.
///
- public static readonly Hsv Empty = default(Hsv);
+ public static readonly Hsv Empty = default;
///
/// Max range used for clamping
diff --git a/src/ImageSharp/ColorSpaces/HunterLab.cs b/src/ImageSharp/ColorSpaces/HunterLab.cs
index 4ace27def..4395d9d7c 100644
--- a/src/ImageSharp/ColorSpaces/HunterLab.cs
+++ b/src/ImageSharp/ColorSpaces/HunterLab.cs
@@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has L, A, B values set to zero.
///
- public static readonly HunterLab Empty = default(HunterLab);
+ public static readonly HunterLab Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/LinearRgb.cs b/src/ImageSharp/ColorSpaces/LinearRgb.cs
index f2dc297a0..c721347be 100644
--- a/src/ImageSharp/ColorSpaces/LinearRgb.cs
+++ b/src/ImageSharp/ColorSpaces/LinearRgb.cs
@@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has R, G, and B values set to zero.
///
- public static readonly LinearRgb Empty = default(LinearRgb);
+ public static readonly LinearRgb Empty = default;
///
/// The default LinearRgb working space
diff --git a/src/ImageSharp/ColorSpaces/Lms.cs b/src/ImageSharp/ColorSpaces/Lms.cs
index 09c20269a..e46249569 100644
--- a/src/ImageSharp/ColorSpaces/Lms.cs
+++ b/src/ImageSharp/ColorSpaces/Lms.cs
@@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has L, M, and S values set to zero.
///
- public static readonly Lms Empty = default(Lms);
+ public static readonly Lms Empty = default;
///
/// The backing vector for SIMD support.
diff --git a/src/ImageSharp/ColorSpaces/Rgb.cs b/src/ImageSharp/ColorSpaces/Rgb.cs
index 128239467..8cdf54ace 100644
--- a/src/ImageSharp/ColorSpaces/Rgb.cs
+++ b/src/ImageSharp/ColorSpaces/Rgb.cs
@@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has R, G, and B values set to zero.
///
- public static readonly Rgb Empty = default(Rgb);
+ public static readonly Rgb Empty = default;
///
/// The default rgb working space
diff --git a/src/ImageSharp/ColorSpaces/YCbCr.cs b/src/ImageSharp/ColorSpaces/YCbCr.cs
index a6e27de94..2c3feffa9 100644
--- a/src/ImageSharp/ColorSpaces/YCbCr.cs
+++ b/src/ImageSharp/ColorSpaces/YCbCr.cs
@@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.ColorSpaces
///
/// Represents a that has Y, Cb, and Cr values set to zero.
///
- public static readonly YCbCr Empty = default(YCbCr);
+ public static readonly YCbCr Empty = default;
///
/// Vector which is used in clamping to the max value
diff --git a/src/ImageSharp/Common/Exceptions/ImageFormatException.cs b/src/ImageSharp/Common/Exceptions/ImageFormatException.cs
index 7a91756b6..89877b1b6 100644
--- a/src/ImageSharp/Common/Exceptions/ImageFormatException.cs
+++ b/src/ImageSharp/Common/Exceptions/ImageFormatException.cs
@@ -11,13 +11,6 @@ namespace SixLabors.ImageSharp
///
public sealed class ImageFormatException : Exception
{
- ///
- /// Initializes a new instance of the class.
- ///
- public ImageFormatException()
- {
- }
-
///
/// Initializes a new instance of the class with the name of the
/// parameter that causes this exception.
diff --git a/src/ImageSharp/Common/Exceptions/ImageProcessingException.cs b/src/ImageSharp/Common/Exceptions/ImageProcessingException.cs
index eb50d0b65..3c75a6418 100644
--- a/src/ImageSharp/Common/Exceptions/ImageProcessingException.cs
+++ b/src/ImageSharp/Common/Exceptions/ImageProcessingException.cs
@@ -10,13 +10,6 @@ namespace SixLabors.ImageSharp
///
public sealed class ImageProcessingException : Exception
{
- ///
- /// Initializes a new instance of the class.
- ///
- public ImageProcessingException()
- {
- }
-
///
/// Initializes a new instance of the class with the name of the
/// parameter that causes this exception.
@@ -39,4 +32,4 @@ namespace SixLabors.ImageSharp
{
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/Common/Helpers/ImageMaths.cs b/src/ImageSharp/Common/Helpers/ImageMaths.cs
index 75c9190d2..8a2ece4be 100644
--- a/src/ImageSharp/Common/Helpers/ImageMaths.cs
+++ b/src/ImageSharp/Common/Helpers/ImageMaths.cs
@@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Linq;
-using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccFormulaCurveElement.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccFormulaCurveElement.cs
index 5d931039c..d168c5c28 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccFormulaCurveElement.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccFormulaCurveElement.cs
@@ -90,4 +90,4 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return this.Equals((IccCurveSegment)other);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
index d916486db..a7ce0e809 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
@@ -7,7 +7,7 @@ using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
///
- /// A one dimensional curve
+ /// A one dimensional ICC curve.
///
internal sealed class IccOneDimensionalCurve : IEquatable
{
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs
index ee8b4c731..9c3f8aa5e 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs
@@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public bool Equals(IccParametricCurve other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -148,7 +148,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
index 8a7162198..02a817b8c 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs
@@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public bool Equals(IccResponseCurve other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -86,8 +86,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
unchecked
{
int hashCode = (int)this.CurveType;
- hashCode = (hashCode * 397) ^ (this.XyzValues != null ? this.XyzValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.ResponseArrays != null ? this.ResponseArrays.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.XyzValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.ResponseArrays?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.cs
index 0ea404ad9..ee91ad7a1 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.cs
@@ -191,7 +191,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
/// The curve data
private IccTagDataEntry[] ReadCurves(int count)
{
- IccTagDataEntry[] tdata = new IccTagDataEntry[count];
+ var tdata = new IccTagDataEntry[count];
for (int i = 0; i < count; i++)
{
IccTypeSignature type = this.ReadTagDataEntryHeader();
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.cs
index 482853b14..538a31d6a 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.cs
@@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Reads a float
+ /// Reads a float.
///
/// the value
public unsafe float ReadSingle()
@@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Reads an ASCII encoded string
+ /// Reads an ASCII encoded string.
///
/// number of bytes to read
/// The value as a string
@@ -114,7 +114,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Reads an UTF-16 big-endian encoded string
+ /// Reads an UTF-16 big-endian encoded string.
///
/// number of bytes to read
/// The value as a string
@@ -131,34 +131,25 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Reads a signed 32bit number with 1 sign bit, 15 value bits and 16 fractional bits
+ /// Reads a signed 32bit number with 1 sign bit, 15 value bits and 16 fractional bits.
///
/// The number as double
- public float ReadFix16()
- {
- return this.ReadInt32() / 65536f;
- }
+ public float ReadFix16() => this.ReadInt32() / 65536f;
///
- /// Reads an unsigned 32bit number with 16 value bits and 16 fractional bits
+ /// Reads an unsigned 32bit number with 16 value bits and 16 fractional bits.
///
/// The number as double
- public float ReadUFix16()
- {
- return this.ReadUInt32() / 65536f;
- }
+ public float ReadUFix16() => this.ReadUInt32() / 65536f;
///
- /// Reads an unsigned 16bit number with 1 value bit and 15 fractional bits
+ /// Reads an unsigned 16bit number with 1 value bit and 15 fractional bits.
///
/// The number as double
- public float ReadU1Fix15()
- {
- return this.ReadUInt16() / 32768f;
- }
+ public float ReadU1Fix15() => this.ReadUInt16() / 32768f;
///
- /// Reads an unsigned 16bit number with 8 value bits and 8 fractional bits
+ /// Reads an unsigned 16bit number with 8 value bits and 8 fractional bits.
///
/// The number as double
public float ReadUFix8()
@@ -167,7 +158,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Reads a number of bytes and advances the index
+ /// Reads a number of bytes and advances the index.
///
/// The number of bytes to read
/// The read bytes
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs
index 5c14448fa..e41d9b3b8 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs
@@ -183,7 +183,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public IccColorantTableTagDataEntry ReadColorantTableTagDataEntry()
{
uint colorantCount = this.ReadUInt32();
- IccColorantTableEntry[] cdata = new IccColorantTableEntry[colorantCount];
+ var cdata = new IccColorantTableEntry[colorantCount];
for (int i = 0; i < colorantCount; i++)
{
cdata[i] = this.ReadColorantTableEntry();
@@ -265,7 +265,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
ushort outTableCount = this.ReadUInt16();
// Input LUT
- IccLut[] inValues = new IccLut[inChCount];
+ var inValues = new IccLut[inChCount];
byte[] gridPointCount = new byte[inChCount];
for (int i = 0; i < inChCount; i++)
{
@@ -277,7 +277,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
IccClut clut = this.ReadClut16(inChCount, outChCount, gridPointCount);
// Output LUT
- IccLut[] outValues = new IccLut[outChCount];
+ var outValues = new IccLut[outChCount];
for (int i = 0; i < outChCount; i++)
{
outValues[i] = this.ReadLut16(outTableCount);
@@ -300,7 +300,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
float[,] matrix = this.ReadMatrix(3, 3, false);
// Input LUT
- IccLut[] inValues = new IccLut[inChCount];
+ var inValues = new IccLut[inChCount];
byte[] gridPointCount = new byte[inChCount];
for (int i = 0; i < inChCount; i++)
{
@@ -312,7 +312,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
IccClut clut = this.ReadClut8(inChCount, outChCount, gridPointCount);
// Output LUT
- IccLut[] outValues = new IccLut[outChCount];
+ var outValues = new IccLut[outChCount];
for (int i = 0; i < outChCount; i++)
{
outValues[i] = this.ReadLut8();
@@ -463,9 +463,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
uint recordCount = this.ReadUInt32();
this.ReadUInt32(); // Record size (always 12)
- IccLocalizedString[] text = new IccLocalizedString[recordCount];
+ var text = new IccLocalizedString[recordCount];
- CultureInfo[] culture = new CultureInfo[recordCount];
+ var culture = new CultureInfo[recordCount];
uint[] length = new uint[recordCount];
uint[] offset = new uint[recordCount];
@@ -531,13 +531,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
ushort outChannelCount = this.ReadUInt16();
uint elementCount = this.ReadUInt32();
- IccPositionNumber[] positionTable = new IccPositionNumber[elementCount];
+ var positionTable = new IccPositionNumber[elementCount];
for (int i = 0; i < elementCount; i++)
{
positionTable[i] = this.ReadPositionNumber();
}
- IccMultiProcessElement[] elements = new IccMultiProcessElement[elementCount];
+ var elements = new IccMultiProcessElement[elementCount];
for (int i = 0; i < elementCount; i++)
{
this.currentIndex = (int)positionTable[i].Offset + start;
@@ -559,7 +559,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
string prefix = this.ReadAsciiString(32);
string suffix = this.ReadAsciiString(32);
- IccNamedColor[] colors = new IccNamedColor[colorCount];
+ var colors = new IccNamedColor[colorCount];
for (int i = 0; i < colorCount; i++)
{
colors[i] = this.ReadNamedColor(coordCount);
@@ -584,7 +584,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public IccProfileSequenceDescTagDataEntry ReadProfileSequenceDescTagDataEntry()
{
uint count = this.ReadUInt32();
- IccProfileDescription[] description = new IccProfileDescription[count];
+ var description = new IccProfileDescription[count];
for (int i = 0; i < count; i++)
{
description[i] = this.ReadProfileDescription();
@@ -601,13 +601,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int start = this.currentIndex - 8; // 8 is the tag header size
uint count = this.ReadUInt32();
- IccPositionNumber[] table = new IccPositionNumber[count];
+ var table = new IccPositionNumber[count];
for (int i = 0; i < count; i++)
{
table[i] = this.ReadPositionNumber();
}
- IccProfileSequenceIdentifier[] entries = new IccProfileSequenceIdentifier[count];
+ var entries = new IccProfileSequenceIdentifier[count];
for (int i = 0; i < count; i++)
{
this.currentIndex = (int)(start + table[i].Offset);
@@ -636,7 +636,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
offset[i] = this.ReadUInt32();
}
- IccResponseCurve[] curves = new IccResponseCurve[measurmentCount];
+ var curves = new IccResponseCurve[measurmentCount];
for (int i = 0; i < measurmentCount; i++)
{
this.currentIndex = (int)(start + offset[i]);
@@ -783,7 +783,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public IccXyzTagDataEntry ReadXyzTagDataEntry(uint size)
{
uint count = (size - 8) / 12;
- Vector3[] arrayData = new Vector3[count];
+ var arrayData = new Vector3[count];
for (int i = 0; i < count; i++)
{
arrayData[i] = this.ReadXyzNumber();
@@ -864,7 +864,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
var flags = (IccScreeningFlag)this.ReadInt32();
uint channelCount = this.ReadUInt32();
- IccScreeningChannel[] channels = new IccScreeningChannel[channelCount];
+ var channels = new IccScreeningChannel[channelCount];
for (int i = 0; i < channels.Length; i++)
{
channels[i] = this.ReadScreeningChannel();
@@ -902,4 +902,4 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return new IccUcrBgTagDataEntry(ucrCurve, bgCurve, description);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
index 9ee4f0004..18280faaf 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
@@ -206,8 +206,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public int WriteColorantTableTagDataEntry(IccColorantTableTagDataEntry value)
{
int count = this.WriteUInt32((uint)value.ColorantData.Length);
- foreach (IccColorantTableEntry colorant in value.ColorantData)
+
+ for (int i = 0; i < value.ColorantData.Length; i++)
{
+ ref IccColorantTableEntry colorant = ref value.ColorantData[i];
+
count += this.WriteAsciiString(colorant.Name, 32, true);
count += this.WriteUInt16(colorant.Pcs1);
count += this.WriteUInt16(colorant.Pcs2);
@@ -683,8 +686,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public int WriteProfileSequenceDescTagDataEntry(IccProfileSequenceDescTagDataEntry value)
{
int count = this.WriteUInt32((uint)value.Descriptions.Length);
- foreach (IccProfileDescription desc in value.Descriptions)
+
+ for (int i = 0; i < value.Descriptions.Length; i++)
{
+ ref IccProfileDescription desc = ref value.Descriptions[i];
+
count += this.WriteProfileDescription(desc);
}
@@ -706,13 +712,15 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
// Jump over position table
long tablePosition = this.dataStream.Position;
this.dataStream.Position += length * 8;
- IccPositionNumber[] table = new IccPositionNumber[length];
+ var table = new IccPositionNumber[length];
for (int i = 0; i < length; i++)
{
+ ref IccProfileSequenceIdentifier sequenceIdentifier = ref value.Data[i];
+
uint offset = (uint)(this.dataStream.Position - start);
- int size = this.WriteProfileId(value.Data[i].Id);
- size += this.WriteTagDataEntry(new IccMultiLocalizedUnicodeTagDataEntry(value.Data[i].Description));
+ int size = this.WriteProfileId(sequenceIdentifier.Id);
+ size += this.WriteTagDataEntry(new IccMultiLocalizedUnicodeTagDataEntry(sequenceIdentifier.Description));
size += this.WritePadding();
table[i] = new IccPositionNumber(offset, (uint)size);
count += size;
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Exceptions/InvalidIccProfileException.cs b/src/ImageSharp/MetaData/Profiles/ICC/Exceptions/InvalidIccProfileException.cs
index d867edbeb..f69067041 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Exceptions/InvalidIccProfileException.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Exceptions/InvalidIccProfileException.cs
@@ -10,13 +10,6 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public class InvalidIccProfileException : Exception
{
- ///
- /// Initializes a new instance of the class.
- ///
- public InvalidIccProfileException()
- {
- }
-
///
/// Initializes a new instance of the class.
///
@@ -37,4 +30,4 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs b/src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs
index ea84113fd..ca7c73620 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs
@@ -84,7 +84,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
private IccTagDataEntry[] ReadTagData(IccDataReader reader)
{
IccTagTableEntry[] tagTable = this.ReadTagTable(reader);
- IccTagDataEntry[] entries = new IccTagDataEntry[tagTable.Length];
+ var entries = new IccTagDataEntry[tagTable.Length];
var store = new Dictionary();
for (int i = 0; i < tagTable.Length; i++)
{
@@ -112,7 +112,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
reader.SetIndex(128); // An ICC header is 128 bytes long
uint tagCount = reader.ReadUInt32();
- IccTagTableEntry[] table = new IccTagTableEntry[tagCount];
+ var table = new IccTagTableEntry[tagCount];
for (int i = 0; i < tagCount; i++)
{
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs
index 4789a69fe..1b0d041b6 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs
@@ -44,7 +44,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -54,8 +54,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- var entry = obj as IccTagDataEntry;
- return entry != null && this.Equals(entry);
+ return obj is IccTagDataEntry entry && this.Equals(entry);
}
///
@@ -70,7 +69,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public virtual bool Equals(IccTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs b/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs
index d04869548..0aa030684 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs
@@ -44,4 +44,4 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return this.Equals((IccMultiProcessElement)other);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMultiProcessElement.cs b/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMultiProcessElement.cs
index 59acd0eb7..3da482b1f 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMultiProcessElement.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccMultiProcessElement.cs
@@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the signature of this element
+ /// Gets the signature of this element,
///
public IccMultiProcessElementSignature Signature { get; }
@@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public int InputChannelCount { get; }
///
- /// Gets the number of output channels
+ /// Gets the number of output channels.
///
public int OutputChannelCount { get; }
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
index 6d838558a..b400e1bd7 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccChromaticityTagDataEntry.cs
@@ -82,8 +82,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccChromaticityTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccChromaticityTagDataEntry entry && this.Equals(entry);
}
///
@@ -105,7 +104,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -125,7 +124,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.ColorantType;
- hashCode = (hashCode * 397) ^ (this.ChannelValues != null ? this.ChannelValues.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.ChannelValues?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
index 56af95a16..73024ee12 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantOrderTagDataEntry.cs
@@ -43,14 +43,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccColorantOrderTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccColorantOrderTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccColorantOrderTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -66,7 +65,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -76,7 +75,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccColorantOrderTagDataEntry && this.Equals((IccColorantOrderTagDataEntry)obj);
+ return obj is IccColorantOrderTagDataEntry other && this.Equals(other);
}
///
@@ -84,7 +83,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.ColorantNumber != null ? this.ColorantNumber.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.ColorantNumber?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
index b04ee10d0..353dab604 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccColorantTableTagDataEntry.cs
@@ -44,14 +44,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccColorantTableTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccColorantTableTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccColorantTableTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -67,7 +66,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -77,7 +76,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccColorantTableTagDataEntry && this.Equals((IccColorantTableTagDataEntry)obj);
+ return obj is IccColorantTableTagDataEntry other && this.Equals(other);
}
///
@@ -85,7 +84,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.ColorantData != null ? this.ColorantData.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.ColorantData?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs
index 1e516ce7f..848418f95 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCrdInfoTagDataEntry.cs
@@ -88,14 +88,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccCrdInfoTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccCrdInfoTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccCrdInfoTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -116,7 +115,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -126,7 +125,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccCrdInfoTagDataEntry && this.Equals((IccCrdInfoTagDataEntry)obj);
+ return obj is IccCrdInfoTagDataEntry other && this.Equals(other);
}
///
@@ -135,11 +134,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
unchecked
{
int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.PostScriptProductName != null ? this.PostScriptProductName.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.RenderingIntent0Crd != null ? this.RenderingIntent0Crd.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.RenderingIntent1Crd != null ? this.RenderingIntent1Crd.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.RenderingIntent2Crd != null ? this.RenderingIntent2Crd.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.RenderingIntent3Crd != null ? this.RenderingIntent3Crd.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.PostScriptProductName?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.RenderingIntent0Crd?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.RenderingIntent1Crd?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.RenderingIntent2Crd?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.RenderingIntent3Crd?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
index 7f753ff7d..c9a59bb32 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccCurveTagDataEntry.cs
@@ -79,26 +79,25 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public float Gamma => this.IsGamma ? this.CurveData[0] : 0;
///
- /// Gets a value indicating whether the curve maps input directly to output
+ /// Gets a value indicating whether the curve maps input directly to output.
///
public bool IsIdentityResponse => this.CurveData.Length == 0;
///
- /// Gets a value indicating whether the curve is a gamma curve
+ /// Gets a value indicating whether the curve is a gamma curve.
///
public bool IsGamma => this.CurveData.Length == 1;
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccCurveTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccCurveTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccCurveTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -114,7 +113,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -124,7 +123,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccCurveTagDataEntry && this.Equals((IccCurveTagDataEntry)obj);
+ return obj is IccCurveTagDataEntry other && this.Equals(other);
}
///
@@ -132,7 +131,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.CurveData != null ? this.CurveData.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.CurveData?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
index 3b17e2942..c8f5f8b7c 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDataTagDataEntry.cs
@@ -67,14 +67,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccDataTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccDataTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccDataTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -90,7 +89,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -100,7 +99,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccDataTagDataEntry && this.Equals((IccDataTagDataEntry)obj);
+ return obj is IccDataTagDataEntry other && this.Equals(other);
}
///
@@ -109,7 +108,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
unchecked
{
int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Data?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.IsAscii.GetHashCode();
return hashCode;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
index 879c208c1..7a2d97571 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccDateTimeTagDataEntry.cs
@@ -38,14 +38,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccDateTimeTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccDateTimeTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccDateTimeTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -61,7 +60,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
index 23580fac6..afe4e0bd3 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccFix16ArrayTagDataEntry.cs
@@ -40,14 +40,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccFix16ArrayTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccFix16ArrayTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccFix16ArrayTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -63,7 +62,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccFix16ArrayTagDataEntry && this.Equals((IccFix16ArrayTagDataEntry)obj);
+ return obj is IccFix16ArrayTagDataEntry other && this.Equals(other);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
index 13e146330..d98e45ace 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut16TagDataEntry.cs
@@ -111,14 +111,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccLut16TagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccLut16TagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccLut16TagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -138,7 +137,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -158,9 +157,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.InputValues != null ? this.InputValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.ClutValues != null ? this.ClutValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.OutputValues != null ? this.OutputValues.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.InputValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.OutputValues?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
index fd6d028ea..e57e0f543 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLut8TagDataEntry.cs
@@ -114,14 +114,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccLut8TagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccLut8TagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccLut8TagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -141,7 +140,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -161,9 +160,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.InputValues != null ? this.InputValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.ClutValues != null ? this.ClutValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.OutputValues != null ? this.OutputValues.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.InputValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.OutputValues?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
index faf9a4550..59c80d409 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs
@@ -147,14 +147,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccLutAToBTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccLutAToBTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccLutAToBTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -178,7 +177,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -188,7 +187,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccLutAToBTagDataEntry && this.Equals((IccLutAToBTagDataEntry)obj);
+ return obj is IccLutAToBTagDataEntry other && this.Equals(other);
}
///
@@ -201,10 +200,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
hashCode = (hashCode * 397) ^ this.Matrix3x3.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix3x1.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.ClutValues != null ? this.ClutValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.CurveB != null ? this.CurveB.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.CurveM != null ? this.CurveM.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.CurveA != null ? this.CurveA.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.CurveB?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.CurveM?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.CurveA?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
index 10ffca335..57b17c452 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs
@@ -147,14 +147,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccLutBToATagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccLutBToATagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccLutBToATagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -178,7 +177,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -188,7 +187,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccLutBToATagDataEntry && this.Equals((IccLutBToATagDataEntry)obj);
+ return obj is IccLutBToATagDataEntry other && this.Equals(other);
}
///
@@ -201,10 +200,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
hashCode = (hashCode * 397) ^ this.Matrix3x3.GetHashCode();
hashCode = (hashCode * 397) ^ this.Matrix3x1.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.ClutValues != null ? this.ClutValues.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.CurveB != null ? this.CurveB.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.CurveM != null ? this.CurveM.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.CurveA != null ? this.CurveA.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.ClutValues?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.CurveB?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.CurveM?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.CurveA?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs
index 12010ea09..5f2dbe347 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMeasurementTagDataEntry.cs
@@ -73,14 +73,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccMeasurementTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccMeasurementTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccMeasurementTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
index 62792b44e..d1745faac 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiLocalizedUnicodeTagDataEntry.cs
@@ -41,14 +41,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccMultiLocalizedUnicodeTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccMultiLocalizedUnicodeTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccMultiLocalizedUnicodeTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -64,7 +63,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -82,7 +81,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Texts != null ? this.Texts.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Texts?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
index 437c6734b..8b0c06568 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccMultiProcessElementsTagDataEntry.cs
@@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public bool Equals(IccMultiProcessElementsTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccMultiProcessElementsTagDataEntry && this.Equals((IccMultiProcessElementsTagDataEntry)obj);
+ return obj is IccMultiProcessElementsTagDataEntry other && this.Equals(other);
}
///
@@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.InputChannelCount;
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
- hashCode = (hashCode * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Data?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs
index d3e73b018..bdb1aacb3 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccNamedColor2TagDataEntry.cs
@@ -121,8 +121,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccNamedColor2TagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccNamedColor2TagDataEntry entry && this.Equals(entry);
}
///
@@ -159,7 +158,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccNamedColor2TagDataEntry && this.Equals((IccNamedColor2TagDataEntry)obj);
+ return obj is IccNamedColor2TagDataEntry other && this.Equals(other);
}
///
@@ -169,10 +168,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.CoordinateCount;
- hashCode = (hashCode * 397) ^ (this.Prefix != null ? this.Prefix.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.Suffix != null ? this.Suffix.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Prefix?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.Suffix?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ this.VendorFlags;
- hashCode = (hashCode * 397) ^ (this.Colors != null ? this.Colors.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Colors?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
index 192be52a1..e8bbc5e8f 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccParametricCurveTagDataEntry.cs
@@ -39,8 +39,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccParametricCurveTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccParametricCurveTagDataEntry entry && this.Equals(entry);
}
///
@@ -72,7 +71,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccParametricCurveTagDataEntry && this.Equals((IccParametricCurveTagDataEntry)obj);
+ return obj is IccParametricCurveTagDataEntry other && this.Equals(other);
}
///
@@ -80,7 +79,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Curve != null ? this.Curve.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Curve?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
index 88aaa0976..cde7c4043 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceDescTagDataEntry.cs
@@ -42,8 +42,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccProfileSequenceDescTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccProfileSequenceDescTagDataEntry entry && this.Equals(entry);
}
///
@@ -65,7 +64,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -75,7 +74,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccProfileSequenceDescTagDataEntry && this.Equals((IccProfileSequenceDescTagDataEntry)obj);
+ return obj is IccProfileSequenceDescTagDataEntry other && this.Equals(other);
}
///
@@ -83,7 +82,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Descriptions != null ? this.Descriptions.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Descriptions?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
index 7ef17d37e..2309a460e 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccProfileSequenceIdentifierTagDataEntry.cs
@@ -41,8 +41,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccProfileSequenceIdentifierTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccProfileSequenceIdentifierTagDataEntry entry && this.Equals(entry);
}
///
@@ -74,7 +73,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccProfileSequenceIdentifierTagDataEntry && this.Equals((IccProfileSequenceIdentifierTagDataEntry)obj);
+ return obj is IccProfileSequenceIdentifierTagDataEntry other && this.Equals(other);
}
///
@@ -82,7 +81,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
index 7faad30f3..5925454a3 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccResponseCurveSet16TagDataEntry.cs
@@ -53,8 +53,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccResponseCurveSet16TagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccResponseCurveSet16TagDataEntry entry && this.Equals(entry);
}
///
@@ -98,7 +97,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ this.ChannelCount.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.Curves != null ? this.Curves.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Curves?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
index 7a5062707..1e17d0862 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccScreeningTagDataEntry.cs
@@ -50,8 +50,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccScreeningTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccScreeningTagDataEntry entry && this.Equals(entry);
}
///
@@ -85,7 +84,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccScreeningTagDataEntry && this.Equals((IccScreeningTagDataEntry)obj);
+ return obj is IccScreeningTagDataEntry other && this.Equals(other);
}
///
@@ -95,7 +94,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
int hashCode = base.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.Flags;
- hashCode = (hashCode * 397) ^ (this.Channels != null ? this.Channels.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Channels?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
index 82462afa3..a808541cf 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccSignatureTagDataEntry.cs
@@ -40,8 +40,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccSignatureTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccSignatureTagDataEntry entry && this.Equals(entry);
}
///
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccSignatureTagDataEntry && this.Equals((IccSignatureTagDataEntry)obj);
+ return obj is IccSignatureTagDataEntry other && this.Equals(other);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.SignatureData != null ? this.SignatureData.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.SignatureData?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs
index 71030c2a6..c509197e4 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextDescriptionTagDataEntry.cs
@@ -133,8 +133,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccTextDescriptionTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccTextDescriptionTagDataEntry entry && this.Equals(entry);
}
///
@@ -161,7 +160,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -180,9 +179,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
unchecked
{
int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.Ascii != null ? this.Ascii.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.Unicode != null ? this.Unicode.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.ScriptCode != null ? this.ScriptCode.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.Ascii?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.Unicode?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.ScriptCode?.GetHashCode() ?? 0);
hashCode = (hashCode * 397) ^ (int)this.UnicodeLanguageCode;
hashCode = (hashCode * 397) ^ this.ScriptCodeCode.GetHashCode();
return hashCode;
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
index 8127fae29..f5e31ea87 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccTextTagDataEntry.cs
@@ -39,8 +39,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccTextTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccTextTagDataEntry entry && this.Equals(entry);
}
///
@@ -72,7 +71,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccTextTagDataEntry && this.Equals((IccTextTagDataEntry)obj);
+ return obj is IccTextTagDataEntry other && this.Equals(other);
}
///
@@ -80,7 +79,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Text != null ? this.Text.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Text?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
index 709106a52..c619b40d4 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
@@ -33,15 +33,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the array data
+ /// Gets the array data.
///
public float[] Data { get; }
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUFix16ArrayTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUFix16ArrayTagDataEntry entry && this.Equals(entry);
}
///
@@ -63,7 +62,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccUFix16ArrayTagDataEntry && this.Equals((IccUFix16ArrayTagDataEntry)obj);
+ return obj is IccUFix16ArrayTagDataEntry other && this.Equals(other);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
index bcd991cea..4f1959cf1 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt16ArrayTagDataEntry.cs
@@ -40,8 +40,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUInt16ArrayTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUInt16ArrayTagDataEntry entry && this.Equals(entry);
}
///
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccUInt16ArrayTagDataEntry && this.Equals((IccUInt16ArrayTagDataEntry)obj);
+ return obj is IccUInt16ArrayTagDataEntry other && this.Equals(other);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
index 8a5ccb0c0..00ca43084 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt32ArrayTagDataEntry.cs
@@ -40,14 +40,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUInt32ArrayTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUInt32ArrayTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccUInt32ArrayTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -63,7 +62,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
index 6e22f7758..27c273e42 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt64ArrayTagDataEntry.cs
@@ -40,14 +40,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUInt64ArrayTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUInt64ArrayTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccUInt64ArrayTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -63,7 +62,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
index 07e142d49..bf6fdd662 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUInt8ArrayTagDataEntry.cs
@@ -33,21 +33,20 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the array data
+ /// Gets the array data.
///
public byte[] Data { get; }
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUInt8ArrayTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUInt8ArrayTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccUInt8ArrayTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -63,7 +62,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccUInt8ArrayTagDataEntry && this.Equals((IccUInt8ArrayTagDataEntry)obj);
+ return obj is IccUInt8ArrayTagDataEntry other && this.Equals(other);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
index 0f8bd6c33..0f190021f 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUcrBgTagDataEntry.cs
@@ -60,14 +60,13 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUcrBgTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUcrBgTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccUcrBgTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -86,7 +85,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -96,7 +95,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccUcrBgTagDataEntry && this.Equals((IccUcrBgTagDataEntry)obj);
+ return obj is IccUcrBgTagDataEntry other && this.Equals(other);
}
///
@@ -105,9 +104,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
unchecked
{
int hashCode = base.GetHashCode();
- hashCode = (hashCode * 397) ^ (this.UcrCurve != null ? this.UcrCurve.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.BgCurve != null ? this.BgCurve.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.Description != null ? this.Description.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.UcrCurve?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.BgCurve?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.Description?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
index 8b60aad26..ce3be9b69 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccUnknownTagDataEntry.cs
@@ -33,21 +33,20 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the raw data of the entry
+ /// Gets the raw data of the entry.
///
public byte[] Data { get; }
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccUnknownTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccUnknownTagDataEntry entry && this.Equals(entry);
}
///
public bool Equals(IccUnknownTagDataEntry other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -63,7 +62,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccUnknownTagDataEntry && this.Equals((IccUnknownTagDataEntry)obj);
+ return obj is IccUnknownTagDataEntry other && this.Equals(other);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (base.GetHashCode() * 397) ^ (this.Data != null ? this.Data.GetHashCode() : 0);
+ return (base.GetHashCode() * 397) ^ (this.Data?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs
index 2c12066f1..a4db8f7ab 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/TagDataEntries/IccViewingConditionsTagDataEntry.cs
@@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the XYZ values of Illuminant
+ /// Gets the XYZ values of illuminant.
///
public Vector3 IlluminantXyz { get; }
@@ -48,15 +48,14 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public Vector3 SurroundXyz { get; }
///
- /// Gets the illuminant
+ /// Gets the illuminant.
///
public IccStandardIlluminant Illuminant { get; }
///
public override bool Equals(IccTagDataEntry other)
{
- var entry = other as IccViewingConditionsTagDataEntry;
- return entry != null && this.Equals(entry);
+ return other is IccViewingConditionsTagDataEntry entry && this.Equals(entry);
}
///
@@ -81,7 +80,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
index af7e3e011..c42d85134 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccClut.cs
@@ -94,9 +94,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
public float[][] Values { get; }
///
- /// Gets or sets the CLUT data type (important when writing a profile)
+ /// Gets the CLUT data type (important when writing a profile)
///
- public IccClutDataType DataType { get; set; }
+ public IccClutDataType DataType { get; }
///
/// Gets the number of input channels
@@ -116,7 +116,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public bool Equals(IccClut other)
{
- if (ReferenceEquals(null, other))
+ if (other == null)
{
return false;
}
@@ -136,7 +136,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
+ if (obj == null)
{
return false;
}
@@ -146,7 +146,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
return true;
}
- return obj is IccClut && this.Equals((IccClut)obj);
+ return obj is IccClut other && this.Equals(other);
}
///
@@ -154,11 +154,11 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- int hashCode = this.Values != null ? this.Values.GetHashCode() : 0;
+ int hashCode = this.Values?.GetHashCode() ?? 0;
hashCode = (hashCode * 397) ^ (int)this.DataType;
hashCode = (hashCode * 397) ^ this.InputChannelCount;
hashCode = (hashCode * 397) ^ this.OutputChannelCount;
- hashCode = (hashCode * 397) ^ (this.GridPointCount != null ? this.GridPointCount.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.GridPointCount?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
index c5b005ea0..22e4a0523 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccColorantTableEntry.cs
@@ -87,9 +87,9 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public override bool Equals(object other)
+ public override bool Equals(object obj)
{
- return (other is IccColorantTableEntry) && this.Equals((IccColorantTableEntry)other);
+ return obj is IccColorantTableEntry other && this.Equals(other);
}
///
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLocalizedString.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLocalizedString.cs
index 68a5e7cfa..18e28e94c 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLocalizedString.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLocalizedString.cs
@@ -7,12 +7,12 @@ using System.Globalization;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
///
- /// A string with a specific locale
+ /// A string with a specific locale.
///
- internal sealed class IccLocalizedString : IEquatable
+ internal readonly struct IccLocalizedString : IEquatable
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
/// The culture will be
///
/// The text value of this string
@@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
/// The culture will be
///
/// The culture of this string
@@ -37,26 +37,19 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the actual text value
+ /// Gets the text value.
///
public string Text { get; }
///
- /// Gets the culture of the text
+ /// Gets the culture of text.
///
public CultureInfo Culture { get; }
///
- public bool Equals(IccLocalizedString other)
- {
- if (ReferenceEquals(this, other))
- {
- return true;
- }
-
- return this.Culture.Equals(other.Culture)
- && this.Text == other.Text;
- }
+ public bool Equals(IccLocalizedString other) =>
+ this.Culture.Equals(other.Culture) &&
+ this.Text == other.Text;
///
public override string ToString()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLut.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLut.cs
index 12d3208a7..c263ffe27 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLut.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccLut.cs
@@ -9,10 +9,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
/// Lookup Table
///
- internal sealed class IccLut : IEquatable
+ internal readonly struct IccLut : IEquatable
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
///
/// The LUT values
public IccLut(float[] values)
@@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
///
/// The LUT values
public IccLut(ushort[] values)
@@ -39,7 +39,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
///
/// The LUT values
public IccLut(byte[] values)
@@ -63,12 +63,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
public bool Equals(IccLut other)
{
- if (other == null)
- {
- return false;
- }
-
- if (ReferenceEquals(this, other))
+ if (ReferenceEquals(this.Values, other.Values))
{
return true;
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
index 22916c134..5b013fc2c 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccNamedColor.cs
@@ -74,18 +74,16 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public override bool Equals(object other)
+ public override bool Equals(object obj)
{
- return (other is IccNamedColor) && this.Equals((IccNamedColor)other);
+ return obj is IccNamedColor other && this.Equals(other);
}
///
- public bool Equals(IccNamedColor other)
- {
- return this.Name == other.Name
- && this.PcsCoordinates.SequenceEqual(other.PcsCoordinates)
- && this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
- }
+ public bool Equals(IccNamedColor other) =>
+ this.Name == other.Name &&
+ this.PcsCoordinates.SequenceEqual(other.PcsCoordinates) &&
+ this.DeviceCoordinates.SequenceEqual(other.DeviceCoordinates);
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
index d886dc099..aad130b0d 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccPositionNumber.cs
@@ -62,17 +62,15 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public override bool Equals(object other)
+ public override bool Equals(object obj)
{
- return (other is IccPositionNumber) && this.Equals((IccPositionNumber)other);
+ return obj is IccPositionNumber other && this.Equals(other);
}
///
- public bool Equals(IccPositionNumber other)
- {
- return this.Offset == other.Offset
- && this.Size == other.Size;
- }
+ public bool Equals(IccPositionNumber other) =>
+ this.Offset == other.Offset &&
+ this.Size == other.Size;
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
index 455717a03..9db4bb9c4 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileDescription.cs
@@ -9,10 +9,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
///
/// ICC Profile description
///
- internal sealed class IccProfileDescription : IEquatable
+ internal readonly struct IccProfileDescription : IEquatable
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
///
/// Device Manufacturer
/// Device Model
@@ -40,70 +40,48 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the device manufacturer
+ /// Gets the device manufacturer.
///
public uint DeviceManufacturer { get; }
///
- /// Gets the device model
+ /// Gets the device model.
///
public uint DeviceModel { get; }
///
- /// Gets the device attributes
+ /// Gets the device attributes.
///
public IccDeviceAttribute DeviceAttributes { get; }
///
- /// Gets the technology information
+ /// Gets the technology information.
///
public IccProfileTag TechnologyInformation { get; }
///
- /// Gets the device manufacturer info
+ /// Gets the device manufacturer info.
///
public IccLocalizedString[] DeviceManufacturerInfo { get; }
///
- /// Gets the device model info
+ /// Gets the device model info.
///
public IccLocalizedString[] DeviceModelInfo { get; }
///
- public bool Equals(IccProfileDescription other)
- {
- if (ReferenceEquals(null, other))
- {
- return false;
- }
-
- if (ReferenceEquals(this, other))
- {
- return true;
- }
-
- return this.DeviceManufacturer == other.DeviceManufacturer
- && this.DeviceModel == other.DeviceModel
- && this.DeviceAttributes == other.DeviceAttributes
- && this.TechnologyInformation == other.TechnologyInformation
- && this.DeviceManufacturerInfo.SequenceEqual(other.DeviceManufacturerInfo)
- && this.DeviceModelInfo.SequenceEqual(other.DeviceModelInfo);
- }
+ public bool Equals(IccProfileDescription other) =>
+ this.DeviceManufacturer == other.DeviceManufacturer &&
+ this.DeviceModel == other.DeviceModel &&
+ this.DeviceAttributes == other.DeviceAttributes &&
+ this.TechnologyInformation == other.TechnologyInformation &&
+ this.DeviceManufacturerInfo.SequenceEqual(other.DeviceManufacturerInfo) &&
+ this.DeviceModelInfo.SequenceEqual(other.DeviceModelInfo);
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
- {
- return false;
- }
-
- if (ReferenceEquals(this, obj))
- {
- return true;
- }
-
- return obj is IccProfileDescription && this.Equals((IccProfileDescription)obj);
+ return obj is IccProfileDescription other && this.Equals(other);
}
///
@@ -115,8 +93,8 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
hashCode = (hashCode * 397) ^ (int)this.DeviceModel;
hashCode = (hashCode * 397) ^ this.DeviceAttributes.GetHashCode();
hashCode = (hashCode * 397) ^ (int)this.TechnologyInformation;
- hashCode = (hashCode * 397) ^ (this.DeviceManufacturerInfo != null ? this.DeviceManufacturerInfo.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (this.DeviceModelInfo != null ? this.DeviceModelInfo.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (this.DeviceManufacturerInfo?.GetHashCode() ?? 0);
+ hashCode = (hashCode * 397) ^ (this.DeviceModelInfo?.GetHashCode() ?? 0);
return hashCode;
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
index 4070f835d..67911936f 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileId.cs
@@ -95,19 +95,17 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public override bool Equals(object other)
+ public override bool Equals(object obj)
{
- return (other is IccProfileId) && this.Equals((IccProfileId)other);
+ return obj is IccProfileId other && this.Equals(other);
}
///
- public bool Equals(IccProfileId other)
- {
- return this.Part1 == other.Part1
- && this.Part2 == other.Part2
- && this.Part3 == other.Part3
- && this.Part4 == other.Part4;
- }
+ public bool Equals(IccProfileId other) =>
+ this.Part1 == other.Part1 &&
+ this.Part2 == other.Part2 &&
+ this.Part3 == other.Part3 &&
+ this.Part4 == other.Part4;
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
index dfa3fb203..d5362ad70 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccProfileSequenceIdentifier.cs
@@ -7,12 +7,12 @@ using System.Linq;
namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
///
- /// Description of a profile within a sequence
+ /// Description of a profile within a sequence.
///
- internal sealed class IccProfileSequenceIdentifier : IEquatable
+ internal readonly struct IccProfileSequenceIdentifier : IEquatable
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the struct.
///
/// ID of the profile
/// Description of the profile
@@ -25,45 +25,24 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- /// Gets the ID of the profile
+ /// Gets the ID of the profile.
///
public IccProfileId Id { get; }
///
- /// Gets the description of the profile
+ /// Gets the description of the profile.
///
public IccLocalizedString[] Description { get; }
///
- public bool Equals(IccProfileSequenceIdentifier other)
- {
- if (ReferenceEquals(null, other))
- {
- return false;
- }
-
- if (ReferenceEquals(this, other))
- {
- return true;
- }
-
- return this.Id.Equals(other.Id) && this.Description.SequenceEqual(other.Description);
- }
+ public bool Equals(IccProfileSequenceIdentifier other) =>
+ this.Id.Equals(other.Id) &&
+ this.Description.SequenceEqual(other.Description);
///
public override bool Equals(object obj)
{
- if (ReferenceEquals(null, obj))
- {
- return false;
- }
-
- if (ReferenceEquals(this, obj))
- {
- return true;
- }
-
- return obj is IccProfileSequenceIdentifier && this.Equals((IccProfileSequenceIdentifier)obj);
+ return obj is IccProfileSequenceIdentifier other && this.Equals(other);
}
///
@@ -71,7 +50,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
{
unchecked
{
- return (this.Id.GetHashCode() * 397) ^ (this.Description != null ? this.Description.GetHashCode() : 0);
+ return (this.Id.GetHashCode() * 397) ^ (this.Description?.GetHashCode() ?? 0);
}
}
}
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
index c786a0fd4..d1da2366e 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccResponseNumber.cs
@@ -62,17 +62,15 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public override bool Equals(object other)
+ public override bool Equals(object obj)
{
- return (other is IccResponseNumber) && this.Equals((IccResponseNumber)other);
+ return obj is IccResponseNumber other && this.Equals(other);
}
///
- public bool Equals(IccResponseNumber other)
- {
- return this.DeviceCode == other.DeviceCode
- && this.MeasurementValue == other.MeasurementValue;
- }
+ public bool Equals(IccResponseNumber other) =>
+ this.DeviceCode == other.DeviceCode &&
+ this.MeasurementValue == other.MeasurementValue;
///
public override int GetHashCode()
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
index e1f1bb32f..c038cfaba 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccScreeningChannel.cs
@@ -69,12 +69,10 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public bool Equals(IccScreeningChannel other)
- {
- return this.Frequency.Equals(other.Frequency)
- && this.Angle.Equals(other.Angle)
- && this.SpotShape == other.SpotShape;
- }
+ public bool Equals(IccScreeningChannel other) =>
+ this.Frequency == other.Frequency &&
+ this.Angle == other.Angle &&
+ this.SpotShape == other.SpotShape;
///
public override bool Equals(object obj)
diff --git a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
index 7cb5c7901..04357dcf6 100644
--- a/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
+++ b/src/ImageSharp/MetaData/Profiles/ICC/Various/IccTagTableEntry.cs
@@ -69,18 +69,16 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
///
- public override bool Equals(object other)
+ public override bool Equals(object obj)
{
- return (other is IccTagTableEntry) && this.Equals((IccTagTableEntry)other);
+ return obj is IccTagTableEntry other && this.Equals(other);
}
///
- public bool Equals(IccTagTableEntry other)
- {
- return this.Signature == other.Signature
- && this.Offset == other.Offset
- && this.DataSize == other.DataSize;
- }
+ public bool Equals(IccTagTableEntry other) =>
+ this.Signature == other.Signature &&
+ this.Offset == other.Offset &&
+ this.DataSize == other.DataSize;
///
public override int GetHashCode()
diff --git a/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs b/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs
index 4291e775d..302b90e30 100644
--- a/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs
+++ b/tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs
@@ -1,15 +1,13 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using Xunit;
-using SixLabors.ImageSharp.Advanced;
using System.Runtime.CompilerServices;
-// ReSharper disable InconsistentNaming
+using SixLabors.ImageSharp.Advanced;
+using SixLabors.ImageSharp.PixelFormats;
+using Xunit;
namespace SixLabors.ImageSharp.Tests.Advanced
{
- using SixLabors.ImageSharp.PixelFormats;
-
public class AdvancedImageExtensionsTests
{
[Theory]
@@ -19,7 +17,7 @@ namespace SixLabors.ImageSharp.Tests.Advanced
{
using (Image image = provider.GetImage())
{
- TPixel[] targetBuffer = new TPixel[image.Width * image.Height];
+ var targetBuffer = new TPixel[image.Width * image.Height];
ref byte source = ref Unsafe.As(ref targetBuffer[0]);
ref byte dest = ref Unsafe.As(ref image.DangerousGetPinnableReferenceToPixelBuffer());
diff --git a/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs b/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs
index 121d93dac..34b2f718e 100644
--- a/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs
+++ b/tests/ImageSharp.Tests/BaseImageOperationsExtensionTest.cs
@@ -1,10 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
-using System.Collections.Generic;
-using System.Text;
-
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Primitives;
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieLabAndCieLchConversionTests.cs b/tests/ImageSharp.Tests/Colorspaces/CieLabAndCieLchConversionTests.cs
index 426945989..299b9e9e5 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieLabAndCieLchConversionTests.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieLabAndCieLchConversionTests.cs
@@ -36,10 +36,10 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Lch_to_Lab(float l, float c, float h, float l2, float a, float b)
{
// Arrange
- CieLch input = new CieLch(l, c, h);
+ var input = new CieLch(l, c, h);
// Act
- CieLab output = Converter.ToCieLab(input);
+ var output = Converter.ToCieLab(input);
// Assert
Assert.Equal(l2, output.L, FloatRoundingComparer);
@@ -62,10 +62,10 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Lab_to_LCHab(float l, float a, float b, float l2, float c, float h)
{
// Arrange
- CieLab input = new CieLab(l, a, b);
+ var input = new CieLab(l, a, b);
// Act
- CieLch output = Converter.ToCieLch(input);
+ var output = Converter.ToCieLch(input);
// Assert
Assert.Equal(l2, output.L, FloatRoundingComparer);
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieLuvAndCieLchuvConversionTests.cs b/tests/ImageSharp.Tests/Colorspaces/CieLuvAndCieLchuvConversionTests.cs
index 17fd1db50..cbcddcfe5 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieLuvAndCieLchuvConversionTests.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieLuvAndCieLchuvConversionTests.cs
@@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Lchuv_to_Luv(float l, float c, float h, float l2, float u, float v)
{
// Arrange
- CieLchuv input = new CieLchuv(l, c, h);
+ var input = new CieLchuv(l, c, h);
// Act
CieLuv output = Converter.ToCieLuv(input);
@@ -63,7 +63,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Luv_to_LCHuv(float l, float u, float v, float l2, float c, float h)
{
// Arrange
- CieLuv input = new CieLuv(l, u, v);
+ var input = new CieLuv(l, u, v);
// Act
CieLchuv output = Converter.ToCieLchuv(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLabConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLabConversionTest.cs
index 76d76f236..186f97618 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLabConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLabConversionTest.cs
@@ -34,8 +34,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Lab_to_Xyz(float l, float a, float b, float x, float y, float z)
{
// Arrange
- CieLab input = new CieLab(l, a, b, Illuminants.D65);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
+ var input = new CieLab(l, a, b, Illuminants.D65);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
// Act
CieXyz output = converter.ToCieXyz(input);
@@ -59,11 +59,11 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Xyz_to_Lab(float x, float y, float z, float l, float a, float b)
{
// Arrange
- CieXyz input = new CieXyz(x, y, z);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
+ var input = new CieXyz(x, y, z);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
// Act
- CieLab output = converter.ToCieLab(input);
+ var output = converter.ToCieLab(input);
// Assert
Assert.Equal(l, output.L, FloatRoundingComparer);
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLuvConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLuvConversionTest.cs
index b18bd56dc..46f4f15b8 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLuvConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieLuvConversionTest.cs
@@ -33,8 +33,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Luv_to_Xyz(float l, float u, float v, float x, float y, float z)
{
// Arrange
- CieLuv input = new CieLuv(l, u, v, Illuminants.D65);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
+ var input = new CieLuv(l, u, v, Illuminants.D65);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
// Act
CieXyz output = converter.ToCieXyz(input);
@@ -58,8 +58,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Xyz_to_Luv(float x, float y, float z, float l, float u, float v)
{
// Arrange
- CieXyz input = new CieXyz(x, y, z);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
+ var input = new CieXyz(x, y, z);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65, TargetLabWhitePoint = Illuminants.D65 };
// Act
CieLuv output = converter.ToCieLuv(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieXyyConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieXyyConversionTest.cs
index 1652c5392..d461acd56 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieXyyConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndCieXyyConversionTest.cs
@@ -28,8 +28,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
[InlineData(0, 0, 0, 0.538842, 0.000000, 0.000000)]
public void Convert_xyY_to_XYZ(float xyzX, float xyzY, float xyzZ, float x, float y, float yl)
{
- // Arrange
- CieXyy input = new CieXyy(x, y, yl);
+ var input = new CieXyy(x, y, yl);
// Act
CieXyz output = Converter.ToCieXyz(input);
@@ -47,8 +46,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
[InlineData(0.231809, 0, 0.077528, 0.749374, 0.000000, 0.000000)]
public void Convert_XYZ_to_xyY(float xyzX, float xyzY, float xyzZ, float x, float y, float yl)
{
- // Arrange
- CieXyz input = new CieXyz(xyzX, xyzY, xyzZ);
+ var input = new CieXyz(xyzX, xyzY, xyzZ);
// Act
CieXyy output = Converter.ToCieXyy(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndHunterLabConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndHunterLabConversionTest.cs
index 1c48d00ff..bea392c16 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndHunterLabConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndHunterLabConversionTest.cs
@@ -28,8 +28,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_HunterLab_to_Xyz(float l, float a, float b, float x, float y, float z)
{
// Arrange
- HunterLab input = new HunterLab(l, a, b);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.C };
+ var input = new HunterLab(l, a, b);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.C };
// Act
CieXyz output = converter.ToCieXyz(input);
@@ -49,8 +49,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_HunterLab_to_Xyz_D65(float l, float a, float b, float x, float y, float z)
{
// Arrange
- HunterLab input = new HunterLab(l, a, b);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 };
+ var input = new HunterLab(l, a, b);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 };
// Act
CieXyz output = converter.ToCieXyz(input);
@@ -70,8 +70,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Xyz_D65_to_HunterLab(float x, float y, float z, float l, float a, float b)
{
// Arrange
- CieXyz input = new CieXyz(x, y, z);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 };
+ var input = new CieXyz(x, y, z);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 };
// Act
HunterLab output = converter.ToHunterLab(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndLmsConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndLmsConversionTest.cs
index f63c54212..45ca9049a 100644
--- a/tests/ImageSharp.Tests/Colorspaces/CieXyzAndLmsConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/CieXyzAndLmsConversionTest.cs
@@ -31,8 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Lms_to_CieXyz(float l, float m, float s, float x, float y, float z)
{
// Arrange
- Lms input = new Lms(l, m, s);
- ColorSpaceConverter converter = new ColorSpaceConverter();
+ var input = new Lms(l, m, s);
+ var converter = new ColorSpaceConverter();
// Act
CieXyz output = converter.ToCieXyz(input);
@@ -56,8 +56,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_CieXyz_to_Lms(float x, float y, float z, float l, float m, float s)
{
// Arrange
- CieXyz input = new CieXyz(x, y, z);
- ColorSpaceConverter converter = new ColorSpaceConverter();
+ var input = new CieXyz(x, y, z);
+ var converter = new ColorSpaceConverter();
// Act
Lms output = converter.ToLms(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/ColorConverterAdaptTest.cs b/tests/ImageSharp.Tests/Colorspaces/ColorConverterAdaptTest.cs
index 6cb32be47..b393c51b7 100644
--- a/tests/ImageSharp.Tests/Colorspaces/ColorConverterAdaptTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/ColorConverterAdaptTest.cs
@@ -28,9 +28,9 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Adapt_RGB_WideGamutRGB_To_sRGB(float r1, float g1, float b1, float r2, float g2, float b2)
{
// Arrange
- Rgb input = new Rgb(r1, g1, b1, RgbWorkingSpaces.WideGamutRgb);
- Rgb expectedOutput = new Rgb(r2, g2, b2, RgbWorkingSpaces.SRgb);
- ColorSpaceConverter converter = new ColorSpaceConverter { TargetRgbWorkingSpace = RgbWorkingSpaces.SRgb };
+ var input = new Rgb(r1, g1, b1, RgbWorkingSpaces.WideGamutRgb);
+ var expectedOutput = new Rgb(r2, g2, b2, RgbWorkingSpaces.SRgb);
+ var converter = new ColorSpaceConverter { TargetRgbWorkingSpace = RgbWorkingSpaces.SRgb };
// Action
Rgb output = converter.Adapt(input);
@@ -49,9 +49,9 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Adapt_RGB_SRGB_To_WideGamutRGB(float r1, float g1, float b1, float r2, float g2, float b2)
{
// Arrange
- Rgb input = new Rgb(r1, g1, b1, RgbWorkingSpaces.SRgb);
- Rgb expectedOutput = new Rgb(r2, g2, b2, RgbWorkingSpaces.WideGamutRgb);
- ColorSpaceConverter converter = new ColorSpaceConverter { TargetRgbWorkingSpace = RgbWorkingSpaces.WideGamutRgb };
+ var input = new Rgb(r1, g1, b1, RgbWorkingSpaces.SRgb);
+ var expectedOutput = new Rgb(r2, g2, b2, RgbWorkingSpaces.WideGamutRgb);
+ var converter = new ColorSpaceConverter { TargetRgbWorkingSpace = RgbWorkingSpaces.WideGamutRgb };
// Action
Rgb output = converter.Adapt(input);
@@ -69,9 +69,9 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Adapt_Lab_D50_To_D65(float l1, float a1, float b1, float l2, float a2, float b2)
{
// Arrange
- CieLab input = new CieLab(l1, a1, b1, Illuminants.D65);
- CieLab expectedOutput = new CieLab(l2, a2, b2);
- ColorSpaceConverter converter = new ColorSpaceConverter { TargetLabWhitePoint = Illuminants.D50 };
+ var input = new CieLab(l1, a1, b1, Illuminants.D65);
+ var expectedOutput = new CieLab(l2, a2, b2);
+ var converter = new ColorSpaceConverter { TargetLabWhitePoint = Illuminants.D50 };
// Action
CieLab output = converter.Adapt(input);
@@ -110,9 +110,9 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Adapt_CieXyz_D65_To_D50_XyzScaling(float x1, float y1, float z1, float x2, float y2, float z2)
{
// Arrange
- CieXyz input = new CieXyz(x1, y1, z1);
- CieXyz expectedOutput = new CieXyz(x2, y2, z2);
- ColorSpaceConverter converter = new ColorSpaceConverter
+ var input = new CieXyz(x1, y1, z1);
+ var expectedOutput = new CieXyz(x2, y2, z2);
+ var converter = new ColorSpaceConverter
{
ChromaticAdaptation = new VonKriesChromaticAdaptation(LmsAdaptationMatrix.XyzScaling),
WhitePoint = Illuminants.D50
@@ -133,9 +133,9 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Adapt_Xyz_D65_To_D50_XyzScaling(float x1, float y1, float z1, float x2, float y2, float z2)
{
// Arrange
- CieXyz input = new CieXyz(x1, y1, z1);
- CieXyz expectedOutput = new CieXyz(x2, y2, z2);
- ColorSpaceConverter converter = new ColorSpaceConverter
+ var input = new CieXyz(x1, y1, z1);
+ var expectedOutput = new CieXyz(x2, y2, z2);
+ var converter = new ColorSpaceConverter
{
ChromaticAdaptation = new VonKriesChromaticAdaptation(LmsAdaptationMatrix.XyzScaling),
WhitePoint = Illuminants.D50
diff --git a/tests/ImageSharp.Tests/Colorspaces/RgbAndCieXyzConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/RgbAndCieXyzConversionTest.cs
index e7f197878..929c35ee9 100644
--- a/tests/ImageSharp.Tests/Colorspaces/RgbAndCieXyzConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/RgbAndCieXyzConversionTest.cs
@@ -35,8 +35,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_XYZ_D50_to_SRGB(float x, float y, float z, float r, float g, float b)
{
// Arrange
- CieXyz input = new CieXyz(x, y, z);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D50, TargetRgbWorkingSpace = RgbWorkingSpaces.SRgb };
+ var input = new CieXyz(x, y, z);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D50, TargetRgbWorkingSpace = RgbWorkingSpaces.SRgb };
// Act
Rgb output = converter.ToRgb(input);
@@ -92,12 +92,12 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_SRGB_to_XYZ_D50(float r, float g, float b, float x, float y, float z)
{
// Arrange
- Rgb input = new Rgb(r, g, b);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D50 };
+ var input = new Rgb(r, g, b);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D50 };
// Act
CieXyz output = converter.ToCieXyz(input);
-
+
// Assert
IEqualityComparer comparer = new ApproximateFloatComparer(0.001f);
Assert.Equal(x, output.X, comparer);
@@ -119,8 +119,8 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_SRGB_to_XYZ_D65(float r, float g, float b, float x, float y, float z)
{
// Arrange
- Rgb input = new Rgb(r, g, b);
- ColorSpaceConverter converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 };
+ var input = new Rgb(r, g, b);
+ var converter = new ColorSpaceConverter { WhitePoint = Illuminants.D65 };
// Act
CieXyz output = converter.ToCieXyz(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/RgbAndCmykConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/RgbAndCmykConversionTest.cs
index aa1f9c574..9a6ff7b49 100644
--- a/tests/ImageSharp.Tests/Colorspaces/RgbAndCmykConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/RgbAndCmykConversionTest.cs
@@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Cmyk_To_Rgb(float c, float m, float y, float k, float r, float g, float b)
{
// Arrange
- Cmyk input = new Cmyk(c, m, y, k);
+ var input = new Cmyk(c, m, y, k);
// Act
Rgb output = Converter.ToRgb(input);
@@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Rgb_To_Cmyk(float r, float g, float b, float c, float m, float y, float k)
{
// Arrange
- Rgb input = new Rgb(r, g, b);
+ var input = new Rgb(r, g, b);
// Act
Cmyk output = Converter.ToCmyk(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/RgbAndHslConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/RgbAndHslConversionTest.cs
index f658ddaae..4f1537932 100644
--- a/tests/ImageSharp.Tests/Colorspaces/RgbAndHslConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/RgbAndHslConversionTest.cs
@@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Hsl_To_Rgb(float h, float s, float l, float r, float g, float b)
{
// Arrange
- Hsl input = new Hsl(h, s, l);
+ var input = new Hsl(h, s, l);
// Act
Rgb output = Converter.ToRgb(input);
@@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Rgb_To_Hsl(float r, float g, float b, float h, float s, float l)
{
// Arrange
- Rgb input = new Rgb(r, g, b);
+ var input = new Rgb(r, g, b);
// Act
Hsl output = Converter.ToHsl(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/RgbAndHsvConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/RgbAndHsvConversionTest.cs
index 63b3d9b74..7f46ff1fc 100644
--- a/tests/ImageSharp.Tests/Colorspaces/RgbAndHsvConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/RgbAndHsvConversionTest.cs
@@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Hsv_To_Rgb(float h, float s, float v, float r, float g, float b)
{
// Arrange
- Hsv input = new Hsv(h, s, v);
+ var input = new Hsv(h, s, v);
// Act
Rgb output = Converter.ToRgb(input);
@@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Rgb_To_Hsv(float r, float g, float b, float h, float s, float v)
{
// Arrange
- Rgb input = new Rgb(r, g, b);
+ var input = new Rgb(r, g, b);
// Act
Hsv output = Converter.ToHsv(input);
diff --git a/tests/ImageSharp.Tests/Colorspaces/RgbAndYCbCrConversionTest.cs b/tests/ImageSharp.Tests/Colorspaces/RgbAndYCbCrConversionTest.cs
index 96c302e25..46c12e3a5 100644
--- a/tests/ImageSharp.Tests/Colorspaces/RgbAndYCbCrConversionTest.cs
+++ b/tests/ImageSharp.Tests/Colorspaces/RgbAndYCbCrConversionTest.cs
@@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_YCbCr_To_Rgb(float y, float cb, float cr, float r, float g, float b)
{
// Arrange
- YCbCr input = new YCbCr(y, cb, cr);
+ var input = new YCbCr(y, cb, cr);
// Act
Rgb output = Converter.ToRgb(input);
@@ -55,7 +55,7 @@ namespace SixLabors.ImageSharp.Tests.Colorspaces
public void Convert_Rgb_To_YCbCr(float r, float g, float b, float y, float cb, float cr)
{
// Arrange
- Rgb input = new Rgb(r, g, b);
+ var input = new Rgb(r, g, b);
// Act
YCbCr output = Converter.ToYCbCr(input);
diff --git a/tests/ImageSharp.Tests/Common/ConstantsTests.cs b/tests/ImageSharp.Tests/Common/ConstantsTests.cs
index 48ecbbbc9..38d754d60 100644
--- a/tests/ImageSharp.Tests/Common/ConstantsTests.cs
+++ b/tests/ImageSharp.Tests/Common/ConstantsTests.cs
@@ -13,4 +13,4 @@ namespace SixLabors.ImageSharp.Tests.Common
Assert.Equal(0.001f, Constants.Epsilon);
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs
index d16c053cd..c6c3b68f3 100644
--- a/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs
+++ b/tests/ImageSharp.Tests/Common/SimdUtilsTests.cs
@@ -1,18 +1,18 @@
-using System;
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Linq;
using System.Numerics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using SixLabors.ImageSharp.Common.Tuples;
+
using Xunit;
-// ReSharper disable InconsistentNaming
+using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests.Common
{
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using SixLabors.ImageSharp.Common.Tuples;
-
- using Xunit.Abstractions;
- using Xunit.Sdk;
-
public class SimdUtilsTests
{
private ITestOutputHelper Output { get; }
@@ -36,22 +36,10 @@ namespace SixLabors.ImageSharp.Tests.Common
Vector4 actual = v.PseudoRound();
- Assert.Equal(
- R(v.X),
- (int)actual.X
- );
- Assert.Equal(
- R(v.Y),
- (int)actual.Y
- );
- Assert.Equal(
- R(v.Z),
- (int)actual.Z
- );
- Assert.Equal(
- R(v.W),
- (int)actual.W
- );
+ Assert.Equal(R(v.X), (int)actual.X);
+ Assert.Equal(R(v.Y), (int)actual.Y);
+ Assert.Equal(R(v.Z), (int)actual.Z);
+ Assert.Equal(R(v.W), (int)actual.W);
}
private static Vector CreateExactTestVector1()
@@ -73,12 +61,15 @@ namespace SixLabors.ImageSharp.Tests.Common
private static Vector CreateRandomTestVector(int seed, float min, float max)
{
float[] data = new float[Vector.Count];
- Random rnd = new Random();
+
+ var rnd = new Random();
+
for (int i = 0; i < Vector.Count; i++)
{
- float v = (float)rnd.NextDouble() * (max-min) + min;
+ float v = (float)rnd.NextDouble() * (max - min) + min;
data[i] = v;
}
+
return new Vector(data);
}
@@ -102,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests.Common
[InlineData(42, 1000f)]
public void FastRound_RandomValues(int seed, float scale)
{
- Vector v = CreateRandomTestVector(seed, -scale*0.5f, scale*0.5f);
+ Vector v = CreateRandomTestVector(seed, -scale * 0.5f, scale * 0.5f);
Vector r = v.FastRound();
this.Output.WriteLine(v.ToString());
@@ -118,6 +109,7 @@ namespace SixLabors.ImageSharp.Tests.Common
this.Output.WriteLine("Skipping AVX2 specific test case: " + testCaseName);
return true;
}
+
return false;
}
@@ -133,7 +125,7 @@ namespace SixLabors.ImageSharp.Tests.Common
return;
}
- float[] orig = new Random(seed).GenerateRandomRoundedFloatArray(count, 0, 256);
+ float[] orig = new Random(seed).GenerateRandomRoundedFloatArray(count, 0, 256);
float[] normalized = orig.Select(f => f / 255f).ToArray();
byte[] dest = new byte[count];
@@ -158,12 +150,12 @@ namespace SixLabors.ImageSharp.Tests.Common
}
float[] source = new Random(seed).GenerateRandomFloatArray(count, 0, 1f);
-
+
byte[] dest = new byte[count];
-
+
SimdUtils.BulkConvertNormalizedFloatToByte(source, dest);
- byte[] expected = source.Select(f => (byte)Math.Round(f*255f)).ToArray();
+ byte[] expected = source.Select(f => (byte)Math.Round(f * 255f)).ToArray();
Assert.Equal(expected, dest);
}
@@ -217,16 +209,17 @@ namespace SixLabors.ImageSharp.Tests.Common
return;
}
- float[] source = {0, 7, 42, 255, 0.5f, 1.1f, 2.6f, 16f};
- byte[] expected = source.Select(f => (byte)Math.Round(f)).ToArray();
+ float[] source = { 0, 7, 42, 255, 0.5f, 1.1f, 2.6f, 16f };
+
+ var expected = source.Select(f => (byte)Math.Round(f)).ToArray();
source = source.Select(f => f / 255f).ToArray();
- byte[] dest = new byte[8];
+ Span dest = stackalloc byte[8];
this.MagicConvert(source, dest);
- Assert.Equal(expected, dest);
+ Assert.True(dest.SequenceEqual(expected));
}
private static byte MagicConvert(float x)
@@ -239,10 +232,11 @@ namespace SixLabors.ImageSharp.Tests.Common
private void MagicConvert(Span source, Span dest)
{
var magick = new Vector(32768.0f);
+
Vector scale = new Vector(255f) / new Vector(256f);
Vector x = MemoryMarshal.Cast>(source)[0];
-
+
x = (x * scale) + magick;
Tuple8.OfUInt32 ii = default;
@@ -252,7 +246,7 @@ namespace SixLabors.ImageSharp.Tests.Common
iiRef = x;
//Tuple8.OfUInt32 ii = Unsafe.As, Tuple8.OfUInt32>(ref x);
-
+
ref Tuple8.OfByte d = ref MemoryMarshal.Cast(dest)[0];
d.LoadFrom(ref ii);
@@ -266,6 +260,7 @@ namespace SixLabors.ImageSharp.Tests.Common
{
int actual = (int)r[i];
int expected = Re(v[i]);
+
Assert.Equal(expected, actual);
}
}
diff --git a/src/ImageSharp/Common/Tuples/Tuple8.cs b/tests/ImageSharp.Tests/Common/Tuple8.cs
similarity index 100%
rename from src/ImageSharp/Common/Tuples/Tuple8.cs
rename to tests/ImageSharp.Tests/Common/Tuple8.cs
diff --git a/tests/ImageSharp.Tests/ComplexIntegrationTests.cs b/tests/ImageSharp.Tests/ComplexIntegrationTests.cs
index 86703959a..ed4bb6104 100644
--- a/tests/ImageSharp.Tests/ComplexIntegrationTests.cs
+++ b/tests/ImageSharp.Tests/ComplexIntegrationTests.cs
@@ -1,13 +1,12 @@
-namespace SixLabors.ImageSharp.Tests
-{
- using SixLabors.ImageSharp.Formats.Jpeg;
- using SixLabors.ImageSharp.PixelFormats;
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Transforms;
- using SixLabors.Primitives;
+using SixLabors.ImageSharp.Formats.Jpeg;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing.Transforms;
+using SixLabors.Primitives;
- using Xunit;
+using Xunit;
+namespace SixLabors.ImageSharp.Tests
+{
///
/// Might be useful to catch complex bugs
///
diff --git a/tests/ImageSharp.Tests/ConfigurationTests.cs b/tests/ImageSharp.Tests/ConfigurationTests.cs
index cf348569c..88aabfe33 100644
--- a/tests/ImageSharp.Tests/ConfigurationTests.cs
+++ b/tests/ImageSharp.Tests/ConfigurationTests.cs
@@ -1,95 +1,95 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using SixLabors.ImageSharp.Formats;
-using SixLabors.ImageSharp.IO;
-using SixLabors.ImageSharp.PixelFormats;
-using Moq;
-using Xunit;
-
-namespace SixLabors.ImageSharp.Tests
-{
- ///
- /// Tests the configuration class.
- ///
- public class ConfigurationTests
- {
- public Configuration ConfigurationEmpty { get; private set; }
- public Configuration DefaultConfiguration { get; private set; }
-
- public ConfigurationTests()
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using SixLabors.ImageSharp.Formats;
+using SixLabors.ImageSharp.IO;
+using SixLabors.ImageSharp.PixelFormats;
+using Moq;
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests
+{
+ ///
+ /// Tests the configuration class.
+ ///
+ public class ConfigurationTests
+ {
+ public Configuration ConfigurationEmpty { get; private set; }
+ public Configuration DefaultConfiguration { get; private set; }
+
+ public ConfigurationTests()
{
// the shallow copy of configuration should behave exactly like the default configuration,
- // so by using the copy, we test both the default and the copy.
- this.DefaultConfiguration = Configuration.CreateDefaultInstance().ShallowCopy();
- this.ConfigurationEmpty = new Configuration();
- }
-
- [Fact]
- public void DefaultsToLocalFileSystem()
- {
- Assert.IsType(this.DefaultConfiguration.FileSystem);
- Assert.IsType(this.ConfigurationEmpty.FileSystem);
- }
-
- ///
- /// Test that the default configuration is not null.
- ///
- [Fact]
- public void TestDefultConfigurationIsNotNull()
- {
- Assert.True(Configuration.Default != null);
- }
-
- ///
- /// Test that the default configuration parallel options is not null.
- ///
- [Fact]
- public void TestDefultConfigurationParallelOptionsIsNotNull()
- {
- Assert.True(Configuration.Default.ParallelOptions != null);
- }
-
- ///
- /// Test that the default configuration read origin options is set to begin.
- ///
- [Fact]
- public void TestDefultConfigurationReadOriginIsCurrent()
- {
- Assert.True(Configuration.Default.ReadOrigin == ReadOrigin.Current);
- }
-
- ///
- /// Test that the default configuration parallel options max degrees of parallelism matches the
- /// environment processor count.
- ///
- [Fact]
- public void TestDefultConfigurationMaxDegreeOfParallelism()
- {
- Assert.True(Configuration.Default.ParallelOptions.MaxDegreeOfParallelism == Environment.ProcessorCount);
- }
-
- [Fact]
- public void ConstructorCallConfigureOnFormatProvider()
- {
- var provider = new Mock();
- var config = new Configuration(provider.Object);
-
- provider.Verify(x => x.Configure(config));
- }
-
- [Fact]
- public void AddFormatCallsConfig()
- {
- var provider = new Mock();
- var config = new Configuration();
- config.Configure(provider.Object);
-
- provider.Verify(x => x.Configure(config));
- }
- }
+ // so by using the copy, we test both the default and the copy.
+ this.DefaultConfiguration = Configuration.CreateDefaultInstance().ShallowCopy();
+ this.ConfigurationEmpty = new Configuration();
+ }
+
+ [Fact]
+ public void DefaultsToLocalFileSystem()
+ {
+ Assert.IsType(this.DefaultConfiguration.FileSystem);
+ Assert.IsType(this.ConfigurationEmpty.FileSystem);
+ }
+
+ ///
+ /// Test that the default configuration is not null.
+ ///
+ [Fact]
+ public void TestDefultConfigurationIsNotNull()
+ {
+ Assert.True(Configuration.Default != null);
+ }
+
+ ///
+ /// Test that the default configuration parallel options is not null.
+ ///
+ [Fact]
+ public void TestDefultConfigurationParallelOptionsIsNotNull()
+ {
+ Assert.True(Configuration.Default.ParallelOptions != null);
+ }
+
+ ///
+ /// Test that the default configuration read origin options is set to begin.
+ ///
+ [Fact]
+ public void TestDefultConfigurationReadOriginIsCurrent()
+ {
+ Assert.True(Configuration.Default.ReadOrigin == ReadOrigin.Current);
+ }
+
+ ///
+ /// Test that the default configuration parallel options max degrees of parallelism matches the
+ /// environment processor count.
+ ///
+ [Fact]
+ public void TestDefultConfigurationMaxDegreeOfParallelism()
+ {
+ Assert.True(Configuration.Default.ParallelOptions.MaxDegreeOfParallelism == Environment.ProcessorCount);
+ }
+
+ [Fact]
+ public void ConstructorCallConfigureOnFormatProvider()
+ {
+ var provider = new Mock();
+ var config = new Configuration(provider.Object);
+
+ provider.Verify(x => x.Configure(config));
+ }
+
+ [Fact]
+ public void AddFormatCallsConfig()
+ {
+ var provider = new Mock();
+ var config = new Configuration();
+ config.Configure(provider.Object);
+
+ provider.Verify(x => x.Configure(config));
+ }
+ }
}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs
index a0f62c4e7..daa640a0b 100644
--- a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs
@@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByBezierLine()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "BezierLine");
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x.BackgroundColor(Rgba32.Blue)
.DrawBeziers(Rgba32.HotPink, 5,
@@ -54,9 +54,9 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "BezierLine");
- Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150);
+ var color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150);
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x.BackgroundColor(Rgba32.Blue)
.DrawBeziers(color,
@@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
image.Save($"{path}/Opacity.png");
//shift background color towards foreground color by the opacity amount
- Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f));
+ var mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f));
using (PixelAccessor sourcePixels = image.Lock())
{
diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs
index d63467435..d0087b1d2 100644
--- a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs
+++ b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs
@@ -3,8 +3,8 @@
using System;
using System.Numerics;
-using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
using SixLabors.Primitives;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs
index dbf0e6ce9..7e75f52b2 100644
--- a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs
@@ -90,7 +90,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing
}
}
-
[Fact]
public void PathExtendingOffEdgeOfImageShouldNotBeCropped()
{
diff --git a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs
index 7db88e959..5b47e7835 100644
--- a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs
@@ -3,17 +3,15 @@
using System;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Primitives;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
using SixLabors.ImageSharp.Processing.Drawing.Brushes;
-
+using SixLabors.ImageSharp.Processing.Transforms;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Primitives;
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Transforms;
-
public class FillPatternBrushTests : FileTestBase
{
private void Test(string name, Rgba32 background, IBrush brush, Rgba32[,] expectedPattern)
@@ -36,9 +34,9 @@ namespace SixLabors.ImageSharp.Tests.Drawing
int yStride = expectedPatternFast.Rows;
int offsetX = r.Next(image.Width / xStride) * xStride;
int offsetY = r.Next(image.Height / yStride) * yStride;
- for (var x = 0; x < xStride; x++)
+ for (int x = 0; x < xStride; x++)
{
- for (var y = 0; y < yStride; y++)
+ for (int y = 0; y < yStride; y++)
{
int actualX = x + offsetX;
int actualY = y + offsetY;
diff --git a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs
index c995dd31b..8c619c817 100644
--- a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs
@@ -4,7 +4,7 @@
using System.Numerics;
using Moq;
-using Xunit;
+
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
@@ -14,6 +14,8 @@ using SixLabors.ImageSharp.Processing.Drawing.Pens;
using SixLabors.ImageSharp.Processing.Drawing.Processors;
using SixLabors.Primitives;
+using Xunit;
+
namespace SixLabors.ImageSharp.Tests.Drawing
{
public class FillRegionProcessorTests
diff --git a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs
index aa360c893..02e34092e 100644
--- a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs
@@ -3,14 +3,13 @@
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
+using SixLabors.ImageSharp.Processing.Overlays;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Overlays;
-
public class FillSolidBrushTests : FileTestBase
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs
index 0e0df6844..09ed46908 100644
--- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs
@@ -3,16 +3,16 @@
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
using SixLabors.ImageSharp.Processing.Drawing.Pens;
+using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.Shapes;
+
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Overlays;
-
public class LineComplexPolygonTests : FileTestBase
{
[Fact]
@@ -87,9 +87,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (PixelAccessor sourcePixels = image.Lock())
{
Assert.Equal(Rgba32.HotPink, sourcePixels[10, 10]);
-
Assert.Equal(Rgba32.HotPink, sourcePixels[200, 150]);
-
Assert.Equal(Rgba32.HotPink, sourcePixels[50, 300]);
@@ -110,7 +108,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing
}
}
-
[Fact]
public void ImageShouldBeOverlayedByPolygonOutlineOverlapping()
{
@@ -135,13 +132,9 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (PixelAccessor sourcePixels = image.Lock())
{
Assert.Equal(Rgba32.HotPink, sourcePixels[10, 10]);
-
Assert.Equal(Rgba32.HotPink, sourcePixels[200, 150]);
-
Assert.Equal(Rgba32.HotPink, sourcePixels[50, 300]);
-
Assert.Equal(Rgba32.Blue, sourcePixels[130, 41]);
-
Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]);
//inside hole
@@ -153,7 +146,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing
}
}
-
[Fact]
public void ImageShouldBeOverlayedByPolygonOutlineDashed()
{
@@ -177,7 +169,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing
}
}
-
[Fact]
public void ImageShouldBeOverlayedPolygonOutlineWithOpacity()
{
@@ -206,24 +197,16 @@ namespace SixLabors.ImageSharp.Tests.Drawing
using (PixelAccessor sourcePixels = image.Lock())
{
Assert.Equal(mergedColor, sourcePixels[10, 10]);
-
Assert.Equal(mergedColor, sourcePixels[200, 150]);
-
Assert.Equal(mergedColor, sourcePixels[50, 300]);
-
-
Assert.Equal(mergedColor, sourcePixels[37, 85]);
-
Assert.Equal(mergedColor, sourcePixels[93, 85]);
-
Assert.Equal(mergedColor, sourcePixels[65, 137]);
-
Assert.Equal(Rgba32.Blue, sourcePixels[2, 2]);
//inside hole
Assert.Equal(Rgba32.Blue, sourcePixels[57, 99]);
-
//inside shape
Assert.Equal(Rgba32.Blue, sourcePixels[100, 192]);
}
diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs
index e23616b1e..6128756c5 100644
--- a/tests/ImageSharp.Tests/Drawing/LineTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs
@@ -2,24 +2,24 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
+
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
using SixLabors.ImageSharp.Processing.Drawing.Pens;
+using SixLabors.ImageSharp.Processing.Overlays;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Overlays;
-
public class LineTests : FileTestBase
{
[Fact]
public void ImageShouldBeOverlayedByPath()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -46,13 +46,13 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPath_NoAntialias()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
.DrawLines(
new GraphicsOptions(false),
- Rgba32.HotPink,
+ Rgba32.HotPink,
5,
new SixLabors.Primitives.PointF[] {
new Vector2(10, 10),
@@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPathDashed()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPathDotted()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -112,7 +112,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPathDashDot()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -130,7 +130,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedByPathDashDotDot()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- Image image = new Image(500, 500);
+ var image = new Image(500, 500);
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -147,9 +147,9 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150);
+ var color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150);
- Image image = new Image(500, 500);
+ var image = new Image(500, 500);
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -161,7 +161,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
image.Save($"{path}/Opacity.png");
//shift background color towards forground color by the opacity amount
- Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f));
+ var mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f));
using (PixelAccessor sourcePixels = image.Lock())
{
@@ -178,7 +178,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "Lines");
- Image image = new Image(500, 500);
+ var image = new Image(500, 500);
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs
index 717feafa8..0c0fb58fa 100644
--- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs
+++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs
@@ -79,7 +79,6 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Paths
this.operations.FillPolygon(this.noneDefault, this.color, this.path);
FillRegionProcessor processor = this.Verify>();
-
Assert.Equal(this.noneDefault, processor.Options);
ShapeRegion region = Assert.IsType(processor.Region);
diff --git a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs
index 4a87ad189..6ce1e2da3 100644
--- a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs
+++ b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
using SixLabors.ImageSharp.Processing.Drawing.Brushes;
using SixLabors.Primitives;
@@ -9,8 +10,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests
{
- using SixLabors.ImageSharp.Processing;
-
public class RecolorImageTest : FileTestBase
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs
index 7c75c2c44..7175e7a65 100644
--- a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs
@@ -3,15 +3,14 @@
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
+using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.Shapes;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Overlays;
-
[GroupOutput("Drawing")]
public class SolidBezierTests
{
diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs
index 39a7bac53..8ff27fd72 100644
--- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs
@@ -4,33 +4,33 @@
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
+using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.Shapes;
+
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Overlays;
-
public class SolidComplexPolygonTests : FileTestBase
{
[Fact]
public void ImageShouldBeOverlayedByPolygonOutline()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "ComplexPolygon");
- Polygon simplePath = new Polygon(new LinearLineSegment(
+ var simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300)));
- Polygon hole1 = new Polygon(new LinearLineSegment(
+ var hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(93, 85),
new Vector2(65, 137)));
IPath clipped = simplePath.Clip(hole1);
// var clipped = new Rectangle(10, 10, 100, 100).Clip(new Rectangle(20, 0, 20, 20));
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -52,17 +52,17 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedPolygonOutlineWithOverlap()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "ComplexPolygon");
- Polygon simplePath = new Polygon(new LinearLineSegment(
+ var simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300)));
- Polygon hole1 = new Polygon(new LinearLineSegment(
+ var hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(130, 40),
new Vector2(65, 137)));
- using (Image image = new Image(500, 500))
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -83,18 +83,19 @@ namespace SixLabors.ImageSharp.Tests.Drawing
public void ImageShouldBeOverlayedPolygonOutlineWithOpacity()
{
string path = TestEnvironment.CreateOutputDirectory("Drawing", "ComplexPolygon");
- Polygon simplePath = new Polygon(new LinearLineSegment(
+ var simplePath = new Polygon(new LinearLineSegment(
new Vector2(10, 10),
new Vector2(200, 150),
new Vector2(50, 300)));
- Polygon hole1 = new Polygon(new LinearLineSegment(
+ var hole1 = new Polygon(new LinearLineSegment(
new Vector2(37, 85),
new Vector2(93, 85),
new Vector2(65, 137)));
- Rgba32 color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150);
- using (Image image = new Image(500, 500))
+ var color = new Rgba32(Rgba32.HotPink.R, Rgba32.HotPink.G, Rgba32.HotPink.B, 150);
+
+ using (var image = new Image(500, 500))
{
image.Mutate(x => x
.BackgroundColor(Rgba32.Blue)
@@ -102,7 +103,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing
image.Save($"{path}/Opacity.png");
//shift background color towards forground color by the opacity amount
- Rgba32 mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f));
+ var mergedColor = new Rgba32(Vector4.Lerp(Rgba32.Blue.ToVector4(), Rgba32.HotPink.ToVector4(), 150f / 255f));
using (PixelAccessor sourcePixels = image.Lock())
{
diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs
index 57ce93dea..4d6281a3c 100644
--- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs
+++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs
@@ -3,17 +3,18 @@
using System;
using System.Numerics;
+
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
+using SixLabors.ImageSharp.Processing.Drawing.Brushes;
+using SixLabors.ImageSharp.Processing.Overlays;
using SixLabors.Shapes;
+
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Drawing.Brushes;
- using SixLabors.ImageSharp.Processing.Overlays;
-
public class SolidPolygonTests : FileTestBase
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs
index 30d47ab5d..4649bee6b 100644
--- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs
+++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.Path.cs
@@ -2,14 +2,14 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Fonts;
+using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Drawing.Brushes;
+using SixLabors.ImageSharp.Processing.Drawing.Pens;
using SixLabors.ImageSharp.Processing.Drawing.Processors;
using SixLabors.ImageSharp.Processing.Text;
using SixLabors.Shapes;
using Xunit;
-using SixLabors.ImageSharp.Processing.Drawing.Pens;
namespace SixLabors.ImageSharp.Tests.Drawing.Text
{
diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs
index 9c929d1c7..88b650a3e 100644
--- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs
+++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs
@@ -2,8 +2,8 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
-using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Fonts;
+using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Drawing.Brushes;
using SixLabors.ImageSharp.Processing.Drawing.Pens;
using SixLabors.ImageSharp.Processing.Drawing.Processors;
diff --git a/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs b/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs
index ec05b64ab..9e0cd62b6 100644
--- a/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs
+++ b/tests/ImageSharp.Tests/Drawing/Text/OutputText.cs
@@ -3,9 +3,9 @@
using System.Numerics;
+using SixLabors.Fonts;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.Fonts;
using SixLabors.ImageSharp.Processing.Drawing;
using SixLabors.ImageSharp.Processing.Text;
diff --git a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs
index aed68f76b..8d29536b2 100644
--- a/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs
@@ -1,19 +1,14 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using Xunit;
-// ReSharper disable InconsistentNaming
+using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-
- using Xunit.Abstractions;
-
public class BmpEncoderTests : FileTestBase
{
public static readonly TheoryData BitsPerPixel =
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs
index 8ce1f111d..d11b3d79b 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs
@@ -123,17 +123,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
public override bool Equals(object obj)
{
- if (object.ReferenceEquals(null, obj)) return false;
- if (object.ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != this.GetType()) return false;
- return this.Equals((SpectralData)obj);
+ return obj is SpectralData other && this.Equals(other);
}
public override int GetHashCode()
{
unchecked
{
- return (this.ComponentCount * 397) ^ (this.Components != null ? this.Components[0].GetHashCode() : 0);
+ return (this.ComponentCount * 397) ^ (this.Components?[0].GetHashCode() ?? 0);
}
}
diff --git a/tests/ImageSharp.Tests/IO/LocalFileSystem.cs b/tests/ImageSharp.Tests/IO/LocalFileSystem.cs
index 3fa94d671..07f1b5cd0 100644
--- a/tests/ImageSharp.Tests/IO/LocalFileSystem.cs
+++ b/tests/ImageSharp.Tests/IO/LocalFileSystem.cs
@@ -17,9 +17,9 @@ namespace SixLabors.ImageSharp.Tests.IO
string testData = Guid.NewGuid().ToString();
File.WriteAllText(path, testData);
- LocalFileSystem fs = new LocalFileSystem();
+ var fs = new LocalFileSystem();
- using (StreamReader r = new StreamReader(fs.OpenRead(path)))
+ using (var r = new StreamReader(fs.OpenRead(path)))
{
string data = r.ReadToEnd();
@@ -34,9 +34,9 @@ namespace SixLabors.ImageSharp.Tests.IO
{
string path = Path.GetTempFileName();
string testData = Guid.NewGuid().ToString();
- LocalFileSystem fs = new LocalFileSystem();
+ var fs = new LocalFileSystem();
- using (StreamWriter r = new StreamWriter(fs.Create(path)))
+ using (var r = new StreamWriter(fs.Create(path)))
{
r.Write(testData);
}
diff --git a/tests/ImageSharp.Tests/ImageOperationTests.cs b/tests/ImageSharp.Tests/ImageOperationTests.cs
index 61705fe4e..d73eea687 100644
--- a/tests/ImageSharp.Tests/ImageOperationTests.cs
+++ b/tests/ImageSharp.Tests/ImageOperationTests.cs
@@ -4,11 +4,11 @@
using System;
using System.Linq;
-using SixLabors.ImageSharp.Processing;
-using SixLabors.ImageSharp.Processing.Processors;
using Moq;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Processing.Processors;
using Xunit;
diff --git a/tests/ImageSharp.Tests/Numerics/RationalTests.cs b/tests/ImageSharp.Tests/Numerics/RationalTests.cs
index 71bf71fa0..a9b9106c5 100644
--- a/tests/ImageSharp.Tests/Numerics/RationalTests.cs
+++ b/tests/ImageSharp.Tests/Numerics/RationalTests.cs
@@ -19,15 +19,15 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void AreEqual()
{
- Rational r1 = new Rational(3, 2);
- Rational r2 = new Rational(3, 2);
+ var r1 = new Rational(3, 2);
+ var r2 = new Rational(3, 2);
Assert.Equal(r1, r2);
Assert.True(r1 == r2);
- Rational r3 = new Rational(7.55);
- Rational r4 = new Rational(755, 100);
- Rational r5 = new Rational(151, 20);
+ var r3 = new Rational(7.55);
+ var r4 = new Rational(755, 100);
+ var r5 = new Rational(151, 20);
Assert.Equal(r3, r4);
Assert.Equal(r4, r5);
@@ -39,8 +39,8 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void AreNotEqual()
{
- Rational first = new Rational(0, 100);
- Rational second = new Rational(100, 100);
+ var first = new Rational(0, 100);
+ var second = new Rational(100, 100);
Assert.NotEqual(first, second);
Assert.True(first != second);
@@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void ConstructorAssignsProperties()
{
- Rational rational = new Rational(7, 55);
+ var rational = new Rational(7, 55);
Assert.Equal(7U, rational.Numerator);
Assert.Equal(55U, rational.Denominator);
@@ -76,15 +76,15 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void Fraction()
{
- Rational first = new Rational(1.0 / 1600);
- Rational second = new Rational(1.0 / 1600, true);
+ var first = new Rational(1.0 / 1600);
+ var second = new Rational(1.0 / 1600, true);
Assert.False(first.Equals(second));
}
[Fact]
public void ToDouble()
{
- Rational rational = new Rational(0, 0);
+ var rational = new Rational(0, 0);
Assert.Equal(double.NaN, rational.ToDouble());
rational = new Rational(2, 0);
@@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void ToStringRepresention()
{
- Rational rational = new Rational(0, 0);
+ var rational = new Rational(0, 0);
Assert.Equal("[ Indeterminate ]", rational.ToString());
rational = new Rational(double.PositiveInfinity);
diff --git a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
index b22e84f3c..77920ba2f 100644
--- a/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
+++ b/tests/ImageSharp.Tests/Numerics/SignedRationalTests.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.Primitives;
using Xunit;
@@ -19,15 +18,15 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void AreEqual()
{
- SignedRational r1 = new SignedRational(3, 2);
- SignedRational r2 = new SignedRational(3, 2);
+ var r1 = new SignedRational(3, 2);
+ var r2 = new SignedRational(3, 2);
Assert.Equal(r1, r2);
Assert.True(r1 == r2);
- SignedRational r3 = new SignedRational(7.55);
- SignedRational r4 = new SignedRational(755, 100);
- SignedRational r5 = new SignedRational(151, 20);
+ var r3 = new SignedRational(7.55);
+ var r4 = new SignedRational(755, 100);
+ var r5 = new SignedRational(151, 20);
Assert.Equal(r3, r4);
Assert.Equal(r4, r5);
@@ -39,8 +38,8 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void AreNotEqual()
{
- SignedRational first = new SignedRational(0, 100);
- SignedRational second = new SignedRational(100, 100);
+ var first = new SignedRational(0, 100);
+ var second = new SignedRational(100, 100);
Assert.NotEqual(first, second);
Assert.True(first != second);
@@ -52,7 +51,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void ConstructorAssignsProperties()
{
- SignedRational rational = new SignedRational(7, -55);
+ var rational = new SignedRational(7, -55);
Assert.Equal(7, rational.Numerator);
Assert.Equal(-55, rational.Denominator);
@@ -80,15 +79,15 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void Fraction()
{
- SignedRational first = new SignedRational(1.0 / 1600);
- SignedRational second = new SignedRational(1.0 / 1600, true);
+ var first = new SignedRational(1.0 / 1600);
+ var second = new SignedRational(1.0 / 1600, true);
Assert.False(first.Equals(second));
}
[Fact]
public void ToDouble()
{
- SignedRational rational = new SignedRational(0, 0);
+ var rational = new SignedRational(0, 0);
Assert.Equal(double.NaN, rational.ToDouble());
rational = new SignedRational(2, 0);
@@ -101,7 +100,7 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void ToStringRepresention()
{
- SignedRational rational = new SignedRational(0, 0);
+ var rational = new SignedRational(0, 0);
Assert.Equal("[ Indeterminate ]", rational.ToString());
rational = new SignedRational(double.PositiveInfinity);
diff --git a/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs b/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs
index 324225a06..46198991a 100644
--- a/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs
@@ -3,16 +3,16 @@
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing.Binarization;
+using SixLabors.ImageSharp.Processing.Binarization.Processors;
+using SixLabors.ImageSharp.Processing.Dithering;
+using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion;
+using SixLabors.ImageSharp.Processing.Dithering.Ordered;
+
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
- using SixLabors.ImageSharp.Processing.Binarization;
- using SixLabors.ImageSharp.Processing.Binarization.Processors;
- using SixLabors.ImageSharp.Processing.Dithering;
- using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion;
- using SixLabors.ImageSharp.Processing.Dithering.Ordered;
-
public class BinaryDitherTest : BaseImageOperationsExtensionTest
{
private readonly IOrderedDither orderedDither;
diff --git a/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs b/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs
index 6029b0d5f..bf15db366 100644
--- a/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs
@@ -2,18 +2,15 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp.Processing.Binarization;
+using SixLabors.ImageSharp.Processing.Binarization.Processors;
+
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
- using SixLabors.ImageSharp.Processing.Binarization;
- using SixLabors.ImageSharp.Processing.Binarization.Processors;
-
public class BinaryThresholdTest : BaseImageOperationsExtensionTest
{
-
[Fact]
public void BinaryThreshold_CorrectProcessor()
{
diff --git a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
index 89e48cfa3..3e1a7acc0 100644
--- a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
+++ b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs
@@ -1,13 +1,13 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using SixLabors.ImageSharp.Primitives;
+using SixLabors.ImageSharp.Processing.Dithering.Ordered;
+
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
- using SixLabors.ImageSharp.Primitives;
- using SixLabors.ImageSharp.Processing.Dithering.Ordered;
-
public class OrderedDitherFactoryTests
{
private static readonly DenseMatrix Expected2x2Matrix = new DenseMatrix(
diff --git a/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs b/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs
index a29fc28c9..e53de85fe 100644
--- a/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs
@@ -2,16 +2,15 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing.Dithering;
+using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion;
+using SixLabors.ImageSharp.Processing.Dithering.Ordered;
+using SixLabors.ImageSharp.Processing.Dithering.Processors;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Binarization
{
- using SixLabors.ImageSharp.Processing.Dithering;
- using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion;
- using SixLabors.ImageSharp.Processing.Dithering.Ordered;
- using SixLabors.ImageSharp.Processing.Dithering.Processors;
-
public class DitherTest : BaseImageOperationsExtensionTest
{
private readonly IOrderedDither orderedDither;
diff --git a/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs
index 7aa1720e2..6aa8fbba6 100644
--- a/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs
@@ -2,14 +2,13 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing.Overlays;
+using SixLabors.ImageSharp.Processing.Overlays.Processors;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Effects
{
- using SixLabors.ImageSharp.Processing.Overlays;
- using SixLabors.ImageSharp.Processing.Overlays.Processors;
-
public class BackgroundColorTest : BaseImageOperationsExtensionTest
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs b/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs
index f40cc250b..2f4ba0516 100644
--- a/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs
@@ -2,15 +2,12 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp.Processing.Effects;
+using SixLabors.ImageSharp.Processing.Effects.Processors;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Effects
{
- using SixLabors.ImageSharp.Processing.Effects;
- using SixLabors.ImageSharp.Processing.Effects.Processors;
-
public class OilPaintTest : BaseImageOperationsExtensionTest
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs
index 1cc69bcb6..245e104f9 100644
--- a/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs
@@ -2,15 +2,12 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp.Processing.Effects;
+using SixLabors.ImageSharp.Processing.Effects.Processors;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Effects
{
- using SixLabors.ImageSharp.Processing.Effects;
- using SixLabors.ImageSharp.Processing.Effects.Processors;
-
public class PixelateTest : BaseImageOperationsExtensionTest
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs
index db10c16b1..7e06e67d7 100644
--- a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs
@@ -2,14 +2,12 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing.Processors;
+using SixLabors.ImageSharp.Processing.Filters;
+using SixLabors.ImageSharp.Processing.Filters.Processors;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Filters
{
- using SixLabors.ImageSharp.Processing.Filters;
- using SixLabors.ImageSharp.Processing.Filters.Processors;
-
public class BlackWhiteTest : BaseImageOperationsExtensionTest
{
[Fact]
@@ -22,7 +20,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Filters
[Fact]
public void BlackWhite_rect_CorrectProcessor()
{
- this.operations.BlackWhite( this.rect);
+ this.operations.BlackWhite(this.rect);
BlackWhiteProcessor p = this.Verify>(this.rect);
}
}
diff --git a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs
index dc3281a63..e47430efa 100644
--- a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs
@@ -2,15 +2,12 @@
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Processing.Processors;
-using SixLabors.Primitives;
+using SixLabors.ImageSharp.Processing.Filters;
+using SixLabors.ImageSharp.Processing.Filters.Processors;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Effects
{
- using SixLabors.ImageSharp.Processing.Filters;
- using SixLabors.ImageSharp.Processing.Filters.Processors;
-
public class BrightnessTest : BaseImageOperationsExtensionTest
{
[Fact]
diff --git a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs
index 04b916b6e..ee99938bb 100644
--- a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs
@@ -4,16 +4,15 @@
using System.Collections.Generic;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing.Filters;
+using SixLabors.ImageSharp.Processing.Filters.Processors;
+using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Tests.TestUtilities;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Filters
{
- using SixLabors.ImageSharp.Processing.Filters;
- using SixLabors.ImageSharp.Processing.Filters.Processors;
- using SixLabors.ImageSharp.Processing.Processors;
-
public class ColorBlindnessTest : BaseImageOperationsExtensionTest
{
public static IEnumerable
public int PerPixelManhattanThreshold { get; }
-
+
public override ImageSimilarityReport CompareImagesOrFrames(ImageFrame expected, ImageFrame actual)
{
if (expected.Size() != actual.Size())
{
throw new InvalidOperationException("Calling ImageComparer is invalid when dimensions mismatch!");
}
-
+
int width = actual.Width;
// TODO: Comparing through Rgba32 is not robust enough because of the existance of super high precision pixel types.
- Rgba32[] aBuffer = new Rgba32[width];
- Rgba32[] bBuffer = new Rgba32[width];
+ var aBuffer = new Rgba32[width];
+ var bBuffer = new Rgba32[width];
float totalDifference = 0.0f;
@@ -93,7 +93,7 @@
float normalizedDifference = totalDifference / ((float)actual.Width * (float)actual.Height);
normalizedDifference /= 4.0f * 255.0f;
-
+
if (normalizedDifference > this.ImageThreshold)
{
return new ImageSimilarityReport(expected, actual, differences, normalizedDifference);
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
index 4993273fa..2dbddcc8f 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
@@ -115,7 +115,7 @@ namespace SixLabors.ImageSharp.Tests
{
this.FilePath = filePath;
}
-
+
///
/// Gets the file path relative to the "~/tests/images" folder
///
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
index 30902b4b0..df5b424a2 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs
@@ -1,17 +1,15 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Drawing;
-using SixLabors.ImageSharp.Processing.Overlays;
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests
{
- using SixLabors.ImageSharp.Processing;
///
/// Provides instances for parametric unit tests.
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs
index d4f936cd4..ab0cc42f9 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs
@@ -3,19 +3,16 @@
using System;
using System.Reflection;
+using Castle.Core.Internal;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests
{
- using Castle.Core.Internal;
-
- using SixLabors.ImageSharp.Memory;
- using SixLabors.ImageSharp.Processing;
-
public interface ITestImageProvider
{
PixelTypes PixelType { get; }
@@ -103,7 +100,7 @@ namespace SixLabors.ImageSharp.Tests
///
public Image GetImage(Action> operationsToApply)
{
- var img = GetImage();
+ Image img = GetImage();
img.Mutate(operationsToApply);
return img;
}
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
index 7fc9e58d4..0b25991ff 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
@@ -7,14 +7,11 @@ using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
-using Xunit.Abstractions;
-
namespace SixLabors.ImageSharp.Tests
{
public abstract partial class TestImageProvider
where TPixel : struct, IPixel
{
-
///
/// A test image provider that produces test patterns.
///
@@ -199,7 +196,7 @@ namespace SixLabors.ImageSharp.Tests
int pixelCount = left * top;
uint stepsPerPixel = (uint)(uint.MaxValue / pixelCount);
- TPixel c = default(TPixel);
+ TPixel c = default;
Rgba32 t = new Rgba32(0);
for (int x = left; x < right; x++)
diff --git a/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs b/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs
index c892c09de..6d06ec5e9 100644
--- a/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/MeasureFixture.cs
@@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.Tests
}
private ITestOutputHelper Output { get; }
-
+
public void Dispose()
{
this.stopwatch.Stop();
diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs
index 0e967e927..b1e53cb6a 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceDecoder.cs
@@ -1,7 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-
using System.IO;
using SixLabors.ImageSharp.Formats;
@@ -23,7 +22,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
{
return SystemDrawingBridge.FromFromArgb32SystemDrawingBitmap(sourceBitmap);
}
-
+
using (var convertedBitmap = new System.Drawing.Bitmap(
sourceBitmap.Width,
sourceBitmap.Height,
diff --git a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs
index e1ef68fa6..ca6f32f5b 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingReferenceEncoder.cs
@@ -1,9 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System.Collections.Generic;
-using System.Text;
-
using System.Drawing.Imaging;
using System.IO;
@@ -21,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs
this.imageFormat = imageFormat;
}
- public static SystemDrawingReferenceEncoder Png { get; } = new SystemDrawingReferenceEncoder(System.Drawing.Imaging.ImageFormat.Png);
+ public static SystemDrawingReferenceEncoder Png { get; } = new SystemDrawingReferenceEncoder(ImageFormat.Png);
public void Encode(Image image, Stream stream)
where TPixel : struct, IPixel
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
index 7616f89ea..ee0382dbe 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
@@ -4,23 +4,19 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
+using System.Numerics;
+using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats;
+using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
+
+using Xunit;
namespace SixLabors.ImageSharp.Tests
{
- using System.Numerics;
- using SixLabors.ImageSharp.Advanced;
- using SixLabors.ImageSharp.Memory;
- using SixLabors.ImageSharp.MetaData;
- using SixLabors.ImageSharp.Processing;
-
- using Xunit;
-
public static class TestImageExtensions
{
///
@@ -32,28 +28,28 @@ namespace SixLabors.ImageSharp.Tests
where TPixel : struct, IPixel
{
MemoryManager memoryManager = ctx.MemoryManager;
- ctx.Apply(
- img =>
- {
- using (Buffer2D temp = memoryManager.Allocate2D(img.Width, img.Height))
- {
- Span tempSpan = temp.Span;
- foreach (ImageFrame frame in img.Frames)
- {
- Span pixelSpan = frame.GetPixelSpan();
- PixelOperations.Instance.ToVector4(pixelSpan, tempSpan, pixelSpan.Length);
+ ctx.Apply(img =>
+ {
+ using (Buffer2D temp = memoryManager.Allocate2D(img.Width, img.Height))
+ {
+ Span tempSpan = temp.Span;
+ foreach (ImageFrame frame in img.Frames)
+ {
+ Span pixelSpan = frame.GetPixelSpan();
- for (int i = 0; i < tempSpan.Length; i++)
- {
- ref Vector4 v = ref tempSpan[i];
- v.W = 1.0f;
- }
+ PixelOperations.Instance.ToVector4(pixelSpan, tempSpan, pixelSpan.Length);
- PixelOperations.Instance.PackFromVector4(tempSpan, pixelSpan, pixelSpan.Length);
- }
+ for (int i = 0; i < tempSpan.Length; i++)
+ {
+ ref Vector4 v = ref tempSpan[i];
+ v.W = 1.0f;
}
- });
+
+ PixelOperations.Instance.PackFromVector4(tempSpan, pixelSpan, pixelSpan.Length);
+ }
+ }
+ });
}
///
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs b/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs
index 1eb0aafff..7ce892edb 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestPixel.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using SixLabors.ImageSharp.PixelFormats;
+
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests.TestUtilities
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestType.cs b/tests/ImageSharp.Tests/TestUtilities/TestType.cs
index 788a0543a..852aaf2d4 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestType.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestType.cs
@@ -14,7 +14,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities
public TestType()
{
}
-
+
public void Deserialize(IXunitSerializationInfo info)
{
}
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
index 9af3ce39c..4f9a558d4 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
@@ -6,14 +6,14 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
+
using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests
{
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
- using SixLabors.Primitives;
-
///
/// Various utility and extension methods.
///
diff --git a/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs b/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs
index 3916f189c..990258e0c 100644
--- a/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/TestVector4.cs
@@ -1,11 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using System;
-using System.Collections.Generic;
using System.Numerics;
-using System.Text;
-using SixLabors.ImageSharp.PixelFormats;
using Xunit.Abstractions;
namespace SixLabors.ImageSharp.Tests.TestUtilities
@@ -43,8 +39,8 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities
{
this.X = info.GetValue("x");
this.Y = info.GetValue("y");
- this.Z= info.GetValue("z");
- this.W= info.GetValue("w");
+ this.Z = info.GetValue("z");
+ this.W = info.GetValue("w");
}
public void Serialize(IXunitSerializationInfo info)
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/GroupOutputTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/GroupOutputTests.cs
index be12678c8..061d42b0a 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/GroupOutputTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/GroupOutputTests.cs
@@ -1,12 +1,11 @@
-// ReSharper disable InconsistentNaming
-namespace SixLabors.ImageSharp.Tests
-{
- using System.IO;
+using System.IO;
- using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.PixelFormats;
- using Xunit;
+using Xunit;
+namespace SixLabors.ImageSharp.Tests
+{
[GroupOutput("Foo")]
public class GroupOutputTests
{
@@ -17,9 +16,9 @@ namespace SixLabors.ImageSharp.Tests
{
Assert.Equal("Foo", provider.Utility.OutputSubfolderName);
}
-
+
[Theory]
- [WithBlankImages(1,1, PixelTypes.Rgba32)]
+ [WithBlankImages(1, 1, PixelTypes.Rgba32)]
public void GetTestOutputDir_ShouldDefineSubfolder(TestImageProvider provider)
where TPixel : struct, IPixel
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
index 1e768637e..48c1b391a 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs
@@ -1,21 +1,19 @@
-// ReSharper disable InconsistentNaming
-namespace SixLabors.ImageSharp.Tests
-{
- using System.Collections.Generic;
- using System.Linq;
-
- using SixLabors.ImageSharp.PixelFormats;
- using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+using System.Collections.Generic;
+using System.Linq;
- using Moq;
+using Moq;
- using SixLabors.Primitives;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Processing.Transforms;
+using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+using SixLabors.Primitives;
- using Xunit;
- using Xunit.Abstractions;
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Processing.Transforms;
+using Xunit;
+using Xunit.Abstractions;
+namespace SixLabors.ImageSharp.Tests
+{
public class ImageComparerTests
{
public ImageComparerTests(ITestOutputHelper output)
@@ -24,9 +22,9 @@ namespace SixLabors.ImageSharp.Tests
}
private ITestOutputHelper Output { get; }
-
+
[Theory]
- [WithTestPatternImages(100,100,PixelTypes.Rgba32, 0.0001f, 1)]
+ [WithTestPatternImages(100, 100, PixelTypes.Rgba32, 0.0001f, 1)]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32, 0, 0)]
public void TolerantImageComparer_ApprovesPerfectSimilarity(
TestImageProvider provider,
@@ -85,7 +83,7 @@ namespace SixLabors.ImageSharp.Tests
}
}
}
-
+
[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32)]
public void TolerantImageComparer_TestPerPixelThreshold(TestImageProvider provider)
@@ -160,7 +158,7 @@ namespace SixLabors.ImageSharp.Tests
}
}
}
-
+
[Theory]
[WithTestPatternImages(100, 100, PixelTypes.Rgba32)]
public void ExactComparer_DoesNotTolerateAnyPixelDifference(TestImageProvider provider)
@@ -174,7 +172,7 @@ namespace SixLabors.ImageSharp.Tests
ImagingTestCaseUtility.ModifyPixel(clone, 7, 93, 1);
IEnumerable reports = ExactImageComparer.Instance.CompareImages(image, clone);
-
+
this.Output.WriteLine(reports.Single().ToString());
PixelDifference[] differences = reports.Single().Differences;
Assert.Equal(2, differences.Length);
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceCodecTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceCodecTests.cs
index eda6c99a3..ee398c87b 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceCodecTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ReferenceCodecTests.cs
@@ -1,15 +1,14 @@
-namespace SixLabors.ImageSharp.Tests
-{
- using SixLabors.ImageSharp.Formats;
- using SixLabors.ImageSharp.Formats.Png;
- using SixLabors.ImageSharp.PixelFormats;
- using SixLabors.ImageSharp.Processing;
- using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
- using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
+using SixLabors.ImageSharp.Formats.Png;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
- using Xunit;
- using Xunit.Abstractions;
+using Xunit;
+using Xunit.Abstractions;
+namespace SixLabors.ImageSharp.Tests
+{
public class ReferenceCodecTests
{
private ITestOutputHelper Output { get; }
@@ -73,7 +72,7 @@ namespace SixLabors.ImageSharp.Tests
if (TestEnvironment.IsLinux) return;
string path = SavePng(provider, PngColorType.RgbWithAlpha);
-
+
using (var sdBitmap = new System.Drawing.Bitmap(path))
{
using (Image original = provider.GetImage())
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
index 25584727a..9db55281e 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs
@@ -5,18 +5,17 @@ using System;
using System.IO;
using SixLabors.ImageSharp.Formats;
+using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.Formats.Jpeg;
+using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs;
+
using Xunit;
using Xunit.Abstractions;
-// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests
{
- using SixLabors.ImageSharp.Formats.Bmp;
- using SixLabors.ImageSharp.Formats.Png;
-
public class TestEnvironmentTests
{
public TestEnvironmentTests(ITestOutputHelper output)
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageExtensionsTests.cs
index 45ac2d6cc..6a1582828 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageExtensionsTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageExtensionsTests.cs
@@ -1,15 +1,14 @@
-// ReSharper disable InconsistentNaming
-namespace SixLabors.ImageSharp.Tests
-{
- using System;
+using System;
- using SixLabors.ImageSharp.PixelFormats;
- using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+using Moq;
- using Moq;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
- using Xunit;
+using Xunit;
+namespace SixLabors.ImageSharp.Tests
+{
public class TestImageExtensionsTests
{
[Theory]
@@ -83,11 +82,10 @@ namespace SixLabors.ImageSharp.Tests
{
ImagingTestCaseUtility.ModifyPixel(image, 3, 1, 1);
- Assert.ThrowsAny(
- () =>
- {
- image.CompareToOriginal(provider, ImageComparer.Exact);
- });
+ Assert.ThrowsAny(() =>
+ {
+ image.CompareToOriginal(provider, ImageComparer.Exact);
+ });
}
}
@@ -98,11 +96,10 @@ namespace SixLabors.ImageSharp.Tests
{
using (Image image = provider.GetImage())
{
- Assert.ThrowsAny(
- () =>
- {
- image.CompareToOriginal(provider, Mock.Of());
- });
+ Assert.ThrowsAny(() =>
+ {
+ image.CompareToOriginal(provider, Mock.Of());
+ });
}
}
}
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs
index 2f306e949..494c56dea 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs
@@ -116,7 +116,6 @@ namespace SixLabors.ImageSharp.Tests
}
}
-
[Theory]
[WithFile(TestImages.Bmp.F, PixelTypes.Rgba32)]
public void GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache(TestImageProvider provider)
@@ -124,20 +123,19 @@ namespace SixLabors.ImageSharp.Tests
{
Assert.NotNull(provider.Utility.SourceFileOrDescription);
- TestDecoder.DoTestThreadSafe(
- () =>
- {
- string testName = nameof(this.GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache);
+ TestDecoder.DoTestThreadSafe(() =>
+ {
+ string testName = nameof(this.GetImage_WithCustomParameterlessDecoder_ShouldUtilizeCache);
- var decoder = new TestDecoder();
- decoder.InitCaller(testName);
+ var decoder = new TestDecoder();
+ decoder.InitCaller(testName);
- provider.GetImage(decoder);
- Assert.Equal(1, TestDecoder.GetInvocationCount(testName));
+ provider.GetImage(decoder);
+ Assert.Equal(1, TestDecoder.GetInvocationCount(testName));
- provider.GetImage(decoder);
- Assert.Equal(1, TestDecoder.GetInvocationCount(testName));
- });
+ provider.GetImage(decoder);
+ Assert.Equal(1, TestDecoder.GetInvocationCount(testName));
+ });
}
private class TestDecoderWithParameters : IImageDecoder
@@ -183,24 +181,23 @@ namespace SixLabors.ImageSharp.Tests
{
Assert.NotNull(provider.Utility.SourceFileOrDescription);
- TestDecoderWithParameters.DoTestThreadSafe(
- () =>
- {
- string testName =
- nameof(this.GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual);
+ TestDecoderWithParameters.DoTestThreadSafe(() =>
+ {
+ string testName =
+ nameof(this.GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual);
- var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 };
- decoder1.InitCaller(testName);
+ var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 };
+ decoder1.InitCaller(testName);
- var decoder2 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 };
- decoder2.InitCaller(testName);
+ var decoder2 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 };
+ decoder2.InitCaller(testName);
- provider.GetImage(decoder1);
- Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName));
+ provider.GetImage(decoder1);
+ Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName));
- provider.GetImage(decoder2);
- Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName));
- });
+ provider.GetImage(decoder2);
+ Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName));
+ });
}
[Theory]
@@ -210,24 +207,23 @@ namespace SixLabors.ImageSharp.Tests
{
Assert.NotNull(provider.Utility.SourceFileOrDescription);
- TestDecoderWithParameters.DoTestThreadSafe(
- () =>
- {
- string testName =
- nameof(this.GetImage_WithCustomParametricDecoder_ShouldNotUtilizeCache_WhenParametersAreNotEqual);
+ TestDecoderWithParameters.DoTestThreadSafe(() =>
+ {
+ string testName =
+ nameof(this.GetImage_WithCustomParametricDecoder_ShouldNotUtilizeCache_WhenParametersAreNotEqual);
- var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 42 };
- decoder1.InitCaller(testName);
+ var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 42 };
+ decoder1.InitCaller(testName);
- var decoder2 = new TestDecoderWithParameters() { Param1 = "LoL", Param2 = 42 };
- decoder2.InitCaller(testName);
+ var decoder2 = new TestDecoderWithParameters() { Param1 = "LoL", Param2 = 42 };
+ decoder2.InitCaller(testName);
- provider.GetImage(decoder1);
- Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName));
+ provider.GetImage(decoder1);
+ Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName));
- provider.GetImage(decoder2);
- Assert.Equal(2, TestDecoderWithParameters.GetInvocationCount(testName));
- });
+ provider.GetImage(decoder2);
+ Assert.Equal(2, TestDecoderWithParameters.GetInvocationCount(testName));
+ });
}
diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs
index 1e58b7097..a451402c2 100644
--- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs
@@ -7,6 +7,7 @@ using System.Linq;
using System.Numerics;
using SixLabors.ImageSharp.PixelFormats;
+
using Xunit;
using Xunit.Abstractions;