Browse Source

Merge pull request #13 from SixLabors/master

Latest changes from master
af/octree-no-pixelmap
Sergio Pedri 6 years ago
committed by GitHub
parent
commit
acade85294
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/ImageSharp/Advanced/AotCompilerTools.cs
  2. 6
      src/ImageSharp/Common/Helpers/ImageMaths.cs
  3. 2
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  4. 6
      src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
  5. 10
      src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs
  6. 0
      src/ImageSharp/Formats/Bmp/BmpMetadata.cs
  7. 21
      src/ImageSharp/Formats/Bmp/MetadataExtensions.cs
  8. 4
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  9. 6
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs
  10. 0
      src/ImageSharp/Formats/Gif/GifFrameMetadata.cs
  11. 0
      src/ImageSharp/Formats/Gif/GifMetadata.cs
  12. 28
      src/ImageSharp/Formats/Gif/MetadataExtensions.cs
  13. 7
      src/ImageSharp/Formats/IImageDecoder.cs
  14. 11
      src/ImageSharp/Formats/Jpeg/JpegDecoder.cs
  15. 59
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
  16. 2
      src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
  17. 0
      src/ImageSharp/Formats/Jpeg/JpegMetadata.cs
  18. 21
      src/ImageSharp/Formats/Jpeg/MetadataExtensions.cs
  19. 21
      src/ImageSharp/Formats/Png/MetadataExtensions.cs
  20. 16
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  21. 22
      src/ImageSharp/Formats/Png/PngEncoderCore.cs
  22. 8
      src/ImageSharp/Formats/Png/PngMetadata.cs
  23. 111
      src/ImageSharp/Formats/Png/PngScanlineProcessor.cs
  24. 21
      src/ImageSharp/Formats/Tga/MetadataExtensions.cs
  25. 8
      src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
  26. 4
      src/ImageSharp/Formats/Tga/TgaEncoderCore.cs
  27. 4
      src/ImageSharp/Formats/Tga/TgaImageFormatDetector.cs
  28. 34
      src/ImageSharp/Image.Decode.cs
  29. 30
      src/ImageSharp/Image.FromBytes.cs
  30. 22
      src/ImageSharp/Image.FromFile.cs
  31. 45
      src/ImageSharp/Image.FromStream.cs
  32. 45
      src/ImageSharp/ImageSharp.csproj
  33. 0
      src/ImageSharp/Metadata/FrameDecodingMode.cs
  34. 0
      src/ImageSharp/Metadata/ImageFrameMetadata.cs
  35. 0
      src/ImageSharp/Metadata/ImageMetadata.cs
  36. 0
      src/ImageSharp/Metadata/PixelResolutionUnit.cs
  37. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifConstants.cs
  38. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifDataType.cs
  39. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifParts.cs
  40. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs
  41. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
  42. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifTag.cs
  43. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifTagDescriptionAttribute.cs
  44. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifTags.cs
  45. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifValue.cs
  46. 0
      src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs
  47. 0
      src/ImageSharp/Metadata/Profiles/Exif/README.md
  48. 0
      src/ImageSharp/Metadata/Profiles/ICC/Curves/IccCurveSegment.cs
  49. 0
      src/ImageSharp/Metadata/Profiles/ICC/Curves/IccFormulaCurveElement.cs
  50. 0
      src/ImageSharp/Metadata/Profiles/ICC/Curves/IccOneDimensionalCurve.cs
  51. 0
      src/ImageSharp/Metadata/Profiles/ICC/Curves/IccParametricCurve.cs
  52. 0
      src/ImageSharp/Metadata/Profiles/ICC/Curves/IccResponseCurve.cs
  53. 0
      src/ImageSharp/Metadata/Profiles/ICC/Curves/IccSampledCurveElement.cs
  54. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs
  55. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Lut.cs
  56. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Matrix.cs
  57. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs
  58. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs
  59. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Primitives.cs
  60. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs
  61. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.cs
  62. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs
  63. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Lut.cs
  64. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs
  65. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs
  66. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs
  67. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Primitives.cs
  68. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs
  69. 0
      src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs
  70. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccClutDataType.cs
  71. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccColorSpaceType.cs
  72. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccColorantEncoding.cs
  73. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccCurveMeasurementEncodings.cs
  74. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccCurveSegmentSignature.cs
  75. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccDataType.cs
  76. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccDeviceAttribute.cs
  77. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccFormulaCurveType.cs
  78. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccMeasurementGeometry.cs
  79. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccMultiProcessElementSignature.cs
  80. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccParametricCurveType.cs
  81. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccPrimaryPlatformType.cs
  82. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccProfileClass.cs
  83. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccProfileFlag.cs
  84. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccProfileTag.cs
  85. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccRenderingIntent.cs
  86. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccScreeningFlag.cs
  87. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccScreeningSpotType.cs
  88. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccSignatureName.cs
  89. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccStandardIlluminant.cs
  90. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccStandardObserver.cs
  91. 0
      src/ImageSharp/Metadata/Profiles/ICC/Enums/IccTypeSignature.cs
  92. 0
      src/ImageSharp/Metadata/Profiles/ICC/Exceptions/InvalidIccProfileException.cs
  93. 0
      src/ImageSharp/Metadata/Profiles/ICC/IccProfile.cs
  94. 0
      src/ImageSharp/Metadata/Profiles/ICC/IccProfileHeader.cs
  95. 0
      src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs
  96. 0
      src/ImageSharp/Metadata/Profiles/ICC/IccTagDataEntry.cs
  97. 0
      src/ImageSharp/Metadata/Profiles/ICC/IccWriter.cs
  98. 0
      src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccBAcsProcessElement.cs
  99. 0
      src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccClutProcessElement.cs
  100. 0
      src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs

8
src/ImageSharp/Advanced/AotCompilerTools.cs

@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.Advanced
/// </summary>
private static void SeedEverything()
{
Seed<Alpha8>();
Seed<A8>();
Seed<Argb32>();
Seed<Bgr24>();
Seed<Bgr565>();
@ -48,8 +48,10 @@ namespace SixLabors.ImageSharp.Advanced
Seed<Bgra4444>();
Seed<Bgra5551>();
Seed<Byte4>();
Seed<Gray16>();
Seed<Gray8>();
Seed<L16>();
Seed<L8>();
Seed<La16>();
Seed<La32>();
Seed<HalfSingle>();
Seed<HalfVector2>();
Seed<HalfVector4>();

6
src/ImageSharp/Common/Helpers/ImageMaths.cs

@ -38,7 +38,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="byte"/>.</returns>
[MethodImpl(InliningOptions.ShortMethod)]
public static byte Get8BitBT709Luminance(byte r, byte g, byte b) =>
(byte)((r * .2126F) + (g * .7152F) + (b * .0722F) + 0.5f);
(byte)((r * .2126F) + (g * .7152F) + (b * .0722F) + 0.5F);
/// <summary>
/// Gets the luminance from the rgb components using the formula as specified by ITU-R Recommendation BT.709.
@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="ushort"/>.</returns>
[MethodImpl(InliningOptions.ShortMethod)]
public static ushort Get16BitBT709Luminance(ushort r, ushort g, ushort b) =>
(ushort)((r * .2126F) + (g * .7152F) + (b * .0722F));
(ushort)((r * .2126F) + (g * .7152F) + (b * .0722F) + 0.5F);
/// <summary>
/// Gets the luminance from the rgb components using the formula as specified by ITU-R Recommendation BT.709.
@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp
/// <returns>The <see cref="ushort"/>.</returns>
[MethodImpl(InliningOptions.ShortMethod)]
public static ushort Get16BitBT709Luminance(float r, float g, float b) =>
(ushort)((r * .2126F) + (g * .7152F) + (b * .0722F));
(ushort)((r * .2126F) + (g * .7152F) + (b * .0722F) + 0.5F);
/// <summary>
/// Scales a value from a 16 bit <see cref="ushort"/> to it's 8 bit <see cref="byte"/> equivalent.

2
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -1321,7 +1321,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
this.metadata = meta;
short bitsPerPixel = this.infoHeader.BitsPerPixel;
this.bmpMetadata = this.metadata.GetFormatMetadata(BmpFormat.Instance);
this.bmpMetadata = this.metadata.GetBmpMetadata();
this.bmpMetadata.InfoHeaderType = infoHeaderType;
// We can only encode at these bit rates so far (1 bit and 4 bit are still missing).

6
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
this.configuration = image.GetConfiguration();
ImageMetadata metadata = image.Metadata;
BmpMetadata bmpMetadata = metadata.GetFormatMetadata(BmpFormat.Instance);
BmpMetadata bmpMetadata = metadata.GetBmpMetadata();
this.bitsPerPixel = this.bitsPerPixel ?? bmpMetadata.BitsPerPixel;
short bpp = (short)this.bitsPerPixel;
@ -315,11 +315,11 @@ namespace SixLabors.ImageSharp.Formats.Bmp
private void Write8Bit<TPixel>(Stream stream, ImageFrame<TPixel> image)
where TPixel : struct, IPixel<TPixel>
{
bool isGray8 = typeof(TPixel) == typeof(Gray8);
bool isL8 = typeof(TPixel) == typeof(L8);
using (IMemoryOwner<byte> colorPaletteBuffer = this.memoryAllocator.AllocateManagedByteBuffer(ColorPaletteSize8Bit, AllocationOptions.Clean))
{
Span<byte> colorPalette = colorPaletteBuffer.GetSpan();
if (isGray8)
if (isL8)
{
this.Write8BitGray(stream, image, colorPalette);
}

10
src/ImageSharp/Formats/Bmp/BmpImageFormatDetector.cs

@ -22,9 +22,13 @@ namespace SixLabors.ImageSharp.Formats.Bmp
private bool IsSupportedFileFormat(ReadOnlySpan<byte> header)
{
short fileTypeMarker = BinaryPrimitives.ReadInt16LittleEndian(header);
return header.Length >= this.HeaderSize &&
(fileTypeMarker == BmpConstants.TypeMarkers.Bitmap || fileTypeMarker == BmpConstants.TypeMarkers.BitmapArray);
if (header.Length >= this.HeaderSize)
{
short fileTypeMarker = BinaryPrimitives.ReadInt16LittleEndian(header);
return fileTypeMarker == BmpConstants.TypeMarkers.Bitmap || fileTypeMarker == BmpConstants.TypeMarkers.BitmapArray;
}
return false;
}
}
}

0
src/ImageSharp/Formats/Bmp/BmpMetaData.cs → src/ImageSharp/Formats/Bmp/BmpMetadata.cs

21
src/ImageSharp/Formats/Bmp/MetadataExtensions.cs

@ -0,0 +1,21 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Formats.Bmp;
using SixLabors.ImageSharp.Metadata;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Extension methods for the <see cref="ImageMetadata"/> type.
/// </summary>
public static partial class MetadataExtensions
{
/// <summary>
/// Gets the bmp format specific metadata for the image.
/// </summary>
/// <param name="metadata">The metadata this method extends.</param>
/// <returns>The <see cref="BmpMetadata"/>.</returns>
public static BmpMetadata GetBmpMetadata(this ImageMetadata metadata) => metadata.GetFormatMetadata(BmpFormat.Instance);
}
}

4
src/ImageSharp/Formats/Gif/GifDecoderCore.cs

@ -553,7 +553,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void SetFrameMetadata(ImageFrameMetadata meta)
{
GifFrameMetadata gifMeta = meta.GetFormatMetadata(GifFormat.Instance);
GifFrameMetadata gifMeta = meta.GetGifMetadata();
if (this.graphicsControlExtension.DelayTime > 0)
{
gifMeta.FrameDelay = this.graphicsControlExtension.DelayTime;
@ -615,7 +615,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
}
this.metadata = meta;
this.gifMetadata = meta.GetFormatMetadata(GifFormat.Instance);
this.gifMetadata = meta.GetGifMetadata();
this.gifMetadata.ColorTableMode = this.logicalScreenDescriptor.GlobalColorTableFlag
? GifColorTableMode.Global
: GifColorTableMode.Local;

6
src/ImageSharp/Formats/Gif/GifEncoderCore.cs

@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
this.configuration = image.GetConfiguration();
ImageMetadata metadata = image.Metadata;
GifMetadata gifMetadata = metadata.GetFormatMetadata(GifFormat.Instance);
GifMetadata gifMetadata = metadata.GetGifMetadata();
this.colorTableMode = this.colorTableMode ?? gifMetadata.ColorTableMode;
bool useGlobalTable = this.colorTableMode == GifColorTableMode.Global;
@ -136,7 +136,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
{
ImageFrame<TPixel> frame = image.Frames[i];
ImageFrameMetadata metadata = frame.Metadata;
GifFrameMetadata frameMetadata = metadata.GetFormatMetadata(GifFormat.Instance);
GifFrameMetadata frameMetadata = metadata.GetGifMetadata();
this.WriteGraphicalControlExtension(frameMetadata, transparencyIndex, stream);
this.WriteImageDescriptor(frame, false, stream);
@ -166,7 +166,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
foreach (ImageFrame<TPixel> frame in image.Frames)
{
ImageFrameMetadata metadata = frame.Metadata;
GifFrameMetadata frameMetadata = metadata.GetFormatMetadata(GifFormat.Instance);
GifFrameMetadata frameMetadata = metadata.GetGifMetadata();
if (quantized is null)
{
// Allow each frame to be encoded at whatever color depth the frame designates if set.

0
src/ImageSharp/Formats/Gif/GifFrameMetaData.cs → src/ImageSharp/Formats/Gif/GifFrameMetadata.cs

0
src/ImageSharp/Formats/Gif/GifMetaData.cs → src/ImageSharp/Formats/Gif/GifMetadata.cs

28
src/ImageSharp/Formats/Gif/MetadataExtensions.cs

@ -0,0 +1,28 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Formats.Gif;
using SixLabors.ImageSharp.Metadata;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Extension methods for the <see cref="ImageMetadata"/> type.
/// </summary>
public static partial class MetadataExtensions
{
/// <summary>
/// Gets the gif format specific metadata for the image.
/// </summary>
/// <param name="metadata">The metadata this method extends.</param>
/// <returns>The <see cref="GifMetadata"/>.</returns>
public static GifMetadata GetGifMetadata(this ImageMetadata metadata) => metadata.GetFormatMetadata(GifFormat.Instance);
/// <summary>
/// Gets the gif format specific metadata for the image frame.
/// </summary>
/// <param name="metadata">The metadata this method extends.</param>
/// <returns>The <see cref="GifFrameMetadata"/>.</returns>
public static GifFrameMetadata GetGifMetadata(this ImageFrameMetadata metadata) => metadata.GetFormatMetadata(GifFormat.Instance);
}
}

7
src/ImageSharp/Formats/IImageDecoder.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.IO;
@ -17,17 +17,16 @@ namespace SixLabors.ImageSharp.Formats
/// <typeparam name="TPixel">The pixel format.</typeparam>
/// <param name="configuration">The configuration for the image.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <returns>The decoded image of a given pixel type.</returns>
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
Image<TPixel> Decode<TPixel>(Configuration configuration, Stream stream)
where TPixel : struct, IPixel<TPixel>;
/// <summary>
/// Decodes the image from the specified stream to an <see cref="Image"/>.
/// The decoder is free to choose the pixel type.
/// </summary>
/// <param name="configuration">The configuration for the image.</param>
/// <param name="stream">The <see cref="Stream"/> containing image data.</param>
/// <returns>The decoded image of a pixel type chosen by the decoder.</returns>
/// <returns>The <see cref="Image"/>.</returns>
Image Decode(Configuration configuration, Stream stream);
}
}

11
src/ImageSharp/Formats/Jpeg/JpegDecoder.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.IO;
@ -28,6 +28,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
}
}
/// <inheritdoc />
public Image Decode(Configuration configuration, Stream stream)
=> this.Decode<Rgba32>(configuration, stream);
/// <inheritdoc/>
public IImageInfo Identify(Configuration configuration, Stream stream)
{
@ -38,8 +42,5 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
return decoder.Identify(stream);
}
}
/// <inheritdoc />
public Image Decode(Configuration configuration, Stream stream) => this.Decode<Rgba32>(configuration, stream);
}
}
}

59
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -649,48 +649,51 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
switch (quantizationTableSpec >> 4)
{
case 0:
{
// 8 bit values
if (remaining < 64)
{
// 8 bit values
if (remaining < 64)
{
done = true;
break;
}
done = true;
break;
}
this.InputStream.Read(this.temp, 0, 64);
remaining -= 64;
this.InputStream.Read(this.temp, 0, 64);
remaining -= 64;
ref Block8x8F table = ref this.QuantizationTables[tableIndex];
for (int j = 0; j < 64; j++)
{
table[j] = this.temp[j];
}
ref Block8x8F table = ref this.QuantizationTables[tableIndex];
for (int j = 0; j < 64; j++)
{
table[j] = this.temp[j];
}
}
break;
break;
case 1:
{
// 16 bit values
if (remaining < 128)
{
// 16 bit values
if (remaining < 128)
{
done = true;
break;
}
done = true;
break;
}
this.InputStream.Read(this.temp, 0, 128);
remaining -= 128;
this.InputStream.Read(this.temp, 0, 128);
remaining -= 128;
ref Block8x8F table = ref this.QuantizationTables[tableIndex];
for (int j = 0; j < 64; j++)
{
table[j] = (this.temp[2 * j] << 8) | this.temp[(2 * j) + 1];
}
ref Block8x8F table = ref this.QuantizationTables[tableIndex];
for (int j = 0; j < 64; j++)
{
table[j] = (this.temp[2 * j] << 8) | this.temp[(2 * j) + 1];
}
}
break;
break;
default:
{
JpegThrowHelper.ThrowBadQuantizationTable();
break;
}
}
if (done)

2
src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs

@ -206,7 +206,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
ImageMetadata metadata = image.Metadata;
// System.Drawing produces identical output for jpegs with a quality parameter of 0 and 1.
int qlty = (this.quality ?? metadata.GetFormatMetadata(JpegFormat.Instance).Quality).Clamp(1, 100);
int qlty = (this.quality ?? metadata.GetJpegMetadata().Quality).Clamp(1, 100);
this.subsample = this.subsample ?? (qlty >= 91 ? JpegSubsample.Ratio444 : JpegSubsample.Ratio420);
// Convert from a quality rating to a scaling factor.

0
src/ImageSharp/Formats/Jpeg/JpegMetaData.cs → src/ImageSharp/Formats/Jpeg/JpegMetadata.cs

21
src/ImageSharp/Formats/Jpeg/MetadataExtensions.cs

@ -0,0 +1,21 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Metadata;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Extension methods for the <see cref="ImageMetadata"/> type.
/// </summary>
public static partial class MetadataExtensions
{
/// <summary>
/// Gets the jpeg format specific metadata for the image.
/// </summary>
/// <param name="metadata">The metadata this method extends.</param>
/// <returns>The <see cref="JpegMetadata"/>.</returns>
public static JpegMetadata GetJpegMetadata(this ImageMetadata metadata) => metadata.GetFormatMetadata(JpegFormat.Instance);
}
}

21
src/ImageSharp/Formats/Png/MetadataExtensions.cs

@ -0,0 +1,21 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Metadata;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Extension methods for the <see cref="ImageMetadata"/> type.
/// </summary>
public static partial class MetadataExtensions
{
/// <summary>
/// Gets the png format specific metadata for the image.
/// </summary>
/// <param name="metadata">The metadata this method extends.</param>
/// <returns>The <see cref="PngMetadata"/>.</returns>
public static PngMetadata GetPngMetadata(this ImageMetadata metadata) => metadata.GetFormatMetadata(PngFormat.Instance);
}
}

16
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -149,7 +149,7 @@ namespace SixLabors.ImageSharp.Formats.Png
where TPixel : struct, IPixel<TPixel>
{
var metadata = new ImageMetadata();
PngMetadata pngMetadata = metadata.GetFormatMetadata(PngFormat.Instance);
PngMetadata pngMetadata = metadata.GetPngMetadata();
this.currentStream = stream;
this.currentStream.Skip(8);
Image<TPixel> image = null;
@ -240,7 +240,7 @@ namespace SixLabors.ImageSharp.Formats.Png
public IImageInfo Identify(Stream stream)
{
var metadata = new ImageMetadata();
PngMetadata pngMetadata = metadata.GetFormatMetadata(PngFormat.Instance);
PngMetadata pngMetadata = metadata.GetPngMetadata();
this.currentStream = stream;
this.currentStream.Skip(8);
try
@ -658,8 +658,8 @@ namespace SixLabors.ImageSharp.Formats.Png
scanlineSpan,
rowSpan,
pngMetadata.HasTransparency,
pngMetadata.TransparentGray16.GetValueOrDefault(),
pngMetadata.TransparentGray8.GetValueOrDefault());
pngMetadata.TransparentL16.GetValueOrDefault(),
pngMetadata.TransparentL8.GetValueOrDefault());
break;
@ -742,8 +742,8 @@ namespace SixLabors.ImageSharp.Formats.Png
pixelOffset,
increment,
pngMetadata.HasTransparency,
pngMetadata.TransparentGray16.GetValueOrDefault(),
pngMetadata.TransparentGray8.GetValueOrDefault());
pngMetadata.TransparentL16.GetValueOrDefault(),
pngMetadata.TransparentL8.GetValueOrDefault());
break;
@ -837,11 +837,11 @@ 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
{
pngMetadata.TransparentGray8 = new Gray8(ReadByteLittleEndian(alpha, 0));
pngMetadata.TransparentL8 = new L8(ReadByteLittleEndian(alpha, 0));
}
pngMetadata.HasTransparency = true;

22
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -199,16 +199,16 @@ namespace SixLabors.ImageSharp.Formats.Png
if (this.use16Bit)
{
// 16 bit grayscale
using (IMemoryOwner<Gray16> luminanceBuffer = this.memoryAllocator.Allocate<Gray16>(rowSpan.Length))
using (IMemoryOwner<L16> luminanceBuffer = this.memoryAllocator.Allocate<L16>(rowSpan.Length))
{
Span<Gray16> luminanceSpan = luminanceBuffer.GetSpan();
ref Gray16 luminanceRef = ref MemoryMarshal.GetReference(luminanceSpan);
PixelOperations<TPixel>.Instance.ToGray16(this.configuration, rowSpan, luminanceSpan);
Span<L16> luminanceSpan = luminanceBuffer.GetSpan();
ref L16 luminanceRef = ref MemoryMarshal.GetReference(luminanceSpan);
PixelOperations<TPixel>.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);
}
}
@ -218,7 +218,7 @@ namespace SixLabors.ImageSharp.Formats.Png
if (this.bitDepth == 8)
{
// 8 bit grayscale
PixelOperations<TPixel>.Instance.ToGray8Bytes(
PixelOperations<TPixel>.Instance.ToL8Bytes(
this.configuration,
rowSpan,
rawScanlineSpan,
@ -235,7 +235,7 @@ namespace SixLabors.ImageSharp.Formats.Png
Span<byte> tempSpan = temp.GetSpan();
// We need to first create an array of luminance bytes then scale them down to the correct bit depth.
PixelOperations<TPixel>.Instance.ToGray8Bytes(
PixelOperations<TPixel>.Instance.ToL8Bytes(
this.configuration,
rowSpan,
tempSpan,
@ -761,15 +761,15 @@ 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.TransparentGray8.HasValue)
else if (pngMetadata.TransparentL8.HasValue)
{
alpha.Clear();
alpha[1] = pngMetadata.TransparentGray8.Value.PackedValue;
alpha[1] = pngMetadata.TransparentL8.Value.PackedValue;
this.WriteChunk(stream, PngChunkType.Transparency, this.chunkDataBuffer, 0, 2);
}
}

8
src/ImageSharp/Formats/Png/PngMetaData.cs → src/ImageSharp/Formats/Png/PngMetadata.cs

@ -29,8 +29,8 @@ namespace SixLabors.ImageSharp.Formats.Png
this.Gamma = other.Gamma;
this.InterlaceMethod = other.InterlaceMethod;
this.HasTransparency = other.HasTransparency;
this.TransparentGray8 = other.TransparentGray8;
this.TransparentGray16 = other.TransparentGray16;
this.TransparentL8 = other.TransparentL8;
this.TransparentL16 = other.TransparentL16;
this.TransparentRgb24 = other.TransparentRgb24;
this.TransparentRgb48 = other.TransparentRgb48;
@ -77,13 +77,13 @@ namespace SixLabors.ImageSharp.Formats.Png
/// Gets or sets the 8 bit grayscale transparent color.
/// This represents any color in an 8 bit grayscale encoded png that should be transparent.
/// </summary>
public Gray8? TransparentGray8 { get; set; }
public L8? TransparentL8 { get; set; }
/// <summary>
/// Gets or sets the 16 bit grayscale transparent color.
/// This represents any color in a 16 bit grayscale encoded png that should be transparent.
/// </summary>
public Gray16? TransparentGray16 { get; set; }
public L16? TransparentL16 { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the image contains a transparency chunk and markers were decoded.

111
src/ImageSharp/Formats/Png/PngScanlineProcessor.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@ -20,8 +20,8 @@ namespace SixLabors.ImageSharp.Formats.Png
ReadOnlySpan<byte> scanlineSpan,
Span<TPixel> rowSpan,
bool hasTrans,
Gray16 luminance16Trans,
Gray8 luminanceTrans)
L16 luminance16Trans,
L8 luminanceTrans)
where TPixel : struct, IPixel<TPixel>
{
TPixel pixel = default;
@ -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(Unsafe.As<ushort, L16>(ref luminance));
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Formats.Png
for (int x = 0; x < header.Width; x++)
{
byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, x) * scaleFactor);
pixel.FromGray8(new Gray8(luminance));
pixel.FromL8(Unsafe.As<byte, L8>(ref luminance));
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -55,32 +55,28 @@ namespace SixLabors.ImageSharp.Formats.Png
if (header.BitDepth == 16)
{
Rgba64 rgba64 = default;
La32 source = default;
for (int x = 0, o = 0; x < header.Width; x++, o += 2)
{
ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
rgba64.R = luminance;
rgba64.G = luminance;
rgba64.B = luminance;
rgba64.A = luminance.Equals(luminance16Trans.PackedValue) ? ushort.MinValue : ushort.MaxValue;
source.L = luminance;
source.A = luminance.Equals(luminance16Trans.PackedValue) ? ushort.MinValue : ushort.MaxValue;
pixel.FromRgba64(rgba64);
pixel.FromLa32(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
else
{
La16 source = default;
byte scaledLuminanceTrans = (byte)(luminanceTrans.PackedValue * scaleFactor);
Rgba32 rgba32 = default;
for (int x = 0; x < header.Width; x++)
{
byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, x) * scaleFactor);
rgba32.R = luminance;
rgba32.G = luminance;
rgba32.B = luminance;
rgba32.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue;
source.L = luminance;
source.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue;
pixel.FromRgba32(rgba32);
pixel.FromLa16(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -93,8 +89,8 @@ namespace SixLabors.ImageSharp.Formats.Png
int pixelOffset,
int increment,
bool hasTrans,
Gray16 luminance16Trans,
Gray8 luminanceTrans)
L16 luminance16Trans,
L8 luminanceTrans)
where TPixel : struct, IPixel<TPixel>
{
TPixel pixel = default;
@ -109,7 +105,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(Unsafe.As<ushort, L16>(ref luminance));
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -118,7 +114,7 @@ namespace SixLabors.ImageSharp.Formats.Png
for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o++)
{
byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, o) * scaleFactor);
pixel.FromGray8(new Gray8(luminance));
pixel.FromL8(Unsafe.As<byte, L8>(ref luminance));
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -128,32 +124,28 @@ namespace SixLabors.ImageSharp.Formats.Png
if (header.BitDepth == 16)
{
Rgba64 rgba64 = default;
La32 source = default;
for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o += 2)
{
ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
rgba64.R = luminance;
rgba64.G = luminance;
rgba64.B = luminance;
rgba64.A = luminance.Equals(luminance16Trans.PackedValue) ? ushort.MinValue : ushort.MaxValue;
source.L = luminance;
source.A = luminance.Equals(luminance16Trans.PackedValue) ? ushort.MinValue : ushort.MaxValue;
pixel.FromRgba64(rgba64);
pixel.FromLa32(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
else
{
La16 source = default;
byte scaledLuminanceTrans = (byte)(luminanceTrans.PackedValue * scaleFactor);
Rgba32 rgba32 = default;
for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o++)
{
byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, o) * scaleFactor);
rgba32.R = luminance;
rgba32.G = luminance;
rgba32.B = luminance;
rgba32.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue;
source.L = luminance;
source.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue;
pixel.FromRgba32(rgba32);
pixel.FromLa16(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -173,35 +165,26 @@ namespace SixLabors.ImageSharp.Formats.Png
if (header.BitDepth == 16)
{
Rgba64 rgba64 = default;
La32 source = default;
for (int x = 0, o = 0; x < header.Width; x++, o += 4)
{
ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
ushort alpha = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2));
rgba64.R = luminance;
rgba64.G = luminance;
rgba64.B = luminance;
rgba64.A = alpha;
source.L = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
source.A = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2));
pixel.FromRgba64(rgba64);
pixel.FromLa32(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
else
{
Rgba32 rgba32 = default;
La16 source = default;
for (int x = 0; x < header.Width; x++)
{
int offset = x * bytesPerPixel;
byte luminance = Unsafe.Add(ref scanlineSpanRef, offset);
byte alpha = Unsafe.Add(ref scanlineSpanRef, offset + bytesPerSample);
rgba32.R = luminance;
rgba32.G = luminance;
rgba32.B = luminance;
rgba32.A = alpha;
source.L = Unsafe.Add(ref scanlineSpanRef, offset);
source.A = Unsafe.Add(ref scanlineSpanRef, offset + bytesPerSample);
pixel.FromRgba32(rgba32);
pixel.FromLa16(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
@ -223,34 +206,26 @@ namespace SixLabors.ImageSharp.Formats.Png
if (header.BitDepth == 16)
{
Rgba64 rgba64 = default;
La32 source = default;
for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o += 4)
{
ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
ushort alpha = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2));
rgba64.R = luminance;
rgba64.G = luminance;
rgba64.B = luminance;
rgba64.A = alpha;
source.L = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2));
source.A = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2));
pixel.FromRgba64(rgba64);
pixel.FromLa32(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
}
}
else
{
Rgba32 rgba32 = default;
int offset = 0;
La16 source = default;
for (int x = pixelOffset; x < header.Width; x += increment)
{
byte luminance = Unsafe.Add(ref scanlineSpanRef, offset);
byte alpha = Unsafe.Add(ref scanlineSpanRef, offset + bytesPerSample);
rgba32.R = luminance;
rgba32.G = luminance;
rgba32.B = luminance;
rgba32.A = alpha;
source.L = Unsafe.Add(ref scanlineSpanRef, offset);
source.A = Unsafe.Add(ref scanlineSpanRef, offset + bytesPerSample);
pixel.FromRgba32(rgba32);
pixel.FromLa16(source);
Unsafe.Add(ref rowSpanRef, x) = pixel;
offset += bytesPerPixel;
}
@ -403,12 +378,12 @@ namespace SixLabors.ImageSharp.Formats.Png
}
else
{
Rgba32 rgba32 = default;
ReadOnlySpan<Rgb24> rgb24Span = MemoryMarshal.Cast<byte, Rgb24>(scanlineSpan);
ref Rgb24 rgb24SpanRef = ref MemoryMarshal.GetReference(rgb24Span);
for (int x = 0; x < header.Width; x++)
{
ref readonly Rgb24 rgb24 = ref Unsafe.Add(ref rgb24SpanRef, x);
Rgba32 rgba32 = default;
rgba32.Rgb = rgb24;
rgba32.A = rgb24.Equals(rgb24Trans) ? byte.MinValue : byte.MaxValue;
@ -576,4 +551,4 @@ namespace SixLabors.ImageSharp.Formats.Png
}
}
}
}
}

21
src/ImageSharp/Formats/Tga/MetadataExtensions.cs

@ -0,0 +1,21 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Formats.Tga;
using SixLabors.ImageSharp.Metadata;
namespace SixLabors.ImageSharp
{
/// <summary>
/// Extension methods for the <see cref="ImageMetadata"/> type.
/// </summary>
public static partial class MetadataExtensions
{
/// <summary>
/// Gets the tga format specific metadata for the image.
/// </summary>
/// <param name="metadata">The metadata this method extends.</param>
/// <returns>The <see cref="TgaMetadata"/>.</returns>
public static TgaMetadata GetTgaMetadata(this ImageMetadata metadata) => metadata.GetFormatMetadata(TgaFormat.Instance);
}
}

8
src/ImageSharp/Formats/Tga/TgaDecoderCore.cs

@ -301,7 +301,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
switch (colorMapPixelSizeInBytes)
{
case 1:
color.FromGray8(Unsafe.As<byte, Gray8>(ref palette[bufferSpan[idx] * colorMapPixelSizeInBytes]));
color.FromL8(Unsafe.As<byte, L8>(ref palette[bufferSpan[idx] * colorMapPixelSizeInBytes]));
break;
case 2:
// Set alpha value to 1, to treat it as opaque for Bgra5551.
@ -341,7 +341,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
this.currentStream.Read(row);
int newY = Invert(y, height, inverted);
Span<TPixel> pixelSpan = pixels.GetRowSpan(newY);
PixelOperations<TPixel>.Instance.FromGray8Bytes(
PixelOperations<TPixel>.Instance.FromL8Bytes(
this.configuration,
row.GetSpan(),
pixelSpan,
@ -467,7 +467,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
switch (bytesPerPixel)
{
case 1:
color.FromGray8(Unsafe.As<byte, Gray8>(ref bufferSpan[idx]));
color.FromL8(Unsafe.As<byte, L8>(ref bufferSpan[idx]));
break;
case 2:
// Set alpha value to 1, to treat it as opaque for Bgra5551.
@ -573,7 +573,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
this.currentStream.Read(buffer, 0, TgaFileHeader.Size);
this.fileHeader = TgaFileHeader.Parse(buffer);
this.metadata = new ImageMetadata();
this.tgaMetadata = this.metadata.GetFormatMetadata(TgaFormat.Instance);
this.tgaMetadata = this.metadata.GetTgaMetadata();
this.tgaMetadata.BitsPerPixel = (TgaBitsPerPixel)this.fileHeader.PixelDepth;
// Bit at position 5 of the descriptor indicates, that the origin is top left instead of bottom right.

4
src/ImageSharp/Formats/Tga/TgaEncoderCore.cs

@ -71,7 +71,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
this.configuration = image.GetConfiguration();
ImageMetadata metadata = image.Metadata;
TgaMetadata tgaMetadata = metadata.GetFormatMetadata(TgaFormat.Instance);
TgaMetadata tgaMetadata = metadata.GetTgaMetadata();
this.bitsPerPixel = this.bitsPerPixel ?? tgaMetadata.BitsPerPixel;
TgaImageType imageType = this.compression is TgaCompression.RunLength ? TgaImageType.RleTrueColor : TgaImageType.TrueColor;
@ -251,7 +251,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
for (int y = pixels.Height - 1; y >= 0; y--)
{
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
PixelOperations<TPixel>.Instance.ToGray8Bytes(
PixelOperations<TPixel>.Instance.ToL8Bytes(
this.configuration,
pixelSpan,
row.GetSpan(),

4
src/ImageSharp/Formats/Tga/TgaImageFormatDetector.cs

@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
{
if (header.Length >= this.HeaderSize)
{
// There is no magick bytes in a tga file, so at least the image type
// There are no magic bytes in a tga file, so at least the image type
// and the colormap type in the header will be checked for a valid value.
if (header[1] != 0 && header[1] != 1)
{
@ -34,7 +34,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
return imageType.IsValid();
}
return true;
return false;
}
}
}

34
src/ImageSharp/Image.Decode.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.IO;
using System.Linq;
using SixLabors.ImageSharp.Formats;
@ -47,19 +48,26 @@ namespace SixLabors.ImageSharp
/// <returns>The mime type or null if none found.</returns>
private static IImageFormat InternalDetectFormat(Stream stream, Configuration config)
{
// This is probably a candidate for making into a public API in the future!
int maxHeaderSize = config.MaxHeaderSize;
if (maxHeaderSize <= 0)
// We take a minimum of the stream length vs the max header size and always check below
// to ensure that only formats that headers fit within the given buffer length are tested.
int headerSize = (int)Math.Min(config.MaxHeaderSize, stream.Length);
if (headerSize <= 0)
{
return null;
}
using (IManagedByteBuffer buffer = config.MemoryAllocator.AllocateManagedByteBuffer(maxHeaderSize, AllocationOptions.Clean))
using (IManagedByteBuffer buffer = config.MemoryAllocator.AllocateManagedByteBuffer(headerSize, AllocationOptions.Clean))
{
long startPosition = stream.Position;
stream.Read(buffer.Array, 0, maxHeaderSize);
stream.Read(buffer.Array, 0, headerSize);
stream.Position = startPosition;
return config.ImageFormatsManager.FormatDetectors.Select(x => x.DetectFormat(buffer.GetSpan())).LastOrDefault(x => x != null);
// Does the given stream contain enough data to fit in the header for the format
// and does that data match the format specification?
// Individual formats should still check since they are public.
return config.ImageFormatsManager.FormatDetectors
.Where(x => x.HeaderSize <= headerSize)
.Select(x => x.DetectFormat(buffer.GetSpan())).LastOrDefault(x => x != null);
}
}
@ -123,10 +131,14 @@ namespace SixLabors.ImageSharp
/// <returns>
/// The <see cref="IImageInfo"/> or null if suitable info detector not found.
/// </returns>
private static IImageInfo InternalIdentity(Stream stream, Configuration config)
private static (IImageInfo info, IImageFormat format) InternalIdentity(Stream stream, Configuration config)
{
var detector = DiscoverDecoder(stream, config, out IImageFormat _) as IImageInfoDetector;
return detector?.Identify(config, stream);
if (!(DiscoverDecoder(stream, config, out IImageFormat format) is IImageInfoDetector detector))
{
return (null, null);
}
return (detector?.Identify(config, stream), format);
}
}
}
}

30
src/ImageSharp/Image.FromBytes.cs

@ -270,7 +270,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="data">The byte array containing image data.</param>
/// <param name="format">The detected format.</param>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(byte[] data, out IImageFormat format) =>
Load(Configuration.Default, data, out format);
@ -279,24 +279,24 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="data">The byte array containing encoded image data.</param>
/// <param name="decoder">The decoder.</param>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(byte[] data, IImageDecoder decoder) => Load(Configuration.Default, data, decoder);
/// <summary>
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
/// Load a new instance of <see cref="Image"/> from the given encoded byte array.
/// </summary>
/// <param name="config">The config for the decoder.</param>
/// <param name="data">The byte array containing encoded image data.</param>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Configuration config, byte[] data) => Load(config, data, out _);
/// <summary>
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
/// Load a new instance of <see cref="Image"/> from the given encoded byte array.
/// </summary>
/// <param name="config">The config for the decoder.</param>
/// <param name="data">The byte array containing image data.</param>
/// <param name="decoder">The decoder.</param>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Configuration config, byte[] data, IImageDecoder decoder)
{
using (var stream = new MemoryStream(data))
@ -306,12 +306,12 @@ namespace SixLabors.ImageSharp
}
/// <summary>
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte array.
/// Load a new instance of <see cref="Image"/> from the given encoded byte array.
/// </summary>
/// <param name="config">The config for the decoder.</param>
/// <param name="data">The byte array containing image data.</param>
/// <param name="format">The mime type of the decoded image.</param>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Configuration config, byte[] data, out IImageFormat format)
{
using (var stream = new MemoryStream(data))
@ -321,10 +321,10 @@ namespace SixLabors.ImageSharp
}
/// <summary>
/// Load a new instance of <see cref="Image{Rgba32}"/> from the given encoded byte span.
/// Load a new instance of <see cref="Image"/> from the given encoded byte span.
/// </summary>
/// <param name="data">The byte span containing image data.</param>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(ReadOnlySpan<byte> data) => Load(Configuration.Default, data);
/// <summary>
@ -332,7 +332,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="data">The byte span containing image data.</param>
/// <param name="decoder">The decoder.</param>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(ReadOnlySpan<byte> data, IImageDecoder decoder) =>
Load(Configuration.Default, data, decoder);
@ -341,7 +341,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="data">The byte span containing image data.</param>
/// <param name="format">The detected format.</param>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(ReadOnlySpan<byte> data, out IImageFormat format) =>
Load(Configuration.Default, data, out format);
@ -350,7 +350,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="config">The configuration options.</param>
/// <param name="data">The byte span containing image data.</param>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Configuration config, ReadOnlySpan<byte> data) => Load(config, data, out _);
/// <summary>
@ -359,7 +359,7 @@ namespace SixLabors.ImageSharp
/// <param name="config">The Configuration.</param>
/// <param name="data">The byte span containing image data.</param>
/// <param name="decoder">The decoder.</param>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static unsafe Image Load(
Configuration config,
ReadOnlySpan<byte> data,
@ -380,7 +380,7 @@ namespace SixLabors.ImageSharp
/// <param name="config">The configuration options.</param>
/// <param name="data">The byte span containing image data.</param>
/// <param name="format">The <see cref="IImageFormat"/> of the decoded image.</param>>
/// <returns>A new <see cref="Image"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static unsafe Image Load(
Configuration config,
ReadOnlySpan<byte> data,

22
src/ImageSharp/Image.FromFile.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
@ -39,17 +39,17 @@ namespace SixLabors.ImageSharp
}
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given file.
/// Create a new instance of the <see cref="Image"/> class from the given file.
/// </summary>
/// <param name="path">The file path to the image.</param>
/// <exception cref="NotSupportedException">
/// Thrown if the stream is not readable nor seekable.
/// </exception>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(string path) => Load(Configuration.Default, path);
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given file.
/// Create a new instance of the <see cref="Image"/> class from the given file.
/// </summary>
/// <param name="path">The file path to the image.</param>
/// <param name="format">The mime type of the decoded image.</param>
@ -60,18 +60,18 @@ namespace SixLabors.ImageSharp
public static Image Load(string path, out IImageFormat format) => Load(Configuration.Default, path, out format);
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given file.
/// Create a new instance of the <see cref="Image"/> class from the given file.
/// </summary>
/// <param name="config">The config for the decoder.</param>
/// <param name="path">The file path to the image.</param>
/// <exception cref="NotSupportedException">
/// Thrown if the stream is not readable nor seekable.
/// </exception>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Configuration config, string path) => Load(config, path, out _);
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given file.
/// Create a new instance of the <see cref="Image"/> class from the given file.
/// </summary>
/// <param name="config">The Configuration.</param>
/// <param name="path">The file path to the image.</param>
@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp
/// <exception cref="NotSupportedException">
/// Thrown if the stream is not readable nor seekable.
/// </exception>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Configuration config, string path, IImageDecoder decoder)
{
using (Stream stream = config.FileSystem.OpenRead(path))
@ -89,14 +89,14 @@ namespace SixLabors.ImageSharp
}
/// <summary>
/// Create a new instance of the <see cref="Image{Rgba32}"/> class from the given file.
/// Create a new instance of the <see cref="Image"/> class from the given file.
/// </summary>
/// <param name="path">The file path to the image.</param>
/// <param name="decoder">The decoder.</param>
/// <exception cref="NotSupportedException">
/// Thrown if the stream is not readable nor seekable.
/// </exception>
/// <returns>A new <see cref="Image{Rgba32}"/>.</returns>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(string path, IImageDecoder decoder) => Load(Configuration.Default, path, decoder);
/// <summary>
@ -224,4 +224,4 @@ namespace SixLabors.ImageSharp
}
}
}
}
}

45
src/ImageSharp/Image.FromStream.cs

@ -16,20 +16,20 @@ namespace SixLabors.ImageSharp
public abstract partial class Image
{
/// <summary>
/// By reading the header on the provided stream this calculates the images mime type.
/// By reading the header on the provided stream this calculates the images format type.
/// </summary>
/// <param name="stream">The image stream to read the header from.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <returns>The mime type or null if none found.</returns>
/// <returns>The format type or null if none found.</returns>
public static IImageFormat DetectFormat(Stream stream) => DetectFormat(Configuration.Default, stream);
/// <summary>
/// By reading the header on the provided stream this calculates the images mime type.
/// By reading the header on the provided stream this calculates the images format type.
/// </summary>
/// <param name="config">The configuration.</param>
/// <param name="stream">The image stream to read the header from.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <returns>The mime type or null if none found.</returns>
/// <returns>The format type or null if none found.</returns>
public static IImageFormat DetectFormat(Configuration config, Stream stream)
=> WithSeekableStream(config, stream, s => InternalDetectFormat(s, config));
@ -41,29 +41,46 @@ namespace SixLabors.ImageSharp
/// <returns>
/// The <see cref="IImageInfo"/> or null if suitable info detector not found.
/// </returns>
public static IImageInfo Identify(Stream stream) => Identify(Configuration.Default, stream);
public static IImageInfo Identify(Stream stream) => Identify(stream, out IImageFormat _);
/// <summary>
/// By reading the header on the provided stream this reads the raw image information.
/// </summary>
/// <param name="stream">The image stream to read the header from.</param>
/// <param name="format">The format type of the decoded image.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <returns>
/// The <see cref="IImageInfo"/> or null if suitable info detector not found.
/// </returns>
public static IImageInfo Identify(Stream stream, out IImageFormat format) => Identify(Configuration.Default, stream, out format);
/// <summary>
/// Reads the raw image information from the specified stream without fully decoding it.
/// </summary>
/// <param name="config">The configuration.</param>
/// <param name="stream">The image stream to read the information from.</param>
/// <param name="format">The format type of the decoded image.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <returns>
/// The <see cref="IImageInfo"/> or null if suitable info detector is not found.
/// </returns>
public static IImageInfo Identify(Configuration config, Stream stream)
=> WithSeekableStream(config, stream, s => InternalIdentity(s, config ?? Configuration.Default));
public static IImageInfo Identify(Configuration config, Stream stream, out IImageFormat format)
{
(IImageInfo info, IImageFormat format) data = WithSeekableStream(config, stream, s => InternalIdentity(s, config ?? Configuration.Default));
format = data.format;
return data.info;
}
/// <summary>
/// Decode a new instance of the <see cref="Image"/> class from the given stream.
/// The pixel format is selected by the decoder.
/// </summary>
/// <param name="stream">The stream containing image information.</param>
/// <param name="format">the mime type of the decoded image.</param>
/// <param name="format">The format type of the decoded image.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <exception cref="UnknownImageFormatException">Image cannot be loaded.</exception>
/// <returns>A new <see cref="Image"/>.</returns>>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Stream stream, out IImageFormat format) => Load(Configuration.Default, stream, out format);
/// <summary>
@ -73,7 +90,7 @@ namespace SixLabors.ImageSharp
/// <param name="stream">The stream containing image information.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <exception cref="UnknownImageFormatException">Image cannot be loaded.</exception>
/// <returns>A new <see cref="Image"/>.</returns>>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Stream stream) => Load(Configuration.Default, stream);
/// <summary>
@ -84,7 +101,7 @@ namespace SixLabors.ImageSharp
/// <param name="decoder">The decoder.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <exception cref="UnknownImageFormatException">Image cannot be loaded.</exception>
/// <returns>A new <see cref="Image"/>.</returns>>
/// <returns>The <see cref="Image"/>.</returns>
public static Image Load(Stream stream, IImageDecoder decoder) => Load(Configuration.Default, stream, decoder);
/// <summary>
@ -126,7 +143,7 @@ namespace SixLabors.ImageSharp
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given stream.
/// </summary>
/// <param name="stream">The stream containing image information.</param>
/// <param name="format">the mime type of the decoded image.</param>
/// <param name="format">The format type of the decoded image.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <exception cref="UnknownImageFormatException">Image cannot be loaded.</exception>
/// <typeparam name="TPixel">The pixel format.</typeparam>
@ -180,7 +197,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="config">The configuration options.</param>
/// <param name="stream">The stream containing image information.</param>
/// <param name="format">the mime type of the decoded image.</param>
/// <param name="format">The format type of the decoded image.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <exception cref="UnknownImageFormatException">Image cannot be loaded.</exception>
/// <typeparam name="TPixel">The pixel format.</typeparam>
@ -215,7 +232,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="config">The configuration options.</param>
/// <param name="stream">The stream containing image information.</param>
/// <param name="format">the mime type of the decoded image.</param>
/// <param name="format">The format type of the decoded image.</param>
/// <exception cref="NotSupportedException">Thrown if the stream is not readable.</exception>
/// <exception cref="UnknownImageFormatException">Image cannot be loaded.</exception>
/// <returns>A new <see cref="Image{TPixel}"/>.</returns>

45
src/ImageSharp/ImageSharp.csproj

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
@ -76,15 +76,30 @@
<AutoGen>True</AutoGen>
<DependentUpon>Bgra32.PixelOperations.Generated.tt</DependentUpon>
</Compile>
<Compile Update="PixelFormats\PixelImplementations\Generated\Gray8.PixelOperations.Generated.cs">
<Compile Update="PixelFormats\PixelImplementations\Generated\Bgra5551.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Gray8.PixelOperations.Generated.tt</DependentUpon>
<DependentUpon>Bgra5551.PixelOperations.Generated.tt</DependentUpon>
</Compile>
<Compile Update="PixelFormats\PixelImplementations\Generated\Gray16.PixelOperations.Generated.cs">
<Compile Update="PixelFormats\PixelImplementations\Generated\L8.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Gray16.PixelOperations.Generated.tt</DependentUpon>
<DependentUpon>L8.PixelOperations.Generated.tt</DependentUpon>
</Compile>
<Compile Update="PixelFormats\PixelImplementations\Generated\L16.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>L16.PixelOperations.Generated.tt</DependentUpon>
</Compile>
<Compile Update="PixelFormats\PixelImplementations\Generated\La16.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>La16.PixelOperations.Generated.tt</DependentUpon>
</Compile>
<Compile Update="PixelFormats\PixelImplementations\Generated\La32.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>La32.PixelOperations.Generated.tt</DependentUpon>
</Compile>
<Compile Update="PixelFormats\PixelImplementations\Generated\Rgb24.PixelOperations.Generated.cs">
<DesignTime>True</DesignTime>
@ -151,13 +166,25 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Bgra32.PixelOperations.Generated.cs</LastGenOutput>
</None>
<None Update="PixelFormats\PixelImplementations\Generated\Gray8.PixelOperations.Generated.tt">
<None Update="PixelFormats\PixelImplementations\Generated\Bgra5551.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Bgra5551.PixelOperations.Generated.cs</LastGenOutput>
</None>
<None Update="PixelFormats\PixelImplementations\Generated\L8.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>L8.PixelOperations.Generated.cs</LastGenOutput>
</None>
<None Update="PixelFormats\PixelImplementations\Generated\L16.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>L16.PixelOperations.Generated.cs</LastGenOutput>
</None>
<None Update="PixelFormats\PixelImplementations\Generated\La16.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Gray8.PixelOperations.Generated.cs</LastGenOutput>
<LastGenOutput>La16.PixelOperations.Generated.cs</LastGenOutput>
</None>
<None Update="PixelFormats\PixelImplementations\Generated\Gray16.PixelOperations.Generated.tt">
<None Update="PixelFormats\PixelImplementations\Generated\La32.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Gray16.PixelOperations.Generated.cs</LastGenOutput>
<LastGenOutput>La32.PixelOperations.Generated.cs</LastGenOutput>
</None>
<None Update="PixelFormats\PixelImplementations\Generated\Rgb24.PixelOperations.Generated.tt">
<Generator>TextTemplatingFileGenerator</Generator>

0
src/ImageSharp/MetaData/FrameDecodingMode.cs → src/ImageSharp/Metadata/FrameDecodingMode.cs

0
src/ImageSharp/MetaData/ImageFrameMetaData.cs → src/ImageSharp/Metadata/ImageFrameMetadata.cs

0
src/ImageSharp/MetaData/ImageMetaData.cs → src/ImageSharp/Metadata/ImageMetadata.cs

0
src/ImageSharp/MetaData/PixelResolutionUnit.cs → src/ImageSharp/Metadata/PixelResolutionUnit.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifConstants.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifConstants.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifDataType.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifDataType.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifParts.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifParts.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifReader.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifTag.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifTag.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifTagDescriptionAttribute.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifTagDescriptionAttribute.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifTags.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifTags.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifValue.cs

0
src/ImageSharp/MetaData/Profiles/Exif/ExifWriter.cs → src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs

0
src/ImageSharp/MetaData/Profiles/Exif/README.md → src/ImageSharp/Metadata/Profiles/Exif/README.md

0
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccCurveSegment.cs → src/ImageSharp/Metadata/Profiles/ICC/Curves/IccCurveSegment.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccFormulaCurveElement.cs → src/ImageSharp/Metadata/Profiles/ICC/Curves/IccFormulaCurveElement.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccOneDimensionalCurve.cs → src/ImageSharp/Metadata/Profiles/ICC/Curves/IccOneDimensionalCurve.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccParametricCurve.cs → src/ImageSharp/Metadata/Profiles/ICC/Curves/IccParametricCurve.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccResponseCurve.cs → src/ImageSharp/Metadata/Profiles/ICC/Curves/IccResponseCurve.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Curves/IccSampledCurveElement.cs → src/ImageSharp/Metadata/Profiles/ICC/Curves/IccSampledCurveElement.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Curves.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Lut.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Lut.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Matrix.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Matrix.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.MultiProcessElement.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.NonPrimitives.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.Primitives.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Primitives.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataReader/IccDataReader.cs → src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Curves.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Lut.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Lut.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Matrix.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.MultiProcessElement.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.NonPrimitives.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.Primitives.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.Primitives.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.TagDataEntry.cs

0
src/ImageSharp/MetaData/Profiles/ICC/DataWriter/IccDataWriter.cs → src/ImageSharp/Metadata/Profiles/ICC/DataWriter/IccDataWriter.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccClutDataType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccClutDataType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccColorSpaceType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccColorSpaceType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccColorantEncoding.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccColorantEncoding.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccCurveMeasurementEncodings.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccCurveMeasurementEncodings.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccCurveSegmentSignature.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccCurveSegmentSignature.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccDataType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccDataType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccDeviceAttribute.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccDeviceAttribute.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccFormulaCurveType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccFormulaCurveType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccMeasurementGeometry.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccMeasurementGeometry.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccMultiProcessElementSignature.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccMultiProcessElementSignature.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccParametricCurveType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccParametricCurveType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccPrimaryPlatformType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccPrimaryPlatformType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccProfileClass.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccProfileClass.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccProfileFlag.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccProfileFlag.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccProfileTag.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccProfileTag.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccRenderingIntent.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccRenderingIntent.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccScreeningFlag.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccScreeningFlag.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccScreeningSpotType.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccScreeningSpotType.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccSignatureName.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccSignatureName.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccStandardIlluminant.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccStandardIlluminant.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccStandardObserver.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccStandardObserver.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Enums/IccTypeSignature.cs → src/ImageSharp/Metadata/Profiles/ICC/Enums/IccTypeSignature.cs

0
src/ImageSharp/MetaData/Profiles/ICC/Exceptions/InvalidIccProfileException.cs → src/ImageSharp/Metadata/Profiles/ICC/Exceptions/InvalidIccProfileException.cs

0
src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs → src/ImageSharp/Metadata/Profiles/ICC/IccProfile.cs

0
src/ImageSharp/MetaData/Profiles/ICC/IccProfileHeader.cs → src/ImageSharp/Metadata/Profiles/ICC/IccProfileHeader.cs

0
src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs → src/ImageSharp/Metadata/Profiles/ICC/IccReader.cs

0
src/ImageSharp/MetaData/Profiles/ICC/IccTagDataEntry.cs → src/ImageSharp/Metadata/Profiles/ICC/IccTagDataEntry.cs

0
src/ImageSharp/MetaData/Profiles/ICC/IccWriter.cs → src/ImageSharp/Metadata/Profiles/ICC/IccWriter.cs

0
src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccBAcsProcessElement.cs → src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccBAcsProcessElement.cs

0
src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccClutProcessElement.cs → src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccClutProcessElement.cs

0
src/ImageSharp/MetaData/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs → src/ImageSharp/Metadata/Profiles/ICC/MultiProcessElements/IccCurveSetProcessElement.cs

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save