diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs index 09c161572..089b1ab31 100644 --- a/src/ImageSharp/Advanced/AotCompilerTools.cs +++ b/src/ImageSharp/Advanced/AotCompilerTools.cs @@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.Advanced Seed(); Seed(); Seed(); - Seed(); + Seed(); Seed(); Seed(); Seed(); diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 6ced7079d..53bf457c2 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -658,7 +658,7 @@ namespace SixLabors.ImageSharp.Formats.Png scanlineSpan, rowSpan, pngMetadata.HasTransparency, - pngMetadata.TransparentGray16.GetValueOrDefault(), + pngMetadata.TransparentL16.GetValueOrDefault(), pngMetadata.TransparentL8.GetValueOrDefault()); break; @@ -742,7 +742,7 @@ namespace SixLabors.ImageSharp.Formats.Png pixelOffset, increment, pngMetadata.HasTransparency, - pngMetadata.TransparentGray16.GetValueOrDefault(), + pngMetadata.TransparentL16.GetValueOrDefault(), pngMetadata.TransparentL8.GetValueOrDefault()); break; @@ -837,7 +837,7 @@ namespace SixLabors.ImageSharp.Formats.Png { if (this.header.BitDepth == 16) { - pngMetadata.TransparentGray16 = new Gray16(BinaryPrimitives.ReadUInt16LittleEndian(alpha.Slice(0, 2))); + pngMetadata.TransparentL16 = new L16(BinaryPrimitives.ReadUInt16LittleEndian(alpha.Slice(0, 2))); } else { diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index bc090e198..82796c570 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -199,16 +199,16 @@ namespace SixLabors.ImageSharp.Formats.Png if (this.use16Bit) { // 16 bit grayscale - using (IMemoryOwner luminanceBuffer = this.memoryAllocator.Allocate(rowSpan.Length)) + using (IMemoryOwner luminanceBuffer = this.memoryAllocator.Allocate(rowSpan.Length)) { - Span luminanceSpan = luminanceBuffer.GetSpan(); - ref Gray16 luminanceRef = ref MemoryMarshal.GetReference(luminanceSpan); - PixelOperations.Instance.ToGray16(this.configuration, rowSpan, luminanceSpan); + Span luminanceSpan = luminanceBuffer.GetSpan(); + ref L16 luminanceRef = ref MemoryMarshal.GetReference(luminanceSpan); + PixelOperations.Instance.ToL16(this.configuration, rowSpan, luminanceSpan); // Can't map directly to byte array as it's big-endian. for (int x = 0, o = 0; x < luminanceSpan.Length; x++, o += 2) { - Gray16 luminance = Unsafe.Add(ref luminanceRef, x); + L16 luminance = Unsafe.Add(ref luminanceRef, x); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o, 2), luminance.PackedValue); } } @@ -761,9 +761,9 @@ namespace SixLabors.ImageSharp.Formats.Png } else if (pngMetadata.ColorType == PngColorType.Grayscale) { - if (pngMetadata.TransparentGray16.HasValue && this.use16Bit) + if (pngMetadata.TransparentL16.HasValue && this.use16Bit) { - BinaryPrimitives.WriteUInt16LittleEndian(alpha, pngMetadata.TransparentGray16.Value.PackedValue); + BinaryPrimitives.WriteUInt16LittleEndian(alpha, pngMetadata.TransparentL16.Value.PackedValue); this.WriteChunk(stream, PngChunkType.Transparency, this.chunkDataBuffer, 0, 2); } else if (pngMetadata.TransparentL8.HasValue) diff --git a/src/ImageSharp/Formats/Png/PngMetaData.cs b/src/ImageSharp/Formats/Png/PngMetaData.cs index abecfdd57..87a2080f0 100644 --- a/src/ImageSharp/Formats/Png/PngMetaData.cs +++ b/src/ImageSharp/Formats/Png/PngMetaData.cs @@ -30,7 +30,7 @@ namespace SixLabors.ImageSharp.Formats.Png this.InterlaceMethod = other.InterlaceMethod; this.HasTransparency = other.HasTransparency; this.TransparentL8 = other.TransparentL8; - this.TransparentGray16 = other.TransparentGray16; + this.TransparentL16 = other.TransparentL16; this.TransparentRgb24 = other.TransparentRgb24; this.TransparentRgb48 = other.TransparentRgb48; @@ -83,7 +83,7 @@ namespace SixLabors.ImageSharp.Formats.Png /// Gets or sets the 16 bit grayscale transparent color. /// This represents any color in a 16 bit grayscale encoded png that should be transparent. /// - public Gray16? TransparentGray16 { get; set; } + public L16? TransparentL16 { get; set; } /// /// Gets or sets a value indicating whether the image contains a transparency chunk and markers were decoded. diff --git a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs index 89e5f4482..c6fd4b87d 100644 --- a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs +++ b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs @@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Formats.Png ReadOnlySpan scanlineSpan, Span rowSpan, bool hasTrans, - Gray16 luminance16Trans, + L16 luminance16Trans, L8 luminanceTrans) where TPixel : struct, IPixel { @@ -36,7 +36,7 @@ namespace SixLabors.ImageSharp.Formats.Png for (int x = 0, o = 0; x < header.Width; x++, o += 2) { ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2)); - pixel.FromGray16(new Gray16(luminance)); + pixel.FromL16(new L16(luminance)); Unsafe.Add(ref rowSpanRef, x) = pixel; } } @@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Formats.Png int pixelOffset, int increment, bool hasTrans, - Gray16 luminance16Trans, + L16 luminance16Trans, L8 luminanceTrans) where TPixel : struct, IPixel { @@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Formats.Png for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o += 2) { ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2)); - pixel.FromGray16(new Gray16(luminance)); + pixel.FromL16(new L16(luminance)); Unsafe.Add(ref rowSpanRef, x) = pixel; } } diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj index 7b60100a6..ddb27dc48 100644 --- a/src/ImageSharp/ImageSharp.csproj +++ b/src/ImageSharp/ImageSharp.csproj @@ -81,10 +81,10 @@ True L8.PixelOperations.Generated.tt - + True True - Gray16.PixelOperations.Generated.tt + L16.PixelOperations.Generated.tt True @@ -155,9 +155,9 @@ TextTemplatingFileGenerator L8.PixelOperations.Generated.cs - + TextTemplatingFileGenerator - Gray16.PixelOperations.Generated.cs + L16.PixelOperations.Generated.cs TextTemplatingFileGenerator diff --git a/src/ImageSharp/PixelFormats/IPixel.cs b/src/ImageSharp/PixelFormats/IPixel.cs index 83a05a62e..9b954ee9b 100644 --- a/src/ImageSharp/PixelFormats/IPixel.cs +++ b/src/ImageSharp/PixelFormats/IPixel.cs @@ -86,10 +86,10 @@ namespace SixLabors.ImageSharp.PixelFormats void FromL8(L8 source); /// - /// Initializes the pixel instance from an value. + /// Initializes the pixel instance from an value. /// - /// The value. - void FromGray16(Gray16 source); + /// The value. + void FromL16(L16 source); /// /// Initializes the pixel instance from an value. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs index 9995b7d4f..e88fc107c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs @@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.PackedValue = byte.MaxValue; + public void FromL16(L16 source) => this.PackedValue = byte.MaxValue; /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs index 41f4c603e..d0feb6915 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs @@ -239,7 +239,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { byte rgb = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); this.R = rgb; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs index cb6fc1132..a965364f1 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs @@ -149,7 +149,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { byte rgb = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); this.R = rgb; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs index fc7e92c39..104d24bdf 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs @@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs index b0f4afed1..63f08b2b7 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs @@ -195,7 +195,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { byte rgb = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); this.R = rgb; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs index e2be5f438..ec27219f9 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs @@ -108,7 +108,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs index 2df4411a8..ba915a7c0 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs @@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs index 87fd55f98..f6ac50481 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs @@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs index 66eebc34a..dbfd96a5f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs @@ -152,18 +152,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromArgb32(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs index 063c22ddd..51aa2264a 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs @@ -109,18 +109,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromBgr24(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs index 63769e3b5..1f3065187 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs @@ -152,18 +152,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromBgra32(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L16.PixelOperations.Generated.cs similarity index 68% rename from src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.cs rename to src/ImageSharp/PixelFormats/PixelImplementations/Generated/L16.PixelOperations.Generated.cs index c29d56480..3bf21cc2c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L16.PixelOperations.Generated.cs @@ -16,15 +16,15 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// Provides optimized overrides for bulk operations. /// - public partial struct Gray16 + public partial struct L16 { /// /// Provides optimized overrides for bulk operations. /// - internal class PixelOperations : PixelOperations + internal class PixelOperations : PixelOperations { /// - internal override void FromGray16(Configuration configuration, ReadOnlySpan source, Span destPixels) + internal override void FromL16(Configuration configuration, ReadOnlySpan source, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); @@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); @@ -43,155 +43,155 @@ namespace SixLabors.ImageSharp.PixelFormats /// - internal override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Argb32 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - internal override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); - ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); + ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// internal override void From( Configuration configuration, ReadOnlySpan sourcePixels, - Span destinationPixels) + Span destinationPixels) { - PixelOperations.Instance.ToGray16(configuration, sourcePixels, destinationPixels); + PixelOperations.Instance.ToL16(configuration, sourcePixels, destinationPixels); } } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.tt b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L16.PixelOperations.Generated.tt similarity index 68% rename from src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.tt rename to src/ImageSharp/PixelFormats/PixelImplementations/Generated/L16.PixelOperations.Generated.tt index ac484bdbc..937902346 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L16.PixelOperations.Generated.tt @@ -6,14 +6,14 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// Provides optimized overrides for bulk operations. /// - public partial struct Gray16 + public partial struct L16 { /// /// Provides optimized overrides for bulk operations. /// - internal class PixelOperations : PixelOperations + internal class PixelOperations : PixelOperations { - <# GenerateAllDefaultConversionMethods("Gray16"); #> + <# GenerateAllDefaultConversionMethods("L16"); #> } } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L8.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L8.PixelOperations.Generated.cs index 9e031778a..71940bf8b 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L8.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/L8.PixelOperations.Generated.cs @@ -97,18 +97,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromL8(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.cs index 8739fbe62..735689a85 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.cs @@ -126,18 +126,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromRgb24(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.cs index d98ede99f..dd6ea800b 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.cs @@ -115,18 +115,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromRgb48(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.cs index c2a144edb..70067c38a 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.cs @@ -141,18 +141,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Rgba32 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromRgba32(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.cs index 97917b74a..bbbc9d08e 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.cs @@ -115,18 +115,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.NotNull(configuration, nameof(configuration)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Rgba64 sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destRef, i); + ref L16 dp = ref Unsafe.Add(ref destRef, i); dp.FromRgba64(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/_Common.ttinclude b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/_Common.ttinclude index 963c020e4..dacf55938 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/_Common.ttinclude +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/_Common.ttinclude @@ -15,7 +15,7 @@ using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; <#+ - static readonly string[] CommonPixelTypes = { "Argb32", "Bgr24", "Bgra32", "L8", "Gray16", "Rgb24", "Rgba32", "Rgb48", "Rgba64" }; + static readonly string[] CommonPixelTypes = { "Argb32", "Bgr24", "Bgra32", "L8", "L16", "Rgb24", "Rgba32", "Rgb48", "Rgba64" }; static readonly string[] Optimized32BitTypes = { "Rgba32", "Argb32", "Bgra32" }; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs index 5d661672b..5f3314654 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs @@ -98,7 +98,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs index a3ff4824d..47d7c8ea5 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs @@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs index 6cb9f3899..7b19c5ec4 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs @@ -117,7 +117,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs similarity index 80% rename from src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs rename to src/ImageSharp/PixelFormats/PixelImplementations/L16.cs index 1645711bb..cda79ab39 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Gray16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs @@ -7,48 +7,48 @@ using System.Runtime.CompilerServices; namespace SixLabors.ImageSharp.PixelFormats { /// - /// Packed pixel type containing a single 16 bit normalized gray values. + /// Packed pixel type containing a single 16 bit normalized luminance value. /// /// Ranges from [0, 0, 0, 1] to [1, 1, 1, 1] in vector form. /// /// - public partial struct Gray16 : IPixel, IPackedVector + public partial struct L16 : IPixel, IPackedVector { private const float Max = ushort.MaxValue; /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The luminance component - public Gray16(ushort luminance) => this.PackedValue = luminance; + public L16(ushort luminance) => this.PackedValue = luminance; /// public ushort PackedValue { get; set; } /// - /// Compares two objects for equality. + /// Compares two objects for equality. /// - /// The on the left side of the operand. - /// The on the right side of the operand. + /// The on the left side of the operand. + /// The on the right side of the operand. /// /// True if the parameter is equal to the parameter; otherwise, false. /// [MethodImpl(InliningOptions.ShortMethod)] - public static bool operator ==(Gray16 left, Gray16 right) => left.Equals(right); + public static bool operator ==(L16 left, L16 right) => left.Equals(right); /// - /// Compares two objects for equality. + /// Compares two objects for equality. /// - /// The on the left side of the operand. - /// The on the right side of the operand. + /// The on the left side of the operand. + /// The on the right side of the operand. /// /// True if the parameter is not equal to the parameter; otherwise, false. /// [MethodImpl(InliningOptions.ShortMethod)] - public static bool operator !=(Gray16 left, Gray16 right) => !left.Equals(right); + public static bool operator !=(L16 left, L16 right) => !left.Equals(right); /// - public PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -110,7 +110,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.PackedValue = source.PackedValue; + public void FromL16(L16 source) => this.PackedValue = source.PackedValue; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -152,14 +152,14 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.PackedValue = ImageMaths.Get16BitBT709Luminance(source.R, source.G, source.B); /// - public override bool Equals(object obj) => obj is Gray16 other && this.Equals(other); + public override bool Equals(object obj) => obj is L16 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public bool Equals(Gray16 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(L16 other) => this.PackedValue.Equals(other.PackedValue); /// - public override string ToString() => $"Gray16({this.PackedValue})"; + public override string ToString() => $"L16({this.PackedValue})"; /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs index fbc0c5eab..0ab26d603 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs @@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.PackedValue = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); + public void FromL16(L16 source) => this.PackedValue = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs index adca7ffb6..a9128b463 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs @@ -119,7 +119,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs index 82b5fc3c3..d9af3002d 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs @@ -120,7 +120,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs index 9fdc9a12b..045443afc 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs @@ -115,7 +115,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs index 05e114677..afdc3cc4c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs @@ -122,7 +122,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs index e5641f14c..915e48351 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs @@ -103,7 +103,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs index 57b415885..c694e04cf 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs @@ -164,7 +164,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { byte rgb = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); this.R = rgb; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs index 3e42f328c..c5e459ab4 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs @@ -142,7 +142,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { this.R = source.PackedValue; this.G = source.PackedValue; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs index 98fb05774..773426dc4 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs @@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs index bb1dad3bd..5693e24d7 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs @@ -317,7 +317,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { byte rgb = ImageMaths.DownScaleFrom16BitTo8Bit(source.PackedValue); this.R = rgb; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs index e8184abe9..6a48f0e98 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs @@ -267,7 +267,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) + public void FromL16(L16 source) { this.R = source.PackedValue; this.G = source.PackedValue; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.PixelOperations.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.PixelOperations.cs index 07fdb2ef1..5ced9e8a3 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.PixelOperations.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.PixelOperations.cs @@ -62,17 +62,17 @@ namespace SixLabors.ImageSharp.PixelFormats } } - internal override void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref Vector4 sourceBaseRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels)); - ref Gray16 destBaseRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destBaseRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref Vector4 sp = ref Unsafe.Add(ref sourceBaseRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destBaseRef, i); + ref L16 dp = ref Unsafe.Add(ref destBaseRef, i); dp.ConvertFromRgbaScaledVector4(sp); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index 877941f7a..36b1a991f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs @@ -144,7 +144,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs index 47a10bc59..441f4338e 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs @@ -121,7 +121,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs index 79405a4a0..e294c07ae 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs @@ -126,7 +126,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public void FromGray16(Gray16 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromL16(L16 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(InliningOptions.ShortMethod)] diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs index 1c826df44..c3f737b97 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs @@ -299,75 +299,75 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - /// Converts all pixels in 'source` span of into a span of -s. + /// Converts all pixels in 'source` span of into a span of -s. /// /// A to configure internal operations - /// The source of data. + /// The source of data. /// The to the destination pixels. - internal virtual void FromGray16(Configuration configuration, ReadOnlySpan source, Span destPixels) + internal virtual void FromL16(Configuration configuration, ReadOnlySpan source, Span destPixels) { Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); - ref Gray16 sourceBaseRef = ref MemoryMarshal.GetReference(source); + ref L16 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < source.Length; i++) { - ref Gray16 sp = ref Unsafe.Add(ref sourceBaseRef, i); + ref L16 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); - dp.FromGray16(sp); + dp.FromL16(sp); } } /// - /// A helper for that expects a byte span. - /// The layout of the data in 'sourceBytes' must be compatible with layout. + /// A helper for that expects a byte span. + /// The layout of the data in 'sourceBytes' must be compatible with layout. /// /// A to configure internal operations /// The to the source bytes. /// The to the destination pixels. /// The number of pixels to convert. [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void FromGray16Bytes(Configuration configuration, ReadOnlySpan sourceBytes, Span destPixels, int count) + internal void FromL16Bytes(Configuration configuration, ReadOnlySpan sourceBytes, Span destPixels, int count) { - this.FromGray16(configuration, MemoryMarshal.Cast(sourceBytes).Slice(0, count), destPixels); + this.FromL16(configuration, MemoryMarshal.Cast(sourceBytes).Slice(0, count), destPixels); } /// - /// Converts all pixels of the 'sourcePixels` span to a span of -s. + /// Converts all pixels of the 'sourcePixels` span to a span of -s. /// /// A to configure internal operations /// The span of source pixels - /// The destination span of data. - internal virtual void ToGray16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) + /// The destination span of data. + internal virtual void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels) { Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); - ref Gray16 destBaseRef = ref MemoryMarshal.GetReference(destPixels); + ref L16 destBaseRef = ref MemoryMarshal.GetReference(destPixels); for (int i = 0; i < sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); - ref Gray16 dp = ref Unsafe.Add(ref destBaseRef, i); + ref L16 dp = ref Unsafe.Add(ref destBaseRef, i); dp.FromScaledVector4(sp.ToScaledVector4()); } } /// - /// A helper for that expects a byte span as destination. - /// The layout of the data in 'destBytes' must be compatible with layout. + /// A helper for that expects a byte span as destination. + /// The layout of the data in 'destBytes' must be compatible with layout. /// /// A to configure internal operations /// The to the source pixels. /// The to the destination bytes. /// The number of pixels to convert. [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal void ToGray16Bytes(Configuration configuration, ReadOnlySpan sourcePixels, Span destBytes, int count) + internal void ToL16Bytes(Configuration configuration, ReadOnlySpan sourcePixels, Span destBytes, int count) { - this.ToGray16(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast(destBytes)); + this.ToL16(configuration, sourcePixels.Slice(0, count), MemoryMarshal.Cast(destBytes)); } /// diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt index 8a61f13db..0ed221e61 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt @@ -121,8 +121,8 @@ namespace SixLabors.ImageSharp.PixelFormats GenerateFromMethods("L8"); GenerateToDestFormatMethods("L8"); - GenerateFromMethods("Gray16"); - GenerateToDestFormatMethods("Gray16"); + GenerateFromMethods("L16"); + GenerateToDestFormatMethods("L16"); GenerateFromMethods("Rgb24"); GenerateToDestFormatMethods("Rgb24"); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs index 610241de5..3b05b00ce 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs @@ -57,9 +57,9 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png TestImages.Png.Rgb48BppTrans }; - public static readonly string[] TestImagesGray16Bit = + public static readonly string[] TestImagesL16Bit = { - TestImages.Png.Gray16Bit, + TestImages.Png.L16Bit, }; public static readonly string[] TestImagesGrayAlpha16Bit = @@ -156,8 +156,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png } [Theory] - [WithFileCollection(nameof(TestImagesGray16Bit), PixelTypes.Rgb48)] - public void Decode_Gray16Bit(TestImageProvider provider) + [WithFileCollection(nameof(TestImagesL16Bit), PixelTypes.Rgb48)] + public void Decode_L16Bit(TestImageProvider provider) where TPixel : struct, IPixel { using (Image image = provider.GetImage(new PngDecoder())) diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index 44659f902..2281da7fc 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -314,8 +314,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png case PngColorType.Grayscale: if (pngBitDepth.Equals(PngBitDepth.Bit16)) { - Assert.True(outMeta.TransparentGray16.HasValue); - Assert.Equal(inMeta.TransparentGray16, outMeta.TransparentGray16); + Assert.True(outMeta.TransparentL16.HasValue); + Assert.Equal(inMeta.TransparentL16, outMeta.TransparentL16); } else { diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs index 447203599..3043626ca 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs @@ -235,7 +235,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats ushort expected = ushort.MaxValue; // act - bgr.FromGray16(new Gray16(ushort.MaxValue)); + bgr.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, bgr.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs index e91c0d88b..b979eebde 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs @@ -190,7 +190,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats ushort expectedPackedValue = ushort.MaxValue; // act - bgra.FromGray16(new Gray16(ushort.MaxValue)); + bgra.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, bgra.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs index d6f054bbb..41ebfc955 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs @@ -215,7 +215,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats ushort expectedPackedValue = ushort.MaxValue; // act - bgra.FromGray16(new Gray16(ushort.MaxValue)); + bgra.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, bgra.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs index 1624f3bcf..2eb5553d7 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs @@ -155,7 +155,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats uint expectedPackedValue = uint.MaxValue; // act - byte4.FromGray16(new Gray16(ushort.MaxValue)); + byte4.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, byte4.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/Gray16Tests.cs b/tests/ImageSharp.Tests/PixelFormats/L16Tests.cs similarity index 75% rename from tests/ImageSharp.Tests/PixelFormats/Gray16Tests.cs rename to tests/ImageSharp.Tests/PixelFormats/L16Tests.cs index 8a0bd62c1..179ba12b2 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Gray16Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/L16Tests.cs @@ -7,13 +7,13 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.PixelFormats { - public class Gray16Tests + public class L16Tests { [Fact] public void AreEqual() { - var color1 = new Gray16(3000); - var color2 = new Gray16(3000); + var color1 = new L16(3000); + var color2 = new L16(3000); Assert.Equal(color1, color2); } @@ -21,8 +21,8 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats [Fact] public void AreNotEqual() { - var color1 = new Gray16(12345); - var color2 = new Gray16(54321); + var color1 = new L16(12345); + var color2 = new L16(54321); Assert.NotEqual(color1, color2); } @@ -32,16 +32,16 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats [InlineData(65535)] [InlineData(32767)] [InlineData(42)] - public void Gray16_PackedValue_EqualsInput(ushort input) - => Assert.Equal(input, new Gray16(input).PackedValue); + public void L16_PackedValue_EqualsInput(ushort input) + => Assert.Equal(input, new L16(input).PackedValue); [Fact] - public void Gray16_FromScaledVector4() + public void L16_FromScaledVector4() { // Arrange - Gray16 gray = default; + L16 gray = default; const ushort expected = 32767; - Vector4 scaled = new Gray16(expected).ToScaledVector4(); + Vector4 scaled = new L16(expected).ToScaledVector4(); // Act gray.FromScaledVector4(scaled); @@ -55,10 +55,10 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats [InlineData(0)] [InlineData(65535)] [InlineData(32767)] - public void Gray16_ToScaledVector4(ushort input) + public void L16_ToScaledVector4(ushort input) { // Arrange - var gray = new Gray16(input); + var gray = new L16(input); // Act Vector4 actual = gray.ToScaledVector4(); @@ -72,12 +72,12 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats } [Fact] - public void Gray16_FromVector4() + public void L16_FromVector4() { // Arrange - Gray16 gray = default; + L16 gray = default; const ushort expected = 32767; - var vector = new Gray16(expected).ToVector4(); + var vector = new L16(expected).ToVector4(); // Act gray.FromVector4(vector); @@ -91,10 +91,10 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats [InlineData(0)] [InlineData(65535)] [InlineData(32767)] - public void Gray16_ToVector4(ushort input) + public void L16_ToVector4(ushort input) { // Arrange - var gray = new Gray16(input); + var gray = new L16(input); // Act var actual = gray.ToVector4(); @@ -108,10 +108,10 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats } [Fact] - public void Gray16_FromRgba32() + public void L16_FromRgba32() { // Arrange - Gray16 gray = default; + L16 gray = default; const byte rgb = 128; ushort scaledRgb = ImageMaths.UpscaleFrom8BitTo16Bit(rgb); ushort expected = ImageMaths.Get16BitBT709Luminance(scaledRgb, scaledRgb, scaledRgb); @@ -128,11 +128,11 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats [InlineData(0)] [InlineData(65535)] [InlineData(8100)] - public void Gray16_ToRgba32(ushort input) + public void L16_ToRgba32(ushort input) { // Arrange ushort expected = ImageMaths.DownScaleFrom16BitTo8Bit(input); - var gray = new Gray16(input); + var gray = new L16(input); // Act Rgba32 actual = default; @@ -146,10 +146,10 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats } [Fact] - public void Gray16_FromBgra5551() + public void L16_FromBgra5551() { // arrange - var gray = default(Gray16); + var gray = default(L16); ushort expected = ushort.MaxValue; // act diff --git a/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs index 1f8e8a040..7f02493b4 100644 --- a/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs @@ -141,7 +141,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats Vector4 expected = Vector4.One; // act - byte4.FromGray16(new Gray16(ushort.MaxValue)); + byte4.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, byte4.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs b/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs index 90c7678d0..834bae685 100644 --- a/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs @@ -142,7 +142,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats Vector4 expected = Vector4.One; // act - byte4.FromGray16(new Gray16(ushort.MaxValue)); + byte4.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, byte4.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs b/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs index 8ce2b6b80..6a678abc7 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs @@ -69,18 +69,18 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats return; } - // L8 and Gray16 are special implementations of IPixel in that they do not conform to the + // L8 and L16 are special implementations of IPixel in that they do not conform to the // standard RGBA colorspace format and must be converted from RGBA using the special ITU BT709 algorithm. // One of the requirements of FromScaledVector4/ToScaledVector4 is that it unaware of this and // packs/unpacks the pixel without and conversion so we employ custom methods do do this. - if (typeof(TDestinationPixel) == typeof(Gray16)) + if (typeof(TDestinationPixel) == typeof(L16)) { - ref Gray16 gray16Ref = ref MemoryMarshal.GetReference( - MemoryMarshal.Cast(destinationPixels)); + ref L16 L16Ref = ref MemoryMarshal.GetReference( + MemoryMarshal.Cast(destinationPixels)); for (int i = 0; i < count; i++) { ref TSourcePixel sp = ref Unsafe.Add(ref sourceRef, i); - ref Gray16 dp = ref Unsafe.Add(ref gray16Ref, i); + ref L16 dp = ref Unsafe.Add(ref L16Ref, i); dp.ConvertFromRgbaScaledVector4(sp.ToScaledVector4()); } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.Gray16OperationsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.Gray16OperationsTests.cs index ffb1a0b02..ddcdc30bf 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.Gray16OperationsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.Gray16OperationsTests.cs @@ -10,15 +10,15 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations { public partial class PixelOperationsTests { - public class Gray16OperationsTests : PixelOperationsTests + public class L16OperationsTests : PixelOperationsTests { - public Gray16OperationsTests(ITestOutputHelper output) + public L16OperationsTests(ITestOutputHelper output) : base(output) { } [Fact] - public void IsSpecialImplementation() => Assert.IsType(PixelOperations.Instance); + public void IsSpecialImplementation() => Assert.IsType(PixelOperations.Instance); } } diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs index c52f752ec..033e7b648 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs @@ -285,7 +285,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations default(Bgra32), default(Rgb24), default(L8), - default(Gray16), + default(L16), default(Rgb48), default(Rgba64) }; @@ -803,11 +803,11 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations [Theory] [MemberData(nameof(ArraySizesData))] - public void FromGray16(int count) + public void FromL16(int count) { - Gray16[] source = CreateVector4TestData(count).Select(v => + L16[] source = CreateVector4TestData(count).Select(v => { - Gray16 g = default; + L16 g = default; g.FromVector4(v); return g; }).ToArray(); @@ -816,22 +816,22 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations for (int i = 0; i < count; i++) { - expected[i].FromGray16(source[i]); + expected[i].FromL16(source[i]); } TestOperation( source, expected, - (s, d) => Operations.FromGray16(this.Configuration, s, d.GetSpan()) + (s, d) => Operations.FromL16(this.Configuration, s, d.GetSpan()) ); } [Theory] [MemberData(nameof(ArraySizesData))] - public void ToGray16(int count) + public void ToL16(int count) { TPixel[] source = CreatePixelTestData(count); - var expected = new Gray16[count]; + var expected = new L16[count]; for (int i = 0; i < count; i++) { @@ -841,7 +841,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations TestOperation( source, expected, - (s, d) => Operations.ToGray16(this.Configuration, s, d.GetSpan()) + (s, d) => Operations.ToL16(this.Configuration, s, d.GetSpan()) ); } @@ -1016,11 +1016,11 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations // ReSharper restore PossibleNullReferenceException } } - else if (typeof(TDest) == typeof(Gray16)) + else if (typeof(TDest) == typeof(L16)) { // Minor difference is tolerated for 16 bit pixel values - Span expected = MemoryMarshal.Cast(this.ExpectedDestBuffer.AsSpan()); - Span actual = MemoryMarshal.Cast(this.ActualDestBuffer.GetSpan()); + Span expected = MemoryMarshal.Cast(this.ExpectedDestBuffer.AsSpan()); + Span actual = MemoryMarshal.Cast(this.ActualDestBuffer.GetSpan()); for (int i = 0; i < count; i++) { diff --git a/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs b/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs index 50cadb225..56cb526a4 100644 --- a/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs @@ -176,7 +176,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats uint expectedPackedValue = uint.MaxValue; // act - rgba.FromGray16(new Gray16(ushort.MaxValue)); + rgba.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expectedPackedValue, rgba.PackedValue); diff --git a/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs b/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs index 96d5ccf3c..3a2841bb3 100644 --- a/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs @@ -169,7 +169,7 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats Vector4 expected = Vector4.One; // act - rgba.FromGray16(new Gray16(ushort.MaxValue)); + rgba.FromL16(new L16(ushort.MaxValue)); // assert Assert.Equal(expected, rgba.ToScaledVector4()); diff --git a/tests/ImageSharp.Tests/TestFormat.cs b/tests/ImageSharp.Tests/TestFormat.cs index 39c4580b3..12915ab29 100644 --- a/tests/ImageSharp.Tests/TestFormat.cs +++ b/tests/ImageSharp.Tests/TestFormat.cs @@ -253,7 +253,7 @@ namespace SixLabors.ImageSharp.Tests public void FromBgr24(Bgr24 source) { } public void FromBgra32(Bgra32 source) { } public void FromL8(L8 source) { } - public void FromGray16(Gray16 source) { } + public void FromL16(L16 source) { } public void FromRgb24(Rgb24 source) { } public void FromRgba32(Rgba32 source) { } public void ToRgba32(ref Rgba32 dest) { } diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 06d8dd8b9..b48b9b690 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Tests public const string Palette8Bpp = "Png/palette-8bpp.png"; public const string Bpp1 = "Png/bpp1.png"; public const string Gray4Bpp = "Png/gray_4bpp.png"; - public const string Gray16Bit = "Png/gray-16.png"; + public const string L16Bit = "Png/gray-16.png"; public const string GrayA8Bit = "Png/gray-alpha-8.png"; public const string GrayA8BitInterlaced = "Png/rollsroyce.png"; public const string GrayAlpha1BitInterlaced = "Png/iftbbn0g01.png"; diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/MagickReferenceCodecTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/MagickReferenceCodecTests.cs index b60439b48..3b4097820 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/MagickReferenceCodecTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/MagickReferenceCodecTests.cs @@ -58,7 +58,7 @@ namespace SixLabors.ImageSharp.Tests.TestUtilities.Tests [WithBlankImages(1, 1, PixelTypesToTest48, TestImages.Png.Rgb48Bpp)] [WithBlankImages(1, 1, PixelTypesToTest48, TestImages.Png.Rgb48BppInterlaced)] [WithBlankImages(1, 1, PixelTypesToTest48, TestImages.Png.Rgb48BppTrans)] - [WithBlankImages(1, 1, PixelTypesToTest48, TestImages.Png.Gray16Bit)] + [WithBlankImages(1, 1, PixelTypesToTest48, TestImages.Png.L16Bit)] public void MagickDecode_16BitDepthImage_IsApproximatelyEquivalentTo_SystemDrawingResult(TestImageProvider dummyProvider, string testImage) where TPixel : struct, IPixel {