diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs
index ad0d4e311e..3091658e5d 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs
@@ -1,6 +1,8 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using System;
+using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion
@@ -31,6 +33,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return CieLabToCieLchConverter.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 CieLab sourceRef = ref source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLab sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -44,6 +67,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 CieLchuv sourceRef = ref source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -57,6 +101,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 CieLuv sourceRef = ref source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -70,6 +135,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -83,6 +169,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(labColor);
}
+ ///
+ /// 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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -96,6 +203,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -109,6 +237,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Hsl sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -122,6 +271,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Hsv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -135,6 +305,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -148,6 +339,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -161,6 +373,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Lms sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -174,6 +407,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Rgb sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -186,5 +440,26 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
var xyzColor = this.ToCieXyz(color);
return this.ToCieLch(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 source.DangerousGetPinnableReference();
+ ref CieLch destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLch dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLch(sp);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs
index 36e504fb1f..05f1a6f309 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs
@@ -1,6 +1,8 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
+using System;
+using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.ColorSpaces.Conversion.Implementation;
namespace SixLabors.ImageSharp.ColorSpaces.Conversion
@@ -28,6 +30,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLab sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -41,6 +64,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLch sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -57,6 +101,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return CieLuvToCieLchuvConverter.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 CieLuv sourceRef = ref source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -70,6 +135,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -83,6 +169,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(labColor);
}
+ ///
+ /// 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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -96,6 +203,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -109,6 +237,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Hsl sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -122,6 +271,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Hsv sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -135,6 +305,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -148,6 +339,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -161,6 +373,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Lms sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -174,6 +407,27 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref Rgb sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
+
///
/// Converts a into a
///
@@ -186,5 +440,26 @@ namespace SixLabors.ImageSharp.ColorSpaces.Conversion
var xyzColor = this.ToCieXyz(color);
return this.ToCieLchuv(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 source.DangerousGetPinnableReference();
+ ref CieLchuv destRef = ref destination.DangerousGetPinnableReference();
+
+ for (int i = 0; i < count; i++)
+ {
+ ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i);
+ ref CieLchuv dp = ref Unsafe.Add(ref destRef, i);
+ dp = this.ToCieLchuv(sp);
+ }
+ }
}
}
\ No newline at end of file