|
|
|
@ -30,6 +30,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void PackFromVector4(Span<Vector4> sourceVectors, Span<TPixel> destColors, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceVectors, count, nameof(sourceVectors)); |
|
|
|
Guard.MustBeSizedAtLeast(destColors, count, nameof(destColors)); |
|
|
|
|
|
|
|
ref Vector4 sourceRef = ref sourceVectors.DangerousGetPinnableReference(); |
|
|
|
ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
@ -49,6 +52,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void ToVector4(Span<TPixel> sourceColors, Span<Vector4> destVectors, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceColors, count, nameof(sourceColors)); |
|
|
|
Guard.MustBeSizedAtLeast(destVectors, count, nameof(destVectors)); |
|
|
|
|
|
|
|
ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); |
|
|
|
ref Vector4 destRef = ref destVectors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
@ -68,6 +74,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void PackFromXyzBytes(Span<byte> sourceBytes, Span<TPixel> destColors, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceBytes, count * 3, nameof(sourceBytes)); |
|
|
|
Guard.MustBeSizedAtLeast(destColors, count, nameof(destColors)); |
|
|
|
|
|
|
|
ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); |
|
|
|
ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
@ -91,6 +100,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void ToXyzBytes(Span<TPixel> sourceColors, Span<byte> destBytes, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceColors, count, nameof(sourceColors)); |
|
|
|
Guard.MustBeSizedAtLeast(destBytes, count * 3, nameof(destBytes)); |
|
|
|
|
|
|
|
ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
@ -108,6 +120,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void PackFromXyzwBytes(Span<byte> sourceBytes, Span<TPixel> destColors, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceBytes, count * 4, nameof(sourceBytes)); |
|
|
|
Guard.MustBeSizedAtLeast(destColors, count, nameof(destColors)); |
|
|
|
|
|
|
|
ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); |
|
|
|
ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
@ -131,6 +146,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void ToXyzwBytes(Span<TPixel> sourceColors, Span<byte> destBytes, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceColors, count, nameof(sourceColors)); |
|
|
|
Guard.MustBeSizedAtLeast(destBytes, count * 4, nameof(destBytes)); |
|
|
|
|
|
|
|
ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
@ -148,6 +166,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void PackFromZyxBytes(Span<byte> sourceBytes, Span<TPixel> destColors, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceBytes, count * 3, nameof(sourceBytes)); |
|
|
|
Guard.MustBeSizedAtLeast(destColors, count, nameof(destColors)); |
|
|
|
|
|
|
|
ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); |
|
|
|
ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
@ -171,6 +192,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void ToZyxBytes(Span<TPixel> sourceColors, Span<byte> destBytes, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceColors, count, nameof(sourceColors)); |
|
|
|
Guard.MustBeSizedAtLeast(destBytes, count * 3, nameof(destBytes)); |
|
|
|
|
|
|
|
ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
@ -188,6 +212,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void PackFromZyxwBytes(Span<byte> sourceBytes, Span<TPixel> destColors, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceBytes, count * 4, nameof(sourceBytes)); |
|
|
|
Guard.MustBeSizedAtLeast(destColors, count, nameof(destColors)); |
|
|
|
|
|
|
|
ref byte sourceRef = ref sourceBytes.DangerousGetPinnableReference(); |
|
|
|
ref TPixel destRef = ref destColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
@ -211,6 +238,9 @@ namespace ImageSharp.PixelFormats |
|
|
|
/// <param name="count">The number of pixels to convert.</param>
|
|
|
|
internal virtual void ToZyxwBytes(Span<TPixel> sourceColors, Span<byte> destBytes, int count) |
|
|
|
{ |
|
|
|
Guard.MustBeSizedAtLeast(sourceColors, count, nameof(sourceColors)); |
|
|
|
Guard.MustBeSizedAtLeast(destBytes, count * 4, nameof(destBytes)); |
|
|
|
|
|
|
|
ref TPixel sourceRef = ref sourceColors.DangerousGetPinnableReference(); |
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) |
|
|
|
|