Browse Source

Fix icc namespaces

pull/1567/head
Brian Popow 3 years ago
parent
commit
d229fed8a4
  1. 1
      tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs
  2. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderCurvesTests.cs
  3. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderLutTests.cs
  4. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMatrixTests.cs
  5. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMultiProcessElementTests.cs
  6. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderNonPrimitivesTests.cs
  7. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderPrimitivesTests.cs
  8. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderTagDataEntryTests.cs
  9. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs
  10. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs
  11. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests1.cs
  12. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests2.cs
  13. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterMatrixTests.cs
  14. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterMultiProcessElementTests.cs
  15. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterNonPrimitivesTests.cs
  16. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs
  17. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterTagDataEntryTests.cs
  18. 6
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterTests.cs
  19. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs
  20. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccReaderTests.cs
  21. 1
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs
  22. 307
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataClut.cs
  23. 41
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLut.cs
  24. 79
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutAB.cs
  25. 95
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutEntry.cs
  26. 85
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMatrix.cs
  27. 113
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs
  28. 123
      tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs
  29. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataArray.cs
  30. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataCurves.cs
  31. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs
  32. 4
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs
  33. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataMultiProcessElements.cs
  34. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs
  35. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataPrimitives.cs
  36. 2
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs
  37. 3
      tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs

1
tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.Metadata.cs

@ -7,6 +7,7 @@ using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Metadata.Profiles.Iptc; using SixLabors.ImageSharp.Metadata.Profiles.Iptc;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Formats.Jpg; namespace SixLabors.ImageSharp.Tests.Formats.Jpg;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderCurvesTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderLutTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMatrixTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;
@ -30,8 +31,5 @@ public class IccDataReaderMatrixTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataReader CreateReader(byte[] data) private static IccDataReader CreateReader(byte[] data) => new(data);
{
return new IccDataReader(data);
}
} }

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderMultiProcessElementTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderNonPrimitivesTests.cs

@ -3,6 +3,7 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderPrimitivesTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataReader/IccDataReaderTagDataEntryTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataReader;

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterCurvesTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -80,8 +81,5 @@ public class IccDataWriterCurvesTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new IccDataWriter();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -80,8 +81,5 @@ public class IccDataWriterLutTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new IccDataWriter();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests1.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -80,8 +81,5 @@ public class IccDataWriterLutTests1
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterLutTests2.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -80,8 +81,5 @@ public class IccDataWriterLutTests2
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterMatrixTests.cs

@ -3,6 +3,7 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -69,8 +70,5 @@ public class IccDataWriterMatrixTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterMultiProcessElementTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -56,8 +57,5 @@ public class IccDataWriterMultiProcessElementTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterNonPrimitivesTests.cs

@ -3,6 +3,7 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -117,8 +118,5 @@ public class IccDataWriterNonPrimitivesTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -112,8 +113,5 @@ public class IccDataWriterPrimitivesTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterTagDataEntryTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -404,8 +405,5 @@ public class IccDataWriterTagDataEntryTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

6
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.ICC.DataWriter;
@ -105,8 +106,5 @@ public class IccDataWriterTests
Assert.Equal(expected, output); Assert.Equal(expected, output);
} }
private static IccDataWriter CreateWriter() private static IccDataWriter CreateWriter() => new();
{
return new IccDataWriter();
}
} }

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccProfileTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Icc; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Icc;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccReaderTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Icc; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Icc;

1
tests/ImageSharp.Tests/Metadata/Profiles/ICC/IccWriterTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
using SixLabors.ImageSharp.Tests.TestDataIcc;
namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Icc; namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Icc;

307
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataClut.cs

@ -4,160 +4,159 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataClut
{ {
public class IccConversionDataClut internal static IccClut Clut3x2 = new(
{ new[]
internal static IccClut Clut3x2 = new IccClut( {
new[] new[] { 0.1f, 0.1f },
{ new[] { 0.2f, 0.2f },
new[] { 0.1f, 0.1f }, new[] { 0.3f, 0.3f },
new[] { 0.2f, 0.2f },
new[] { 0.3f, 0.3f }, new[] { 0.11f, 0.11f },
new[] { 0.21f, 0.21f },
new[] { 0.11f, 0.11f }, new[] { 0.31f, 0.31f },
new[] { 0.21f, 0.21f },
new[] { 0.31f, 0.31f }, new[] { 0.12f, 0.12f },
new[] { 0.22f, 0.22f },
new[] { 0.12f, 0.12f }, new[] { 0.32f, 0.32f },
new[] { 0.22f, 0.22f },
new[] { 0.32f, 0.32f }, new[] { 0.13f, 0.13f },
new[] { 0.23f, 0.23f },
new[] { 0.13f, 0.13f }, new[] { 0.33f, 0.33f },
new[] { 0.23f, 0.23f },
new[] { 0.33f, 0.33f }, new[] { 0.14f, 0.14f },
new[] { 0.24f, 0.24f },
new[] { 0.14f, 0.14f }, new[] { 0.34f, 0.34f },
new[] { 0.24f, 0.24f },
new[] { 0.34f, 0.34f }, new[] { 0.15f, 0.15f },
new[] { 0.25f, 0.25f },
new[] { 0.15f, 0.15f }, new[] { 0.35f, 0.35f },
new[] { 0.25f, 0.25f },
new[] { 0.35f, 0.35f }, new[] { 0.16f, 0.16f },
new[] { 0.26f, 0.26f },
new[] { 0.16f, 0.16f }, new[] { 0.36f, 0.36f },
new[] { 0.26f, 0.26f },
new[] { 0.36f, 0.36f }, new[] { 0.17f, 0.17f },
new[] { 0.27f, 0.27f },
new[] { 0.17f, 0.17f }, new[] { 0.37f, 0.37f },
new[] { 0.27f, 0.27f },
new[] { 0.37f, 0.37f }, new[] { 0.18f, 0.18f },
new[] { 0.28f, 0.28f },
new[] { 0.18f, 0.18f }, new[] { 0.38f, 0.38f },
new[] { 0.28f, 0.28f }, },
new[] { 0.38f, 0.38f }, new byte[] { 3, 3, 3 },
}, IccClutDataType.Float);
new byte[] { 3, 3, 3 },
IccClutDataType.Float); internal static IccClut Clut3x1 = new(
new[]
internal static IccClut Clut3x1 = new IccClut( {
new[] new[] { 0.10f },
{ new[] { 0.20f },
new[] { 0.10f }, new[] { 0.30f },
new[] { 0.20f },
new[] { 0.30f }, new[] { 0.11f },
new[] { 0.21f },
new[] { 0.11f }, new[] { 0.31f },
new[] { 0.21f },
new[] { 0.31f }, new[] { 0.12f },
new[] { 0.22f },
new[] { 0.12f }, new[] { 0.32f },
new[] { 0.22f },
new[] { 0.32f }, new[] { 0.13f },
new[] { 0.23f },
new[] { 0.13f }, new[] { 0.33f },
new[] { 0.23f },
new[] { 0.33f }, new[] { 0.14f },
new[] { 0.24f },
new[] { 0.14f }, new[] { 0.34f },
new[] { 0.24f },
new[] { 0.34f }, new[] { 0.15f },
new[] { 0.25f },
new[] { 0.15f }, new[] { 0.35f },
new[] { 0.25f },
new[] { 0.35f }, new[] { 0.16f },
new[] { 0.26f },
new[] { 0.16f }, new[] { 0.36f },
new[] { 0.26f },
new[] { 0.36f }, new[] { 0.17f },
new[] { 0.27f },
new[] { 0.17f }, new[] { 0.37f },
new[] { 0.27f },
new[] { 0.37f }, new[] { 0.18f },
new[] { 0.28f },
new[] { 0.18f }, new[] { 0.38f },
new[] { 0.28f }, },
new[] { 0.38f }, new byte[] { 3, 3, 3 },
}, IccClutDataType.Float);
new byte[] { 3, 3, 3 },
IccClutDataType.Float); internal static IccClut Clut2x2 = new(
new[]
internal static IccClut Clut2x2 = new IccClut(
new[]
{
new[] { 0.1f, 0.9f },
new[] { 0.2f, 0.8f },
new[] { 0.3f, 0.7f },
new[] { 0.4f, 0.6f },
new[] { 0.5f, 0.5f },
new[] { 0.6f, 0.4f },
new[] { 0.7f, 0.3f },
new[] { 0.8f, 0.2f },
new[] { 0.9f, 0.1f },
},
new byte[] { 3, 3 },
IccClutDataType.Float);
internal static IccClut Clut2x1 = new IccClut(
new[]
{
new[] { 0.1f },
new[] { 0.2f },
new[] { 0.3f },
new[] { 0.4f },
new[] { 0.5f },
new[] { 0.6f },
new[] { 0.7f },
new[] { 0.8f },
new[] { 0.9f },
},
new byte[] { 3, 3 },
IccClutDataType.Float);
internal static IccClut Clut1x2 = new IccClut(
new[]
{
new[] { 0f, 0.5f },
new[] { 0.25f, 0.75f, },
new[] { 0.5f, 1f },
},
new byte[] { 3 },
IccClutDataType.Float);
internal static IccClut Clut1x1 = new IccClut(
new[]
{
new[] { 0f },
new[] { 0.5f },
new[] { 1f },
},
new byte[] { 3 },
IccClutDataType.Float);
public static object[][] ClutConversionTestData =
{ {
new object[] { Clut3x2, new Vector4(0.75f, 0.75f, 0.75f, 0), new Vector4(0.31f, 0.31f, 0, 0) }, new[] { 0.1f, 0.9f },
new object[] { Clut3x1, new Vector4(0.2f, 0.6f, 0.8f, 0), new Vector4(0.276f, 0, 0, 0) }, new[] { 0.2f, 0.8f },
new object[] { Clut3x1, new Vector4(0.75f, 0.75f, 0.75f, 0), new Vector4(0.31f, 0, 0, 0) }, new[] { 0.3f, 0.7f },
new object[] { Clut2x2, new Vector4(0.2f, 0.6f, 0, 0), new Vector4(0.46f, 0.54f, 0, 0) },
new object[] { Clut2x2, new Vector4(0.25f, 0.75f, 0, 0), new Vector4(0.4f, 0.6f, 0, 0) }, new[] { 0.4f, 0.6f },
new object[] { Clut2x1, new Vector4(0.25f, 0.75f, 0, 0), new Vector4(0.4f, 0, 0, 0) }, new[] { 0.5f, 0.5f },
new object[] { Clut1x2, new Vector4(0.25f, 0, 0, 0), new Vector4(0.125f, 0.625f, 0, 0) }, new[] { 0.6f, 0.4f },
new object[] { Clut1x1, new Vector4(0.25f, 0, 0, 0), new Vector4(0.25f, 0, 0, 0) },
}; new[] { 0.7f, 0.3f },
} new[] { 0.8f, 0.2f },
new[] { 0.9f, 0.1f },
},
new byte[] { 3, 3 },
IccClutDataType.Float);
internal static IccClut Clut2x1 = new(
new[]
{
new[] { 0.1f },
new[] { 0.2f },
new[] { 0.3f },
new[] { 0.4f },
new[] { 0.5f },
new[] { 0.6f },
new[] { 0.7f },
new[] { 0.8f },
new[] { 0.9f },
},
new byte[] { 3, 3 },
IccClutDataType.Float);
internal static IccClut Clut1x2 = new(
new[]
{
new[] { 0f, 0.5f },
new[] { 0.25f, 0.75f, },
new[] { 0.5f, 1f },
},
new byte[] { 3 },
IccClutDataType.Float);
internal static IccClut Clut1x1 = new(
new[]
{
new[] { 0f },
new[] { 0.5f },
new[] { 1f },
},
new byte[] { 3 },
IccClutDataType.Float);
public static object[][] ClutConversionTestData =
{
new object[] { Clut3x2, new Vector4(0.75f, 0.75f, 0.75f, 0), new Vector4(0.31f, 0.31f, 0, 0) },
new object[] { Clut3x1, new Vector4(0.2f, 0.6f, 0.8f, 0), new Vector4(0.276f, 0, 0, 0) },
new object[] { Clut3x1, new Vector4(0.75f, 0.75f, 0.75f, 0), new Vector4(0.31f, 0, 0, 0) },
new object[] { Clut2x2, new Vector4(0.2f, 0.6f, 0, 0), new Vector4(0.46f, 0.54f, 0, 0) },
new object[] { Clut2x2, new Vector4(0.25f, 0.75f, 0, 0), new Vector4(0.4f, 0.6f, 0, 0) },
new object[] { Clut2x1, new Vector4(0.25f, 0.75f, 0, 0), new Vector4(0.4f, 0, 0, 0) },
new object[] { Clut1x2, new Vector4(0.25f, 0, 0, 0), new Vector4(0.125f, 0.625f, 0, 0) },
new object[] { Clut1x1, new Vector4(0.25f, 0, 0, 0), new Vector4(0.25f, 0, 0, 0) },
};
} }

41
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLut.cs

@ -1,31 +1,30 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataLut
{ {
public class IccConversionDataLut private static readonly float[] LutEven = { 0, 0.5f, 1 };
{
private static readonly float[] LutEven = { 0, 0.5f, 1 };
private static readonly float[] LutUneven = { 0, 0.7f, 1 }; private static readonly float[] LutUneven = { 0, 0.7f, 1 };
public static object[][] LutConversionTestData = public static object[][] LutConversionTestData =
{ {
new object[] { LutEven, false, 0.5f, 0.5f }, new object[] { LutEven, false, 0.5f, 0.5f },
new object[] { LutEven, false, 0.25f, 0.25f }, new object[] { LutEven, false, 0.25f, 0.25f },
new object[] { LutEven, false, 0.75f, 0.75f }, new object[] { LutEven, false, 0.75f, 0.75f },
new object[] { LutEven, true, 0.5f, 0.5f }, new object[] { LutEven, true, 0.5f, 0.5f },
new object[] { LutEven, true, 0.25f, 0.25f }, new object[] { LutEven, true, 0.25f, 0.25f },
new object[] { LutEven, true, 0.75f, 0.75f }, new object[] { LutEven, true, 0.75f, 0.75f },
new object[] { LutUneven, false, 0.1, 0.14 }, new object[] { LutUneven, false, 0.1, 0.14 },
new object[] { LutUneven, false, 0.5, 0.7 }, new object[] { LutUneven, false, 0.5, 0.7 },
new object[] { LutUneven, false, 0.75, 0.85 }, new object[] { LutUneven, false, 0.75, 0.85 },
new object[] { LutUneven, true, 0.14, 0.1 }, new object[] { LutUneven, true, 0.14, 0.1 },
new object[] { LutUneven, true, 0.7, 0.5 }, new object[] { LutUneven, true, 0.7, 0.5 },
new object[] { LutUneven, true, 0.85, 0.75 }, new object[] { LutUneven, true, 0.85, 0.75 },
}; };
}
} }

79
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutAB.cs

@ -4,48 +4,47 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataLutAB
{ {
public class IccConversionDataLutAB private static readonly IccLutAToBTagDataEntry LutAtoBSingleCurve = new(
{ new IccTagDataEntry[]
private static readonly IccLutAToBTagDataEntry LutAtoBSingleCurve = new IccLutAToBTagDataEntry( {
new IccTagDataEntry[] IccConversionDataTrc.IdentityCurve,
{ IccConversionDataTrc.IdentityCurve,
IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve
IccConversionDataTrc.IdentityCurve, },
IccConversionDataTrc.IdentityCurve null,
}, null,
null, null,
null, null,
null, null);
null,
null);
// also need: // also need:
// # CurveM + matrix // # CurveM + matrix
// # CurveA + CLUT + CurveB // # CurveA + CLUT + CurveB
// # CurveA + CLUT + CurveM + Matrix + CurveB // # CurveA + CLUT + CurveM + Matrix + CurveB
private static readonly IccLutBToATagDataEntry LutBtoASingleCurve = new IccLutBToATagDataEntry( private static readonly IccLutBToATagDataEntry LutBtoASingleCurve = new(
new IccTagDataEntry[] new IccTagDataEntry[]
{ {
IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve,
IccConversionDataTrc.IdentityCurve, IccConversionDataTrc.IdentityCurve,
IccConversionDataTrc.IdentityCurve IccConversionDataTrc.IdentityCurve
}, },
null, null,
null, null,
null, null,
null, null,
null); null);
public static object[][] LutAToBConversionTestData = public static object[][] LutAToBConversionTestData =
{ {
new object[] { LutAtoBSingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0) }, new object[] { LutAtoBSingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0) },
}; };
public static object[][] LutBToAConversionTestData = public static object[][] LutBToAConversionTestData =
{ {
new object[] { LutBtoASingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0) }, new object[] { LutBtoASingleCurve, new Vector4(0.2f, 0.3f, 0.4f, 0), new Vector4(0.2f, 0.3f, 0.4f, 0) },
}; };
}
} }

95
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataLutEntry.cs

@ -4,59 +4,58 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataLutEntry
{ {
public class IccConversionDataLutEntry private static readonly IccLut Lut256 = CreateLut(256);
private static readonly IccLut Lut32 = CreateLut(32);
private static readonly IccLut LutIdentity = CreateIdentityLut(0, 1);
private static readonly IccLut8TagDataEntry Lut8 = new(
new[] { Lut256, Lut256 },
IccConversionDataClut.Clut2x1,
new[] { Lut256 });
private static readonly IccLut16TagDataEntry Lut16 = new(
new[] { Lut32, Lut32 },
IccConversionDataClut.Clut2x1,
new[] { LutIdentity });
private static readonly IccLut8TagDataEntry Lut8Matrix = new(
IccConversionDataMatrix.Matrix3x3Random,
new[] { Lut256, Lut256, Lut256 },
IccConversionDataClut.Clut3x1,
new[] { Lut256 });
private static readonly IccLut16TagDataEntry Lut16Matrix = new(
IccConversionDataMatrix.Matrix3x3Random,
new[] { Lut32, Lut32, Lut32 },
IccConversionDataClut.Clut3x1,
new[] { LutIdentity });
private static IccLut CreateLut(int length)
{ {
private static readonly IccLut Lut256 = CreateLut(256); float[] values = new float[length];
private static readonly IccLut Lut32 = CreateLut(32); for (int i = 0; i < values.Length; i++)
private static readonly IccLut LutIdentity = CreateIdentityLut(0, 1);
private static readonly IccLut8TagDataEntry Lut8 = new IccLut8TagDataEntry(
new[] { Lut256, Lut256 },
IccConversionDataClut.Clut2x1,
new[] { Lut256 });
private static readonly IccLut16TagDataEntry Lut16 = new IccLut16TagDataEntry(
new[] { Lut32, Lut32 },
IccConversionDataClut.Clut2x1,
new[] { LutIdentity });
private static readonly IccLut8TagDataEntry Lut8Matrix = new IccLut8TagDataEntry(
IccConversionDataMatrix.Matrix3x3Random,
new[] { Lut256, Lut256, Lut256 },
IccConversionDataClut.Clut3x1,
new[] { Lut256 });
private static readonly IccLut16TagDataEntry Lut16Matrix = new IccLut16TagDataEntry(
IccConversionDataMatrix.Matrix3x3Random,
new[] { Lut32, Lut32, Lut32 },
IccConversionDataClut.Clut3x1,
new[] { LutIdentity });
private static IccLut CreateLut(int length)
{ {
float[] values = new float[length]; values[i] = 0.1f + (i / (float)length);
for (int i = 0; i < values.Length; i++)
{
values[i] = 0.1f + (i / (float)length);
}
return new IccLut(values);
} }
private static IccLut CreateIdentityLut(float min, float max) => new IccLut(new[] { min, max }); return new IccLut(values);
}
public static object[][] Lut8ConversionTestData = private static IccLut CreateIdentityLut(float min, float max) => new(new[] { min, max });
{
new object[] { Lut8, new Vector4(0.2f, 0.3f, 0, 0), new Vector4(0.339762866f, 0, 0, 0) },
new object[] { Lut8Matrix, new Vector4(0.21f, 0.31f, 0.41f, 0), new Vector4(0.431305826f, 0, 0, 0) },
};
public static object[][] Lut16ConversionTestData = public static object[][] Lut8ConversionTestData =
{ {
new object[] { Lut16, new Vector4(0.2f, 0.3f, 0, 0), new Vector4(0.245625019f, 0, 0, 0) }, new object[] { Lut8, new Vector4(0.2f, 0.3f, 0, 0), new Vector4(0.339762866f, 0, 0, 0) },
new object[] { Lut16Matrix, new Vector4(0.21f, 0.31f, 0.41f, 0), new Vector4(0.336980581f, 0, 0, 0) }, new object[] { Lut8Matrix, new Vector4(0.21f, 0.31f, 0.41f, 0), new Vector4(0.431305826f, 0, 0, 0) },
}; };
}
public static object[][] Lut16ConversionTestData =
{
new object[] { Lut16, new Vector4(0.2f, 0.3f, 0, 0), new Vector4(0.245625019f, 0, 0, 0) },
new object[] { Lut16Matrix, new Vector4(0.21f, 0.31f, 0.41f, 0), new Vector4(0.336980581f, 0, 0, 0) },
};
} }

85
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMatrix.cs

@ -3,52 +3,51 @@
using System.Numerics; using System.Numerics;
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataMatrix
{ {
public class IccConversionDataMatrix private static readonly Vector3 Vector3Zero = new(0.0f, 0.0f, 0.0f);
{
private static readonly Vector3 Vector3Zero = new Vector3(0.0f, 0.0f, 0.0f);
public static float[,] Matrix3x3Random = public static float[,] Matrix3x3Random =
{ {
{ 0.1f, 0.2f, 0.3f }, { 0.1f, 0.2f, 0.3f },
{ 0.4f, 0.5f, 0.6f }, { 0.4f, 0.5f, 0.6f },
{ 0.7f, 0.8f, 0.9f } { 0.7f, 0.8f, 0.9f }
}; };
public static float[,] Matrix3x3Identity = public static float[,] Matrix3x3Identity =
{ {
{ 1, 0, 0 }, { 1, 0, 0 },
{ 0, 1, 0 }, { 0, 1, 0 },
{ 0, 0, 1 } { 0, 0, 1 }
}; };
public static object[][] MatrixConversionTestData = public static object[][] MatrixConversionTestData =
{ {
new object[] { CreateMatrix(Matrix3x3Identity), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.5f, 0.5f, 0.5f, 0) }, new object[] { CreateMatrix(Matrix3x3Identity), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.5f, 0.5f, 0.5f, 0) },
new object[] { CreateMatrix(Matrix3x3Identity), new Vector3(0.2f, 0.2f, 0.2f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.7f, 0.7f, 0) }, new object[] { CreateMatrix(Matrix3x3Identity), new Vector3(0.2f, 0.2f, 0.2f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.7f, 0.7f, 0) },
new object[] { CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.6f, 0.75f, 0.9f, 0) }, new object[] { CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.6f, 0.75f, 0.9f, 0) },
new object[] { CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.95f, 1.2f, 0) }, new object[] { CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.7f, 0.95f, 1.2f, 0) },
new object[] { CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.67f, 0.8f, 0.93f, 0) }, new object[] { CreateMatrix(Matrix3x3Random), Vector3Zero, new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.67f, 0.8f, 0.93f, 0) },
new object[] { CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.77f, 1, 1.23f, 0) }, new object[] { CreateMatrix(Matrix3x3Random), new Vector3(0.1f, 0.2f, 0.3f), new Vector4(0.2f, 0.4f, 0.7f, 0), new Vector4(0.77f, 1, 1.23f, 0) },
}; };
private static Matrix4x4 CreateMatrix(float[,] matrix) => new Matrix4x4( private static Matrix4x4 CreateMatrix(float[,] matrix) => new(
matrix[0, 0], matrix[0, 0],
matrix[0, 1], matrix[0, 1],
matrix[0, 2], matrix[0, 2],
0, 0,
matrix[1, 0], matrix[1, 0],
matrix[1, 1], matrix[1, 1],
matrix[1, 2], matrix[1, 2],
0, 0,
matrix[2, 0], matrix[2, 0],
matrix[2, 1], matrix[2, 1],
matrix[2, 2], matrix[2, 2],
0, 0,
0, 0,
0, 0,
0, 0,
1); 1);
}
} }

113
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataMultiProcessElement.cs

@ -3,76 +3,77 @@
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataMultiProcessElement
{ {
public class IccConversionDataMultiProcessElement private static readonly IccMatrixProcessElement Matrix = new(
new float[,]
{ {
private static readonly IccMatrixProcessElement Matrix = new IccMatrixProcessElement( { 2, 4, 6 },
new float[,] { 3, 5, 7 },
{ },
{ 2, 4, 6 }, new float[] { 3, 4, 5 });
{ 3, 5, 7 },
}, new float[] { 3, 4, 5 });
private static readonly IccClut Clut = new IccClut( private static readonly IccClut Clut = new(
new[] new[]
{ {
new[] { 0.2f, 0.3f }, new[] { 0.2f, 0.3f },
new[] { 0.4f, 0.5f }, new[] { 0.4f, 0.5f },
new[] { 0.21f, 0.31f }, new[] { 0.21f, 0.31f },
new[] { 0.41f, 0.51f }, new[] { 0.41f, 0.51f },
new[] { 0.22f, 0.32f }, new[] { 0.22f, 0.32f },
new[] { 0.42f, 0.52f }, new[] { 0.42f, 0.52f },
new[] { 0.23f, 0.33f }, new[] { 0.23f, 0.33f },
new[] { 0.43f, 0.53f }, new[] { 0.43f, 0.53f },
}, new byte[] { 2, 2, 2 }, },
IccClutDataType.Float); new byte[] { 2, 2, 2 },
IccClutDataType.Float);
private static readonly IccFormulaCurveElement FormulaCurveElement1 = new IccFormulaCurveElement(IccFormulaCurveType.Type1, 2.2f, 0.7f, 0.2f, 0.3f, 0, 0); private static readonly IccFormulaCurveElement FormulaCurveElement1 = new(IccFormulaCurveType.Type1, 2.2f, 0.7f, 0.2f, 0.3f, 0, 0);
private static readonly IccFormulaCurveElement FormulaCurveElement2 = new IccFormulaCurveElement(IccFormulaCurveType.Type2, 2.2f, 0.9f, 0.9f, 0.02f, 0.1f, 0); private static readonly IccFormulaCurveElement FormulaCurveElement2 = new(IccFormulaCurveType.Type2, 2.2f, 0.9f, 0.9f, 0.02f, 0.1f, 0);
private static readonly IccFormulaCurveElement FormulaCurveElement3 = new IccFormulaCurveElement(IccFormulaCurveType.Type3, 0, 0.9f, 0.9f, 1.02f, 0.1f, 0.02f); private static readonly IccFormulaCurveElement FormulaCurveElement3 = new(IccFormulaCurveType.Type3, 0, 0.9f, 0.9f, 1.02f, 0.1f, 0.02f);
private static readonly IccCurveSetProcessElement CurveSet1DFormula1 = Create1DSingleCurveSet(FormulaCurveElement1); private static readonly IccCurveSetProcessElement CurveSet1DFormula1 = Create1DSingleCurveSet(FormulaCurveElement1);
private static readonly IccCurveSetProcessElement CurveSet1DFormula2 = Create1DSingleCurveSet(FormulaCurveElement2); private static readonly IccCurveSetProcessElement CurveSet1DFormula2 = Create1DSingleCurveSet(FormulaCurveElement2);
private static readonly IccCurveSetProcessElement CurveSet1DFormula3 = Create1DSingleCurveSet(FormulaCurveElement3); private static readonly IccCurveSetProcessElement CurveSet1DFormula3 = Create1DSingleCurveSet(FormulaCurveElement3);
private static readonly IccCurveSetProcessElement CurveSet1DFormula1And2 = Create1DMultiCurveSet(new[] { 0.5f }, FormulaCurveElement1, FormulaCurveElement2); private static readonly IccCurveSetProcessElement CurveSet1DFormula1And2 = Create1DMultiCurveSet(new[] { 0.5f }, FormulaCurveElement1, FormulaCurveElement2);
private static readonly IccClutProcessElement ClutElement = new IccClutProcessElement(Clut); private static readonly IccClutProcessElement ClutElement = new(Clut);
private static IccCurveSetProcessElement Create1DSingleCurveSet(IccCurveSegment segment) private static IccCurveSetProcessElement Create1DSingleCurveSet(IccCurveSegment segment)
{ {
var curve = new IccOneDimensionalCurve(new float[0], new[] { segment }); var curve = new IccOneDimensionalCurve(new float[0], new[] { segment });
return new IccCurveSetProcessElement(new[] { curve }); return new IccCurveSetProcessElement(new[] { curve });
} }
private static IccCurveSetProcessElement Create1DMultiCurveSet(float[] breakPoints, params IccCurveSegment[] segments) private static IccCurveSetProcessElement Create1DMultiCurveSet(float[] breakPoints, params IccCurveSegment[] segments)
{ {
var curve = new IccOneDimensionalCurve(breakPoints, segments); var curve = new IccOneDimensionalCurve(breakPoints, segments);
return new IccCurveSetProcessElement(new[] { curve }); return new IccCurveSetProcessElement(new[] { curve });
} }
public static object[][] MpeCurveConversionTestData = public static object[][] MpeCurveConversionTestData =
{ {
new object[] { CurveSet1DFormula1, new[] { 0.51f }, new[] { 0.575982451f } }, new object[] { CurveSet1DFormula1, new[] { 0.51f }, new[] { 0.575982451f } },
new object[] { CurveSet1DFormula2, new[] { 0.52f }, new[] { -0.4684991f } }, new object[] { CurveSet1DFormula2, new[] { 0.52f }, new[] { -0.4684991f } },
new object[] { CurveSet1DFormula3, new[] { 0.53f }, new[] { 0.86126f } }, new object[] { CurveSet1DFormula3, new[] { 0.53f }, new[] { 0.86126f } },
new object[] { CurveSet1DFormula1And2, new[] { 0.31f }, new[] { 0.445982f } }, new object[] { CurveSet1DFormula1And2, new[] { 0.31f }, new[] { 0.445982f } },
new object[] { CurveSet1DFormula1And2, new[] { 0.61f }, new[] { -0.341274023f } }, new object[] { CurveSet1DFormula1And2, new[] { 0.61f }, new[] { -0.341274023f } },
}; };
public static object[][] MpeMatrixConversionTestData = public static object[][] MpeMatrixConversionTestData =
{ {
new object[] { Matrix, new float[] { 2, 4 }, new float[] { 19, 32, 45 } } new object[] { Matrix, new float[] { 2, 4 }, new float[] { 19, 32, 45 } }
}; };
public static object[][] MpeClutConversionTestData = public static object[][] MpeClutConversionTestData =
{ {
new object[] { ClutElement, new[] { 0.5f, 0.5f, 0.5f }, new[] { 0.5f, 0.5f } } new object[] { ClutElement, new[] { 0.5f, 0.5f, 0.5f }, new[] { 0.5f, 0.5f } }
}; };
}
} }

123
tests/ImageSharp.Tests/TestDataIcc/Conversion/IccConversionDataTrc.cs

@ -4,74 +4,73 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion namespace SixLabors.ImageSharp.Tests.TestDataIcc.Conversion;
public class IccConversionDataTrc
{ {
public class IccConversionDataTrc internal static IccCurveTagDataEntry IdentityCurve = new();
{ internal static IccCurveTagDataEntry Gamma2Curve = new(2);
internal static IccCurveTagDataEntry IdentityCurve = new IccCurveTagDataEntry(); internal static IccCurveTagDataEntry LutCurve = new(new float[] { 0, 0.7f, 1 });
internal static IccCurveTagDataEntry Gamma2Curve = new IccCurveTagDataEntry(2);
internal static IccCurveTagDataEntry LutCurve = new IccCurveTagDataEntry(new float[] { 0, 0.7f, 1 });
internal static IccParametricCurveTagDataEntry ParamCurve1 = new IccParametricCurveTagDataEntry(new IccParametricCurve(2.2f)); internal static IccParametricCurveTagDataEntry ParamCurve1 = new(new IccParametricCurve(2.2f));
internal static IccParametricCurveTagDataEntry ParamCurve2 = new IccParametricCurveTagDataEntry(new IccParametricCurve(2.2f, 1.5f, -0.5f)); internal static IccParametricCurveTagDataEntry ParamCurve2 = new(new IccParametricCurve(2.2f, 1.5f, -0.5f));
internal static IccParametricCurveTagDataEntry ParamCurve3 = new IccParametricCurveTagDataEntry(new IccParametricCurve(2.2f, 1.5f, -0.5f, 0.3f)); internal static IccParametricCurveTagDataEntry ParamCurve3 = new(new IccParametricCurve(2.2f, 1.5f, -0.5f, 0.3f));
internal static IccParametricCurveTagDataEntry ParamCurve4 = new IccParametricCurveTagDataEntry(new IccParametricCurve(2.4f, 1 / 1.055f, 0.055f / 1.055f, 1 / 12.92f, 0.04045f)); internal static IccParametricCurveTagDataEntry ParamCurve4 = new(new IccParametricCurve(2.4f, 1 / 1.055f, 0.055f / 1.055f, 1 / 12.92f, 0.04045f));
internal static IccParametricCurveTagDataEntry ParamCurve5 = new IccParametricCurveTagDataEntry(new IccParametricCurve(2.2f, 0.7f, 0.2f, 0.3f, 0.1f, 0.5f, 0.2f)); internal static IccParametricCurveTagDataEntry ParamCurve5 = new(new IccParametricCurve(2.2f, 0.7f, 0.2f, 0.3f, 0.1f, 0.5f, 0.2f));
public static object[][] TrcArrayConversionTestData = public static object[][] TrcArrayConversionTestData =
{
new object[]
{ {
new object[] new IccTagDataEntry[] { IdentityCurve, Gamma2Curve, ParamCurve1 },
{ false,
new IccTagDataEntry[] { IdentityCurve, Gamma2Curve, ParamCurve1 }, new Vector4(2, 2, 0.5f, 0),
false, new Vector4(2, 4, 0.217637628f, 0),
new Vector4(2, 2, 0.5f, 0), },
new Vector4(2, 4, 0.217637628f, 0), new object[]
},
new object[]
{
new IccTagDataEntry[] { IdentityCurve, Gamma2Curve, ParamCurve1 },
true,
new Vector4(1, 4, 0.217637628f, 0),
new Vector4(1, 2, 0.5f, 0),
},
};
public static object[][] CurveConversionTestData =
{ {
new object[] { IdentityCurve, false, 2, 2 }, new IccTagDataEntry[] { IdentityCurve, Gamma2Curve, ParamCurve1 },
new object[] { Gamma2Curve, false, 2, 4 }, true,
new object[] { LutCurve, false, 0.1, 0.14 }, new Vector4(1, 4, 0.217637628f, 0),
new object[] { LutCurve, false, 0.5, 0.7 }, new Vector4(1, 2, 0.5f, 0),
new object[] { LutCurve, false, 0.75, 0.85 }, },
};
new object[] { IdentityCurve, true, 2, 2 }, public static object[][] CurveConversionTestData =
new object[] { Gamma2Curve, true, 4, 2 }, {
new object[] { LutCurve, true, 0.14, 0.1 }, new object[] { IdentityCurve, false, 2, 2 },
new object[] { LutCurve, true, 0.7, 0.5 }, new object[] { Gamma2Curve, false, 2, 4 },
new object[] { LutCurve, true, 0.85, 0.75 }, new object[] { LutCurve, false, 0.1, 0.14 },
}; new object[] { LutCurve, false, 0.5, 0.7 },
new object[] { LutCurve, false, 0.75, 0.85 },
public static object[][] ParametricCurveConversionTestData = new object[] { IdentityCurve, true, 2, 2 },
{ new object[] { Gamma2Curve, true, 4, 2 },
new object[] { ParamCurve1, false, 0.5f, 0.217637628f }, new object[] { LutCurve, true, 0.14, 0.1 },
new object[] { ParamCurve2, false, 0.6f, 0.133208528f }, new object[] { LutCurve, true, 0.7, 0.5 },
new object[] { ParamCurve2, false, 0.21f, 0 }, new object[] { LutCurve, true, 0.85, 0.75 },
new object[] { ParamCurve3, false, 0.61f, 0.444446117f }, };
new object[] { ParamCurve3, false, 0.22f, 0.3f },
new object[] { ParamCurve4, false, 0.3f, 0.0732389539f }, public static object[][] ParametricCurveConversionTestData =
new object[] { ParamCurve4, false, 0.03f, 0.00232198136f }, {
new object[] { ParamCurve5, false, 0.2f, 0.593165159f }, new object[] { ParamCurve1, false, 0.5f, 0.217637628f },
new object[] { ParamCurve5, false, 0.05f, 0.215f }, new object[] { ParamCurve2, false, 0.6f, 0.133208528f },
new object[] { ParamCurve2, false, 0.21f, 0 },
new object[] { ParamCurve3, false, 0.61f, 0.444446117f },
new object[] { ParamCurve3, false, 0.22f, 0.3f },
new object[] { ParamCurve4, false, 0.3f, 0.0732389539f },
new object[] { ParamCurve4, false, 0.03f, 0.00232198136f },
new object[] { ParamCurve5, false, 0.2f, 0.593165159f },
new object[] { ParamCurve5, false, 0.05f, 0.215f },
new object[] { ParamCurve1, true, 0.217637628f, 0.5f }, new object[] { ParamCurve1, true, 0.217637628f, 0.5f },
new object[] { ParamCurve2, true, 0.133208528f, 0.6f }, new object[] { ParamCurve2, true, 0.133208528f, 0.6f },
new object[] { ParamCurve2, true, 0, 1 / 3f }, new object[] { ParamCurve2, true, 0, 1 / 3f },
new object[] { ParamCurve3, true, 0.444446117f, 0.61f }, new object[] { ParamCurve3, true, 0.444446117f, 0.61f },
new object[] { ParamCurve3, true, 0.3f, 1 / 3f }, new object[] { ParamCurve3, true, 0.3f, 1 / 3f },
new object[] { ParamCurve4, true, 0.0732389539f, 0.3f }, new object[] { ParamCurve4, true, 0.0732389539f, 0.3f },
new object[] { ParamCurve4, true, 0.00232198136f, 0.03f }, new object[] { ParamCurve4, true, 0.00232198136f, 0.03f },
new object[] { ParamCurve5, true, 0.593165159f, 0.2f }, new object[] { ParamCurve5, true, 0.593165159f, 0.2f },
new object[] { ParamCurve5, true, 0.215f, 0.05f }, new object[] { ParamCurve5, true, 0.215f, 0.05f },
}; };
}
} }

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataArray.cs

@ -1,7 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataArray internal static class IccTestDataArray
{ {

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataCurves.cs

@ -3,7 +3,7 @@
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataCurves internal static class IccTestDataCurves
{ {

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataLut.cs

@ -3,7 +3,7 @@
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataLut internal static class IccTestDataLut
{ {

4
tests/ImageSharp.Tests/TestDataIcc/IccTestDataMatrix.cs

@ -3,9 +3,7 @@
using System.Numerics; using System.Numerics;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
using SixLabors.ImageSharp;
internal static class IccTestDataMatrix internal static class IccTestDataMatrix
{ {

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataMultiProcessElements.cs

@ -3,7 +3,7 @@
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataMultiProcessElements internal static class IccTestDataMultiProcessElements
{ {

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataNonPrimitives.cs

@ -5,7 +5,7 @@ using System.Globalization;
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataNonPrimitives internal static class IccTestDataNonPrimitives
{ {

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataPrimitives.cs

@ -1,7 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataPrimitives internal static class IccTestDataPrimitives
{ {

2
tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs

@ -4,7 +4,7 @@
using System.Numerics; using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataProfiles internal static class IccTestDataProfiles
{ {

3
tests/ImageSharp.Tests/TestDataIcc/IccTestDataTagDataEntry.cs

@ -2,10 +2,9 @@
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System.Globalization; using System.Globalization;
using System.Numerics;
using SixLabors.ImageSharp.Metadata.Profiles.Icc; using SixLabors.ImageSharp.Metadata.Profiles.Icc;
namespace SixLabors.ImageSharp.Tests; namespace SixLabors.ImageSharp.Tests.TestDataIcc;
internal static class IccTestDataTagDataEntry internal static class IccTestDataTagDataEntry
{ {

Loading…
Cancel
Save