diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs
index 498f0cc9d0..f4b52a49ab 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs
@@ -1,6 +1,9 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation;
@@ -26,6 +29,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref CieLab sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLab sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -39,6 +63,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref CieLch sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLch sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -60,6 +105,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.Adapt(unadapted);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -73,6 +139,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -92,6 +179,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return converter.Convert(adapted);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -105,6 +213,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -118,6 +247,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref Hsl sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Hsl sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -131,6 +281,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref Hsv sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Hsv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -144,6 +315,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -157,6 +349,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref Lms sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Lms sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -170,6 +383,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -183,6 +417,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLuv(xyzColor);
}
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref Rgb sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Rgb sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -195,5 +450,26 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
var xyzColor = this.ToCieXyz(color);
return this.ToCieLuv(xyzColor);
}
+
+ ///
+ /// Performs the bulk conversion from into
+ ///
+ /// The span to the source colors
+ /// The span to the destination colors
+ /// The number of colors to convert.
+ public void Convert(Span source, Span destination, int count)
+ {
+ Guard.SpansMustBeSizedAtLeast(source, nameof(source), destination, nameof(destination), count);
+
+ ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source);
+ ref CieLuv destRef = ref MemoryMarshal.GetReference(destination);
+
+ for (int i = 0; i < count; i++)
+ {
+ ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLuv(sp);
+ }
+ }
}
}
\ No newline at end of file