diff --git a/.editorconfig b/.editorconfig
index af1e5b44c1..74a363eef1 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -161,6 +161,9 @@ csharp_style_deconstructed_variable_declaration = true:warning
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:error
+# ReSharper inspection severities
+resharper_arrange_object_creation_when_type_evident_highlighting = error
+resharper_arrange_object_creation_when_type_not_evident_highlighting = error
# "Null" checking preferences
csharp_style_throw_expression = true:warning
csharp_style_conditional_delegate_call = true:warning
diff --git a/shared-infrastructure b/shared-infrastructure
index 5e13cde851..132a8232bd 160000
--- a/shared-infrastructure
+++ b/shared-infrastructure
@@ -1 +1 @@
-Subproject commit 5e13cde851a3d6e95d0dfdde2a57071f1efda9c3
+Subproject commit 132a8232bd61471e9e9df727fb7a112800030327
diff --git a/src/ImageSharp/Advanced/ParallelExecutionSettings.cs b/src/ImageSharp/Advanced/ParallelExecutionSettings.cs
index f295ddb1b0..fd9692f9ae 100644
--- a/src/ImageSharp/Advanced/ParallelExecutionSettings.cs
+++ b/src/ImageSharp/Advanced/ParallelExecutionSettings.cs
@@ -79,7 +79,7 @@ public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier)
{
Guard.MustBeGreaterThan(multiplier, 0, nameof(multiplier));
- return new(
+ return new ParallelExecutionSettings(
this.MaxDegreeOfParallelism,
this.MinimumPixelsProcessedPerTask * multiplier,
this.MemoryAllocator);
@@ -92,6 +92,6 @@ public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier)
/// The .
public static ParallelExecutionSettings FromConfiguration(Configuration configuration)
{
- return new(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator);
+ return new ParallelExecutionSettings(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator);
}
}
diff --git a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs
index b76f2948f1..cbcd12aec2 100644
--- a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs
+++ b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs
@@ -139,7 +139,7 @@ public void Invoke(int i)
}
int yMax = Math.Min(yMin + this.stepY, this.maxY);
- RowInterval rows = new RowInterval(yMin, yMax);
+ RowInterval rows = new(yMin, yMax);
// Skip the safety copy when invoking a potentially impure method on a readonly field
Unsafe.AsRef(in this.operation).Invoke(in rows);
@@ -185,7 +185,7 @@ public void Invoke(int i)
}
int yMax = Math.Min(yMin + this.stepY, this.maxY);
- RowInterval rows = new RowInterval(yMin, yMax);
+ RowInterval rows = new(yMin, yMax);
using IMemoryOwner buffer = this.allocator.Allocate(this.bufferLength);
diff --git a/src/ImageSharp/Color/Color.WernerPalette.cs b/src/ImageSharp/Color/Color.WernerPalette.cs
index 1058da6547..6f0e3744f3 100644
--- a/src/ImageSharp/Color/Color.WernerPalette.cs
+++ b/src/ImageSharp/Color/Color.WernerPalette.cs
@@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp;
///
public partial struct Color
{
- private static readonly Lazy WernerPaletteLazy = new Lazy(CreateWernerPalette, true);
+ private static readonly Lazy WernerPaletteLazy = new(CreateWernerPalette, true);
///
/// Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821.
diff --git a/src/ImageSharp/Color/Color.cs b/src/ImageSharp/Color/Color.cs
index 8f54680ec4..1dfbf0a243 100644
--- a/src/ImageSharp/Color/Color.cs
+++ b/src/ImageSharp/Color/Color.cs
@@ -81,10 +81,10 @@ public static Color FromPixel(TPixel source)
PixelTypeInfo info = TPixel.GetPixelTypeInfo();
if (info.ComponentInfo.HasValue && info.ComponentInfo.Value.GetMaximumComponentPrecision() <= (int)PixelComponentBitDepth.Bit32)
{
- return new(source.ToScaledVector4());
+ return new Color(source.ToScaledVector4());
}
- return new(source);
+ return new Color(source);
}
///
@@ -120,7 +120,7 @@ public static void FromPixel(ReadOnlySpan source, Span de
{
for (int i = 0; i < destination.Length; i++)
{
- destination[i] = new(source[i]);
+ destination[i] = new Color(source[i]);
}
}
}
diff --git a/src/ImageSharp/ColorProfiles/CieLab.cs b/src/ImageSharp/ColorProfiles/CieLab.cs
index c1f53c1622..ebe1631021 100644
--- a/src/ImageSharp/ColorProfiles/CieLab.cs
+++ b/src/ImageSharp/ColorProfiles/CieLab.cs
@@ -88,7 +88,7 @@ public Vector4 ToScaledVector4()
v3 += this.AsVector3Unsafe();
v3 += new Vector3(0, 128F, 128F);
v3 /= new Vector3(100F, 255F, 255F);
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -97,7 +97,7 @@ public static CieLab FromScaledVector4(Vector4 source)
Vector3 v3 = source.AsVector3();
v3 *= new Vector3(100F, 255, 255);
v3 -= new Vector3(0, 128F, 128F);
- return new(v3);
+ return new CieLab(v3);
}
///
@@ -145,7 +145,7 @@ public static CieLab FromProfileConnectingSpace(ColorConversionOptions options,
float a = 500F * (fx - fy);
float b = 200F * (fy - fz);
- return new(l, a, b);
+ return new CieLab(l, a, b);
}
///
@@ -182,7 +182,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
Vector3 wxyz = new(whitePoint.X, whitePoint.Y, whitePoint.Z);
Vector3 xyzr = new(xr, yr, zr);
- return new(xyzr * wxyz);
+ return new CieXyz(xyzr * wxyz);
}
///
diff --git a/src/ImageSharp/ColorProfiles/CieLch.cs b/src/ImageSharp/ColorProfiles/CieLch.cs
index 53afc0053b..e62aa2ba23 100644
--- a/src/ImageSharp/ColorProfiles/CieLch.cs
+++ b/src/ImageSharp/ColorProfiles/CieLch.cs
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The hue in degrees.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLch(float l, float c, float h)
- : this(new(l, c, h))
+ : this(new Vector3(l, c, h))
{
}
@@ -100,7 +100,7 @@ public Vector4 ToScaledVector4()
v3 += this.AsVector3Unsafe();
v3 += new Vector3(0, 200, 0);
v3 /= new Vector3(100, 400, 360);
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -109,7 +109,7 @@ public static CieLch FromScaledVector4(Vector4 source)
Vector3 v3 = source.AsVector3();
v3 *= new Vector3(100, 400, 360);
v3 -= new Vector3(0, 200, 0);
- return new(v3, true);
+ return new CieLch(v3, true);
}
///
@@ -155,7 +155,7 @@ public static CieLch FromProfileConnectingSpace(ColorConversionOptions options,
hDegrees += 360;
}
- return new(l, c, hDegrees);
+ return new CieLch(l, c, hDegrees);
}
///
@@ -181,7 +181,7 @@ public CieLab ToProfileConnectingSpace(ColorConversionOptions options)
float a = c * MathF.Cos(hRadians);
float b = c * MathF.Sin(hRadians);
- return new(l, a, b);
+ return new CieLab(l, a, b);
}
///
diff --git a/src/ImageSharp/ColorProfiles/CieLchuv.cs b/src/ImageSharp/ColorProfiles/CieLchuv.cs
index c08d6cc40c..5478752ddc 100644
--- a/src/ImageSharp/ColorProfiles/CieLchuv.cs
+++ b/src/ImageSharp/ColorProfiles/CieLchuv.cs
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The hue in degrees.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public CieLchuv(float l, float c, float h)
- : this(new(l, c, h))
+ : this(new Vector3(l, c, h))
{
}
@@ -97,7 +97,7 @@ public Vector4 ToScaledVector4()
v3 += this.AsVector3Unsafe();
v3 += new Vector3(0, 200, 0);
v3 /= new Vector3(100, 400, 360);
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -106,7 +106,7 @@ public static CieLchuv FromScaledVector4(Vector4 source)
Vector3 v3 = source.AsVector3();
v3 *= new Vector3(100, 400, 360);
v3 -= new Vector3(0, 200, 0);
- return new(v3, true);
+ return new CieLchuv(v3, true);
}
///
@@ -154,7 +154,7 @@ public static CieLchuv FromProfileConnectingSpace(ColorConversionOptions options
hDegrees += 360;
}
- return new(l, c, hDegrees);
+ return new CieLchuv(l, c, hDegrees);
}
///
diff --git a/src/ImageSharp/ColorProfiles/CieLuv.cs b/src/ImageSharp/ColorProfiles/CieLuv.cs
index 58ec9048c0..b17c433313 100644
--- a/src/ImageSharp/ColorProfiles/CieLuv.cs
+++ b/src/ImageSharp/ColorProfiles/CieLuv.cs
@@ -134,7 +134,7 @@ public static CieLuv FromProfileConnectingSpace(ColorConversionOptions options,
v = 0;
}
- return new((float)l, (float)u, (float)v);
+ return new CieLuv((float)l, (float)u, (float)v);
}
///
@@ -188,7 +188,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
z = 0;
}
- return new((float)x, (float)y, (float)z);
+ return new CieXyz((float)x, (float)y, (float)z);
}
///
diff --git a/src/ImageSharp/ColorProfiles/CieXyy.cs b/src/ImageSharp/ColorProfiles/CieXyy.cs
index ef45f352df..744b6195e9 100644
--- a/src/ImageSharp/ColorProfiles/CieXyy.cs
+++ b/src/ImageSharp/ColorProfiles/CieXyy.cs
@@ -122,10 +122,10 @@ public static CieXyy FromProfileConnectingSpace(ColorConversionOptions options,
if (float.IsNaN(x) || float.IsNaN(y))
{
- return new(0, 0, source.Y);
+ return new CieXyy(0, 0, source.Y);
}
- return new(x, y, source.Y);
+ return new CieXyy(x, y, source.Y);
}
///
@@ -144,14 +144,14 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
{
if (MathF.Abs(this.Y) < Constants.Epsilon)
{
- return new(0, 0, this.Yl);
+ return new CieXyz(0, 0, this.Yl);
}
float x = (this.X * this.Yl) / this.Y;
float y = this.Yl;
float z = ((1 - this.X - this.Y) * y) / this.Y;
- return new(x, y, z);
+ return new CieXyz(x, y, z);
}
///
diff --git a/src/ImageSharp/ColorProfiles/CieXyz.cs b/src/ImageSharp/ColorProfiles/CieXyz.cs
index b14f014695..94fcfb21bb 100644
--- a/src/ImageSharp/ColorProfiles/CieXyz.cs
+++ b/src/ImageSharp/ColorProfiles/CieXyz.cs
@@ -88,7 +88,7 @@ internal Vector4 ToVector4()
{
Vector3 v3 = default;
v3 += this.AsVector3Unsafe();
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -97,13 +97,13 @@ public Vector4 ToScaledVector4()
Vector3 v3 = default;
v3 += this.AsVector3Unsafe();
v3 *= 32768F / 65535;
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
internal static CieXyz FromVector4(Vector4 source)
{
Vector3 v3 = source.AsVector3();
- return new(v3);
+ return new CieXyz(v3);
}
///
@@ -111,7 +111,7 @@ public static CieXyz FromScaledVector4(Vector4 source)
{
Vector3 v3 = source.AsVector3();
v3 *= 65535 / 32768F;
- return new(v3);
+ return new CieXyz(v3);
}
///
diff --git a/src/ImageSharp/ColorProfiles/Cmyk.cs b/src/ImageSharp/ColorProfiles/Cmyk.cs
index 3a2ffd6fb6..ee81ff9f7e 100644
--- a/src/ImageSharp/ColorProfiles/Cmyk.cs
+++ b/src/ImageSharp/ColorProfiles/Cmyk.cs
@@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The keyline black component.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Cmyk(float c, float m, float y, float k)
- : this(new(c, m, y, k))
+ : this(new Vector4(c, m, y, k))
{
}
@@ -138,12 +138,12 @@ public static Cmyk FromProfileConnectingSpace(ColorConversionOptions options, in
if (k.X >= 1F - Constants.Epsilon)
{
- return new(0, 0, 0, 1F);
+ return new Cmyk(0, 0, 0, 1F);
}
cmy = (cmy - k) / (Vector3.One - k);
- return new(cmy.X, cmy.Y, cmy.Z, k.X);
+ return new Cmyk(cmy.X, cmy.Y, cmy.Z, k.X);
}
///
diff --git a/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs b/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs
index d0afec4ab2..7072537a4a 100644
--- a/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs
+++ b/src/ImageSharp/ColorProfiles/ColorProfileConverter.cs
@@ -12,7 +12,7 @@ public class ColorProfileConverter
/// Initializes a new instance of the class.
///
public ColorProfileConverter()
- : this(new())
+ : this(new ColorConversionOptions())
{
}
diff --git a/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs b/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs
index b00ff8200b..c33f40001a 100644
--- a/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs
+++ b/src/ImageSharp/ColorProfiles/ColorProfileConverterExtensionsIcc.cs
@@ -57,11 +57,11 @@ internal static TTo ConvertUsingIccProfile(this ColorProfileConverte
ConversionParams sourceParams = new(converter.Options.SourceIccProfile, toPcs: true);
ConversionParams targetParams = new(converter.Options.TargetIccProfile, toPcs: false);
- ColorProfileConverter pcsConverter = new(new()
+ ColorProfileConverter pcsConverter = new(new ColorConversionOptions
{
MemoryAllocator = converter.Options.MemoryAllocator,
- SourceWhitePoint = new(converter.Options.SourceIccProfile.Header.PcsIlluminant),
- TargetWhitePoint = new(converter.Options.TargetIccProfile.Header.PcsIlluminant),
+ SourceWhitePoint = new CieXyz(converter.Options.SourceIccProfile.Header.PcsIlluminant),
+ TargetWhitePoint = new CieXyz(converter.Options.TargetIccProfile.Header.PcsIlluminant),
});
// Normalize the source, then convert to the PCS space.
@@ -101,11 +101,11 @@ internal static void ConvertUsingIccProfile(this ColorProfileConvert
ConversionParams sourceParams = new(converter.Options.SourceIccProfile, toPcs: true);
ConversionParams targetParams = new(converter.Options.TargetIccProfile, toPcs: false);
- ColorProfileConverter pcsConverter = new(new()
+ ColorProfileConverter pcsConverter = new(new ColorConversionOptions
{
MemoryAllocator = converter.Options.MemoryAllocator,
- SourceWhitePoint = new(converter.Options.SourceIccProfile.Header.PcsIlluminant),
- TargetWhitePoint = new(converter.Options.TargetIccProfile.Header.PcsIlluminant),
+ SourceWhitePoint = new CieXyz(converter.Options.SourceIccProfile.Header.PcsIlluminant),
+ TargetWhitePoint = new CieXyz(converter.Options.TargetIccProfile.Header.PcsIlluminant),
});
using IMemoryOwner pcsBuffer = converter.Options.MemoryAllocator.Allocate(source.Length);
@@ -355,7 +355,7 @@ private static Vector4 GetTargetPcsWithPerceptualAdjustment(
vector = Vector3.Max(vector, Vector3.Zero);
}
- xyz = new(AdjustPcsFromV2BlackPoint(vector));
+ xyz = new CieXyz(AdjustPcsFromV2BlackPoint(vector));
}
// when converting from PCS to device with v2 perceptual intent
@@ -371,7 +371,7 @@ private static Vector4 GetTargetPcsWithPerceptualAdjustment(
vector = Vector3.Max(vector, Vector3.Zero);
}
- xyz = new(vector);
+ xyz = new CieXyz(vector);
}
switch (targetParams.PcsType)
diff --git a/src/ImageSharp/ColorProfiles/Hsl.cs b/src/ImageSharp/ColorProfiles/Hsl.cs
index 2735b55137..7a9365fb75 100644
--- a/src/ImageSharp/ColorProfiles/Hsl.cs
+++ b/src/ImageSharp/ColorProfiles/Hsl.cs
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The l value (lightness) component.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsl(float h, float s, float l)
- : this(new(h, s, l))
+ : this(new Vector3(h, s, l))
{
}
@@ -141,7 +141,7 @@ public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in
if (MathF.Abs(chroma) < Constants.Epsilon)
{
- return new(0F, s, l);
+ return new Hsl(0F, s, l);
}
if (MathF.Abs(r - max) < Constants.Epsilon)
@@ -172,7 +172,7 @@ public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in
s = chroma / (2F - max - min);
}
- return new(h, s, l);
+ return new Hsl(h, s, l);
}
///
@@ -213,7 +213,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
}
}
- return new(r, g, b);
+ return new Rgb(r, g, b);
}
///
diff --git a/src/ImageSharp/ColorProfiles/Hsv.cs b/src/ImageSharp/ColorProfiles/Hsv.cs
index d29b3023e7..1e013fe1fb 100644
--- a/src/ImageSharp/ColorProfiles/Hsv.cs
+++ b/src/ImageSharp/ColorProfiles/Hsv.cs
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The v value (brightness) component.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsv(float h, float s, float v)
- : this(new(h, s, v))
+ : this(new Vector3(h, s, v))
{
}
@@ -139,7 +139,7 @@ public static Hsv FromProfileConnectingSpace(ColorConversionOptions options, in
if (MathF.Abs(chroma) < Constants.Epsilon)
{
- return new(0, s, v);
+ return new Hsv(0, s, v);
}
if (MathF.Abs(r - max) < Constants.Epsilon)
@@ -163,7 +163,7 @@ public static Hsv FromProfileConnectingSpace(ColorConversionOptions options, in
s = chroma / v;
- return new(h, s, v);
+ return new Hsv(h, s, v);
}
///
@@ -185,7 +185,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
if (MathF.Abs(s) < Constants.Epsilon)
{
- return new(v, v, v);
+ return new Rgb(v, v, v);
}
float h = (MathF.Abs(this.H - 360) < Constants.Epsilon) ? 0 : this.H / 60;
@@ -236,7 +236,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
break;
}
- return new(r, g, b);
+ return new Rgb(r, g, b);
}
///
diff --git a/src/ImageSharp/ColorProfiles/HunterLab.cs b/src/ImageSharp/ColorProfiles/HunterLab.cs
index 341360b12e..e978c6de22 100644
--- a/src/ImageSharp/ColorProfiles/HunterLab.cs
+++ b/src/ImageSharp/ColorProfiles/HunterLab.cs
@@ -87,7 +87,7 @@ public Vector4 ToScaledVector4()
v3 += this.AsVector3Unsafe();
v3 += new Vector3(0, 128F, 128F);
v3 /= new Vector3(100F, 255F, 255F);
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -96,7 +96,7 @@ public static HunterLab FromScaledVector4(Vector4 source)
Vector3 v3 = source.AsVector3();
v3 *= new Vector3(100F, 255, 255);
v3 -= new Vector3(0, 128F, 128F);
- return new(v3);
+ return new HunterLab(v3);
}
///
@@ -151,7 +151,7 @@ public static HunterLab FromProfileConnectingSpace(ColorConversionOptions option
b = 0;
}
- return new(l, a, b);
+ return new HunterLab(l, a, b);
}
///
@@ -184,7 +184,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
float x = (((a / ka) * sqrtPow) + pow) * xn;
float z = (((b / kb) * sqrtPow) - pow) * (-zn);
- return new(x, y, z);
+ return new CieXyz(x, y, z);
}
///
diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs
index e5d95d5134..01c66881a1 100644
--- a/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/ColorTrcCalculator.cs
@@ -23,12 +23,12 @@ public ColorTrcCalculator(
bool toPcs)
{
this.toPcs = toPcs;
- this.curveCalculator = new([redTrc, greenTrc, blueTrc], !toPcs);
+ this.curveCalculator = new TrcCalculator([redTrc, greenTrc, blueTrc], !toPcs);
Vector3 mr = redMatrixColumn.Data[0];
Vector3 mg = greenMatrixColumn.Data[0];
Vector3 mb = blueMatrixColumn.Data[0];
- this.matrix = new(mr.X, mr.Y, mr.Z, 0, mg.X, mg.Y, mg.Z, 0, mb.X, mb.Y, mb.Z, 0, 0, 0, 0, 1);
+ this.matrix = new Matrix4x4(mr.X, mr.Y, mr.Z, 0, mg.X, mg.Y, mg.Z, 0, mb.X, mb.Y, mb.Z, 0, 0, 0, 0, 1);
if (!toPcs)
{
@@ -58,7 +58,7 @@ public Vector4 Calculate(Vector4 value)
// when data to PCS, upstream process provides scaled XYZ
// but input to calculator is descaled XYZ
// (see DemoMaxICC IccCmm.cpp : CIccXformMatrixTRC::Apply)
- xyz = new(CieXyz.FromScaledVector4(xyz).AsVector3Unsafe(), 1);
+ xyz = new Vector4(CieXyz.FromScaledVector4(xyz).AsVector3Unsafe(), 1);
return this.curveCalculator.Calculate(xyz);
}
}
diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs
index 9c7a18ae8c..c39eaf958f 100644
--- a/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/CurveCalculator.cs
@@ -31,7 +31,7 @@ public CurveCalculator(IccCurveTagDataEntry entry, bool inverted)
}
else
{
- this.lutCalculator = new(entry.CurveData, inverted);
+ this.lutCalculator = new LutCalculator(entry.CurveData, inverted);
this.type = CalculationType.Lut;
}
}
diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs
index f39f4da52a..8d823c1e95 100644
--- a/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/GrayTrcCalculator.cs
@@ -12,7 +12,7 @@ internal class GrayTrcCalculator : IVector4Calculator
private readonly TrcCalculator calculator;
public GrayTrcCalculator(IccTagDataEntry grayTrc, bool toPcs)
- => this.calculator = new(new IccTagDataEntry[] { grayTrc }, !toPcs);
+ => this.calculator = new TrcCalculator(new IccTagDataEntry[] { grayTrc }, !toPcs);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector4 Calculate(Vector4 value) => this.calculator.Calculate(value);
diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs
index e0d1ad8d41..172d806394 100644
--- a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutABCalculator.cs
@@ -109,27 +109,27 @@ private void Init(IccTagDataEntry[] curveA, IccTagDataEntry[] curveB, IccTagData
if (hasACurve)
{
- this.curveACalculator = new(curveA, false);
+ this.curveACalculator = new TrcCalculator(curveA, false);
}
if (hasBCurve)
{
- this.curveBCalculator = new(curveB, false);
+ this.curveBCalculator = new TrcCalculator(curveB, false);
}
if (hasMCurve)
{
- this.curveMCalculator = new(curveM, false);
+ this.curveMCalculator = new TrcCalculator(curveM, false);
}
if (hasMatrix)
{
- this.matrixCalculator = new(matrix3x3.Value, matrix3x1.Value);
+ this.matrixCalculator = new MatrixCalculator(matrix3x3.Value, matrix3x1.Value);
}
if (hasClut)
{
- this.clutCalculator = new(clut);
+ this.clutCalculator = new ClutCalculator(clut);
}
}
}
diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs
index fbeae88f8e..c97578ee3f 100644
--- a/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/LutEntryCalculator.cs
@@ -61,7 +61,7 @@ private void Init(IccLut[] inputCurve, IccLut[] outputCurve, IccClut clut, Matri
{
this.inputCurve = InitLut(inputCurve);
this.outputCurve = InitLut(outputCurve);
- this.clutCalculator = new(clut);
+ this.clutCalculator = new ClutCalculator(clut);
this.matrix = matrix;
this.doTransform = !matrix.IsIdentity && inputCurve.Length == 3;
@@ -72,7 +72,7 @@ private static LutCalculator[] InitLut(IccLut[] curves)
LutCalculator[] calculators = new LutCalculator[curves.Length];
for (int i = 0; i < curves.Length; i++)
{
- calculators[i] = new(curves[i].Values, false);
+ calculators[i] = new LutCalculator(curves[i].Values, false);
}
return calculators;
diff --git a/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs b/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs
index 5eade1fc8e..6be1fdbf95 100644
--- a/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/Calculators/MatrixCalculator.cs
@@ -14,7 +14,7 @@ internal class MatrixCalculator : IVector4Calculator
public MatrixCalculator(Matrix4x4 matrix3x3, Vector3 matrix3x1)
{
this.matrix2D = matrix3x3;
- this.matrix1D = new(matrix3x1, 0);
+ this.matrix1D = new Vector4(matrix3x1, 0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs b/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs
index f0ee4ba580..29e30b53e2 100644
--- a/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/CompactSrgbV4Profile.cs
@@ -37,6 +37,6 @@ private static IccProfile GetIccProfile()
{
byte[] buffer = new byte[Data.Length];
Data.CopyTo(buffer);
- return new(buffer);
+ return new IccProfile(buffer);
}
}
diff --git a/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs b/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs
index 917be020b5..20df08e378 100644
--- a/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs
+++ b/src/ImageSharp/ColorProfiles/Icc/IccConverterbase.Conversions.cs
@@ -91,7 +91,7 @@ private static ColorTrcCalculator InitColorTrc(IccProfile profile, bool toPcs)
throw new InvalidIccProfileException("Missing matrix column or channel.");
}
- return new(
+ return new ColorTrcCalculator(
redMatrixColumn,
greenMatrixColumn,
blueMatrixColumn,
@@ -104,6 +104,6 @@ private static ColorTrcCalculator InitColorTrc(IccProfile profile, bool toPcs)
private static GrayTrcCalculator InitGrayTrc(IccProfile profile, bool toPcs)
{
IccTagDataEntry entry = GetTag(profile, IccProfileTag.GrayTrc);
- return new(entry, toPcs);
+ return new GrayTrcCalculator(entry, toPcs);
}
}
diff --git a/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs b/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs
index a5486580fd..71d565f87f 100644
--- a/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs
+++ b/src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs
@@ -24,7 +24,7 @@ public static class KnownChromaticAdaptationMatrices
/// von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez adjusted for D65)
///
public static readonly Matrix4x4 VonKriesHPEAdjusted
- = Matrix4x4.Transpose(new()
+ = Matrix4x4.Transpose(new Matrix4x4
{
M11 = 0.40024F,
M12 = 0.7076F,
@@ -42,7 +42,7 @@ public static readonly Matrix4x4 VonKriesHPEAdjusted
/// von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez for equal energy)
///
public static readonly Matrix4x4 VonKriesHPE
- = Matrix4x4.Transpose(new()
+ = Matrix4x4.Transpose(new Matrix4x4
{
M11 = 0.3897F,
M12 = 0.6890F,
@@ -65,7 +65,7 @@ public static readonly Matrix4x4 VonKriesHPE
/// Bradford chromatic adaptation transform matrix (used in CMCCAT97)
///
public static readonly Matrix4x4 Bradford
- = Matrix4x4.Transpose(new()
+ = Matrix4x4.Transpose(new Matrix4x4
{
M11 = 0.8951F,
M12 = 0.2664F,
@@ -83,7 +83,7 @@ public static readonly Matrix4x4 Bradford
/// Spectral sharpening and the Bradford transform
///
public static readonly Matrix4x4 BradfordSharp
- = Matrix4x4.Transpose(new()
+ = Matrix4x4.Transpose(new Matrix4x4
{
M11 = 1.2694F,
M12 = -0.0988F,
@@ -101,7 +101,7 @@ public static readonly Matrix4x4 BradfordSharp
/// CMCCAT2000 (fitted from all available color data sets)
///
public static readonly Matrix4x4 CMCCAT2000
- = Matrix4x4.Transpose(new()
+ = Matrix4x4.Transpose(new Matrix4x4
{
M11 = 0.7982F,
M12 = 0.3389F,
@@ -119,7 +119,7 @@ public static readonly Matrix4x4 CMCCAT2000
/// CAT02 (optimized for minimizing CIELAB differences)
///
public static readonly Matrix4x4 CAT02
- = Matrix4x4.Transpose(new()
+ = Matrix4x4.Transpose(new Matrix4x4
{
M11 = 0.7328F,
M12 = 0.4296F,
diff --git a/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs b/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs
index 1c5f1664c9..9163839363 100644
--- a/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs
+++ b/src/ImageSharp/ColorProfiles/KnownRgbWorkingSpaces.cs
@@ -18,96 +18,96 @@ public static class KnownRgbWorkingSpaces
/// Uses proper companding function, according to:
///
///
- public static readonly RgbWorkingSpace SRgb = new SRgbWorkingSpace(KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.3000F, 0.6000F), new(0.1500F, 0.0600F)));
+ public static readonly RgbWorkingSpace SRgb = new SRgbWorkingSpace(KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.3000F, 0.6000F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F)));
///
/// Simplified sRgb working space (uses gamma companding instead of ).
/// See also .
///
- public static readonly RgbWorkingSpace SRgbSimplified = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.3000F, 0.6000F), new(0.1500F, 0.0600F)));
+ public static readonly RgbWorkingSpace SRgbSimplified = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.3000F, 0.6000F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F)));
///
/// Rec. 709 (ITU-R Recommendation BT.709) working space.
///
- public static readonly RgbWorkingSpace Rec709 = new Rec709WorkingSpace(KnownIlluminants.D65, new(new(0.64F, 0.33F), new(0.30F, 0.60F), new(0.15F, 0.06F)));
+ public static readonly RgbWorkingSpace Rec709 = new Rec709WorkingSpace(KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.64F, 0.33F), new CieXyChromaticityCoordinates(0.30F, 0.60F), new CieXyChromaticityCoordinates(0.15F, 0.06F)));
///
/// Rec. 2020 (ITU-R Recommendation BT.2020F) working space.
///
- public static readonly RgbWorkingSpace Rec2020 = new Rec2020WorkingSpace(KnownIlluminants.D65, new(new(0.708F, 0.292F), new(0.170F, 0.797F), new(0.131F, 0.046F)));
+ public static readonly RgbWorkingSpace Rec2020 = new Rec2020WorkingSpace(KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.708F, 0.292F), new CieXyChromaticityCoordinates(0.170F, 0.797F), new CieXyChromaticityCoordinates(0.131F, 0.046F)));
///
/// ECI Rgb v2 working space.
///
- public static readonly RgbWorkingSpace ECIRgbv2 = new LWorkingSpace(KnownIlluminants.D50, new(new(0.6700F, 0.3300F), new(0.2100F, 0.7100F), new(0.1400F, 0.0800F)));
+ public static readonly RgbWorkingSpace ECIRgbv2 = new LWorkingSpace(KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6700F, 0.3300F), new CieXyChromaticityCoordinates(0.2100F, 0.7100F), new CieXyChromaticityCoordinates(0.1400F, 0.0800F)));
///
/// Adobe Rgb (1998) working space.
///
- public static readonly RgbWorkingSpace AdobeRgb1998 = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.2100F, 0.7100F), new(0.1500F, 0.0600F)));
+ public static readonly RgbWorkingSpace AdobeRgb1998 = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.2100F, 0.7100F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F)));
///
/// Apple sRgb working space.
///
- public static readonly RgbWorkingSpace ApplesRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D65, new(new(0.6250F, 0.3400F), new(0.2800F, 0.5950F), new(0.1550F, 0.0700F)));
+ public static readonly RgbWorkingSpace ApplesRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6250F, 0.3400F), new CieXyChromaticityCoordinates(0.2800F, 0.5950F), new CieXyChromaticityCoordinates(0.1550F, 0.0700F)));
///
/// Best Rgb working space.
///
- public static readonly RgbWorkingSpace BestRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.7347F, 0.2653F), new(0.2150F, 0.7750F), new(0.1300F, 0.0350F)));
+ public static readonly RgbWorkingSpace BestRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7347F, 0.2653F), new CieXyChromaticityCoordinates(0.2150F, 0.7750F), new CieXyChromaticityCoordinates(0.1300F, 0.0350F)));
///
/// Beta Rgb working space.
///
- public static readonly RgbWorkingSpace BetaRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.6888F, 0.3112F), new(0.1986F, 0.7551F), new(0.1265F, 0.0352F)));
+ public static readonly RgbWorkingSpace BetaRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6888F, 0.3112F), new CieXyChromaticityCoordinates(0.1986F, 0.7551F), new CieXyChromaticityCoordinates(0.1265F, 0.0352F)));
///
/// Bruce Rgb working space.
///
- public static readonly RgbWorkingSpace BruceRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.2800F, 0.6500F), new(0.1500F, 0.0600F)));
+ public static readonly RgbWorkingSpace BruceRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.2800F, 0.6500F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F)));
///
/// CIE Rgb working space.
///
- public static readonly RgbWorkingSpace CIERgb = new GammaWorkingSpace(2.2F, KnownIlluminants.E, new(new(0.7350F, 0.2650F), new(0.2740F, 0.7170F), new(0.1670F, 0.0090F)));
+ public static readonly RgbWorkingSpace CIERgb = new GammaWorkingSpace(2.2F, KnownIlluminants.E, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7350F, 0.2650F), new CieXyChromaticityCoordinates(0.2740F, 0.7170F), new CieXyChromaticityCoordinates(0.1670F, 0.0090F)));
///
/// ColorMatch Rgb working space.
///
- public static readonly RgbWorkingSpace ColorMatchRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new(new(0.6300F, 0.3400F), new(0.2950F, 0.6050F), new(0.1500F, 0.0750F)));
+ public static readonly RgbWorkingSpace ColorMatchRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6300F, 0.3400F), new CieXyChromaticityCoordinates(0.2950F, 0.6050F), new CieXyChromaticityCoordinates(0.1500F, 0.0750F)));
///
/// Don Rgb 4 working space.
///
- public static readonly RgbWorkingSpace DonRgb4 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.6960F, 0.3000F), new(0.2150F, 0.7650F), new(0.1300F, 0.0350F)));
+ public static readonly RgbWorkingSpace DonRgb4 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6960F, 0.3000F), new CieXyChromaticityCoordinates(0.2150F, 0.7650F), new CieXyChromaticityCoordinates(0.1300F, 0.0350F)));
///
/// Ekta Space PS5 working space.
///
- public static readonly RgbWorkingSpace EktaSpacePS5 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.6950F, 0.3050F), new(0.2600F, 0.7000F), new(0.1100F, 0.0050F)));
+ public static readonly RgbWorkingSpace EktaSpacePS5 = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6950F, 0.3050F), new CieXyChromaticityCoordinates(0.2600F, 0.7000F), new CieXyChromaticityCoordinates(0.1100F, 0.0050F)));
///
/// NTSC Rgb working space.
///
- public static readonly RgbWorkingSpace NTSCRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.C, new(new(0.6700F, 0.3300F), new(0.2100F, 0.7100F), new(0.1400F, 0.0800F)));
+ public static readonly RgbWorkingSpace NTSCRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.C, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6700F, 0.3300F), new CieXyChromaticityCoordinates(0.2100F, 0.7100F), new CieXyChromaticityCoordinates(0.1400F, 0.0800F)));
///
/// PAL/SECAM Rgb working space.
///
- public static readonly RgbWorkingSpace PALSECAMRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6400F, 0.3300F), new(0.2900F, 0.6000F), new(0.1500F, 0.0600F)));
+ public static readonly RgbWorkingSpace PALSECAMRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6400F, 0.3300F), new CieXyChromaticityCoordinates(0.2900F, 0.6000F), new CieXyChromaticityCoordinates(0.1500F, 0.0600F)));
///
/// ProPhoto Rgb working space.
///
- public static readonly RgbWorkingSpace ProPhotoRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new(new(0.7347F, 0.2653F), new(0.1596F, 0.8404F), new(0.0366F, 0.0001F)));
+ public static readonly RgbWorkingSpace ProPhotoRgb = new GammaWorkingSpace(1.8F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7347F, 0.2653F), new CieXyChromaticityCoordinates(0.1596F, 0.8404F), new CieXyChromaticityCoordinates(0.0366F, 0.0001F)));
///
/// SMPTE-C Rgb working space.
///
- public static readonly RgbWorkingSpace SMPTECRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new(new(0.6300F, 0.3400F), new(0.3100F, 0.5950F), new(0.1550F, 0.0700F)));
+ public static readonly RgbWorkingSpace SMPTECRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D65, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.6300F, 0.3400F), new CieXyChromaticityCoordinates(0.3100F, 0.5950F), new CieXyChromaticityCoordinates(0.1550F, 0.0700F)));
///
/// Wide Gamut Rgb working space.
///
- public static readonly RgbWorkingSpace WideGamutRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new(new(0.7350F, 0.2650F), new(0.1150F, 0.8260F), new(0.1570F, 0.0180F)));
+ public static readonly RgbWorkingSpace WideGamutRgb = new GammaWorkingSpace(2.2F, KnownIlluminants.D50, new RgbPrimariesChromaticityCoordinates(new CieXyChromaticityCoordinates(0.7350F, 0.2650F), new CieXyChromaticityCoordinates(0.1150F, 0.8260F), new CieXyChromaticityCoordinates(0.1570F, 0.0180F)));
}
diff --git a/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs b/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs
index b838f9ddc9..d32833a382 100644
--- a/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs
+++ b/src/ImageSharp/ColorProfiles/KnownYCbCrMatrices.cs
@@ -16,47 +16,47 @@ public static class KnownYCbCrMatrices
/// ITU-R BT.601 (SD video standard).
///
public static readonly YCbCrTransform BT601 = new(
- new(
+ new Matrix4x4(
0.299000F, 0.587000F, 0.114000F, 0F,
-0.168736F, -0.331264F, 0.500000F, 0F,
0.500000F, -0.418688F, -0.081312F, 0F,
0F, 0F, 0F, 1F),
- new(
+ new Matrix4x4(
1.000000F, 0.000000F, 1.402000F, 0F,
1.000000F, -0.344136F, -0.714136F, 0F,
1.000000F, 1.772000F, 0.000000F, 0F,
0F, 0F, 0F, 1F),
- new(0F, 0.5F, 0.5F));
+ new Vector3(0F, 0.5F, 0.5F));
///
/// ITU-R BT.709 (HD video, sRGB standard).
///
public static readonly YCbCrTransform BT709 = new(
- new(
+ new Matrix4x4(
0.212600F, 0.715200F, 0.072200F, 0F,
-0.114572F, -0.385428F, 0.500000F, 0F,
0.500000F, -0.454153F, -0.045847F, 0F,
0F, 0F, 0F, 1F),
- new(
+ new Matrix4x4(
1.000000F, 0.000000F, 1.574800F, 0F,
1.000000F, -0.187324F, -0.468124F, 0F,
1.000000F, 1.855600F, 0.000000F, 0F,
0F, 0F, 0F, 1F),
- new(0F, 0.5F, 0.5F));
+ new Vector3(0F, 0.5F, 0.5F));
///
/// ITU-R BT.2020 (UHD/4K video standard).
///
public static readonly YCbCrTransform BT2020 = new(
- new(
+ new Matrix4x4(
0.262700F, 0.678000F, 0.059300F, 0F,
-0.139630F, -0.360370F, 0.500000F, 0F,
0.500000F, -0.459786F, -0.040214F, 0F,
0F, 0F, 0F, 1F),
- new(
+ new Matrix4x4(
1.000000F, 0.000000F, 1.474600F, 0F,
1.000000F, -0.164553F, -0.571353F, 0F,
1.000000F, 1.881400F, 0.000000F, 0F,
0F, 0F, 0F, 1F),
- new(0F, 0.5F, 0.5F));
+ new Vector3(0F, 0.5F, 0.5F));
}
diff --git a/src/ImageSharp/ColorProfiles/Lms.cs b/src/ImageSharp/ColorProfiles/Lms.cs
index 86cb7956bf..3aa3d72557 100644
--- a/src/ImageSharp/ColorProfiles/Lms.cs
+++ b/src/ImageSharp/ColorProfiles/Lms.cs
@@ -89,7 +89,7 @@ public Vector4 ToScaledVector4()
v3 += this.AsVector3Unsafe();
v3 += new Vector3(1F);
v3 /= 2F;
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -98,7 +98,7 @@ public static Lms FromScaledVector4(Vector4 source)
Vector3 v3 = source.AsVector3();
v3 *= 2F;
v3 -= new Vector3(1F);
- return new(v3);
+ return new Lms(v3);
}
///
diff --git a/src/ImageSharp/ColorProfiles/Rgb.cs b/src/ImageSharp/ColorProfiles/Rgb.cs
index 4d7788fcfb..42e502592c 100644
--- a/src/ImageSharp/ColorProfiles/Rgb.cs
+++ b/src/ImageSharp/ColorProfiles/Rgb.cs
@@ -154,7 +154,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
Rgb linear = FromScaledVector4(options.SourceRgbWorkingSpace.Expand(this.ToScaledVector4()));
// Then convert to xyz
- return new(Vector3.Transform(linear.AsVector3Unsafe(), GetRgbToCieXyzMatrix(options.SourceRgbWorkingSpace)));
+ return new CieXyz(Vector3.Transform(linear.AsVector3Unsafe(), GetRgbToCieXyzMatrix(options.SourceRgbWorkingSpace)));
}
///
@@ -171,7 +171,7 @@ public static void ToProfileConnectionSpace(ColorConversionOptions options, Read
Rgb linear = FromScaledVector4(options.SourceRgbWorkingSpace.Expand(rgb.ToScaledVector4()));
// Then convert to xyz
- destination[i] = new(Vector3.Transform(linear.AsVector3Unsafe(), matrix));
+ destination[i] = new CieXyz(Vector3.Transform(linear.AsVector3Unsafe(), matrix));
}
}
@@ -274,7 +274,7 @@ private static Matrix4x4 GetRgbToCieXyzMatrix(RgbWorkingSpace workingSpace)
Vector3 vector = Vector3.Transform(workingSpace.WhitePoint.AsVector3Unsafe(), inverseXyzMatrix);
// Use transposed Rows/Columns
- return new()
+ return new Matrix4x4
{
M11 = vector.X * mXr,
M21 = vector.Y * mXg,
diff --git a/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs b/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs
index 6f06ccf27a..25604001fc 100644
--- a/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs
+++ b/src/ImageSharp/ColorProfiles/VonKriesChromaticAdaptation.cs
@@ -31,7 +31,7 @@ public static CieXyz Transform(in CieXyz source, (CieXyz From, CieXyz To) whiteP
if (from.Equals(to))
{
- return new(source.X, source.Y, source.Z);
+ return new CieXyz(source.X, source.Y, source.Z);
}
Vector3 sourceColorLms = Vector3.Transform(source.AsVector3Unsafe(), matrix);
@@ -42,7 +42,7 @@ public static CieXyz Transform(in CieXyz source, (CieXyz From, CieXyz To) whiteP
Vector3 targetColorLms = Vector3.Multiply(vector, sourceColorLms);
Matrix4x4.Invert(matrix, out Matrix4x4 inverseMatrix);
- return new(Vector3.Transform(targetColorLms, inverseMatrix));
+ return new CieXyz(Vector3.Transform(targetColorLms, inverseMatrix));
}
///
@@ -89,7 +89,7 @@ public static void Transform(
Vector3 sourceColorLms = Vector3.Transform(sp.AsVector3Unsafe(), matrix);
Vector3 targetColorLms = Vector3.Multiply(vector, sourceColorLms);
- dp = new(Vector3.Transform(targetColorLms, inverseMatrix));
+ dp = new CieXyz(Vector3.Transform(targetColorLms, inverseMatrix));
}
}
}
diff --git a/src/ImageSharp/ColorProfiles/Y.cs b/src/ImageSharp/ColorProfiles/Y.cs
index 62cef78146..2be34fc311 100644
--- a/src/ImageSharp/ColorProfiles/Y.cs
+++ b/src/ImageSharp/ColorProfiles/Y.cs
@@ -92,7 +92,7 @@ public static Y FromProfileConnectingSpace(ColorConversionOptions options, in Rg
{
Matrix4x4 m = options.YCbCrTransform.Forward;
float offset = options.YCbCrTransform.Offset.X;
- return new(Vector3.Dot(source.AsVector3Unsafe(), new(m.M11, m.M12, m.M13)) + offset);
+ return new Y(Vector3.Dot(source.AsVector3Unsafe(), new Vector3(m.M11, m.M12, m.M13)) + offset);
}
///
diff --git a/src/ImageSharp/ColorProfiles/YCbCr.cs b/src/ImageSharp/ColorProfiles/YCbCr.cs
index e112ef7992..22d629373b 100644
--- a/src/ImageSharp/ColorProfiles/YCbCr.cs
+++ b/src/ImageSharp/ColorProfiles/YCbCr.cs
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The cr chroma component.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public YCbCr(float y, float cb, float cr)
- : this(new(y, cb, cr))
+ : this(new Vector3(y, cb, cr))
{
}
@@ -95,7 +95,7 @@ public Vector4 ToScaledVector4()
{
Vector3 v3 = default;
v3 += this.AsVector3Unsafe();
- return new(v3, 1F);
+ return new Vector4(v3, 1F);
}
///
@@ -133,7 +133,7 @@ public static YCbCr FromProfileConnectingSpace(ColorConversionOptions options, i
Matrix4x4 m = options.TransposedYCbCrTransform.Forward;
Vector3 offset = options.TransposedYCbCrTransform.Offset;
- return new(Vector3.Transform(rgb, m) + offset, true);
+ return new YCbCr(Vector3.Transform(rgb, m) + offset, true);
}
///
diff --git a/src/ImageSharp/ColorProfiles/YccK.cs b/src/ImageSharp/ColorProfiles/YccK.cs
index d0966a6d12..df5eb48947 100644
--- a/src/ImageSharp/ColorProfiles/YccK.cs
+++ b/src/ImageSharp/ColorProfiles/YccK.cs
@@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// The keyline black component.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public YccK(float y, float cb, float cr, float k)
- : this(new(y, cb, cr, k))
+ : this(new Vector4(y, cb, cr, k))
{
}
@@ -149,11 +149,11 @@ public static YccK FromProfileConnectingSpace(ColorConversionOptions options, in
if (k >= 1F - Constants.Epsilon)
{
- return new(new(0F, 0.5F, 0.5F, 1F), true);
+ return new YccK(new Vector4(0F, 0.5F, 0.5F, 1F), true);
}
rgb /= 1F - k;
- return new(new Vector4(Vector3.Transform(rgb, m), k) + new Vector4(offset, 0F));
+ return new YccK(new Vector4(Vector3.Transform(rgb, m), k) + new Vector4(offset, 0F));
}
///
diff --git a/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs b/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs
index c20c6e9c93..6ed83a0d8a 100644
--- a/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs
+++ b/src/ImageSharp/Common/Extensions/ConfigurationExtensions.cs
@@ -14,6 +14,6 @@ internal static class ConfigurationExtensions
///
public static ParallelOptions GetParallelOptions(this Configuration configuration)
{
- return new() { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism };
+ return new ParallelOptions { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism };
}
}
diff --git a/src/ImageSharp/Common/Helpers/Numerics.cs b/src/ImageSharp/Common/Helpers/Numerics.cs
index 0aa8e4a418..ff28063f05 100644
--- a/src/ImageSharp/Common/Helpers/Numerics.cs
+++ b/src/ImageSharp/Common/Helpers/Numerics.cs
@@ -656,7 +656,7 @@ public static Vector4 PermuteW(Vector4 value)
return Sse.Shuffle(value.AsVector128(), value.AsVector128(), ShuffleAlphaControl).AsVector4();
}
- return new(value.W);
+ return new Vector4(value.W);
}
///
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs
index 80bfa29ca2..f471d0231b 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs
@@ -134,7 +134,7 @@ private static void PackFromRgbPlanesScalarBatchedReduce(
ref Rgba32 rgb = ref MemoryMarshal.GetReference(destination);
nuint count = (uint)redChannel.Length / 4;
- destination.Fill(new(0, 0, 0, 255));
+ destination.Fill(new Rgba32(0, 0, 0, 255));
for (nuint i = 0; i < count; i++)
{
ref Rgba32 d0 = ref Unsafe.Add(ref rgb, i * 4);
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.cs b/src/ImageSharp/Common/Helpers/SimdUtils.cs
index 883e18ae73..7f98c83754 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.cs
@@ -29,7 +29,7 @@ internal static partial class SimdUtils
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static Vector4 PseudoRound(this Vector4 v)
{
- Vector4 sign = Numerics.Clamp(v, new(-1), new(1));
+ Vector4 sign = Numerics.Clamp(v, new Vector4(-1), new Vector4(1));
return v + (sign * 0.5f);
}
diff --git a/src/ImageSharp/Common/Helpers/TolerantMath.cs b/src/ImageSharp/Common/Helpers/TolerantMath.cs
index b4ed9ee2f2..2c622d1679 100644
--- a/src/ImageSharp/Common/Helpers/TolerantMath.cs
+++ b/src/ImageSharp/Common/Helpers/TolerantMath.cs
@@ -20,7 +20,7 @@ internal readonly struct TolerantMath
/// It is a field so it can be passed as an 'in' parameter.
/// Does not necessarily fit all use cases!
///
- public static readonly TolerantMath Default = new TolerantMath(1e-8);
+ public static readonly TolerantMath Default = new(1e-8);
public TolerantMath(double epsilon)
{
diff --git a/src/ImageSharp/Common/Helpers/UnitConverter.cs b/src/ImageSharp/Common/Helpers/UnitConverter.cs
index c50766ec20..45dbe41cb9 100644
--- a/src/ImageSharp/Common/Helpers/UnitConverter.cs
+++ b/src/ImageSharp/Common/Helpers/UnitConverter.cs
@@ -131,9 +131,9 @@ public static ExifResolutionValues GetExifResolutionValues(PixelResolutionUnit u
ushort exifUnit = (ushort)(unit + 1);
if (unit == PixelResolutionUnit.AspectRatio)
{
- return new(exifUnit, null, null);
+ return new ExifResolutionValues(exifUnit, null, null);
}
- return new(exifUnit, horizontal, vertical);
+ return new ExifResolutionValues(exifUnit, horizontal, vertical);
}
}
diff --git a/src/ImageSharp/Compression/Zlib/Deflater.cs b/src/ImageSharp/Compression/Zlib/Deflater.cs
index 2e39d435d6..f642ec85a7 100644
--- a/src/ImageSharp/Compression/Zlib/Deflater.cs
+++ b/src/ImageSharp/Compression/Zlib/Deflater.cs
@@ -79,7 +79,7 @@ public Deflater(MemoryAllocator memoryAllocator, int level)
}
// TODO: Possibly provide DeflateStrategy as an option.
- this.engine = new(memoryAllocator, DeflateStrategy.Default);
+ this.engine = new DeflaterEngine(memoryAllocator, DeflateStrategy.Default);
this.SetLevel(level);
this.Reset();
diff --git a/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs b/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs
index c9613610d8..6009fdfbc0 100644
--- a/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs
+++ b/src/ImageSharp/Compression/Zlib/DeflaterEngine.cs
@@ -147,7 +147,7 @@ internal sealed unsafe class DeflaterEngine : IDisposable
/// The deflate strategy to use.
public DeflaterEngine(MemoryAllocator memoryAllocator, DeflateStrategy strategy)
{
- this.huffman = new(memoryAllocator);
+ this.huffman = new DeflaterHuffman(memoryAllocator);
this.Pending = this.huffman.Pending;
this.strategy = strategy;
diff --git a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs
index a05320a09e..e4dc1945a8 100644
--- a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs
+++ b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs
@@ -58,11 +58,11 @@ internal sealed unsafe class DeflaterHuffman : IDisposable
/// The memory allocator to use for buffer allocations.
public DeflaterHuffman(MemoryAllocator memoryAllocator)
{
- this.Pending = new(memoryAllocator);
+ this.Pending = new DeflaterPendingBuffer(memoryAllocator);
- this.literalTree = new(memoryAllocator, LiteralNumber, 257, 15);
- this.distTree = new(memoryAllocator, DistanceNumber, 1, 15);
- this.blTree = new(memoryAllocator, BitLengthNumber, 4, 7);
+ this.literalTree = new Tree(memoryAllocator, LiteralNumber, 257, 15);
+ this.distTree = new Tree(memoryAllocator, DistanceNumber, 1, 15);
+ this.blTree = new Tree(memoryAllocator, BitLengthNumber, 4, 7);
this.distanceMemoryOwner = memoryAllocator.Allocate(BufferSize);
this.distanceBufferHandle = this.distanceMemoryOwner.Memory.Pin();
diff --git a/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs b/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs
index 76a5a045ee..de818fd8f5 100644
--- a/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs
+++ b/src/ImageSharp/Compression/Zlib/DeflaterOutputStream.cs
@@ -30,7 +30,7 @@ public DeflaterOutputStream(MemoryAllocator memoryAllocator, Stream rawStream, i
this.rawStream = rawStream;
this.memoryOwner = memoryAllocator.Allocate(BufferLength);
this.buffer = this.memoryOwner.Memory;
- this.deflater = new(memoryAllocator, compressionLevel);
+ this.deflater = new Deflater(memoryAllocator, compressionLevel);
}
///
diff --git a/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs b/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs
index 9364444065..2e52f84d7b 100644
--- a/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs
+++ b/src/ImageSharp/Compression/Zlib/ZlibDeflateStream.cs
@@ -101,7 +101,7 @@ public ZlibDeflateStream(MemoryAllocator memoryAllocator, Stream stream, PngComp
this.rawStream.WriteByte(Cmf);
this.rawStream.WriteByte((byte)flg);
- this.deflateStream = new(memoryAllocator, this.rawStream, compressionLevel);
+ this.deflateStream = new DeflaterOutputStream(memoryAllocator, this.rawStream, compressionLevel);
}
///
diff --git a/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs b/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs
index aa4beba18c..1d743bf3a5 100644
--- a/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs
+++ b/src/ImageSharp/Compression/Zlib/ZlibInflateStream.cs
@@ -270,7 +270,7 @@ private bool InitializeInflateStream(bool isCriticalChunk)
}
// Initialize the deflate BufferedReadStream.
- this.CompressedStream = new(this, CompressionMode.Decompress, true);
+ this.CompressedStream = new DeflateStream(this, CompressionMode.Decompress, true);
return true;
}
diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs
index 1d9f3bb85d..c2b02dedd9 100644
--- a/src/ImageSharp/Configuration.cs
+++ b/src/ImageSharp/Configuration.cs
@@ -122,7 +122,7 @@ public int StreamProcessingBufferSize
///
/// Gets or the that is currently in use.
///
- public ImageFormatManager ImageFormatsManager { get; private set; } = new ImageFormatManager();
+ public ImageFormatManager ImageFormatsManager { get; private set; } = new();
///
/// Gets or sets the that is currently in use.
diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs
index da6556b367..d98f7bccb5 100644
--- a/src/ImageSharp/Formats/Bmp/BmpDecoder.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpDecoder.cs
@@ -25,7 +25,7 @@ protected override ImageInfo Identify(DecoderOptions options, Stream stream, Can
Guard.NotNull(options, nameof(options));
Guard.NotNull(stream, nameof(stream));
- return new BmpDecoderCore(new() { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken);
+ return new BmpDecoderCore(new BmpDecoderOptions { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken);
}
///
diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
index acf69529aa..17c1f545b7 100644
--- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
@@ -132,7 +132,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
{
int bytesPerColorMapEntry = this.ReadImageHeaders(stream, out bool inverted, out byte[] palette);
- image = new(this.configuration, this.infoHeader.Width, this.infoHeader.Height, this.metadata);
+ image = new Image(this.configuration, this.infoHeader.Width, this.infoHeader.Height, this.metadata);
Buffer2D pixels = image.GetRootFramePixelBuffer();
@@ -220,7 +220,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken)
{
this.ReadImageHeaders(stream, out _, out _);
- return new(new(this.infoHeader.Width, this.infoHeader.Height), this.metadata);
+ return new ImageInfo(new Size(this.infoHeader.Width, this.infoHeader.Height), this.metadata);
}
///
@@ -343,7 +343,7 @@ private void ReadRle(BufferedReadStream stream, BmpCompression compressi
RleSkippedPixelHandling.Transparent => TPixel.FromScaledVector4(Vector4.Zero),
// Default handling for skipped pixels is black (which is what System.Drawing is also doing).
- _ => TPixel.FromScaledVector4(new(0.0f, 0.0f, 0.0f, 1.0f)),
+ _ => TPixel.FromScaledVector4(new Vector4(0.0f, 0.0f, 0.0f, 1.0f)),
};
}
else
@@ -404,7 +404,7 @@ private void ReadRle24(BufferedReadStream stream, Buffer2D pixel
RleSkippedPixelHandling.Transparent => TPixel.FromScaledVector4(Vector4.Zero),
// Default handling for skipped pixels is black (which is what System.Drawing is also doing).
- _ => TPixel.FromScaledVector4(new(0.0f, 0.0f, 0.0f, 1.0f)),
+ _ => TPixel.FromScaledVector4(new Vector4(0.0f, 0.0f, 0.0f, 1.0f)),
};
}
else
@@ -1270,7 +1270,7 @@ private void ReadRgb32BitFields(BufferedReadStream stream, Buffer2D> rightShiftGreenMask);
byte b = (byte)((temp & blueMask) >> rightShiftBlueMask);
byte a = alphaMask != 0 ? (byte)((temp & alphaMask) >> rightShiftAlphaMask) : byte.MaxValue;
- pixelRow[x] = TPixel.FromRgba32(new(r, g, b, a));
+ pixelRow[x] = TPixel.FromRgba32(new Rgba32(r, g, b, a));
}
offset += 4;
@@ -1332,7 +1332,7 @@ private void ReadInfoHeader(BufferedReadStream stream)
long infoHeaderStart = stream.Position;
// Resolution is stored in PPM.
- this.metadata = new()
+ this.metadata = new ImageMetadata
{
ResolutionUnits = PixelResolutionUnit.PixelsPerMeter
};
@@ -1426,7 +1426,7 @@ private void ReadInfoHeader(BufferedReadStream stream)
byte[] iccProfileData = new byte[this.infoHeader.ProfileSize];
stream.Position = infoHeaderStart + this.infoHeader.ProfileData;
stream.Read(iccProfileData);
- this.metadata.IccProfile = new(iccProfileData);
+ this.metadata.IccProfile = new IccProfile(iccProfileData);
stream.Position = streamPosition;
}
}
@@ -1457,7 +1457,7 @@ private void ReadInfoHeader(BufferedReadStream stream)
this.bmpMetadata.InfoHeaderType = infoHeaderType;
this.bmpMetadata.BitsPerPixel = (BmpBitsPerPixel)bitsPerPixel;
- this.Dimensions = new(this.infoHeader.Width, this.infoHeader.Height);
+ this.Dimensions = new Size(this.infoHeader.Width, this.infoHeader.Height);
}
///
diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
index ba9a0dc232..ccc620d6c4 100644
--- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
@@ -655,7 +655,7 @@ private void Write4BitPixelData(
CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel
{
- using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new()
+ using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new QuantizerOptions
{
MaxColors = 16,
Dither = this.quantizer.Options.Dither,
@@ -712,7 +712,7 @@ private void Write2BitPixelData(
CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel
{
- using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new()
+ using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new QuantizerOptions
{
MaxColors = 4,
Dither = this.quantizer.Options.Dither,
@@ -778,7 +778,7 @@ private void Write1BitPixelData(
CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel
{
- using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new()
+ using IQuantizer frameQuantizer = this.quantizer.CreatePixelSpecificQuantizer(configuration, new QuantizerOptions
{
MaxColors = 2,
Dither = this.quantizer.Options.Dither,
diff --git a/src/ImageSharp/Formats/Bmp/BmpFormat.cs b/src/ImageSharp/Formats/Bmp/BmpFormat.cs
index a67b06cb88..5dec4a6748 100644
--- a/src/ImageSharp/Formats/Bmp/BmpFormat.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpFormat.cs
@@ -15,7 +15,7 @@ private BmpFormat()
///
/// Gets the shared instance.
///
- public static BmpFormat Instance { get; } = new BmpFormat();
+ public static BmpFormat Instance { get; } = new();
///
public string Name => "BMP";
diff --git a/src/ImageSharp/Formats/Bmp/BmpMetadata.cs b/src/ImageSharp/Formats/Bmp/BmpMetadata.cs
index 3514a7ed56..1dac74ba3a 100644
--- a/src/ImageSharp/Formats/Bmp/BmpMetadata.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpMetadata.cs
@@ -54,21 +54,21 @@ public static BmpMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
int bpp = metadata.PixelTypeInfo.BitsPerPixel;
return bpp switch
{
- 1 => new() { BitsPerPixel = BmpBitsPerPixel.Bit1 },
- 2 => new() { BitsPerPixel = BmpBitsPerPixel.Bit2 },
- <= 4 => new() { BitsPerPixel = BmpBitsPerPixel.Bit4 },
- <= 8 => new() { BitsPerPixel = BmpBitsPerPixel.Bit8 },
- <= 16 => new()
+ 1 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit1 },
+ 2 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit2 },
+ <= 4 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit4 },
+ <= 8 => new BmpMetadata { BitsPerPixel = BmpBitsPerPixel.Bit8 },
+ <= 16 => new BmpMetadata
{
BitsPerPixel = BmpBitsPerPixel.Bit16,
InfoHeaderType = BmpInfoHeaderType.WinVersion3
},
- <= 24 => new()
+ <= 24 => new BmpMetadata
{
BitsPerPixel = BmpBitsPerPixel.Bit24,
InfoHeaderType = BmpInfoHeaderType.WinVersion4
},
- _ => new()
+ _ => new BmpMetadata
{
BitsPerPixel = BmpBitsPerPixel.Bit32,
InfoHeaderType = BmpInfoHeaderType.WinVersion5
@@ -131,7 +131,7 @@ BmpInfoHeaderType.WinVersion5 or
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs b/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs
index 454f15b862..b4f017253d 100644
--- a/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs
+++ b/src/ImageSharp/Formats/Cur/CurFrameMetadata.cs
@@ -73,7 +73,7 @@ public static CurFrameMetadata FromFormatConnectingFrameMetadata(FormatConnectin
{
if (!metadata.PixelTypeInfo.HasValue)
{
- return new()
+ return new CurFrameMetadata
{
BmpBitsPerPixel = BmpBitsPerPixel.Bit32,
Compression = IconFrameCompression.Png
@@ -98,7 +98,7 @@ public static CurFrameMetadata FromFormatConnectingFrameMetadata(FormatConnectin
compression = IconFrameCompression.Png;
}
- return new()
+ return new CurFrameMetadata
{
BmpBitsPerPixel = bbpp,
Compression = compression,
@@ -147,7 +147,7 @@ internal IconDirEntry ToIconDirEntry(Size size)
? (byte)0
: (byte)ColorNumerics.GetColorCountForBitDepth((int)this.BmpBitsPerPixel);
- return new()
+ return new IconDirEntry
{
Width = ClampEncodingDimension(this.EncodingWidth ?? size.Width),
Height = ClampEncodingDimension(this.EncodingHeight ?? size.Height),
@@ -210,7 +210,7 @@ private PixelTypeInfo GetPixelTypeInfo()
}
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/Cur/CurMetadata.cs b/src/ImageSharp/Formats/Cur/CurMetadata.cs
index 6499c5b422..d8fdb32902 100644
--- a/src/ImageSharp/Formats/Cur/CurMetadata.cs
+++ b/src/ImageSharp/Formats/Cur/CurMetadata.cs
@@ -68,7 +68,7 @@ public static CurMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
compression = IconFrameCompression.Png;
}
- return new()
+ return new CurMetadata
{
BmpBitsPerPixel = bbpp,
Compression = compression
@@ -129,7 +129,7 @@ public PixelTypeInfo GetPixelTypeInfo()
}
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/DecoderOptions.cs b/src/ImageSharp/Formats/DecoderOptions.cs
index 8a365682a0..2511cffdbb 100644
--- a/src/ImageSharp/Formats/DecoderOptions.cs
+++ b/src/ImageSharp/Formats/DecoderOptions.cs
@@ -13,7 +13,7 @@ namespace SixLabors.ImageSharp.Formats;
///
public sealed class DecoderOptions
{
- private static readonly Lazy LazyOptions = new(() => new());
+ private static readonly Lazy LazyOptions = new(() => new DecoderOptions());
private uint maxFrames = int.MaxValue;
diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
index 4817edcf7b..ca28bc7713 100644
--- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
@@ -266,8 +266,8 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
GifThrowHelper.ThrowNoHeader();
}
- return new(
- new(this.logicalScreenDescriptor.Width, this.logicalScreenDescriptor.Height),
+ return new ImageInfo(
+ new Size(this.logicalScreenDescriptor.Width, this.logicalScreenDescriptor.Height),
this.metadata,
framesMetadata);
}
@@ -305,7 +305,7 @@ private void ReadImageDescriptor(BufferedReadStream stream)
GifThrowHelper.ThrowInvalidImageContentException("Width or height should not be 0");
}
- this.Dimensions = new(this.imageDescriptor.Width, this.imageDescriptor.Height);
+ this.Dimensions = new Size(this.imageDescriptor.Width, this.imageDescriptor.Height);
}
///
@@ -344,7 +344,7 @@ private void ReadApplicationExtension(BufferedReadStream stream)
GifXmpApplicationExtension extension = GifXmpApplicationExtension.Read(stream, this.memoryAllocator);
if (extension.Data.Length > 0)
{
- this.metadata!.XmpProfile = new(extension.Data);
+ this.metadata!.XmpProfile = new XmpProfile(extension.Data);
}
else
{
@@ -554,7 +554,7 @@ private void ReadFrameColors(
if (previousFrame is null && previousDisposalMode is null)
{
image = transFlag
- ? new(this.configuration, imageWidth, imageHeight, this.metadata)
+ ? new Image(this.configuration, imageWidth, imageHeight, this.metadata)
: new Image(this.configuration, imageWidth, imageHeight, backgroundPixel, this.metadata);
this.SetFrameMetadata(image.Frames.RootFrame.Metadata);
@@ -597,7 +597,7 @@ private void ReadFrameColors(
if (disposalMethod == FrameDisposalMode.RestoreToBackground)
{
- this.restoreArea = Rectangle.Intersect(image.Bounds, new(descriptor.Left, descriptor.Top, descriptor.Width, descriptor.Height));
+ this.restoreArea = Rectangle.Intersect(image.Bounds, new Rectangle(descriptor.Left, descriptor.Top, descriptor.Width, descriptor.Height));
}
if (colorTable.Length == 0)
diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
index 43af476f2a..ffe318063e 100644
--- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
@@ -113,7 +113,7 @@ public void Encode(Image image, Stream stream, CancellationToken
TransparentColorMode mode = this.transparentColorMode;
// Create a new quantizer options instance augmenting the transparent color mode to match the encoder.
- QuantizerOptions options = (this.encoder.Quantizer?.Options ?? new()).DeepClone(o => o.TransparentColorMode = mode);
+ QuantizerOptions options = (this.encoder.Quantizer?.Options ?? new QuantizerOptions()).DeepClone(o => o.TransparentColorMode = mode);
if (globalQuantizer is null)
{
diff --git a/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs b/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs
index e1b3354ad2..8ea607df6d 100644
--- a/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs
+++ b/src/ImageSharp/Formats/Gif/GifFrameMetadata.cs
@@ -93,7 +93,7 @@ public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata()
// If the color table is global and frame has no transparency. Consider it 'Source' also.
blendSource |= this.ColorTableMode == FrameColorTableMode.Global && !this.HasTransparency;
- return new()
+ return new FormatConnectingFrameMetadata
{
ColorTableMode = this.ColorTableMode,
Duration = TimeSpan.FromMilliseconds(this.FrameDelay * 10),
diff --git a/src/ImageSharp/Formats/Gif/GifMetadata.cs b/src/ImageSharp/Formats/Gif/GifMetadata.cs
index d6e9c780bd..77f600633b 100644
--- a/src/ImageSharp/Formats/Gif/GifMetadata.cs
+++ b/src/ImageSharp/Formats/Gif/GifMetadata.cs
@@ -87,7 +87,7 @@ public PixelTypeInfo GetPixelTypeInfo()
? Numerics.Clamp(ColorNumerics.GetBitsNeededForColorDepth(this.GlobalColorTable.Value.Length), 1, 8)
: 8;
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
ColorType = PixelColorType.Indexed,
ComponentInfo = PixelComponentInfo.Create(1, bpp, bpp),
diff --git a/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs b/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs
index 4c2ffbe4d1..e413896751 100644
--- a/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs
+++ b/src/ImageSharp/Formats/Gif/Sections/GifNetscapeLoopingApplicationExtension.cs
@@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Formats.Gif;
public static GifNetscapeLoopingApplicationExtension Parse(ReadOnlySpan buffer)
{
ushort repeatCount = BinaryPrimitives.ReadUInt16LittleEndian(buffer[..2]);
- return new(repeatCount);
+ return new GifNetscapeLoopingApplicationExtension(repeatCount);
}
public int WriteTo(Span buffer)
diff --git a/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs b/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs
index b32f91205e..1c1127c3be 100644
--- a/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs
+++ b/src/ImageSharp/Formats/Gif/Sections/GifXmpApplicationExtension.cs
@@ -42,7 +42,7 @@ public static GifXmpApplicationExtension Read(Stream stream, MemoryAllocator all
stream.Skip(1); // Skip the terminator.
}
- return new(buffer);
+ return new GifXmpApplicationExtension(buffer);
}
public int WriteTo(Span buffer)
diff --git a/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs b/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs
index 3afb02456a..266a3457a7 100644
--- a/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs
+++ b/src/ImageSharp/Formats/Ico/IcoFrameMetadata.cs
@@ -66,7 +66,7 @@ public static IcoFrameMetadata FromFormatConnectingFrameMetadata(FormatConnectin
{
if (!metadata.PixelTypeInfo.HasValue)
{
- return new()
+ return new IcoFrameMetadata
{
BmpBitsPerPixel = BmpBitsPerPixel.Bit32,
Compression = IconFrameCompression.Png
@@ -91,7 +91,7 @@ public static IcoFrameMetadata FromFormatConnectingFrameMetadata(FormatConnectin
compression = IconFrameCompression.Png;
}
- return new()
+ return new IcoFrameMetadata
{
BmpBitsPerPixel = bbpp,
Compression = compression,
@@ -138,7 +138,7 @@ internal IconDirEntry ToIconDirEntry(Size size)
? (byte)0
: (byte)ColorNumerics.GetColorCountForBitDepth((int)this.BmpBitsPerPixel);
- return new()
+ return new IconDirEntry
{
Width = ClampEncodingDimension(this.EncodingWidth ?? size.Width),
Height = ClampEncodingDimension(this.EncodingHeight ?? size.Height),
@@ -205,7 +205,7 @@ private PixelTypeInfo GetPixelTypeInfo()
}
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/Ico/IcoMetadata.cs b/src/ImageSharp/Formats/Ico/IcoMetadata.cs
index 4436dce855..f8c2ff40f2 100644
--- a/src/ImageSharp/Formats/Ico/IcoMetadata.cs
+++ b/src/ImageSharp/Formats/Ico/IcoMetadata.cs
@@ -68,7 +68,7 @@ public static IcoMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
compression = IconFrameCompression.Png;
}
- return new()
+ return new IcoMetadata
{
BmpBitsPerPixel = bbpp,
Compression = compression
@@ -129,7 +129,7 @@ public PixelTypeInfo GetPixelTypeInfo()
}
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/Icon/IconDecoderCore.cs b/src/ImageSharp/Formats/Icon/IconDecoderCore.cs
index caed2dd902..bc3258e6b2 100644
--- a/src/ImageSharp/Formats/Icon/IconDecoderCore.cs
+++ b/src/ImageSharp/Formats/Icon/IconDecoderCore.cs
@@ -63,7 +63,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
// Since Windows Vista, the size of an image is determined from the BITMAPINFOHEADER structure or PNG image data
// which technically allows storing icons with larger than 256 pixels, but such larger sizes are not recommended by Microsoft.
- this.Dimensions = new(Math.Max(this.Dimensions.Width, temp.Size.Width), Math.Max(this.Dimensions.Height, temp.Size.Height));
+ this.Dimensions = new Size(Math.Max(this.Dimensions.Width, temp.Size.Width), Math.Max(this.Dimensions.Height, temp.Size.Height));
}
ImageMetadata metadata = new();
@@ -208,7 +208,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
// Since Windows Vista, the size of an image is determined from the BITMAPINFOHEADER structure or PNG image data
// which technically allows storing icons with larger than 256 pixels, but such larger sizes are not recommended by Microsoft.
- this.Dimensions = new(Math.Max(this.Dimensions.Width, frameInfo.Size.Width), Math.Max(this.Dimensions.Height, frameInfo.Size.Height));
+ this.Dimensions = new Size(Math.Max(this.Dimensions.Width, frameInfo.Size.Width), Math.Max(this.Dimensions.Height, frameInfo.Size.Height));
}
// Copy the format specific metadata to the image.
@@ -222,7 +222,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
metadata.SetFormatMetadata(PngFormat.Instance, pngMetadata);
}
- return new(this.Dimensions, metadata, frames);
+ return new ImageInfo(this.Dimensions, metadata, frames);
}
protected abstract void SetFrameMetadata(
@@ -276,20 +276,20 @@ protected void ReadHeader(Stream stream)
height = Math.Max(height, entry.Height);
}
- this.Dimensions = new(width, height);
+ this.Dimensions = new Size(width, height);
}
private ImageDecoderCore GetDecoder(bool isPng)
{
if (isPng)
{
- return new PngDecoderCore(new()
+ return new PngDecoderCore(new PngDecoderOptions
{
GeneralOptions = this.Options,
});
}
- return new BmpDecoderCore(new()
+ return new BmpDecoderCore(new BmpDecoderOptions
{
GeneralOptions = this.Options,
ProcessedAlphaMask = true,
diff --git a/src/ImageSharp/Formats/Icon/IconEncoderCore.cs b/src/ImageSharp/Formats/Icon/IconEncoderCore.cs
index 76b14832ae..479cf9f1b0 100644
--- a/src/ImageSharp/Formats/Icon/IconEncoderCore.cs
+++ b/src/ImageSharp/Formats/Icon/IconEncoderCore.cs
@@ -116,7 +116,7 @@ public void Encode(
[MemberNotNull(nameof(entries))]
private void InitHeader(Image image)
{
- this.fileHeader = new(this.iconFileType, (ushort)image.Frames.Count);
+ this.fileHeader = new IconDir(this.iconFileType, (ushort)image.Frames.Count);
this.entries = this.iconFileType switch
{
IconFileType.ICO =>
@@ -155,14 +155,14 @@ [.. image.Frames.Select(i =>
count = 256;
}
- return new WuQuantizer(new()
+ return new WuQuantizer(new QuantizerOptions
{
MaxColors = count
});
}
// Don't dither if we have a palette. We want to preserve as much information as possible.
- return new PaletteQuantizer(metadata.ColorTable.Value, new() { Dither = null });
+ return new PaletteQuantizer(metadata.ColorTable.Value, new QuantizerOptions { Dither = null });
}
internal sealed class EncodingFrameMetadata
diff --git a/src/ImageSharp/Formats/ImageFormatManager.cs b/src/ImageSharp/Formats/ImageFormatManager.cs
index b6b5f87797..ecf96855e5 100644
--- a/src/ImageSharp/Formats/ImageFormatManager.cs
+++ b/src/ImageSharp/Formats/ImageFormatManager.cs
@@ -161,7 +161,7 @@ public void SetDecoder(IImageFormat imageFormat, IImageDecoder decoder)
///
/// Removes all the registered image format detectors.
///
- public void ClearImageFormatDetectors() => this.imageFormatDetectors = new();
+ public void ClearImageFormatDetectors() => this.imageFormatDetectors = new ConcurrentBag();
///
/// Adds a new detector for detecting mime types.
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs
index 754f1f8b49..d2c383132a 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs
@@ -140,7 +140,7 @@ public void LoadFrom(Span source)
///
public override string ToString()
{
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new();
sb.Append('[');
for (int i = 0; i < Size; i++)
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs
index 1c0615ef52..179f9aa287 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs
@@ -57,19 +57,19 @@ static void WidenCopyRowImpl2x2(ref Vector4 selfBase, ref Vector2 destBase, nuin
ref Vector4 dTopLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, offset));
ref Vector4 dBottomLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, offset + destStride));
- Vector4 xyLeft = new Vector4(sLeft.X);
+ Vector4 xyLeft = new(sLeft.X);
xyLeft.Z = sLeft.Y;
xyLeft.W = sLeft.Y;
- Vector4 zwLeft = new Vector4(sLeft.Z);
+ Vector4 zwLeft = new(sLeft.Z);
zwLeft.Z = sLeft.W;
zwLeft.W = sLeft.W;
- Vector4 xyRight = new Vector4(sRight.X);
+ Vector4 xyRight = new(sRight.X);
xyRight.Z = sRight.Y;
xyRight.W = sRight.Y;
- Vector4 zwRight = new Vector4(sRight.Z);
+ Vector4 zwRight = new(sRight.Z);
zwRight.Z = sRight.W;
zwRight.W = sRight.W;
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs
index 495a208317..01bfc0875a 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.TiffYccKScalar.cs
@@ -128,7 +128,7 @@ public static void ConvertToRgbInPlaceWithIcc(Configuration configuration, IccPr
ColorProfileConverter converter = new();
Span source = MemoryMarshal.Cast(packed);
- // YccK is not a defined ICC color space — it's a JPEG-specific encoding used in Adobe-style CMYK JPEGs.
+ // YccK is not a defined ICC color space � it's a JPEG-specific encoding used in Adobe-style CMYK JPEGs.
// ICC profiles expect colorimetric CMYK values, so we must first convert YccK to CMYK using a hardcoded inverse transform.
// This transform assumes Rec.601 YCbCr coefficients and an inverted K channel.
//
@@ -144,7 +144,7 @@ public static void ConvertToRgbInPlaceWithIcc(Configuration configuration, IccPr
SourceIccProfile = profile,
TargetIccProfile = CompactSrgbV4Profile.Profile,
};
- converter = new(options);
+ converter = new ColorProfileConverter(options);
converter.Convert(source, destination);
UnpackDeinterleave3(MemoryMarshal.Cast(packed)[..source.Length], c0, c1, c2);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs
index 4fa18b88ab..2b1c1dca38 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrScalar.cs
@@ -91,7 +91,7 @@ public static void ConvertToRgbInPlaceWithIcc(Configuration configuration, IccPr
SourceIccProfile = profile,
TargetIccProfile = CompactSrgbV4Profile.Profile,
};
- converter = new(options);
+ converter = new ColorProfileConverter(options);
converter.Convert(destination, destination);
UnpackDeinterleave3(MemoryMarshal.Cast(packed)[..source.Length], c0, c1, c2);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs
index 8cd715eb3d..3368e52bf0 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKScalar.cs
@@ -116,7 +116,7 @@ public static void ConvertToRgbInPlaceWithIcc(Configuration configuration, IccPr
SourceIccProfile = profile,
TargetIccProfile = CompactSrgbV4Profile.Profile,
};
- converter = new(options);
+ converter = new ColorProfileConverter(options);
converter.Convert(source, destination);
UnpackDeinterleave3(MemoryMarshal.Cast(packed)[..source.Length], c0, c1, c2);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs
index 7d236eeae9..74227c7a6e 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverterBase.cs
@@ -514,7 +514,7 @@ public ComponentValues Slice(int start, int length)
Span c2 = this.Component2.Length > 0 ? this.Component2.Slice(start, length) : [];
Span c3 = this.Component3.Length > 0 ? this.Component3.Slice(start, length) : [];
- return new(this.ComponentCount, c0, c1, c2, c3);
+ return new ComponentValues(this.ComponentCount, c0, c1, c2, c3);
}
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
index 5109b1862b..cf2369b2cb 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs
@@ -71,7 +71,7 @@ public static bool TryParse(ReadOnlySpan bytes, out AdobeMarker marker)
short app14Flags1 = (short)((bytes[9] << 8) | bytes[10]);
byte colorTransform = bytes[11];
- marker = new(dctEncodeVersion, app14Flags0, app14Flags1, colorTransform);
+ marker = new AdobeMarker(dctEncodeVersion, app14Flags0, app14Flags1, colorTransform);
return true;
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs
index ba6276a5c8..6e83f5b2b4 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs
@@ -242,7 +242,7 @@ public void ParseEntropyCodedData(int scanComponentCount, IccProfile iccProfile)
this.scanComponentCount = scanComponentCount;
- this.scanBuffer = new(this.stream);
+ this.scanBuffer = new JpegBitReader(this.stream);
this.frame.AllocateComponents();
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs
index b43df4d974..9ee43a2c83 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs
@@ -116,7 +116,7 @@ public void ParseEntropyCodedData(int scanComponentCount, IccProfile iccProfile)
this.scanComponentCount = scanComponentCount;
- this.scanBuffer = new(this.stream);
+ this.scanBuffer = new JpegBitReader(this.stream);
this.frame.AllocateComponents();
@@ -784,6 +784,6 @@ private bool HandleRestart()
public void BuildHuffmanTable(int type, int index, ReadOnlySpan codeLengths, ReadOnlySpan values, Span workspace)
{
HuffmanTable[] tables = type == 0 ? this.dcHuffmanTables : this.acHuffmanTables;
- tables[index] = new(codeLengths, values, workspace);
+ tables[index] = new HuffmanTable(codeLengths, values, workspace);
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs
index b31376992f..7e25e945a5 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs
@@ -80,7 +80,7 @@ public static bool TryParse(ReadOnlySpan bytes, out JFifMarker marker)
byte densityUnits = bytes[7];
short xDensity = (short)((bytes[8] << 8) | bytes[9]);
short yDensity = (short)((bytes[10] << 8) | bytes[11]);
- marker = new(majorVersion, minorVersion, densityUnits, xDensity, yDensity);
+ marker = new JFifMarker(majorVersion, minorVersion, densityUnits, xDensity, yDensity);
return true;
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
index 7e4a06d41a..b2debf3938 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
@@ -21,7 +21,7 @@ public JpegComponent(MemoryAllocator memoryAllocator, JpegFrame frame, byte id,
this.HorizontalSamplingFactor = horizontalFactor;
this.VerticalSamplingFactor = verticalFactor;
- this.SamplingFactors = new(this.HorizontalSamplingFactor, this.VerticalSamplingFactor);
+ this.SamplingFactors = new Size(this.HorizontalSamplingFactor, this.VerticalSamplingFactor);
this.QuantizationTableIndex = quantizationTableIndex;
this.Index = index;
@@ -109,7 +109,7 @@ public void Init(int maxSubFactorH, int maxSubFactorV)
int blocksPerLineForMcu = this.Frame.McusPerLine * this.HorizontalSamplingFactor;
int blocksPerColumnForMcu = this.Frame.McusPerColumn * this.VerticalSamplingFactor;
- this.SizeInBlocks = new(blocksPerLineForMcu, blocksPerColumnForMcu);
+ this.SizeInBlocks = new Size(blocksPerLineForMcu, blocksPerColumnForMcu);
this.SubSamplingDivisors = new Size(maxSubFactorH, maxSubFactorV).DivideBy(this.SamplingFactors);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs
index 5b77ab1534..0703e4d9e0 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter.cs
@@ -121,7 +121,7 @@ public static Size CalculateResultingImageSize(Size size, Size? targetSize, out
if (scaledWidth >= tSize.Width && scaledHeight >= tSize.Height)
{
blockPixelSize = blockSize;
- return new(scaledWidth, scaledHeight);
+ return new Size(scaledWidth, scaledHeight);
}
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs
index 7398e97a01..cc565c4d84 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/Component.cs
@@ -19,7 +19,7 @@ public Component(MemoryAllocator memoryAllocator, int horizontalFactor, int vert
this.HorizontalSamplingFactor = horizontalFactor;
this.VerticalSamplingFactor = verticalFactor;
- this.SamplingFactors = new(horizontalFactor, verticalFactor);
+ this.SamplingFactors = new Size(horizontalFactor, verticalFactor);
this.QuantizationTableIndex = quantizationTableIndex;
}
@@ -95,7 +95,7 @@ public void Init(JpegFrame frame, int maxSubFactorH, int maxSubFactorV)
int blocksPerLineForMcu = frame.McusPerLine * this.HorizontalSamplingFactor;
int blocksPerColumnForMcu = frame.McusPerColumn * this.VerticalSamplingFactor;
- this.SizeInBlocks = new(blocksPerLineForMcu, blocksPerColumnForMcu);
+ this.SizeInBlocks = new Size(blocksPerLineForMcu, blocksPerColumnForMcu);
this.SubSamplingDivisors = new Size(maxSubFactorH, maxSubFactorV).DivideBy(this.SamplingFactors);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs
index 1704ae1e74..1b0a177049 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs
@@ -241,7 +241,7 @@ static void MultiplyToAverage(Span target, float multiplier)
ref Vector targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target));
nuint count = target.VectorCount();
- Vector multiplierVector = new Vector(multiplier);
+ Vector multiplierVector = new(multiplier);
for (nuint i = 0; i < count; i++)
{
Unsafe.Add(ref targetVectorRef, i) *= multiplierVector;
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs
index 857f2a1fe5..4815fce0cf 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs
@@ -134,7 +134,7 @@ private bool IsStreamFlushNeeded
public void BuildHuffmanTable(JpegHuffmanTableConfig tableConfig)
{
HuffmanLut[] tables = tableConfig.Class == 0 ? this.dcHuffmanTables : this.acHuffmanTables;
- tables[tableConfig.DestinationIndex] = new(tableConfig.Table);
+ tables[tableConfig.DestinationIndex] = new HuffmanLut(tableConfig.Table);
}
///
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs
index f8a3d6dd2d..6ba0b82723 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/JpegFrame.cs
@@ -27,7 +27,7 @@ public JpegFrame(Image image, JpegFrameConfig frameConfig, bool interleaved)
for (int i = 0; i < this.Components.Length; i++)
{
JpegComponentConfig componentConfig = componentConfigs[i];
- this.Components[i] = new(allocator, componentConfig.HorizontalSampleFactor, componentConfig.VerticalSampleFactor, componentConfig.QuantizatioTableIndex)
+ this.Components[i] = new Component(allocator, componentConfig.HorizontalSampleFactor, componentConfig.VerticalSampleFactor, componentConfig.QuantizatioTableIndex)
{
DcTableId = componentConfig.DcTableSelector,
AcTableId = componentConfig.AcTableSelector,
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs
index e97c57cd95..b60ef68f11 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/SpectralConverter{TPixel}.cs
@@ -51,7 +51,7 @@ public SpectralConverter(JpegFrame frame, Image image, Block8x8F[] dequa
for (int i = 0; i < this.componentProcessors.Length; i++)
{
Component component = frame.Components[i];
- this.componentProcessors[i] = new(
+ this.componentProcessors[i] = new ComponentProcessor(
allocator,
component,
postProcessorBufferSize,
diff --git a/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs
index c92c2e7bd9..b5d01fa5ce 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs
@@ -32,7 +32,7 @@ public static Size DivideRoundUp(this Size originalSize, int divX, int divY)
sizeVect.X = MathF.Ceiling(sizeVect.X);
sizeVect.Y = MathF.Ceiling(sizeVect.Y);
- return new((int)sizeVect.X, (int)sizeVect.Y);
+ return new Size((int)sizeVect.X, (int)sizeVect.Y);
}
///
diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
index 026c542dd9..c013cdc9c7 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
@@ -25,7 +25,7 @@ protected override ImageInfo Identify(DecoderOptions options, Stream stream, Can
Guard.NotNull(options, nameof(options));
Guard.NotNull(stream, nameof(stream));
- using JpegDecoderCore decoder = new(new() { GeneralOptions = options });
+ using JpegDecoderCore decoder = new(new JpegDecoderOptions { GeneralOptions = options });
return decoder.Identify(options.Configuration, stream, cancellationToken);
}
diff --git a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
index c9ac1e6bb1..0ad78b9035 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
@@ -167,7 +167,7 @@ public static JpegFileMarker FindNextFileMarker(BufferedReadStream stream)
int b = stream.ReadByte();
if (b == -1)
{
- return new(JpegConstants.Markers.EOI, stream.Length - 2);
+ return new JpegFileMarker(JpegConstants.Markers.EOI, stream.Length - 2);
}
// Found a marker.
@@ -179,14 +179,14 @@ public static JpegFileMarker FindNextFileMarker(BufferedReadStream stream)
b = stream.ReadByte();
if (b == -1)
{
- return new(JpegConstants.Markers.EOI, stream.Length - 2);
+ return new JpegFileMarker(JpegConstants.Markers.EOI, stream.Length - 2);
}
}
// Found a valid marker. Exit loop
if (b is not 0 and (< JpegConstants.Markers.RST0 or > JpegConstants.Markers.RST7))
{
- return new((byte)(uint)b, stream.Position - 2);
+ return new JpegFileMarker((byte)(uint)b, stream.Position - 2);
}
}
}
@@ -205,7 +205,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
_ = this.Options.TryGetIccProfileForColorConversion(this.Metadata.IccProfile, out IccProfile profile);
- return new(
+ return new Image(
this.configuration,
spectralConverter.GetPixelBuffer(profile, cancellationToken),
this.Metadata);
@@ -222,7 +222,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
this.InitDerivedMetadataProperties();
Size pixelSize = this.Frame.PixelSize;
- return new(new(pixelSize.Width, pixelSize.Height), this.Metadata);
+ return new ImageInfo(new Size(pixelSize.Width, pixelSize.Height), this.Metadata);
}
///
@@ -233,7 +233,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
/// The scan decoder.
public void LoadTables(byte[] tableBytes, IJpegScanDecoder scanDecoder)
{
- this.Metadata ??= new();
+ this.Metadata ??= new ImageMetadata();
this.QuantizationTables = new Block8x8F[4];
this.scanDecoder = scanDecoder;
if (tableBytes.Length < 4)
@@ -256,7 +256,7 @@ public void LoadTables(byte[] tableBytes, IJpegScanDecoder scanDecoder)
// Read next marker.
bytesRead = stream.Read(markerBuffer);
- fileMarker = new(markerBuffer[1], (int)stream.Position - 2);
+ fileMarker = new JpegFileMarker(markerBuffer[1], (int)stream.Position - 2);
while (fileMarker.Marker != JpegConstants.Markers.EOI || (fileMarker.Marker == JpegConstants.Markers.EOI && fileMarker.Invalid))
{
@@ -300,7 +300,7 @@ public void LoadTables(byte[] tableBytes, IJpegScanDecoder scanDecoder)
JpegThrowHelper.ThrowInvalidImageContentException("Not enough data to read marker");
}
- fileMarker = new(markerBuffer[1], 0);
+ fileMarker = new JpegFileMarker(markerBuffer[1], 0);
}
}
@@ -316,7 +316,7 @@ internal void ParseStream(BufferedReadStream stream, SpectralConverter spectralC
this.scanDecoder ??= new HuffmanScanDecoder(stream, spectralConverter, cancellationToken);
- this.Metadata ??= new();
+ this.Metadata ??= new ImageMetadata();
Span markerBuffer = stackalloc byte[2];
@@ -529,7 +529,7 @@ private void ProcessComMarker(BufferedReadStream stream, int markerContentByteSi
chars[i] = (char)read;
}
- metadata.Comments.Add(new(chars));
+ metadata.Comments.Add(new JpegComData(chars));
}
///
@@ -661,7 +661,7 @@ private void InitExifProfile()
{
if (this.hasExif)
{
- this.Metadata.ExifProfile = new(this.exifData);
+ this.Metadata.ExifProfile = new ExifProfile(this.exifData);
}
}
@@ -685,7 +685,7 @@ private void SetIccMetadata(IccProfile profile)
if (!this.skipMetadata && profile?.CheckIsValid() == true)
{
this.hasIcc = true;
- this.Metadata ??= new();
+ this.Metadata ??= new ImageMetadata();
this.Metadata.IccProfile = profile;
}
}
@@ -697,7 +697,7 @@ private void InitIptcProfile()
{
if (this.hasIptc)
{
- this.Metadata.IptcProfile = new(this.iptcData);
+ this.Metadata.IptcProfile = new IptcProfile(this.iptcData);
}
}
@@ -708,7 +708,7 @@ private void InitXmpProfile()
{
if (this.hasXmp)
{
- this.Metadata.XmpProfile = new(this.xmpData);
+ this.Metadata.XmpProfile = new XmpProfile(this.xmpData);
}
}
@@ -992,7 +992,7 @@ private void ProcessApp13Marker(BufferedReadStream stream, int remaining)
/// The remaining bytes in the segment block.
private void ProcessArithmeticTable(BufferedReadStream stream, int remaining)
{
- this.arithmeticDecodingTables ??= new(4);
+ this.arithmeticDecodingTables ??= new List(4);
while (remaining > 0)
{
@@ -1242,8 +1242,8 @@ private void ProcessStartOfFrameMarker(BufferedReadStream stream, int remaining,
JpegThrowHelper.ThrowNotSupportedComponentCount(componentCount);
}
- this.Frame = new(frameMarker, precision, frameWidth, frameHeight, componentCount);
- this.Dimensions = new(frameWidth, frameHeight);
+ this.Frame = new JpegFrame(frameMarker, precision, frameWidth, frameHeight, componentCount);
+ this.Dimensions = new Size(frameWidth, frameHeight);
this.Metadata.GetJpegMetadata().Progressive = this.Frame.Progressive;
remaining -= length;
diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs
index 9a89eced28..98b6dd30a6 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.FrameConfig.cs
@@ -13,13 +13,13 @@ internal sealed unsafe partial class JpegEncoderCore
{
private static JpegFrameConfig[] CreateFrameConfigs()
{
- JpegHuffmanTableConfig defaultLuminanceHuffmanDC = new JpegHuffmanTableConfig(@class: 0, destIndex: 0, HuffmanSpec.LuminanceDC);
- JpegHuffmanTableConfig defaultLuminanceHuffmanAC = new JpegHuffmanTableConfig(@class: 1, destIndex: 0, HuffmanSpec.LuminanceAC);
- JpegHuffmanTableConfig defaultChrominanceHuffmanDC = new JpegHuffmanTableConfig(@class: 0, destIndex: 1, HuffmanSpec.ChrominanceDC);
- JpegHuffmanTableConfig defaultChrominanceHuffmanAC = new JpegHuffmanTableConfig(@class: 1, destIndex: 1, HuffmanSpec.ChrominanceAC);
+ JpegHuffmanTableConfig defaultLuminanceHuffmanDC = new(@class: 0, destIndex: 0, HuffmanSpec.LuminanceDC);
+ JpegHuffmanTableConfig defaultLuminanceHuffmanAC = new(@class: 1, destIndex: 0, HuffmanSpec.LuminanceAC);
+ JpegHuffmanTableConfig defaultChrominanceHuffmanDC = new(@class: 0, destIndex: 1, HuffmanSpec.ChrominanceDC);
+ JpegHuffmanTableConfig defaultChrominanceHuffmanAC = new(@class: 1, destIndex: 1, HuffmanSpec.ChrominanceAC);
- JpegQuantizationTableConfig defaultLuminanceQuantTable = new JpegQuantizationTableConfig(0, Quantization.LuminanceTable);
- JpegQuantizationTableConfig defaultChrominanceQuantTable = new JpegQuantizationTableConfig(1, Quantization.ChrominanceTable);
+ JpegQuantizationTableConfig defaultLuminanceQuantTable = new(0, Quantization.LuminanceTable);
+ JpegQuantizationTableConfig defaultChrominanceQuantTable = new(1, Quantization.ChrominanceTable);
JpegHuffmanTableConfig[] yCbCrHuffmanConfigs = new JpegHuffmanTableConfig[]
{
@@ -38,77 +38,77 @@ private static JpegFrameConfig[] CreateFrameConfigs()
return new JpegFrameConfig[]
{
// YCbCr 4:4:4
- new JpegFrameConfig(
+ new(
JpegColorSpace.YCbCr,
JpegColorType.YCbCrRatio444,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
},
yCbCrHuffmanConfigs,
yCbCrQuantTableConfigs),
// YCbCr 4:2:2
- new JpegFrameConfig(
+ new(
JpegColorSpace.YCbCr,
JpegColorType.YCbCrRatio422,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 2, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 1, hsf: 2, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
},
yCbCrHuffmanConfigs,
yCbCrQuantTableConfigs),
// YCbCr 4:2:0
- new JpegFrameConfig(
+ new(
JpegColorSpace.YCbCr,
JpegColorType.YCbCrRatio420,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 2, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 1, hsf: 2, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
},
yCbCrHuffmanConfigs,
yCbCrQuantTableConfigs),
// YCbCr 4:1:1
- new JpegFrameConfig(
+ new(
JpegColorSpace.YCbCr,
JpegColorType.YCbCrRatio411,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 4, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 1, hsf: 4, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
},
yCbCrHuffmanConfigs,
yCbCrQuantTableConfigs),
// YCbCr 4:1:0
- new JpegFrameConfig(
+ new(
JpegColorSpace.YCbCr,
JpegColorType.YCbCrRatio410,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 4, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 1, hsf: 4, vsf: 2, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 1, dcIndex: 1, acIndex: 1),
},
yCbCrHuffmanConfigs,
yCbCrQuantTableConfigs),
// Luminance
- new JpegFrameConfig(
+ new(
JpegColorSpace.Grayscale,
JpegColorType.Luminance,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 0, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 0, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
},
new JpegHuffmanTableConfig[]
{
@@ -121,14 +121,14 @@ private static JpegFrameConfig[] CreateFrameConfigs()
}),
// Rgb
- new JpegFrameConfig(
+ new(
JpegColorSpace.RGB,
JpegColorType.Rgb,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 82, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 71, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 66, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 82, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 71, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 66, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
},
new JpegHuffmanTableConfig[]
{
@@ -144,15 +144,15 @@ private static JpegFrameConfig[] CreateFrameConfigs()
},
// Cmyk
- new JpegFrameConfig(
+ new(
JpegColorSpace.Cmyk,
JpegColorType.Cmyk,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
},
new JpegHuffmanTableConfig[]
{
@@ -168,15 +168,15 @@ private static JpegFrameConfig[] CreateFrameConfigs()
},
// YccK
- new JpegFrameConfig(
+ new(
JpegColorSpace.Ycck,
JpegColorType.Ycck,
new JpegComponentConfig[]
{
- new JpegComponentConfig(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
- new JpegComponentConfig(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 1, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 2, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 3, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
+ new(id: 4, hsf: 1, vsf: 1, quantIndex: 0, dcIndex: 0, acIndex: 0),
},
new JpegHuffmanTableConfig[]
{
diff --git a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs
index a07be33fc4..9d5a299817 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs
@@ -15,7 +15,7 @@ private JpegFormat()
///
/// Gets the shared instance.
///
- public static JpegFormat Instance { get; } = new JpegFormat();
+ public static JpegFormat Instance { get; } = new();
///
public string Name => "JPEG";
diff --git a/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs b/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs
index 88bea3dc9f..fe4855dc77 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegMetadata.cs
@@ -139,7 +139,7 @@ public static JpegMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
break;
}
- return new()
+ return new JpegMetadata
{
ColorType = color,
ChrominanceQuality = metadata.Quality,
@@ -182,7 +182,7 @@ public PixelTypeInfo GetPixelTypeInfo()
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = PixelAlphaRepresentation.None,
ColorType = colorType,
diff --git a/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs b/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs
index d2a2f661f3..989eadda7a 100644
--- a/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs
+++ b/src/ImageSharp/Formats/Pbm/PbmDecoderCore.cs
@@ -79,8 +79,8 @@ protected override Image Decode(BufferedReadStream stream, Cance
protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken)
{
this.ProcessHeader(stream);
- return new(
- new(this.pixelSize.Width, this.pixelSize.Height),
+ return new ImageInfo(
+ new Size(this.pixelSize.Width, this.pixelSize.Height),
this.metadata);
}
@@ -171,9 +171,9 @@ private void ProcessHeader(BufferedReadStream stream)
this.componentType = PbmComponentType.Bit;
}
- this.pixelSize = new(width, height);
+ this.pixelSize = new Size(width, height);
this.Dimensions = this.pixelSize;
- this.metadata = new();
+ this.metadata = new ImageMetadata();
PbmMetadata meta = this.metadata.GetPbmMetadata();
meta.Encoding = this.encoding;
meta.ColorType = this.colorType;
diff --git a/src/ImageSharp/Formats/Pbm/PbmMetadata.cs b/src/ImageSharp/Formats/Pbm/PbmMetadata.cs
index 9045671fb0..d852f3c8eb 100644
--- a/src/ImageSharp/Formats/Pbm/PbmMetadata.cs
+++ b/src/ImageSharp/Formats/Pbm/PbmMetadata.cs
@@ -77,7 +77,7 @@ public static PbmMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
_ => PbmComponentType.Short
};
- return new()
+ return new PbmMetadata
{
ColorType = color,
ComponentType = componentType
@@ -114,7 +114,7 @@ public PixelTypeInfo GetPixelTypeInfo()
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = PixelAlphaRepresentation.None,
ColorType = colorType,
diff --git a/src/ImageSharp/Formats/Pbm/PlainDecoder.cs b/src/ImageSharp/Formats/Pbm/PlainDecoder.cs
index 4ffd824c5f..8748d90fa8 100644
--- a/src/ImageSharp/Formats/Pbm/PlainDecoder.cs
+++ b/src/ImageSharp/Formats/Pbm/PlainDecoder.cs
@@ -71,7 +71,7 @@ private static void ProcessGrayscale(Configuration configuration, Buffer
for (int x = 0; x < width; x++)
{
stream.ReadDecimal(out int value);
- rowSpan[x] = new((byte)value);
+ rowSpan[x] = new L8((byte)value);
eofReached = !stream.SkipWhitespaceAndComments();
if (eofReached)
{
@@ -107,7 +107,7 @@ private static void ProcessWideGrayscale(Configuration configuration, Bu
for (int x = 0; x < width; x++)
{
stream.ReadDecimal(out int value);
- rowSpan[x] = new((ushort)value);
+ rowSpan[x] = new L16((ushort)value);
eofReached = !stream.SkipWhitespaceAndComments();
if (eofReached)
{
@@ -154,7 +154,7 @@ private static void ProcessRgb(Configuration configuration, Buffer2D(Configuration configuration, Buffer2D
stream.ReadDecimal(out int blue);
- rowSpan[x] = new((ushort)red, (ushort)green, (ushort)blue);
+ rowSpan[x] = new Rgb48((ushort)red, (ushort)green, (ushort)blue);
eofReached = !stream.SkipWhitespaceAndComments();
if (eofReached)
{
diff --git a/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs b/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs
index a68b1cab45..8af0ac8ca7 100644
--- a/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs
+++ b/src/ImageSharp/Formats/Png/Chunks/PngPhysical.cs
@@ -50,7 +50,7 @@ public static PngPhysical Parse(ReadOnlySpan data)
uint vResolution = BinaryPrimitives.ReadUInt32BigEndian(data.Slice(4, 4));
byte unit = data[8];
- return new(hResolution, vResolution, unit);
+ return new PngPhysical(hResolution, vResolution, unit);
}
///
@@ -92,7 +92,7 @@ public static PngPhysical FromMetadata(ImageMetadata meta)
break;
}
- return new(x, y, unitSpecifier);
+ return new PngPhysical(x, y, unitSpecifier);
}
///
diff --git a/src/ImageSharp/Formats/Png/PngDecoder.cs b/src/ImageSharp/Formats/Png/PngDecoder.cs
index b0adbe6c55..df3995294e 100644
--- a/src/ImageSharp/Formats/Png/PngDecoder.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoder.cs
@@ -25,7 +25,7 @@ protected override ImageInfo Identify(DecoderOptions options, Stream stream, Can
Guard.NotNull(options, nameof(options));
Guard.NotNull(stream, nameof(stream));
- return new PngDecoderCore(new() { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken);
+ return new PngDecoderCore(new PngDecoderOptions { GeneralOptions = options }).Identify(options.Configuration, stream, cancellationToken);
}
///
diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
index 577c15272b..38f964d37b 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
@@ -248,7 +248,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
break;
case PngChunkType.Data:
pngMetadata.AnimateRootFrame = currentFrameControl != null;
- currentFrameControl ??= new((uint)this.header.Width, (uint)this.header.Height);
+ currentFrameControl ??= new FrameControl((uint)this.header.Width, (uint)this.header.Height);
if (image is null)
{
this.InitializeImage(metadata, currentFrameControl.Value, out image);
@@ -297,7 +297,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
{
byte[] exifData = new byte[chunk.Length];
chunk.Data.GetSpan().CopyTo(exifData);
- MergeOrSetExifProfile(metadata, new(exifData), replaceExistingKeys: true);
+ MergeOrSetExifProfile(metadata, new ExifProfile(exifData), replaceExistingKeys: true);
}
break;
@@ -433,7 +433,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
}
pngMetadata.AnimateRootFrame = currentFrameControl != null;
- currentFrameControl ??= new((uint)this.header.Width, (uint)this.header.Height);
+ currentFrameControl ??= new FrameControl((uint)this.header.Width, (uint)this.header.Height);
if (framesMetadata.Count == 0)
{
InitializeFrameMetadata(framesMetadata, currentFrameControl.Value);
@@ -497,7 +497,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
{
byte[] exifData = new byte[chunk.Length];
chunk.Data.GetSpan().CopyTo(exifData);
- MergeOrSetExifProfile(metadata, new(exifData), replaceExistingKeys: true);
+ MergeOrSetExifProfile(metadata, new ExifProfile(exifData), replaceExistingKeys: true);
}
break;
@@ -525,7 +525,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
PngThrowHelper.ThrowInvalidHeader();
}
- return new(new(this.header.Width, this.header.Height), metadata, framesMetadata);
+ return new ImageInfo(new Size(this.header.Width, this.header.Height), metadata, framesMetadata);
}
finally
{
@@ -626,7 +626,7 @@ private static void ReadGammaChunk(PngMetadata pngMetadata, ReadOnlySpan d
private void InitializeImage(ImageMetadata metadata, FrameControl frameControl, out Image image)
where TPixel : unmanaged, IPixel
{
- image = new(this.configuration, this.header.Width, this.header.Height, metadata);
+ image = new Image(this.configuration, this.header.Width, this.header.Height, metadata);
PngFrameMetadata frameMetadata = image.Frames.RootFrame.Metadata.GetPngMetadata();
frameMetadata.FromChunk(in frameControl);
@@ -1343,7 +1343,7 @@ private void ReadHeaderChunk(PngMetadata pngMetadata, ReadOnlySpan data)
pngMetadata.InterlaceMethod = this.header.InterlaceMethod;
this.pngColorType = this.header.ColorType;
- this.Dimensions = new(this.header.Width, this.header.Height);
+ this.Dimensions = new Size(this.header.Width, this.header.Height);
}
///
@@ -1377,7 +1377,7 @@ private void ReadTextChunk(ImageMetadata baseMetadata, PngMetadata metadata, Rea
if (!TryReadTextChunkMetadata(baseMetadata, name, value))
{
- metadata.TextData.Add(new(name, value, string.Empty, string.Empty));
+ metadata.TextData.Add(new PngTextData(name, value, string.Empty, string.Empty));
}
}
@@ -1418,7 +1418,7 @@ private void ReadCompressedTextChunk(ImageMetadata baseMetadata, PngMetadata met
if (this.TryDecompressTextData(compressedData, PngConstants.Encoding, out string? uncompressed)
&& !TryReadTextChunkMetadata(baseMetadata, name, uncompressed))
{
- metadata.TextData.Add(new(name, uncompressed, string.Empty, string.Empty));
+ metadata.TextData.Add(new PngTextData(name, uncompressed, string.Empty, string.Empty));
}
}
@@ -1476,7 +1476,7 @@ private static void ReadCicpChunk(ImageMetadata metadata, ReadOnlySpan dat
fullRange = null;
}
- metadata.CicpProfile = new(colorPrimaries, transferFunction, matrixCoefficients, fullRange);
+ metadata.CicpProfile = new CicpProfile(colorPrimaries, transferFunction, matrixCoefficients, fullRange);
}
///
@@ -1560,7 +1560,7 @@ private static bool TryReadLegacyExifTextChunk(ImageMetadata metadata, string da
return false;
}
- MergeOrSetExifProfile(metadata, new(exifBlob), replaceExistingKeys: false);
+ MergeOrSetExifProfile(metadata, new ExifProfile(exifBlob), replaceExistingKeys: false);
return true;
}
@@ -1594,7 +1594,7 @@ private void ReadColorProfileChunk(ImageMetadata metadata, ReadOnlySpan da
if (this.TryDecompressZlibData(compressedData, this.maxUncompressedLength, out byte[] iccpProfileBytes))
{
- metadata.IccProfile = new(iccpProfileBytes);
+ metadata.IccProfile = new IccProfile(iccpProfileBytes);
}
}
@@ -1750,17 +1750,17 @@ private void ReadInternationalTextChunk(ImageMetadata metadata, ReadOnlySpan buffer, out PngChunk chunk)
type != PngChunkType.AnimationControl &&
type != PngChunkType.FrameControl)
{
- chunk = new(length, type);
+ chunk = new PngChunk(length, type);
return true;
}
// A chunk might report a length that exceeds the length of the stream.
// Take the minimum of the two values to ensure we don't read past the end of the stream.
position = this.currentStream.Position;
- chunk = new(
+ chunk = new PngChunk(
length: (int)Math.Min(length, this.currentStream.Length - position),
type: type,
data: this.ReadChunkData(length));
diff --git a/src/ImageSharp/Formats/Png/PngDecoderOptions.cs b/src/ImageSharp/Formats/Png/PngDecoderOptions.cs
index a73db87774..e4aeded157 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderOptions.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderOptions.cs
@@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Formats.Png;
public sealed class PngDecoderOptions : ISpecializedDecoderOptions
{
///
- public DecoderOptions GeneralOptions { get; init; } = new DecoderOptions();
+ public DecoderOptions GeneralOptions { get; init; } = new();
///
/// Gets the maximum memory in bytes that a zTXt, sPLT, iTXt, iCCP, or unknown chunk can occupy when decompressed.
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index e9b76522c9..2b01affea2 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -265,7 +265,7 @@ public void Encode(Image image, Stream stream, CancellationToken
{
// Use the previously derived global palette and a shared quantizer to
// quantize the subsequent frames. This allows us to cache the color matching resolution.
- paletteQuantizer ??= new(
+ paletteQuantizer ??= new PaletteQuantizer(
this.configuration,
this.quantizer!.Options,
previousPalette);
diff --git a/src/ImageSharp/Formats/Png/PngFormat.cs b/src/ImageSharp/Formats/Png/PngFormat.cs
index e5852affa9..e49b89631f 100644
--- a/src/ImageSharp/Formats/Png/PngFormat.cs
+++ b/src/ImageSharp/Formats/Png/PngFormat.cs
@@ -15,7 +15,7 @@ private PngFormat()
///
/// Gets the shared instance.
///
- public static PngFormat Instance { get; } = new PngFormat();
+ public static PngFormat Instance { get; } = new();
///
public string Name => "PNG";
diff --git a/src/ImageSharp/Formats/Png/PngFrameMetadata.cs b/src/ImageSharp/Formats/Png/PngFrameMetadata.cs
index dd642cf6de..b2f993da43 100644
--- a/src/ImageSharp/Formats/Png/PngFrameMetadata.cs
+++ b/src/ImageSharp/Formats/Png/PngFrameMetadata.cs
@@ -53,7 +53,7 @@ private PngFrameMetadata(PngFrameMetadata other)
/// The chunk to create an instance from.
internal void FromChunk(in FrameControl frameControl)
{
- this.FrameDelay = new(frameControl.DelayNumerator, frameControl.DelayDenominator);
+ this.FrameDelay = new Rational(frameControl.DelayNumerator, frameControl.DelayDenominator);
this.DisposalMode = frameControl.DisposalMode;
this.BlendMode = frameControl.BlendMode;
}
@@ -62,7 +62,7 @@ internal void FromChunk(in FrameControl frameControl)
public static PngFrameMetadata FromFormatConnectingFrameMetadata(FormatConnectingFrameMetadata metadata)
=> new()
{
- FrameDelay = new(metadata.Duration.TotalMilliseconds / 1000),
+ FrameDelay = new Rational(metadata.Duration.TotalMilliseconds / 1000),
DisposalMode = GetMode(metadata.DisposalMode),
BlendMode = metadata.BlendMode,
};
@@ -76,7 +76,7 @@ public FormatConnectingFrameMetadata ToFormatConnectingFrameMetadata()
delay = 0;
}
- return new()
+ return new FormatConnectingFrameMetadata
{
ColorTableMode = FrameColorTableMode.Global,
Duration = TimeSpan.FromMilliseconds(delay * 1000),
diff --git a/src/ImageSharp/Formats/Png/PngMetadata.cs b/src/ImageSharp/Formats/Png/PngMetadata.cs
index fcbb93bf0a..3bdbf00add 100644
--- a/src/ImageSharp/Formats/Png/PngMetadata.cs
+++ b/src/ImageSharp/Formats/Png/PngMetadata.cs
@@ -129,7 +129,7 @@ public static PngMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
4 => PngBitDepth.Bit4,
_ => (bpc <= 8) ? PngBitDepth.Bit8 : PngBitDepth.Bit16,
};
- return new()
+ return new PngMetadata
{
ColorType = color,
BitDepth = bitDepth,
@@ -209,7 +209,7 @@ public PixelTypeInfo GetPixelTypeInfo()
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ColorType = colorType,
diff --git a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs
index 820fc0b5cb..33ba58f545 100644
--- a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs
+++ b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs
@@ -133,7 +133,7 @@ public static void ProcessInterlacedGrayscaleWithAlphaScanline(
ushort l = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
ushort a = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2));
- Unsafe.Add(ref rowSpanRef, (uint)x) = TPixel.FromLa32(new(l, a));
+ Unsafe.Add(ref rowSpanRef, (uint)x) = TPixel.FromLa32(new La32(l, a));
}
}
else
@@ -143,7 +143,7 @@ public static void ProcessInterlacedGrayscaleWithAlphaScanline(
{
byte l = Unsafe.Add(ref scanlineSpanRef, offset2);
byte a = Unsafe.Add(ref scanlineSpanRef, offset2 + bytesPerSample);
- Unsafe.Add(ref rowSpanRef, x) = TPixel.FromLa16(new(l, a));
+ Unsafe.Add(ref rowSpanRef, x) = TPixel.FromLa16(new La16(l, a));
offset2 += bytesPerPixel;
}
}
@@ -239,7 +239,7 @@ public static void ProcessInterlacedRgbScanline(
ushort r = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, bytesPerSample));
ushort g = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + bytesPerSample, bytesPerSample));
ushort b = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (2 * bytesPerSample), bytesPerSample));
- Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb48(new(r, g, b));
+ Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb48(new Rgb48(r, g, b));
}
}
else if (pixelOffset == 0 && increment == 1)
@@ -258,7 +258,7 @@ public static void ProcessInterlacedRgbScanline(
byte r = Unsafe.Add(ref scanlineSpanRef, (uint)o);
byte g = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample));
byte b = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample)));
- Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb24(new(r, g, b));
+ Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgb24(new Rgb24(r, g, b));
}
}
@@ -339,7 +339,7 @@ public static void ProcessInterlacedRgbaScanline(
ushort g = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + bytesPerSample, bytesPerSample));
ushort b = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (2 * bytesPerSample), bytesPerSample));
ushort a = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (3 * bytesPerSample), bytesPerSample));
- Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba64(new(r, g, b, a));
+ Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba64(new Rgba64(r, g, b, a));
}
}
else if (pixelOffset == 0 && increment == 1)
@@ -360,7 +360,7 @@ public static void ProcessInterlacedRgbaScanline(
byte g = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample));
byte b = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample)));
byte a = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (3 * bytesPerSample)));
- Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba32(new(r, g, b, a));
+ Unsafe.Add(ref rowSpanRef, x) = TPixel.FromRgba32(new Rgba32(r, g, b, a));
}
}
}
diff --git a/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs b/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs
index 45f79c040f..85fac7ea26 100644
--- a/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs
+++ b/src/ImageSharp/Formats/Qoi/QoiDecoderCore.cs
@@ -68,7 +68,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
qoiMetadata.Channels = this.header.Channels;
qoiMetadata.ColorSpace = this.header.ColorSpace;
- return new(size, metadata);
+ return new ImageInfo(size, metadata);
}
///
@@ -124,7 +124,7 @@ private void ProcessHeader(BufferedReadStream stream)
ThrowInvalidImageContentException();
}
- this.header = new(width, height, (QoiChannels)channels, (QoiColorSpace)colorSpace);
+ this.header = new QoiHeader(width, height, (QoiChannels)channels, (QoiColorSpace)colorSpace);
}
[DoesNotReturn]
diff --git a/src/ImageSharp/Formats/Qoi/QoiFormat.cs b/src/ImageSharp/Formats/Qoi/QoiFormat.cs
index ca2d7ae452..fbee2bc3f4 100644
--- a/src/ImageSharp/Formats/Qoi/QoiFormat.cs
+++ b/src/ImageSharp/Formats/Qoi/QoiFormat.cs
@@ -15,7 +15,7 @@ private QoiFormat()
///
/// Gets the shared instance.
///
- public static QoiFormat Instance { get; } = new QoiFormat();
+ public static QoiFormat Instance { get; } = new();
///
public string DefaultMimeType => "image/qoi";
diff --git a/src/ImageSharp/Formats/Qoi/QoiMetadata.cs b/src/ImageSharp/Formats/Qoi/QoiMetadata.cs
index 8f71ebeee8..e463d511d2 100644
--- a/src/ImageSharp/Formats/Qoi/QoiMetadata.cs
+++ b/src/ImageSharp/Formats/Qoi/QoiMetadata.cs
@@ -44,10 +44,10 @@ public static QoiMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
if (color.HasFlag(PixelColorType.Alpha))
{
- return new() { Channels = QoiChannels.Rgba };
+ return new QoiMetadata { Channels = QoiChannels.Rgba };
}
- return new() { Channels = QoiChannels.Rgb };
+ return new QoiMetadata { Channels = QoiChannels.Rgb };
}
///
@@ -73,7 +73,7 @@ public PixelTypeInfo GetPixelTypeInfo()
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ColorType = colorType,
diff --git a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
index 59977ecbcb..ead157986a 100644
--- a/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
+++ b/src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
@@ -622,7 +622,7 @@ private void ReadRle(BufferedReadStream stream, int width, int height, B
else
{
byte alpha = alphaBits == 0 ? byte.MaxValue : bufferSpan[idx + 3];
- color = TPixel.FromBgra32(new(bufferSpan[idx + 2], bufferSpan[idx + 1], bufferSpan[idx], alpha));
+ color = TPixel.FromBgra32(new Bgra32(bufferSpan[idx + 2], bufferSpan[idx + 1], bufferSpan[idx], alpha));
}
break;
@@ -638,8 +638,8 @@ private void ReadRle(BufferedReadStream stream, int width, int height, B
protected override ImageInfo Identify(BufferedReadStream stream, CancellationToken cancellationToken)
{
this.ReadFileHeader(stream);
- return new(
- new(this.fileHeader.Width, this.fileHeader.Height),
+ return new ImageInfo(
+ new Size(this.fileHeader.Width, this.fileHeader.Height),
this.metadata);
}
@@ -705,7 +705,7 @@ private void ReadBgra32Pixel(BufferedReadStream stream, int x, Span
///
/// Gets the shared instance.
///
- public static TgaFormat Instance { get; } = new TgaFormat();
+ public static TgaFormat Instance { get; } = new();
///
public string Name => "TGA";
diff --git a/src/ImageSharp/Formats/Tga/TgaMetadata.cs b/src/ImageSharp/Formats/Tga/TgaMetadata.cs
index a7be538ec8..8d40f86464 100644
--- a/src/ImageSharp/Formats/Tga/TgaMetadata.cs
+++ b/src/ImageSharp/Formats/Tga/TgaMetadata.cs
@@ -41,10 +41,10 @@ public static TgaMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
int bpp = metadata.PixelTypeInfo.BitsPerPixel;
return bpp switch
{
- <= 8 => new() { BitsPerPixel = TgaBitsPerPixel.Bit8 },
- <= 16 => new() { BitsPerPixel = TgaBitsPerPixel.Bit16 },
- <= 24 => new() { BitsPerPixel = TgaBitsPerPixel.Bit24 },
- _ => new() { BitsPerPixel = TgaBitsPerPixel.Bit32 }
+ <= 8 => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit8 },
+ <= 16 => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit16 },
+ <= 24 => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit24 },
+ _ => new TgaMetadata { BitsPerPixel = TgaBitsPerPixel.Bit32 }
};
}
@@ -79,7 +79,7 @@ public PixelTypeInfo GetPixelTypeInfo()
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
AlphaRepresentation = alpha,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs b/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs
index 1d7de583f7..3debd373c4 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Compressors/DeflateCompressor.cs
@@ -11,7 +11,7 @@ internal sealed class DeflateCompressor : TiffBaseCompressor
{
private readonly DeflateCompressionLevel compressionLevel;
- private readonly MemoryStream memoryStream = new MemoryStream();
+ private readonly MemoryStream memoryStream = new();
public DeflateCompressor(Stream output, MemoryAllocator allocator, int width, int bitsPerPixel, TiffPredictor predictor, DeflateCompressionLevel compressionLevel)
: base(output, allocator, width, bitsPerPixel, predictor)
@@ -29,7 +29,7 @@ public override void Initialize(int rowsPerStrip)
public override void CompressStrip(Span rows, int height)
{
this.memoryStream.Seek(0, SeekOrigin.Begin);
- using (ZlibDeflateStream stream = new ZlibDeflateStream(this.Allocator, this.memoryStream, this.compressionLevel))
+ using (ZlibDeflateStream stream = new(this.Allocator, this.memoryStream, this.compressionLevel))
{
if (this.Predictor == TiffPredictor.Horizontal)
{
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs b/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs
index 7dfb60bad8..a6242114ef 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Compressors/LzwCompressor.cs
@@ -20,7 +20,7 @@ public LzwCompressor(Stream output, MemoryAllocator allocator, int width, int bi
public override TiffCompression Method => TiffCompression.Lzw;
///
- public override void Initialize(int rowsPerStrip) => this.lzwEncoder = new(this.Allocator);
+ public override void Initialize(int rowsPerStrip) => this.lzwEncoder = new TiffLzwEncoder(this.Allocator);
///
public override void CompressStrip(Span rows, int height)
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs b/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs
index a2a83be0a6..1ad69b2c8f 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Compressors/TiffJpegCompressor.cs
@@ -29,7 +29,7 @@ public override void CompressStrip(Span rows, int height)
int pixelCount = rows.Length / 3;
int width = pixelCount / height;
- using MemoryStream memoryStream = new MemoryStream();
+ using MemoryStream memoryStream = new();
Image image = Image.LoadPixelData(rows, width, height);
image.Save(memoryStream, new JpegEncoder()
{
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs
index 39c3928150..4e176f28d7 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/DeflateTiffCompression.cs
@@ -54,7 +54,7 @@ public DeflateTiffCompression(MemoryAllocator memoryAllocator, int width, int bi
protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken)
{
long pos = stream.Position;
- using (ZlibInflateStream deframeStream = new ZlibInflateStream(
+ using (ZlibInflateStream deframeStream = new(
stream,
() =>
{
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs
index cad46e987b..e6895d67cd 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwString.cs
@@ -50,10 +50,10 @@ public LzwString Concatenate(byte other)
{
if (this == Empty)
{
- return new(other);
+ return new LzwString(other);
}
- return new(other, this.FirstChar, this.Length + 1, this);
+ return new LzwString(other, this.FirstChar, this.Length + 1, this);
}
///
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs
index beb22a2bb6..f00c5aa81c 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/LzwTiffCompression.cs
@@ -48,7 +48,7 @@ public LzwTiffCompression(MemoryAllocator memoryAllocator, int width, int bitsPe
///
protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken)
{
- TiffLzwDecoder decoder = new TiffLzwDecoder(stream);
+ TiffLzwDecoder decoder = new(stream);
decoder.DecodePixels(buffer);
if (this.Predictor == TiffPredictor.Horizontal)
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs
index f0ed12c411..ccdf9b0b7d 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/ModifiedHuffmanTiffCompression.cs
@@ -41,7 +41,7 @@ public ModifiedHuffmanTiffCompression(MemoryAllocator allocator, TiffFillOrder f
///
protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken)
{
- ModifiedHuffmanBitReader bitReader = new ModifiedHuffmanBitReader(stream, this.FillOrder, byteCount);
+ ModifiedHuffmanBitReader bitReader = new(stream, this.FillOrder, byteCount);
buffer.Clear();
nint bitsWritten = 0;
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs
index 4d09f7b4e0..d9e49aa754 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T4TiffCompression.cs
@@ -60,7 +60,7 @@ protected override void Decompress(BufferedReadStream stream, int byteCount, int
}
bool eolPadding = this.faxCompressionOptions.HasFlag(FaxCompressionOptions.EolPadding);
- T4BitReader bitReader = new T4BitReader(stream, this.FillOrder, byteCount, eolPadding);
+ T4BitReader bitReader = new(stream, this.FillOrder, byteCount, eolPadding);
buffer.Clear();
nint bitsWritten = 0;
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs
index c0ec49d8e7..2020dce479 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs
@@ -69,7 +69,7 @@ protected override void Decompress(BufferedReadStream stream, int byteCount, int
bitsWritten = this.WriteScanLine(buffer, scanLine, bitsWritten);
scanLine.CopyTo(referenceScanLineSpan);
- referenceScanLine = new(this.isWhiteZero, referenceScanLineSpan);
+ referenceScanLine = new CcittReferenceScanline(this.isWhiteZero, referenceScanLineSpan);
}
}
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs
index 40278dca20..a53e1bc74c 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/TiffLzwDecoder.cs
@@ -103,7 +103,7 @@ public TiffLzwDecoder(Stream stream)
this.table = new LzwString[TableSize];
for (int i = 0; i < 256; i++)
{
- this.table[i] = new((byte)i);
+ this.table[i] = new LzwString((byte)i);
}
this.Init();
diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs
index 5f4ca12bda..c0affc50ac 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/WebpTiffCompression.cs
@@ -32,7 +32,7 @@ public WebpTiffCompression(DecoderOptions options, MemoryAllocator memoryAllocat
///
protected override void Decompress(BufferedReadStream stream, int byteCount, int stripHeight, Span buffer, CancellationToken cancellationToken)
{
- using WebpDecoderCore decoder = new(new() { GeneralOptions = this.options });
+ using WebpDecoderCore decoder = new(new WebpDecoderOptions { GeneralOptions = this.options });
using Image image = decoder.Decode(this.options.Configuration, stream, cancellationToken);
CopyImageBytesToBuffer(buffer, image.Frames.RootFrame.PixelBuffer);
}
diff --git a/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs b/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs
index ebf4042e2b..706e6a38c1 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/HorizontalPredictor.cs
@@ -222,7 +222,7 @@ private static void ApplyHorizontalPrediction24Bit(Span rows, int width)
byte r = (byte)(rowRgb[x].R - rowRgb[x - 1].R);
byte g = (byte)(rowRgb[x].G - rowRgb[x - 1].G);
byte b = (byte)(rowRgb[x].B - rowRgb[x - 1].B);
- rowRgb[x] = new(r, g, b);
+ rowRgb[x] = new Rgb24(r, g, b);
}
}
}
@@ -429,7 +429,7 @@ private static void UndoRgb24BitRow(Span pixelBytes, int width, int y)
r += pixel.R;
g += pixel.G;
b += pixel.B;
- pixel = new(r, g, b);
+ pixel = new Rgb24(r, g, b);
}
}
@@ -462,7 +462,7 @@ private static void UndoRgba32BitRow(Span pixelBytes, int width, int y)
g += pixel.G;
b += pixel.B;
a += pixel.A;
- pixel = new(r, g, b, a);
+ pixel = new Rgba32(r, g, b, a);
}
}
diff --git a/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs b/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs
index 0bc2e73434..aa207e2b60 100644
--- a/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs
+++ b/src/ImageSharp/Formats/Tiff/Compression/TiffDecompressorsFactory.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors;
using SixLabors.ImageSharp.Formats.Tiff.Constants;
using SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation;
@@ -64,11 +65,11 @@ public static TiffBaseDecompressor Create(
case TiffDecoderCompressionType.Jpeg:
DebugGuard.IsTrue(predictor == TiffPredictor.None, "Predictor should only be used with lzw or deflate compression");
- return new JpegTiffCompression(new() { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, jpegTables, photometricInterpretation);
+ return new JpegTiffCompression(new JpegDecoderOptions { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, jpegTables, photometricInterpretation);
case TiffDecoderCompressionType.OldJpeg:
DebugGuard.IsTrue(predictor == TiffPredictor.None, "Predictor should only be used with lzw or deflate compression");
- return new OldJpegTiffCompression(new() { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, oldJpegStartOfImageMarker, photometricInterpretation);
+ return new OldJpegTiffCompression(new JpegDecoderOptions { GeneralOptions = options }, allocator, width, bitsPerPixel, metadata, oldJpegStartOfImageMarker, photometricInterpretation);
case TiffDecoderCompressionType.Webp:
DebugGuard.IsTrue(predictor == TiffPredictor.None, "Predictor should only be used with lzw or deflate compression");
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs
index 2ef261811b..d818aef1b0 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero16TiffColor{TPixel}.cs
@@ -47,7 +47,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
ushort intensity = TiffUtilities.ConvertToUShortBigEndian(data.Slice(offset, 2));
offset += 2;
- pixelRow[x] = TPixel.FromL16(new(intensity));
+ pixelRow[x] = TPixel.FromL16(new L16(intensity));
}
}
else
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs
index b30700adb3..ac316459d8 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero32FloatTiffColor{TPixel}.cs
@@ -40,7 +40,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float intensity = BitConverter.ToSingle(buffer);
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f));
}
}
else
@@ -50,7 +50,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float intensity = BitConverter.ToSingle(data.Slice(offset, 4));
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero4TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero4TiffColor{TPixel}.cs
index 1d33f1a248..41b2bde1b6 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero4TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero4TiffColor{TPixel}.cs
@@ -25,14 +25,14 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
for (int x = left; x < left + width - 1;)
{
byte byteData = data[offset++];
- pixelRowSpan[x++] = TPixel.FromL8(new((byte)(((byteData & 0xF0) >> 4) * 17)));
- pixelRowSpan[x++] = TPixel.FromL8(new((byte)((byteData & 0x0F) * 17)));
+ pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)(((byteData & 0xF0) >> 4) * 17)));
+ pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)((byteData & 0x0F) * 17)));
}
if (isOddWidth)
{
byte byteData = data[offset++];
- pixelRowSpan[left + width - 1] = TPixel.FromL8(new((byte)(((byteData & 0xF0) >> 4) * 17)));
+ pixelRowSpan[left + width - 1] = TPixel.FromL8(new L8((byte)(((byteData & 0xF0) >> 4) * 17)));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs
index 709c2bf649..7428ef0577 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor{TPixel}.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using System.Numerics;
using SixLabors.ImageSharp.Formats.Tiff.Utils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -35,7 +36,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
{
int value = bitReader.ReadBits(this.bitsPerSample0);
float intensity = value / this.factor;
- pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f));
}
bitReader.NextRow();
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs
index d6fc7c4870..d23d1e2909 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabPlanarTiffColor{TPixel}.cs
@@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License.
using System.Buffers;
+using System.Numerics;
using SixLabors.ImageSharp.ColorProfiles;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -34,7 +35,7 @@ public override void Decode(IMemoryOwner[] data, Buffer2D pixels,
{
CieLab lab = new((l[offset] & 0xFF) * 100f * Inv255, (sbyte)a[offset], (sbyte)b[offset]);
Rgb rgb = ColorProfileConverter.Convert(in lab);
- pixelRow[x] = TPixel.FromScaledVector4(new(rgb.R, rgb.G, rgb.B, 1.0f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(rgb.R, rgb.G, rgb.B, 1.0f));
offset++;
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs
index b0236022b3..b10d27ccda 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CieLabTiffColor{TPixel}.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using System.Numerics;
using SixLabors.ImageSharp.ColorProfiles;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -30,7 +31,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float l = (data[offset] & 0xFF) * 100f * Inv255;
CieLab lab = new(l, (sbyte)data[offset + 1], (sbyte)data[offset + 2]);
Rgb rgb = ColorProfileConverter.Convert(in lab);
- pixelRow[x] = TPixel.FromScaledVector4(new(rgb.R, rgb.G, rgb.B, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(rgb.R, rgb.G, rgb.B, 1f));
offset += 3;
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs
index 86e5841935..2e22fcde03 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/CmykTiffColor{TPixel}.cs
@@ -31,7 +31,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
Span pixelRow = pixels.DangerousGetRowSpan(y).Slice(left, width);
for (int x = 0; x < pixelRow.Length; x++)
{
- pixelRow[x] = TPixel.FromVector4(new(data[offset] * Inv255, data[offset + 1] * Inv255, data[offset + 2] * Inv255, 1.0f));
+ pixelRow[x] = TPixel.FromVector4(new Vector4(data[offset] * Inv255, data[offset + 1] * Inv255, data[offset + 2] * Inv255, 1.0f));
offset += 3;
}
@@ -47,7 +47,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
{
Cmyk cmyk = new(data[offset] * Inv255, data[offset + 1] * Inv255, data[offset + 2] * Inv255, data[offset + 3] * Inv255);
Rgb rgb = ColorProfileConverter.Convert(in cmyk);
- pixelRow[x] = TPixel.FromScaledVector4(new(rgb.R, rgb.G, rgb.B, 1.0f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(rgb.R, rgb.G, rgb.B, 1.0f));
offset += 4;
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs
index 745e5846a9..69113cf937 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/PaletteTiffColor{TPixel}.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using System.Numerics;
using SixLabors.ImageSharp.Formats.Tiff.Utils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -63,7 +64,7 @@ private static TPixel[] GeneratePalette(ushort[] colorMap, int colorCount)
float r = colorMap[rOffset + i] * InvMax;
float g = colorMap[gOffset + i] * InvMax;
float b = colorMap[bOffset + i] * InvMax;
- palette[i] = TPixel.FromScaledVector4(new(r, g, b, 1f));
+ palette[i] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f));
}
return palette;
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs
index d8520e307e..c1420b4f4f 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb161616TiffColor{TPixel}.cs
@@ -48,7 +48,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
ushort b = TiffUtilities.ConvertToUShortBigEndian(data.Slice(offset, 2));
offset += 2;
- pixelRow[x] = TPixel.FromRgb48(new(r, g, b));
+ pixelRow[x] = TPixel.FromRgb48(new Rgb48(r, g, b));
}
}
else
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs
index f55d7225e0..84efb90212 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgb16PlanarTiffColor{TPixel}.cs
@@ -44,7 +44,7 @@ public override void Decode(IMemoryOwner[] data, Buffer2D pixels,
offset += 2;
- pixelRow[x] = TPixel.FromRgb48(new(r, g, b));
+ pixelRow[x] = TPixel.FromRgb48(new Rgb48(r, g, b));
}
}
else
@@ -57,7 +57,7 @@ public override void Decode(IMemoryOwner[] data, Buffer2D pixels,
offset += 2;
- pixelRow[x] = TPixel.FromRgb48(new(r, g, b));
+ pixelRow[x] = TPixel.FromRgb48(new Rgb48(r, g, b));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs
index 37605ef804..f9c17eb2f5 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbFloat323232TiffColor{TPixel}.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -50,7 +51,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float b = BitConverter.ToSingle(buffer);
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f));
}
}
else
@@ -66,7 +67,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float b = BitConverter.ToSingle(data.Slice(offset, 4));
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs
index 844b08d3c0..a013abfbdb 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbPlanarTiffColor{TPixel}.cs
@@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License.
using System.Buffers;
+using System.Numerics;
using SixLabors.ImageSharp.Formats.Tiff.Utils;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -62,7 +63,7 @@ public override void Decode(IMemoryOwner[] data, Buffer2D pixels,
float g = gBitReader.ReadBits(this.bitsPerSampleG) / this.gFactor;
float b = bBitReader.ReadBits(this.bitsPerSampleB) / this.bFactor;
- pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f));
}
rBitReader.NextRow();
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs
index 2b85c2fd6f..3c205d1476 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbTiffColor{TPixel}.cs
@@ -52,7 +52,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float g = bitReader.ReadBits(this.bitsPerSampleG) / this.gFactor;
float b = bitReader.ReadBits(this.bitsPerSampleB) / this.bFactor;
- pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, 1f));
}
bitReader.NextRow();
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs
index e4965887d6..9847f45b54 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16161616TiffColor{TPixel}.cs
@@ -67,7 +67,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
pixelRow[x] = hasAssociatedAlpha
? TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a)
- : TPixel.FromRgba64(new(r, g, b, a));
+ : TPixel.FromRgba64(new Rgba64(r, g, b, a));
}
}
else
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs
index 3d36db17de..12357adc10 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/Rgba16PlanarTiffColor{TPixel}.cs
@@ -56,7 +56,7 @@ public override void Decode(IMemoryOwner[] data, Buffer2D pixels,
pixelRow[x] = hasAssociatedAlpha
? TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a)
- : TPixel.FromRgba64(new(r, g, b, a));
+ : TPixel.FromRgba64(new Rgba64(r, g, b, a));
}
}
else
@@ -72,7 +72,7 @@ public override void Decode(IMemoryOwner[] data, Buffer2D pixels,
pixelRow[x] = hasAssociatedAlpha
? TiffUtilities.ColorFromRgba64Premultiplied(r, g, b, a)
- : TPixel.FromRgba64(new(r, g, b, a));
+ : TPixel.FromRgba64(new Rgba64(r, g, b, a));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs
index 12f1b75b40..87a0196413 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/RgbaFloat32323232TiffColor{TPixel}.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
@@ -55,7 +56,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float a = BitConverter.ToSingle(buffer);
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, a));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, a));
}
}
else
@@ -74,7 +75,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float a = BitConverter.ToSingle(data.Slice(offset, 4));
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(r, g, b, a));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(r, g, b, a));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs
index 6f1672e1b9..d70873634e 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero16TiffColor{TPixel}.cs
@@ -36,7 +36,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
ushort intensity = (ushort)(ushort.MaxValue - TiffUtilities.ConvertToUShortBigEndian(data.Slice(offset, 2)));
offset += 2;
- pixelRow[x] = TPixel.FromL16(new(intensity));
+ pixelRow[x] = TPixel.FromL16(new L16(intensity));
}
}
else
@@ -46,7 +46,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
ushort intensity = (ushort)(ushort.MaxValue - TiffUtilities.ConvertToUShortLittleEndian(data.Slice(offset, 2)));
offset += 2;
- pixelRow[x] = TPixel.FromL16(new(intensity));
+ pixelRow[x] = TPixel.FromL16(new L16(intensity));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs
index 0db555cbbd..6986f25ebd 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs
@@ -40,7 +40,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float intensity = 1.0f - BitConverter.ToSingle(buffer);
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f));
}
}
else
@@ -50,7 +50,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
float intensity = 1.0f - BitConverter.ToSingle(data.Slice(offset, 4));
offset += 4;
- pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1.0f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1.0f));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor{TPixel}.cs
index 7dcbe23c5f..09faafc636 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero4TiffColor{TPixel}.cs
@@ -25,14 +25,14 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
for (int x = left; x < left + width - 1;)
{
byte byteData = data[offset++];
- pixelRowSpan[x++] = TPixel.FromL8(new((byte)((15 - ((byteData & 0xF0) >> 4)) * 17)));
- pixelRowSpan[x++] = TPixel.FromL8(new((byte)((15 - (byteData & 0x0F)) * 17)));
+ pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)((15 - ((byteData & 0xF0) >> 4)) * 17)));
+ pixelRowSpan[x++] = TPixel.FromL8(new L8((byte)((15 - (byteData & 0x0F)) * 17)));
}
if (isOddWidth)
{
byte byteData = data[offset++];
- pixelRowSpan[left + width - 1] = TPixel.FromL8(new((byte)((15 - ((byteData & 0xF0) >> 4)) * 17)));
+ pixelRowSpan[left + width - 1] = TPixel.FromL8(new L8((byte)((15 - ((byteData & 0xF0) >> 4)) * 17)));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs
index 5429dbd3b0..ae0dcb753e 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs
@@ -23,7 +23,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
for (int x = 0; x < pixelRow.Length; x++)
{
byte intensity = (byte)(byte.MaxValue - data[offset++]);
- pixelRow[x] = TPixel.FromL8(new(intensity));
+ pixelRow[x] = TPixel.FromL8(new L8(intensity));
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs
index 06212eff3f..0cd01a6199 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor{TPixel}.cs
@@ -36,7 +36,7 @@ public override void Decode(ReadOnlySpan data, Buffer2D pixels, in
{
int value = bitReader.ReadBits(this.bitsPerSample0);
float intensity = 1f - (value / this.factor);
- pixelRow[x] = TPixel.FromScaledVector4(new(intensity, intensity, intensity, 1f));
+ pixelRow[x] = TPixel.FromScaledVector4(new Vector4(intensity, intensity, intensity, 1f));
}
bitReader.NextRow();
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs
index 754cbd0059..d41749be66 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrConverter.cs
@@ -45,10 +45,10 @@ public YCbCrConverter(Rational[] referenceBlackAndWhite, Rational[] coefficients
TiffThrowHelper.ThrowImageFormatException("luma coefficients array should have 6 entry's");
}
- this.yExpander = new(referenceBlackAndWhite[0], referenceBlackAndWhite[1], 255);
- this.cbExpander = new(referenceBlackAndWhite[2], referenceBlackAndWhite[3], 127);
- this.crExpander = new(referenceBlackAndWhite[4], referenceBlackAndWhite[5], 127);
- this.converter = new(coefficients[0], coefficients[1], coefficients[2]);
+ this.yExpander = new CodingRangeExpander(referenceBlackAndWhite[0], referenceBlackAndWhite[1], 255);
+ this.cbExpander = new CodingRangeExpander(referenceBlackAndWhite[2], referenceBlackAndWhite[3], 127);
+ this.crExpander = new CodingRangeExpander(referenceBlackAndWhite[4], referenceBlackAndWhite[5], 127);
+ this.converter = new YCbCrToRgbConverter(coefficients[0], coefficients[1], coefficients[2]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs
index ebae824303..768177bfc0 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrPlanarTiffColor{TPixel}.cs
@@ -20,7 +20,7 @@ internal class YCbCrPlanarTiffColor : TiffBasePlanarColorDecoder
public YCbCrPlanarTiffColor(Rational[] referenceBlackAndWhite, Rational[] coefficients, ushort[] ycbcrSubSampling)
{
- this.converter = new(referenceBlackAndWhite, coefficients);
+ this.converter = new YCbCrConverter(referenceBlackAndWhite, coefficients);
this.ycbcrSubSampling = ycbcrSubSampling;
}
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs
index 3bf550fe55..5a13890356 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/YCbCrTiffColor{TPixel}.cs
@@ -24,7 +24,7 @@ internal class YCbCrTiffColor : TiffBaseColorDecoder
public YCbCrTiffColor(MemoryAllocator memoryAllocator, Rational[] referenceBlackAndWhite, Rational[] coefficients, ushort[] ycbcrSubSampling)
{
this.memoryAllocator = memoryAllocator;
- this.converter = new(referenceBlackAndWhite, coefficients);
+ this.converter = new YCbCrConverter(referenceBlackAndWhite, coefficients);
this.ycbcrSubSampling = ycbcrSubSampling;
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs b/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs
index e9b620ea29..2bfd9a626f 100644
--- a/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffBitsPerSample.cs
@@ -120,7 +120,7 @@ public static bool TryParse(ushort[]? value, out TiffBitsPerSample sample)
break;
}
- sample = new(c0, c1, c2, c3);
+ sample = new TiffBitsPerSample(c0, c1, c2, c3);
return true;
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
index 73f66a062a..fbff352970 100644
--- a/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
@@ -191,7 +191,7 @@ protected override Image Decode(BufferedReadStream stream, Cance
this.Dimensions = frames[0].Size;
ImageMetadata metadata = TiffDecoderMetadataCreator.Create(framesMetadata, this.skipMetadata, reader.ByteOrder, reader.IsBigTiff);
- return new(this.configuration, metadata, frames);
+ return new Image(this.configuration, metadata, frames);
}
catch
{
@@ -228,7 +228,7 @@ protected override ImageInfo Identify(BufferedReadStream stream, CancellationTok
ImageMetadata metadata = TiffDecoderMetadataCreator.Create(framesMetadata, this.skipMetadata, reader.ByteOrder, reader.IsBigTiff);
- return new(new(width, height), metadata, framesMetadata);
+ return new ImageInfo(new Size(width, height), metadata, framesMetadata);
}
///
@@ -285,7 +285,7 @@ private ImageFrame DecodeFrame(ExifProfile tags, Size? size, Can
// We resolve the ICC profile early so that we can use it for color conversion if needed.
if (tags.TryGetValue(ExifTag.IccProfile, out IExifValue iccProfileBytes))
{
- imageFrameMetaData.IccProfile = new(iccProfileBytes.Value);
+ imageFrameMetaData.IccProfile = new IccProfile(iccProfileBytes.Value);
}
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs
index db27854a17..ebf407f9b5 100644
--- a/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffDecoderMetadataCreator.cs
@@ -33,12 +33,12 @@ public static ImageMetadata Create(List frames, bool ignoreM
ImageFrameMetadata frameMetaData = frames[i];
if (TryGetIptc(frameMetaData.ExifProfile.Values, out byte[] iptcBytes))
{
- frameMetaData.IptcProfile = new(iptcBytes);
+ frameMetaData.IptcProfile = new IptcProfile(iptcBytes);
}
if (frameMetaData.ExifProfile.TryGetValue(ExifTag.XMP, out IExifValue xmpProfileBytes))
{
- frameMetaData.XmpProfile = new(xmpProfileBytes.Value);
+ frameMetaData.XmpProfile = new XmpProfile(xmpProfileBytes.Value);
}
}
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs b/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs
index 9583994543..7519871b74 100644
--- a/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs
@@ -531,7 +531,7 @@ private static void ParseCompression(this TiffDecoderCore options, TiffCompressi
// Some encoders do not set the BitsPerSample correctly, so we set those values here to the required values:
// https://github.com/SixLabors/ImageSharp/issues/2587
- options.BitsPerSample = new(1, 0, 0);
+ options.BitsPerSample = new TiffBitsPerSample(1, 0, 0);
options.BitsPerPixel = 1;
break;
@@ -549,7 +549,7 @@ private static void ParseCompression(this TiffDecoderCore options, TiffCompressi
options.FaxCompressionOptions = FaxCompressionOptions.None;
}
- options.BitsPerSample = new(1, 0, 0);
+ options.BitsPerSample = new TiffBitsPerSample(1, 0, 0);
options.BitsPerPixel = 1;
break;
@@ -557,7 +557,7 @@ private static void ParseCompression(this TiffDecoderCore options, TiffCompressi
case TiffCompression.Ccitt1D:
options.CompressionType = TiffDecoderCompressionType.HuffmanRle;
- options.BitsPerSample = new(1, 0, 0);
+ options.BitsPerSample = new TiffBitsPerSample(1, 0, 0);
options.BitsPerPixel = 1;
break;
diff --git a/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs b/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs
index 8890c61a59..eeb4afebfe 100644
--- a/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffEncoderEntriesCollector.cs
@@ -298,12 +298,12 @@ private void ProcessResolution(ImageMetadata imageMetadata)
{
this.Collector.AddOrReplace(new ExifRational(ExifTagValue.XResolution)
{
- Value = new(resolution.HorizontalResolution.Value)
+ Value = new Rational(resolution.HorizontalResolution.Value)
});
this.Collector.AddOrReplace(new ExifRational(ExifTagValue.YResolution)
{
- Value = new(resolution.VerticalResolution.Value)
+ Value = new Rational(resolution.VerticalResolution.Value)
});
}
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffFormat.cs b/src/ImageSharp/Formats/Tiff/TiffFormat.cs
index 76a06d013d..eb052d1bf2 100644
--- a/src/ImageSharp/Formats/Tiff/TiffFormat.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffFormat.cs
@@ -17,7 +17,7 @@ private TiffFormat()
///
/// Gets the shared instance.
///
- public static TiffFormat Instance { get; } = new TiffFormat();
+ public static TiffFormat Instance { get; } = new();
///
public string Name => "TIFF";
@@ -32,8 +32,8 @@ private TiffFormat()
public IEnumerable FileExtensions => TiffConstants.FileExtensions;
///
- public TiffMetadata CreateDefaultFormatMetadata() => new TiffMetadata();
+ public TiffMetadata CreateDefaultFormatMetadata() => new();
///
- public TiffFrameMetadata CreateDefaultFormatFrameMetadata() => new TiffFrameMetadata();
+ public TiffFrameMetadata CreateDefaultFormatFrameMetadata() => new();
}
diff --git a/src/ImageSharp/Formats/Tiff/TiffMetadata.cs b/src/ImageSharp/Formats/Tiff/TiffMetadata.cs
index 7d20564694..e965fcb4f6 100644
--- a/src/ImageSharp/Formats/Tiff/TiffMetadata.cs
+++ b/src/ImageSharp/Formats/Tiff/TiffMetadata.cs
@@ -75,7 +75,7 @@ public static TiffMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
int bpp = metadata.PixelTypeInfo.BitsPerPixel;
return bpp switch
{
- 1 => new()
+ 1 => new TiffMetadata
{
BitsPerPixel = TiffBitsPerPixel.Bit1,
BitsPerSample = TiffConstants.BitsPerSample1Bit,
@@ -83,7 +83,7 @@ public static TiffMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
Compression = TiffCompression.CcittGroup4Fax,
Predictor = TiffPredictor.None
},
- <= 4 => new()
+ <= 4 => new TiffMetadata
{
BitsPerPixel = TiffBitsPerPixel.Bit4,
BitsPerSample = TiffConstants.BitsPerSample4Bit,
@@ -91,7 +91,7 @@ public static TiffMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
Compression = TiffCompression.Deflate,
Predictor = TiffPredictor.None // Best match for low bit depth
},
- 8 => new()
+ 8 => new TiffMetadata
{
BitsPerPixel = TiffBitsPerPixel.Bit8,
BitsPerSample = TiffConstants.BitsPerSample8Bit,
@@ -99,7 +99,7 @@ public static TiffMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
Compression = TiffCompression.Deflate,
Predictor = TiffPredictor.Horizontal
},
- 16 => new()
+ 16 => new TiffMetadata
{
BitsPerPixel = TiffBitsPerPixel.Bit16,
BitsPerSample = TiffConstants.BitsPerSample16Bit,
@@ -107,7 +107,7 @@ public static TiffMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
Compression = TiffCompression.Deflate,
Predictor = TiffPredictor.Horizontal
},
- 32 or 64 => new()
+ 32 or 64 => new TiffMetadata
{
BitsPerPixel = TiffBitsPerPixel.Bit32,
BitsPerSample = TiffConstants.BitsPerSampleRgb8Bit,
@@ -115,7 +115,7 @@ public static TiffMetadata FromFormatConnectingMetadata(FormatConnectingMetadata
Compression = TiffCompression.Deflate,
Predictor = TiffPredictor.Horizontal
},
- _ => new()
+ _ => new TiffMetadata
{
BitsPerPixel = TiffBitsPerPixel.Bit24,
BitsPerSample = TiffConstants.BitsPerSampleRgb8Bit,
@@ -165,7 +165,7 @@ public PixelTypeInfo GetPixelTypeInfo()
break;
}
- return new(bpp)
+ return new PixelTypeInfo(bpp)
{
ColorType = colorType,
ComponentInfo = info,
diff --git a/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs b/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs
index 8b5e04f276..e30765b1f4 100644
--- a/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs
+++ b/src/ImageSharp/Formats/Tiff/Utils/TiffUtilities.cs
@@ -45,7 +45,7 @@ public static TPixel ColorFromRgba64Premultiplied(ushort r, ushort g, us
return TPixel.FromRgba64(default);
}
- return TPixel.FromRgba64(new((ushort)(r / a), (ushort)(g / a), (ushort)(b / a), a));
+ return TPixel.FromRgba64(new Rgba64((ushort)(r / a), (ushort)(g / a), (ushort)(b / a), a));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs b/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs
index 8ede732793..647ff8a1a3 100644
--- a/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/Writers/TiffBiColorWriter{TPixel}.cs
@@ -30,7 +30,7 @@ public TiffBiColorWriter(
: base(image, encodingSize, memoryAllocator, configuration, entriesCollector)
{
// Convert image to black and white.
- this.imageBlackWhite = new(configuration, new(), [image.Clone()]);
+ this.imageBlackWhite = new Image(configuration, new ImageMetadata(), [image.Clone()]);
this.imageBlackWhite.Mutate(img => img.BinaryDither(KnownDitherings.FloydSteinberg));
}
diff --git a/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs b/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs
index a6106ae855..ebf75efe8b 100644
--- a/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/Writers/TiffPaletteWriter{TPixel}.cs
@@ -44,13 +44,13 @@ public TiffPaletteWriter(
this.colorPaletteBytes = this.colorPaletteSize * 2;
using IQuantizer frameQuantizer = quantizer.CreatePixelSpecificQuantizer(
this.Configuration,
- new()
+ new QuantizerOptions
{
MaxColors = this.maxColors
});
frameQuantizer.BuildPalette(pixelSamplingStrategy, frame);
- this.quantizedFrame = frameQuantizer.QuantizeFrame(frame, new(Point.Empty, encodingSize));
+ this.quantizedFrame = frameQuantizer.QuantizeFrame(frame, new Rectangle(Point.Empty, encodingSize));
this.AddColorMapTag();
}
diff --git a/src/ImageSharp/Formats/Webp/AlphaDecoder.cs b/src/ImageSharp/Formats/Webp/AlphaDecoder.cs
index f374daba4f..accfea948e 100644
--- a/src/ImageSharp/Formats/Webp/AlphaDecoder.cs
+++ b/src/ImageSharp/Formats/Webp/AlphaDecoder.cs
@@ -56,12 +56,12 @@ public AlphaDecoder(int width, int height, IMemoryOwner data, byte alphaCh
this.Alpha = memoryAllocator.Allocate(totalPixels);
this.AlphaFilterType = (WebpAlphaFilterType)filter;
- this.Vp8LDec = new(width, height, memoryAllocator);
+ this.Vp8LDec = new Vp8LDecoder(width, height, memoryAllocator);
if (this.Compressed)
{
Vp8LBitReader bitReader = new(data);
- this.LosslessDecoder = new(bitReader, memoryAllocator, configuration);
+ this.LosslessDecoder = new WebpLosslessDecoder(bitReader, memoryAllocator, configuration);
this.LosslessDecoder.DecodeImageStream(this.Vp8LDec, width, height, true);
// Special case: if alpha data uses only the color indexing transform and
diff --git a/src/ImageSharp/Formats/Webp/AlphaEncoder.cs b/src/ImageSharp/Formats/Webp/AlphaEncoder.cs
index 56587da187..fd6f508e4a 100644
--- a/src/ImageSharp/Formats/Webp/AlphaEncoder.cs
+++ b/src/ImageSharp/Formats/Webp/AlphaEncoder.cs
@@ -92,7 +92,7 @@ private static ImageFrame DispatchAlphaToGreen(Configuration con
for (int x = 0; x < width; x++)
{
// Leave A/R/B channels zero'd.
- pixelRow[x] = new(0, alphaRow[x], 0, 0);
+ pixelRow[x] = new Bgra32(0, alphaRow[x], 0, 0);
}
}
diff --git a/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs b/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs
index 505f54312f..e9f50fb493 100644
--- a/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs
+++ b/src/ImageSharp/Formats/Webp/BitWriter/Vp8BitWriter.cs
@@ -399,7 +399,7 @@ public override void WriteEncodedImageToStream(Stream stream)
int mbSize = this.enc.Mbw * this.enc.Mbh;
int expectedSize = (int)((uint)mbSize * 7 / 8);
- Vp8BitWriter bitWriterPartZero = new Vp8BitWriter(expectedSize, this.enc);
+ Vp8BitWriter bitWriterPartZero = new(expectedSize, this.enc);
// Partition #0 with header and partition sizes.
uint size0 = bitWriterPartZero.GeneratePartition0();
@@ -545,7 +545,7 @@ private void WriteProbas()
// Writes the partition #0 modes (that is: all intra modes)
private void CodeIntraModes()
{
- Vp8EncIterator it = new Vp8EncIterator(this.enc);
+ Vp8EncIterator it = new(this.enc);
int predsWidth = this.enc.PredsWidth;
do
diff --git a/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs b/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs
index 0b71a3ed0c..dc867fa85e 100644
--- a/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs
+++ b/src/ImageSharp/Formats/Webp/BitWriter/Vp8LBitWriter.cs
@@ -102,7 +102,7 @@ public Vp8LBitWriter Clone()
{
byte[] clonedBuffer = new byte[this.Buffer.Length];
System.Buffer.BlockCopy(this.Buffer, 0, clonedBuffer, 0, this.cur);
- return new(clonedBuffer, this.bits, this.used, this.cur);
+ return new Vp8LBitWriter(clonedBuffer, this.bits, this.used, this.cur);
}
///
diff --git a/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs b/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs
index 66662569c3..7d22f7f2b3 100644
--- a/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs
+++ b/src/ImageSharp/Formats/Webp/Chunks/WebpFrameData.cs
@@ -124,7 +124,7 @@ public static WebpFrameData Parse(Stream stream)
{
Span buffer = stackalloc byte[4];
- return new(
+ return new WebpFrameData(
dataSize: WebpChunkParsingUtils.ReadChunkSize(stream, buffer),
x: WebpChunkParsingUtils.ReadUInt24LittleEndian(stream, buffer) * 2,
y: WebpChunkParsingUtils.ReadUInt24LittleEndian(stream, buffer) * 2,
diff --git a/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs
index bac6d5167c..274d4426f9 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/BackwardReferenceEncoder.cs
@@ -72,7 +72,7 @@ public static Vp8LBackwardRefs GetBackwardReferences(
BackwardReferencesLz77(width, height, bgra, 0, hashChain, worst);
break;
case Vp8LLz77Type.Lz77Box:
- hashChainBox = new(memoryAllocator, width * height);
+ hashChainBox = new Vp8LHashChain(memoryAllocator, width * height);
BackwardReferencesLz77Box(width, height, bgra, 0, hashChain, hashChainBox, worst);
break;
}
@@ -145,7 +145,7 @@ private static int CalculateBestCacheSize(
for (int i = 0; i < colorCache.Length; i++)
{
histos[i].PaletteCodeBits = i;
- colorCache[i] = new(i);
+ colorCache[i] = new ColorCache(i);
}
// Find the cacheBits giving the lowest entropy.
@@ -281,7 +281,7 @@ private static void BackwardReferencesHashChainDistanceOnly(
if (useColorCache)
{
- colorCache = new(cacheBits);
+ colorCache = new ColorCache(cacheBits);
}
costModel.Build(xSize, cacheBits, refs);
@@ -383,7 +383,7 @@ private static void BackwardReferencesHashChainFollowChosenPath(ReadOnlySpan distArr
{
int costCacheSize = pixCount > BackwardReferenceEncoder.MaxLength ? BackwardReferenceEncoder.MaxLength : pixCount;
- this.CacheIntervals = new();
- this.CostCache = new();
+ this.CacheIntervals = new List();
+ this.CostCache = new List();
this.Costs = memoryAllocator.Allocate(pixCount);
this.DistArray = distArray;
this.Count = 0;
for (int i = 0; i < FreeIntervalsStartCount; i++)
{
- this.freeIntervals.Push(new());
+ this.freeIntervals.Push(new CostInterval());
}
// Fill in the cost cache.
@@ -62,7 +62,7 @@ public CostManager(MemoryAllocator memoryAllocator, IMemoryOwner distArr
double costVal = this.CostCache[i];
if (costVal != cur.Cost)
{
- cur = new()
+ cur = new CostCacheInterval
{
Start = i,
Cost = costVal
@@ -258,7 +258,7 @@ private void InsertInterval(CostInterval? intervalIn, float cost, int position,
}
else
{
- intervalNew = new() { Cost = cost, Start = start, End = end, Index = position };
+ intervalNew = new CostInterval { Cost = cost, Start = start, End = end, Index = position };
}
this.PositionOrphanInterval(intervalNew, intervalIn);
diff --git a/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs b/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs
index 7488f03ca4..58394c212f 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/CrunchConfig.cs
@@ -7,5 +7,5 @@ internal class CrunchConfig
{
public EntropyIx EntropyIdx { get; set; }
- public List SubConfigs { get; } = new List();
+ public List SubConfigs { get; } = new();
}
diff --git a/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs b/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs
index 1375218da9..5806ee5b5c 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/HTreeGroup.cs
@@ -15,7 +15,7 @@ internal struct HTreeGroup
{
public HTreeGroup(uint packedTableSize)
{
- this.HTrees = new(WebpConstants.HuffmanCodesPerMetaCode);
+ this.HTrees = new List(WebpConstants.HuffmanCodesPerMetaCode);
this.PackedTable = new HuffmanCode[packedTableSize];
this.IsTrivialCode = false;
this.IsTrivialLiteral = false;
diff --git a/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs b/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs
index fd5d1dd940..027d4f7ee9 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/HuffmanUtils.cs
@@ -425,7 +425,7 @@ public static int BuildHuffmanTable(Span table, int rootBits, int[]
tableSize = 1 << tableBits;
totalSize += tableSize;
low = key & mask;
- table[low] = new()
+ table[low] = new HuffmanCode
{
BitsUsed = tableBits + rootBits,
Value = (uint)(tablePos - low)
diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs
index c22abd83e2..374465cf79 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LDecoder.cs
@@ -22,7 +22,7 @@ public Vp8LDecoder(int width, int height, MemoryAllocator memoryAllocator)
{
this.Width = width;
this.Height = height;
- this.Metadata = new();
+ this.Metadata = new Vp8LMetadata();
this.Pixels = memoryAllocator.Allocate(width * height, AllocationOptions.Clean);
}
diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs
index 2cbe4bbb61..b398554eb1 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs
@@ -124,16 +124,16 @@ public Vp8LEncoder(
this.transparentColorMode = transparentColorMode;
this.nearLossless = nearLossless;
this.nearLosslessQuality = Numerics.Clamp(nearLosslessQuality, 0, 100);
- this.bitWriter = new(initialSize);
+ this.bitWriter = new Vp8LBitWriter(initialSize);
this.Bgra = memoryAllocator.Allocate(pixelCount);
this.EncodedData = memoryAllocator.Allocate(pixelCount);
this.Palette = memoryAllocator.Allocate(WebpConstants.MaxPaletteSize);
this.Refs = new Vp8LBackwardRefs[3];
- this.HashChain = new(memoryAllocator, pixelCount);
+ this.HashChain = new Vp8LHashChain(memoryAllocator, pixelCount);
for (int i = 0; i < this.Refs.Length; i++)
{
- this.Refs[i] = new(memoryAllocator, pixelCount);
+ this.Refs[i] = new Vp8LBackwardRefs(memoryAllocator, pixelCount);
}
}
@@ -549,14 +549,14 @@ private CrunchConfig[] EncoderAnalyze(ReadOnlySpan bgra, int width, int he
// We can only apply kPalette or kPaletteAndSpatial if we can indeed use a palette.
if ((entropyIx != EntropyIx.Palette && entropyIx != EntropyIx.PaletteAndSpatial) || usePalette)
{
- crunchConfigs.Add(new() { EntropyIdx = entropyIx });
+ crunchConfigs.Add(new CrunchConfig { EntropyIdx = entropyIx });
}
}
}
else
{
// Only choose the guessed best transform.
- crunchConfigs.Add(new() { EntropyIdx = entropyIdx });
+ crunchConfigs.Add(new CrunchConfig { EntropyIdx = entropyIdx });
if (this.quality >= 75 && this.method == WebpEncodingMethod.Level5)
{
// Test with and without color cache.
@@ -565,7 +565,7 @@ private CrunchConfig[] EncoderAnalyze(ReadOnlySpan bgra, int width, int he
// If we have a palette, also check in combination with spatial.
if (entropyIdx == EntropyIx.Palette)
{
- crunchConfigs.Add(new() { EntropyIdx = EntropyIx.PaletteAndSpatial });
+ crunchConfigs.Add(new CrunchConfig { EntropyIdx = EntropyIx.PaletteAndSpatial });
}
}
}
@@ -575,7 +575,7 @@ private CrunchConfig[] EncoderAnalyze(ReadOnlySpan bgra, int width, int he
{
for (int j = 0; j < nlz77s; j++)
{
- crunchConfig.SubConfigs.Add(new()
+ crunchConfig.SubConfigs.Add(new CrunchSubConfig
{
Lz77 = j == 0 ? (int)Vp8LLz77Type.Lz77Standard | (int)Vp8LLz77Type.Lz77Rle : (int)Vp8LLz77Type.Lz77Box,
DoNotCache = doNotCache
@@ -712,7 +712,7 @@ private void EncodeImage(int width, int height, bool useCache, CrunchConfig conf
HuffmanTreeToken[] tokens = new HuffmanTreeToken[maxTokens];
for (int i = 0; i < tokens.Length; i++)
{
- tokens[i] = new();
+ tokens[i] = new HuffmanTreeToken();
}
for (int i = 0; i < 5 * histogramImageSize; i++)
@@ -858,7 +858,7 @@ private void EncodeImageNoHuffman(Span bgra, Vp8LHashChain hashChain, Vp8L
HuffmanTreeToken[] tokens = new HuffmanTreeToken[maxTokens];
for (int i = 0; i < tokens.Length; i++)
{
- tokens[i] = new();
+ tokens[i] = new HuffmanTreeToken();
}
// Store Huffman codes.
diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs
index 5b3ecc7f57..03bedfe672 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs
@@ -613,7 +613,7 @@ public static OwnedVp8LHistogram Create(MemoryAllocator memoryAllocator, int pal
{
IMemoryOwner bufferOwner = memoryAllocator.Allocate(BufferSize, AllocationOptions.Clean);
MemoryHandle bufferHandle = bufferOwner.Memory.Pin();
- return new(bufferOwner, ref bufferHandle, (uint*)bufferHandle.Pointer, paletteCodeBits);
+ return new OwnedVp8LHistogram(bufferOwner, ref bufferHandle, (uint*)bufferHandle.Pointer, paletteCodeBits);
}
///
diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs
index 68b52f22bf..817641393e 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogramSet.cs
@@ -25,7 +25,7 @@ public Vp8LHistogramSet(MemoryAllocator memoryAllocator, int capacity, int cache
unsafe
{
uint* basePointer = (uint*)this.bufferHandle.Pointer;
- this.items = new(capacity);
+ this.items = new List(capacity);
for (int i = 0; i < capacity; i++)
{
this.items.Add(new MemberVp8LHistogram(basePointer + (Vp8LHistogram.BufferSize * i), cacheBits));
@@ -41,7 +41,7 @@ public Vp8LHistogramSet(MemoryAllocator memoryAllocator, Vp8LBackwardRefs refs,
unsafe
{
uint* basePointer = (uint*)this.bufferHandle.Pointer;
- this.items = new(capacity);
+ this.items = new List(capacity);
for (int i = 0; i < capacity; i++)
{
this.items.Add(new MemberVp8LHistogram(basePointer + (Vp8LHistogram.BufferSize * i), refs, cacheBits));
@@ -49,9 +49,9 @@ public Vp8LHistogramSet(MemoryAllocator memoryAllocator, Vp8LBackwardRefs refs,
}
}
- public Vp8LHistogramSet(int capacity) => this.items = new(capacity);
+ public Vp8LHistogramSet(int capacity) => this.items = new List(capacity);
- public Vp8LHistogramSet() => this.items = new();
+ public Vp8LHistogramSet() => this.items = new List();
public int Count => this.items.Count;
diff --git a/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs b/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs
index af26616ccb..6de3ae7497 100644
--- a/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs
@@ -108,7 +108,7 @@ public IMemoryOwner DecodeImageStream(Vp8LDecoder decoder, int xSize, int
int numberOfTransformsPresent = 0;
if (isLevel0)
{
- decoder.Transforms = new(WebpConstants.MaxNumberOfTransforms);
+ decoder.Transforms = new List(WebpConstants.MaxNumberOfTransforms);
// Next bit indicates, if a transformation is present.
while (this.bitReader.ReadBit())
@@ -129,7 +129,7 @@ public IMemoryOwner DecodeImageStream(Vp8LDecoder decoder, int xSize, int
}
else
{
- decoder.Metadata = new();
+ decoder.Metadata = new Vp8LMetadata();
}
// Color cache.
@@ -156,7 +156,7 @@ public IMemoryOwner DecodeImageStream(Vp8LDecoder decoder, int xSize, int
// Finish setting up the color-cache.
if (isColorCachePresent)
{
- decoder.Metadata.ColorCache = new(colorCacheBits);
+ decoder.Metadata.ColorCache = new ColorCache(colorCacheBits);
colorCacheSize = 1 << colorCacheBits;
decoder.Metadata.ColorCacheSize = colorCacheSize;
}
@@ -416,7 +416,7 @@ private void ReadHuffmanCodes(Vp8LDecoder decoder, int xSize, int ySize, int col
int[] codeLengths = new int[maxAlphabetSize];
for (int i = 0; i < numHTreeGroupsMax; i++)
{
- hTreeGroups[i] = new(HuffmanUtils.HuffmanPackedTableSize);
+ hTreeGroups[i] = new HTreeGroup(HuffmanUtils.HuffmanPackedTableSize);
HTreeGroup hTreeGroup = hTreeGroups[i];
int totalSize = 0;
bool isTrivialLiteral = true;
diff --git a/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs b/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs
index 31030adb03..ed1ed52abf 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs
@@ -36,8 +36,8 @@ public static void PickBestIntra16(Vp8EncIterator it, ref Vp8ModeScore rd, Vp8Se
int tlambda = dqm.TLambda;
Span src = it.YuvIn.AsSpan(Vp8EncIterator.YOffEnc);
Span scratch = it.Scratch3;
- Vp8ModeScore rdTmp = new Vp8ModeScore();
- Vp8Residual res = new Vp8Residual();
+ Vp8ModeScore rdTmp = new();
+ Vp8Residual res = new();
Vp8ModeScore rdCur = rdTmp;
Vp8ModeScore rdBest = rd;
int mode;
@@ -107,7 +107,7 @@ public static bool PickBestIntra4(Vp8EncIterator it, ref Vp8ModeScore rd, Vp8Seg
Span bestBlocks = it.YuvOut2.AsSpan(Vp8EncIterator.YOffEnc);
Span scratch = it.Scratch3;
int totalHeaderBits = 0;
- Vp8ModeScore rdBest = new Vp8ModeScore();
+ Vp8ModeScore rdBest = new();
if (maxI4HeaderBits == 0)
{
@@ -118,9 +118,9 @@ public static bool PickBestIntra4(Vp8EncIterator it, ref Vp8ModeScore rd, Vp8Seg
rdBest.H = 211; // '211' is the value of VP8BitCost(0, 145)
rdBest.SetRdScore(dqm.LambdaMode);
it.StartI4();
- Vp8ModeScore rdi4 = new Vp8ModeScore();
- Vp8ModeScore rdTmp = new Vp8ModeScore();
- Vp8Residual res = new Vp8Residual();
+ Vp8ModeScore rdi4 = new();
+ Vp8ModeScore rdTmp = new();
+ Vp8Residual res = new();
Span tmpLevels = stackalloc short[16];
do
{
@@ -220,9 +220,9 @@ public static void PickBestUv(Vp8EncIterator it, ref Vp8ModeScore rd, Vp8Segment
Span tmpDst = it.YuvOut2.AsSpan(Vp8EncIterator.UOffEnc);
Span dst0 = it.YuvOut.AsSpan(Vp8EncIterator.UOffEnc);
Span dst = dst0;
- Vp8ModeScore rdBest = new Vp8ModeScore();
- Vp8ModeScore rdUv = new Vp8ModeScore();
- Vp8Residual res = new Vp8Residual();
+ Vp8ModeScore rdBest = new();
+ Vp8ModeScore rdUv = new();
+ Vp8Residual res = new();
int mode;
rd.ModeUv = -1;
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs
index 0c25fb4e47..90506efb81 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8BandProbas.cs
@@ -16,7 +16,7 @@ public Vp8BandProbas()
this.Probabilities = new Vp8ProbaArray[WebpConstants.NumCtx];
for (int i = 0; i < WebpConstants.NumCtx; i++)
{
- this.Probabilities[i] = new();
+ this.Probabilities[i] = new Vp8ProbaArray();
}
}
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs
index a0fe034864..eee22159e1 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Costs.cs
@@ -13,7 +13,7 @@ public Vp8Costs()
this.Costs = new Vp8CostArray[WebpConstants.NumCtx];
for (int i = 0; i < WebpConstants.NumCtx; i++)
{
- this.Costs[i] = new();
+ this.Costs[i] = new Vp8CostArray();
}
}
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs
index cd9a0dea2a..3c8bafa1b2 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs
@@ -25,7 +25,7 @@ internal class Vp8Decoder : IDisposable
/// Used for allocating memory for the pixel data output and the temporary buffers.
public Vp8Decoder(Vp8FrameHeader frameHeader, Vp8PictureHeader pictureHeader, Vp8SegmentHeader segmentHeader, Vp8Proba probabilities, MemoryAllocator memoryAllocator)
{
- this.FilterHeader = new();
+ this.FilterHeader = new Vp8FilterHeader();
this.FrameHeader = frameHeader;
this.PictureHeader = pictureHeader;
this.SegmentHeader = segmentHeader;
@@ -41,22 +41,22 @@ public Vp8Decoder(Vp8FrameHeader frameHeader, Vp8PictureHeader pictureHeader, Vp
this.FilterInfo = new Vp8FilterInfo[this.MbWidth];
for (int i = 0; i < this.MbWidth; i++)
{
- this.MacroBlockInfo[i] = new();
- this.MacroBlockData[i] = new();
- this.YuvTopSamples[i] = new();
- this.FilterInfo[i] = new();
+ this.MacroBlockInfo[i] = new Vp8MacroBlock();
+ this.MacroBlockData[i] = new Vp8MacroBlockData();
+ this.YuvTopSamples[i] = new Vp8TopSamples();
+ this.FilterInfo[i] = new Vp8FilterInfo();
}
- this.MacroBlockInfo[this.MbWidth] = new();
+ this.MacroBlockInfo[this.MbWidth] = new Vp8MacroBlock();
this.DeQuantMatrices = new Vp8QuantMatrix[WebpConstants.NumMbSegments];
this.FilterStrength = new Vp8FilterInfo[WebpConstants.NumMbSegments, 2];
for (int i = 0; i < WebpConstants.NumMbSegments; i++)
{
- this.DeQuantMatrices[i] = new();
+ this.DeQuantMatrices[i] = new Vp8QuantMatrix();
for (int j = 0; j < 2; j++)
{
- this.FilterStrength[i, j] = new();
+ this.FilterStrength[i, j] = new Vp8FilterInfo();
}
}
@@ -245,7 +245,7 @@ public Vp8Decoder(Vp8FrameHeader frameHeader, Vp8PictureHeader pictureHeader, Vp
public Vp8MacroBlock CurrentMacroBlock => this.MacroBlockInfo[this.MbX];
- public Vp8MacroBlock LeftMacroBlock => this.leftMacroBlock ??= new();
+ public Vp8MacroBlock LeftMacroBlock => this.leftMacroBlock ??= new Vp8MacroBlock();
public Vp8MacroBlockData CurrentBlockData => this.MacroBlockData[this.MbX];
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs
index 7f57c81f84..a7c96edb7c 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncIterator.cs
@@ -427,7 +427,7 @@ public int MbAnalyzeBestIntra4Mode(int bestAlpha)
this.MakeIntra4Preds();
for (mode = 0; mode < maxMode; ++mode)
{
- histos[curHisto] = new();
+ histos[curHisto] = new Vp8Histogram();
histos[curHisto].CollectHistogram(src, this.YuvP.AsSpan(Vp8Encoding.Vp8I4ModeOffsets[mode]), 0, 1);
int alpha = histos[curHisto].GetAlpha();
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs
index a6faddc04d..070e705747 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8EncProba.cs
@@ -29,7 +29,7 @@ public Vp8EncProba()
this.Coeffs[i] = new Vp8BandProbas[WebpConstants.NumBands];
for (int j = 0; j < this.Coeffs[i].Length; j++)
{
- this.Coeffs[i][j] = new();
+ this.Coeffs[i][j] = new Vp8BandProbas();
}
}
@@ -39,7 +39,7 @@ public Vp8EncProba()
this.Stats[i] = new Vp8Stats[WebpConstants.NumBands];
for (int j = 0; j < this.Stats[i].Length; j++)
{
- this.Stats[i][j] = new();
+ this.Stats[i][j] = new Vp8Stats();
}
}
@@ -49,7 +49,7 @@ public Vp8EncProba()
this.LevelCost[i] = new Vp8Costs[WebpConstants.NumBands];
for (int j = 0; j < this.LevelCost[i].Length; j++)
{
- this.LevelCost[i][j] = new();
+ this.LevelCost[i][j] = new Vp8Costs();
}
}
@@ -59,7 +59,7 @@ public Vp8EncProba()
this.RemappedCosts[i] = new Vp8Costs[16];
for (int j = 0; j < this.RemappedCosts[i].Length; j++)
{
- this.RemappedCosts[i][j] = new();
+ this.RemappedCosts[i][j] = new Vp8Costs();
}
}
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs
index 608c5391b3..e4ebe14731 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Encoder.cs
@@ -172,19 +172,19 @@ public Vp8Encoder(
this.MbInfo = new Vp8MacroBlockInfo[this.Mbw * this.Mbh];
for (int i = 0; i < this.MbInfo.Length; i++)
{
- this.MbInfo[i] = new();
+ this.MbInfo[i] = new Vp8MacroBlockInfo();
}
this.SegmentInfos = new Vp8SegmentInfo[4];
for (int i = 0; i < 4; i++)
{
- this.SegmentInfos[i] = new();
+ this.SegmentInfos[i] = new Vp8SegmentInfo();
}
- this.FilterHeader = new();
+ this.FilterHeader = new Vp8FilterHeader();
int predSize = (((4 * this.Mbw) + 1) * ((4 * this.Mbh) + 1)) + this.PredsWidth + 1;
this.PredsWidth = (4 * this.Mbw) + 1;
- this.Proba = new();
+ this.Proba = new Vp8EncProba();
this.Preds = new byte[predSize + this.PredsWidth + this.Mbw];
// Initialize with default values, which the reference c implementation uses,
@@ -424,14 +424,14 @@ private bool Encode(
this.uvAlpha /= totalMb;
// Analysis is done, proceed to actual encoding.
- this.SegmentHeader = new(4);
+ this.SegmentHeader = new Vp8EncSegmentHeader(4);
this.AssignSegments(alphas);
this.SetLoopParams(this.quality);
// Initialize the bitwriter.
int averageBytesPerMacroBlock = AverageBytesPerMb[this.BaseQuant >> 4];
int expectedSize = this.Mbw * this.Mbh * averageBytesPerMacroBlock;
- this.bitWriter = new(expectedSize, this);
+ this.bitWriter = new Vp8BitWriter(expectedSize, this);
// Stats-collection loop.
this.StatLoop(width, height, yStride, uvStride);
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs
index de03f3c93c..0da6dfcad4 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Proba.cs
@@ -23,7 +23,7 @@ public Vp8Proba()
{
for (int j = 0; j < WebpConstants.NumBands; j++)
{
- this.Bands[i, j] = new();
+ this.Bands[i, j] = new Vp8BandProbas();
}
}
diff --git a/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs b/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs
index bd335f2985..dda921a7c7 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/Vp8Stats.cs
@@ -13,7 +13,7 @@ public Vp8Stats()
this.Stats = new Vp8StatsArray[WebpConstants.NumCtx];
for (int i = 0; i < WebpConstants.NumCtx; i++)
{
- this.Stats[i] = new();
+ this.Stats[i] = new Vp8StatsArray();
}
}
diff --git a/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs b/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs
index bd87b385c6..f14df853cd 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs
@@ -150,7 +150,7 @@ private static void DecodePixelValues(int width, int height, Span
{
int offset = yMulWidth + x;
Bgr24 bgr = pixelsBgr[offset];
- decodedPixelRow[x] = TPixel.FromBgra32(new(bgr.R, bgr.G, bgr.B, alphaSpan[offset]));
+ decodedPixelRow[x] = TPixel.FromBgra32(new Bgra32(bgr.R, bgr.G, bgr.B, alphaSpan[offset]));
}
}
}
@@ -1173,13 +1173,13 @@ private void ParsePartitions(Vp8Decoder dec)
pSize = sizeLeft;
}
- dec.Vp8BitReaders[p] = new(this.bitReader.Data, (uint)pSize, partStart);
+ dec.Vp8BitReaders[p] = new Vp8BitReader(this.bitReader.Data, (uint)pSize, partStart);
partStart += pSize;
sizeLeft -= pSize;
sz = sz[3..];
}
- dec.Vp8BitReaders[lastPart] = new(this.bitReader.Data, (uint)sizeLeft, partStart);
+ dec.Vp8BitReaders[lastPart] = new Vp8BitReader(this.bitReader.Data, (uint)sizeLeft, partStart);
}
private void ParseDequantizationIndices(Vp8Decoder decoder)
diff --git a/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs b/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs
index d19efec3b1..173d9436dd 100644
--- a/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs
+++ b/src/ImageSharp/Formats/Webp/WebpAnimationDecoder.cs
@@ -93,7 +93,7 @@ public Image Decode(
ImageFrame