Skip to content

Commit 2fb6d7a

Browse files
committed
Use target type new
1 parent 085caa2 commit 2fb6d7a

File tree

626 files changed

+2786
-2792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+2786
-2792
lines changed

src/ImageSharp/Advanced/ParallelExecutionSettings.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier)
7979
{
8080
Guard.MustBeGreaterThan(multiplier, 0, nameof(multiplier));
8181

82-
return new ParallelExecutionSettings(
82+
return new(
8383
this.MaxDegreeOfParallelism,
8484
this.MinimumPixelsProcessedPerTask * multiplier,
8585
this.MemoryAllocator);
@@ -92,6 +92,6 @@ public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier)
9292
/// <returns>The <see cref="ParallelExecutionSettings"/>.</returns>
9393
public static ParallelExecutionSettings FromConfiguration(Configuration configuration)
9494
{
95-
return new ParallelExecutionSettings(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator);
95+
return new(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator);
9696
}
9797
}

src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void Invoke(int i)
139139
}
140140

141141
int yMax = Math.Min(yMin + this.stepY, this.maxY);
142-
RowInterval rows = new RowInterval(yMin, yMax);
142+
RowInterval rows = new(yMin, yMax);
143143

144144
// Skip the safety copy when invoking a potentially impure method on a readonly field
145145
Unsafe.AsRef(in this.operation).Invoke(in rows);

src/ImageSharp/Advanced/ParallelRowIterator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public static void IterateRows<T>(
6565
}
6666

6767
int verticalStep = DivideCeil(rectangle.Height, numOfSteps);
68-
ParallelOptions? parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps };
69-
RowOperationWrapper<T> wrappingOperation = new RowOperationWrapper<T>(top, bottom, verticalStep, in operation);
68+
ParallelOptions? parallelOptions = new() { MaxDegreeOfParallelism = numOfSteps };
69+
RowOperationWrapper<T> wrappingOperation = new(top, bottom, verticalStep, in operation);
7070

7171
Parallel.For(
7272
0,

src/ImageSharp/Color/Color.WebSafePalette.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp;
88
/// </content>
99
public partial struct Color
1010
{
11-
private static readonly Lazy<Color[]> WebSafePaletteLazy = new Lazy<Color[]>(CreateWebSafePalette, true);
11+
private static readonly Lazy<Color[]> WebSafePaletteLazy = new(CreateWebSafePalette, true);
1212

1313
/// <summary>
1414
/// Gets a collection of named, web safe colors as defined in the CSS Color Module Level 4.

src/ImageSharp/Color/Color.WernerPalette.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp;
88
/// </content>
99
public partial struct Color
1010
{
11-
private static readonly Lazy<Color[]> WernerPaletteLazy = new Lazy<Color[]>(CreateWernerPalette, true);
11+
private static readonly Lazy<Color[]> WernerPaletteLazy = new(CreateWernerPalette, true);
1212

1313
/// <summary>
1414
/// Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821.

src/ImageSharp/ColorProfiles/CieLab.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static CieLab FromProfileConnectingSpace(ColorConversionOptions options,
103103
float a = 500F * (fx - fy);
104104
float b = 200F * (fy - fz);
105105

106-
return new CieLab(l, a, b);
106+
return new(l, a, b);
107107
}
108108

109109
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieLch.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2525
/// <param name="h">The hue in degrees.</param>
2626
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2727
public CieLch(float l, float c, float h)
28-
: this(new Vector3(l, c, h))
28+
: this(new(l, c, h))
2929
{
3030
}
3131

@@ -101,7 +101,7 @@ public static CieLch FromProfileConnectingSpace(ColorConversionOptions options,
101101
hDegrees += 360;
102102
}
103103

104-
return new CieLch(l, c, hDegrees);
104+
return new(l, c, hDegrees);
105105
}
106106

107107
/// <inheritdoc/>
@@ -127,7 +127,7 @@ public CieLab ToProfileConnectingSpace(ColorConversionOptions options)
127127
float a = c * MathF.Cos(hRadians);
128128
float b = c * MathF.Sin(hRadians);
129129

130-
return new CieLab(l, a, b);
130+
return new(l, a, b);
131131
}
132132

133133
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieLchuv.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2525
/// <param name="h">The hue in degrees.</param>
2626
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2727
public CieLchuv(float l, float c, float h)
28-
: this(new Vector3(l, c, h))
28+
: this(new(l, c, h))
2929
{
3030
}
3131

@@ -102,7 +102,7 @@ public static CieLchuv FromProfileConnectingSpace(ColorConversionOptions options
102102
hDegrees += 360;
103103
}
104104

105-
return new CieLchuv(l, c, hDegrees);
105+
return new(l, c, hDegrees);
106106
}
107107

108108
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieLuv.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static CieLuv FromProfileConnectingSpace(ColorConversionOptions options,
123123
v = 0;
124124
}
125125

126-
return new CieLuv((float)l, (float)u, (float)v);
126+
return new((float)l, (float)u, (float)v);
127127
}
128128

129129
/// <inheritdoc/>
@@ -177,7 +177,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
177177
z = 0;
178178
}
179179

180-
return new CieXyz((float)x, (float)y, (float)z);
180+
return new((float)x, (float)y, (float)z);
181181
}
182182

183183
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieXyy.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ public static CieXyy FromProfileConnectingSpace(ColorConversionOptions options,
9191

9292
if (float.IsNaN(x) || float.IsNaN(y))
9393
{
94-
return new CieXyy(0, 0, source.Y);
94+
return new(0, 0, source.Y);
9595
}
9696

97-
return new CieXyy(x, y, source.Y);
97+
return new(x, y, source.Y);
9898
}
9999

100100
/// <inheritdoc/>
@@ -113,14 +113,14 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
113113
{
114114
if (MathF.Abs(this.Y) < Constants.Epsilon)
115115
{
116-
return new CieXyz(0, 0, this.Yl);
116+
return new(0, 0, this.Yl);
117117
}
118118

119119
float x = (this.X * this.Yl) / this.Y;
120120
float y = this.Yl;
121121
float z = ((1 - this.X - this.Y) * y) / this.Y;
122122

123-
return new CieXyz(x, y, z);
123+
return new(x, y, z);
124124
}
125125

126126
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/Cmyk.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2525
/// <param name="k">The keyline black component.</param>
2626
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2727
public Cmyk(float c, float m, float y, float k)
28-
: this(new Vector4(c, m, y, k))
28+
: this(new(c, m, y, k))
2929
{
3030
}
3131

@@ -100,12 +100,12 @@ public static Cmyk FromProfileConnectingSpace(ColorConversionOptions options, in
100100

101101
if (MathF.Abs(k.X - 1F) < Constants.Epsilon)
102102
{
103-
return new Cmyk(0, 0, 0, 1F);
103+
return new(0, 0, 0, 1F);
104104
}
105105

106106
cmy = (cmy - k) / (Vector3.One - k);
107107

108-
return new Cmyk(cmy.X, cmy.Y, cmy.Z, k.X);
108+
return new(cmy.X, cmy.Y, cmy.Z, k.X);
109109
}
110110

111111
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/Hsl.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2424
/// <param name="l">The l value (lightness) component.</param>
2525
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2626
public Hsl(float h, float s, float l)
27-
: this(new Vector3(h, s, l))
27+
: this(new(h, s, l))
2828
{
2929
}
3030

@@ -99,7 +99,7 @@ public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in
9999

100100
if (MathF.Abs(chroma) < Constants.Epsilon)
101101
{
102-
return new Hsl(0F, s, l);
102+
return new(0F, s, l);
103103
}
104104

105105
if (MathF.Abs(r - max) < Constants.Epsilon)
@@ -130,7 +130,7 @@ public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in
130130
s = chroma / (2F - max - min);
131131
}
132132

133-
return new Hsl(h, s, l);
133+
return new(h, s, l);
134134
}
135135

136136
/// <inheritdoc/>
@@ -171,7 +171,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
171171
}
172172
}
173173

174-
return new Rgb(r, g, b);
174+
return new(r, g, b);
175175
}
176176

177177
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/Hsv.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2424
/// <param name="v">The v value (brightness) component.</param>
2525
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2626
public Hsv(float h, float s, float v)
27-
: this(new Vector3(h, s, v))
27+
: this(new(h, s, v))
2828
{
2929
}
3030

@@ -97,7 +97,7 @@ public static Hsv FromProfileConnectingSpace(ColorConversionOptions options, in
9797

9898
if (MathF.Abs(chroma) < Constants.Epsilon)
9999
{
100-
return new Hsv(0, s, v);
100+
return new(0, s, v);
101101
}
102102

103103
if (MathF.Abs(r - max) < Constants.Epsilon)
@@ -121,7 +121,7 @@ public static Hsv FromProfileConnectingSpace(ColorConversionOptions options, in
121121

122122
s = chroma / v;
123123

124-
return new Hsv(h, s, v);
124+
return new(h, s, v);
125125
}
126126

127127
/// <inheritdoc/>
@@ -143,7 +143,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
143143

144144
if (MathF.Abs(s) < Constants.Epsilon)
145145
{
146-
return new Rgb(v, v, v);
146+
return new(v, v, v);
147147
}
148148

149149
float h = (MathF.Abs(this.H - 360) < Constants.Epsilon) ? 0 : this.H / 60;
@@ -194,7 +194,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options)
194194
break;
195195
}
196196

197-
return new Rgb(r, g, b);
197+
return new(r, g, b);
198198
}
199199

200200
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/HunterLab.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static HunterLab FromProfileConnectingSpace(ColorConversionOptions option
108108
b = 0;
109109
}
110110

111-
return new HunterLab(l, a, b);
111+
return new(l, a, b);
112112
}
113113

114114
/// <inheritdoc/>
@@ -141,7 +141,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
141141
float x = (((a / ka) * sqrtPow) + pow) * xn;
142142
float z = (((b / kb) * sqrtPow) - pow) * (-zn);
143143

144-
return new CieXyz(x, y, z);
144+
return new(x, y, z);
145145
}
146146

147147
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/KnownChromaticAdaptationMatrices.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static class KnownChromaticAdaptationMatrices
2424
/// von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez adjusted for D65)
2525
/// </summary>
2626
public static readonly Matrix4x4 VonKriesHPEAdjusted
27-
= Matrix4x4.Transpose(new Matrix4x4
27+
= Matrix4x4.Transpose(new()
2828
{
2929
M11 = 0.40024F,
3030
M12 = 0.7076F,
@@ -42,7 +42,7 @@ public static readonly Matrix4x4 VonKriesHPEAdjusted
4242
/// von Kries chromatic adaptation transform matrix (Hunt-Pointer-Estevez for equal energy)
4343
/// </summary>
4444
public static readonly Matrix4x4 VonKriesHPE
45-
= Matrix4x4.Transpose(new Matrix4x4
45+
= Matrix4x4.Transpose(new()
4646
{
4747
M11 = 0.3897F,
4848
M12 = 0.6890F,
@@ -65,7 +65,7 @@ public static readonly Matrix4x4 VonKriesHPE
6565
/// Bradford chromatic adaptation transform matrix (used in CMCCAT97)
6666
/// </summary>
6767
public static readonly Matrix4x4 Bradford
68-
= Matrix4x4.Transpose(new Matrix4x4
68+
= Matrix4x4.Transpose(new()
6969
{
7070
M11 = 0.8951F,
7171
M12 = 0.2664F,
@@ -83,7 +83,7 @@ public static readonly Matrix4x4 Bradford
8383
/// Spectral sharpening and the Bradford transform
8484
/// </summary>
8585
public static readonly Matrix4x4 BradfordSharp
86-
= Matrix4x4.Transpose(new Matrix4x4
86+
= Matrix4x4.Transpose(new()
8787
{
8888
M11 = 1.2694F,
8989
M12 = -0.0988F,
@@ -101,7 +101,7 @@ public static readonly Matrix4x4 BradfordSharp
101101
/// CMCCAT2000 (fitted from all available color data sets)
102102
/// </summary>
103103
public static readonly Matrix4x4 CMCCAT2000
104-
= Matrix4x4.Transpose(new Matrix4x4
104+
= Matrix4x4.Transpose(new()
105105
{
106106
M11 = 0.7982F,
107107
M12 = 0.3389F,
@@ -119,7 +119,7 @@ public static readonly Matrix4x4 CMCCAT2000
119119
/// CAT02 (optimized for minimizing CIELAB differences)
120120
/// </summary>
121121
public static readonly Matrix4x4 CAT02
122-
= Matrix4x4.Transpose(new Matrix4x4
122+
= Matrix4x4.Transpose(new()
123123
{
124124
M11 = 0.7328F,
125125
M12 = 0.4296F,

0 commit comments

Comments
 (0)