From 62193116a83c6e779c7afa7c8b44a7f2317bdccc Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:33:20 +0200 Subject: [PATCH 01/12] Update to ImageSharp 3.1.11 --- .editorconfig | 33 +++++++++------ .gitattributes | 15 +++++-- Directory.Build.props | 12 ++++++ SixLabors.ImageSharp.props | 11 +++++ codecov.yml | 11 +++++ shared-infrastructure | 2 +- .../ImageSharp.Textures.csproj | 13 ++++-- .../ImageSharp.Textures.Benchmarks.csproj | 4 +- ...ImageSharp.Textures.InteractiveTest.csproj | 2 +- .../ImageSharp.Textures.Tests.csproj | 4 +- tests/ImageSharp.Textures.Tests/TestFile.cs | 11 ++++- .../ImageComparison/ExactImageComparer.cs | 4 +- .../ImageComparison/ImageComparer.cs | 8 ++-- .../ImageComparison/TolerantImageComparer.cs | 2 +- .../ImageProviders/FileProvider.cs | 40 ++++++++++++------- .../ImageProviders/TestImageProvider.cs | 4 +- .../TestUtilities/TestEnvironment.cs | 13 ++++-- .../TestUtilities/TestImageExtensions.cs | 10 ++++- 18 files changed, 143 insertions(+), 56 deletions(-) create mode 100644 SixLabors.ImageSharp.props diff --git a/.editorconfig b/.editorconfig index 33fd057..2e3045f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ -# Version: 2.1.0 (Using https://semver.org/) -# Updated: 2021-03-03 +# Version: 4.1.1 (Using https://semver.org/) +# Updated: 2022-05-23 # See https://github.com/RehanSaeed/EditorConfig/releases for release notes. # See https://github.com/RehanSaeed/EditorConfig for updates to this file. # See http://EditorConfig.org for more information about .editorconfig files. @@ -49,11 +49,11 @@ indent_size = 2 indent_size = 2 # Markdown Files -[*.md] +[*.{md,mdx}] trim_trailing_whitespace = false # Web Files -[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,svg,vue}] +[*.{htm,html,js,jsm,ts,tsx,cjs,cts,ctsx,mjs,mts,mtsx,css,sass,scss,less,pcss,svg,vue}] indent_size = 2 # Batch Files @@ -75,7 +75,7 @@ indent_style = tab [*.{cs,csx,cake,vb,vbx}] # Default Severity for all .NET Code Style rules below -dotnet_analyzer_diagnostic.category-style.severity = warning +dotnet_analyzer_diagnostic.severity = warning ########################################## # Language Rules @@ -122,20 +122,21 @@ dotnet_style_coalesce_expression = true:warning dotnet_style_null_propagation = true:warning dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning # File header preferences -file_header_template = Copyright (c) Six Labors.\nLicensed under the Apache License, Version 2.0. +file_header_template = Copyright (c) Six Labors.\nLicensed under the Six Labors Split License. # SA1636: File header copyright text should match # Justification: .editorconfig supports file headers. If this is changed to a value other than "none", a stylecop.json file will need to added to the project. # dotnet_diagnostic.SA1636.severity = none # Undocumented -dotnet_style_operator_placement_when_wrapping = end_of_line +dotnet_style_operator_placement_when_wrapping = end_of_line:warning +csharp_style_prefer_null_check_over_type_check = true:warning # C# Style Rules # https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules [*.{cs,csx,cake}] # 'var' preferences -csharp_style_var_for_built_in_types = never -csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_for_built_in_types = false:warning +csharp_style_var_when_type_is_apparent = false:warning csharp_style_var_elsewhere = false:warning # Expression-bodied members csharp_style_expression_bodied_methods = true:warning @@ -200,12 +201,15 @@ dotnet_diagnostic.IDE0059.severity = suggestion # Organize using directives dotnet_sort_system_directives_first = true dotnet_separate_import_directive_groups = false +# Dotnet namespace options +dotnet_style_namespace_match_folder = true:suggestion +dotnet_diagnostic.IDE0130.severity = suggestion # C# formatting rules # https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#c-formatting-rules [*.{cs,csx,cake}] # Newline options -# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#new-line-options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#new-line-options csharp_new_line_before_open_brace = all csharp_new_line_before_else = true csharp_new_line_before_catch = true @@ -214,7 +218,7 @@ csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_members_in_anonymous_types = true csharp_new_line_between_query_expression_clauses = true # Indentation options -# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#indentation-options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#indentation-options csharp_indent_case_contents = true csharp_indent_switch_labels = true csharp_indent_labels = no_change @@ -222,7 +226,7 @@ csharp_indent_block_contents = true csharp_indent_braces = false csharp_indent_case_contents_when_block = false # Spacing options -# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#spacing-options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#spacing-options csharp_space_after_cast = false csharp_space_after_keywords_in_control_flow_statements = true csharp_space_between_parentheses = false @@ -246,9 +250,12 @@ csharp_space_before_open_square_brackets = false csharp_space_between_empty_square_brackets = false csharp_space_between_square_brackets = false # Wrap options -# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#wrap-options csharp_preserve_single_line_statements = false csharp_preserve_single_line_blocks = true +# Namespace options +# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#namespace-options +csharp_style_namespace_declarations = file_scoped:warning ########################################## # .NET Naming Rules diff --git a/.gitattributes b/.gitattributes index 70ced69..3647a70 100644 --- a/.gitattributes +++ b/.gitattributes @@ -64,18 +64,19 @@ # Set explicit file behavior to: # treat as text # normalize to Unix-style line endings and -# use a union merge when resoling conflicts +# use a union merge when resolving conflicts ############################################################################### *.csproj text eol=lf merge=union *.dbproj text eol=lf merge=union *.fsproj text eol=lf merge=union *.ncrunchproject text eol=lf merge=union *.vbproj text eol=lf merge=union +*.shproj text eol=lf merge=union ############################################################################### # Set explicit file behavior to: # treat as text # normalize to Windows-style line endings and -# use a union merge when resoling conflicts +# use a union merge when resolving conflicts ############################################################################### *.sln text eol=crlf merge=union ############################################################################### @@ -87,7 +88,6 @@ *.eot binary *.exe binary *.otf binary -*.pbm binary *.pdf binary *.ppt binary *.pptx binary @@ -95,7 +95,6 @@ *.snk binary *.ttc binary *.ttf binary -*.wbmp binary *.woff binary *.woff2 binary *.xls binary @@ -119,6 +118,7 @@ *.bmp filter=lfs diff=lfs merge=lfs -text *.gif filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text +*.qoi filter=lfs diff=lfs merge=lfs -text *.tif filter=lfs diff=lfs merge=lfs -text *.tiff filter=lfs diff=lfs merge=lfs -text *.tga filter=lfs diff=lfs merge=lfs -text @@ -126,3 +126,10 @@ *.dds filter=lfs diff=lfs merge=lfs -text *.ktx filter=lfs diff=lfs merge=lfs -text *.ktx2 filter=lfs diff=lfs merge=lfs -text +*.pam filter=lfs diff=lfs merge=lfs -text +*.pbm filter=lfs diff=lfs merge=lfs -text +*.pgm filter=lfs diff=lfs merge=lfs -text +*.ppm filter=lfs diff=lfs merge=lfs -text +*.pnm filter=lfs diff=lfs merge=lfs -text +*.wbmp filter=lfs diff=lfs merge=lfs -text +*.exr filter=lfs diff=lfs merge=lfs -text diff --git a/Directory.Build.props b/Directory.Build.props index 3a133ef..f0af547 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -18,4 +18,16 @@ + + 12.0 + + + + + true + + diff --git a/SixLabors.ImageSharp.props b/SixLabors.ImageSharp.props new file mode 100644 index 0000000..46d8c23 --- /dev/null +++ b/SixLabors.ImageSharp.props @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/codecov.yml b/codecov.yml index 833fc0a..310eefb 100644 --- a/codecov.yml +++ b/codecov.yml @@ -9,3 +9,14 @@ codecov: # Avoid Report Expired # https://docs.codecov.io/docs/codecov-yaml#section-expired-reports max_report_age: off + +coverage: + # Use integer precision + # https://docs.codecov.com/docs/codecovyml-reference#coverageprecision + precision: 0 + + # Explicitly control coverage status checks + # https://docs.codecov.com/docs/commit-status#disabling-a-status + status: + project: on + patch: off diff --git a/shared-infrastructure b/shared-infrastructure index a042aba..353b9af 160000 --- a/shared-infrastructure +++ b/shared-infrastructure @@ -1 +1 @@ -Subproject commit a042aba176cdb840d800c6ed4cfe41a54fb7b1e3 +Subproject commit 353b9afe32a8000410312d17263407cd7bb82d19 diff --git a/src/ImageSharp.Textures/ImageSharp.Textures.csproj b/src/ImageSharp.Textures/ImageSharp.Textures.csproj index 696c86a..068d917 100644 --- a/src/ImageSharp.Textures/ImageSharp.Textures.csproj +++ b/src/ImageSharp.Textures/ImageSharp.Textures.csproj @@ -15,24 +15,29 @@ - + - net5.0;netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0 + net8.0;net9.0 - netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0 + net8.0 + + + + + - + diff --git a/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj b/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj index fb1e312..ed42250 100644 --- a/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj +++ b/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net5.0;netcoreapp3.1;netcoreapp2.1 + net8.0 false false @@ -14,7 +14,7 @@ - + diff --git a/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj b/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj index 8782a75..08d6c73 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj +++ b/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj @@ -3,7 +3,7 @@ WinExe false - net5.0;netcoreapp3.1;netcoreapp2.1 + net8.0 win-x64;osx-x64 false SixLabors.ImageSharp.Textures.InteractiveTest diff --git a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj index b51f2d1..7e608c3 100644 --- a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj +++ b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj @@ -1,7 +1,7 @@ - net5.0;netcoreapp3.1;netcoreapp2.1 + net8.0 True AnyCPU;x64;x86 SixLabors.ImageSharp.Textures.Tests @@ -10,7 +10,7 @@ - + diff --git a/tests/ImageSharp.Textures.Tests/TestFile.cs b/tests/ImageSharp.Textures.Tests/TestFile.cs index d4c8eef..5630c5c 100644 --- a/tests/ImageSharp.Textures.Tests/TestFile.cs +++ b/tests/ImageSharp.Textures.Tests/TestFile.cs @@ -124,6 +124,15 @@ public class TestFile /// /// The . /// - public Image CreateRgba32Image(IImageDecoder decoder) => ImageSharp.Image.Load(this.Image.GetConfiguration(), this.Bytes, decoder); + public Image CreateRgba32Image(IImageFormat format, IImageDecoder decoder) + { + var options = new DecoderOptions + { + Configuration = this.Image.Configuration + }; + options.Configuration.ImageFormatsManager.SetDecoder(format, decoder); + + return ImageSharp.Image.Load(options, this.Bytes); + } } } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs index c9bf2fd..4b39d16 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs @@ -18,7 +18,7 @@ public override ImageSimilarityReport CompareImages expected, Image actual) { - if (expected.Size() != actual.Size()) + if (expected.Size != actual.Size) { throw new InvalidOperationException("Calling ImageComparer is invalid when dimensions mismatch!"); } @@ -33,7 +33,7 @@ public override ImageSimilarityReport CompareImages actualBuffer = actual.Frames.RootFrame.PixelBuffer; var differences = new List(); - ImageSharp.Configuration configuration = expected.GetConfiguration(); + ImageSharp.Configuration configuration = expected.Configuration; for (int y = 0; y < actual.Height; y++) { diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs index b24a611..6b94fb1 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs @@ -49,9 +49,9 @@ public static void VerifySimilarity( where TPixelA : unmanaged, IPixel where TPixelB : unmanaged, IPixel { - if (expected.Size() != actual.Size()) + if (expected.Size != actual.Size) { - throw new ImageDimensionsMismatchException(expected.Size(), actual.Size()); + throw new ImageDimensionsMismatchException(expected.Size, actual.Size); } if (expected.Frames.Count != actual.Frames.Count) @@ -74,9 +74,9 @@ public static void VerifySimilarityIgnoreRegion( where TPixelA : unmanaged, IPixel where TPixelB : unmanaged, IPixel { - if (expected.Size() != actual.Size()) + if (expected.Size != actual.Size) { - throw new ImageDimensionsMismatchException(expected.Size(), actual.Size()); + throw new ImageDimensionsMismatchException(expected.Size, actual.Size); } if (expected.Frames.Count != actual.Frames.Count) diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs index da9843c..f2fb1f4 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs @@ -60,7 +60,7 @@ public TolerantImageComparer(float imageThreshold, int perPixelManhattanThreshol public override ImageSimilarityReport CompareImages(Image expected, Image actual) { - if (expected.Size() != actual.Size()) + if (expected.Size != actual.Size) { throw new InvalidOperationException("Calling ImageComparer is invalid when dimensions mismatch!"); } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs index 60c9dbc..46e6509 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -1,14 +1,9 @@ // Copyright (c) Six Labors. // Licensed under the Apache License, Version 2.0. -using System; using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; using System.Reflection; -using System.Threading.Tasks; using SixLabors.ImageSharp.Formats; -using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; using Xunit.Abstractions; @@ -145,35 +140,45 @@ public FileProvider() public override Image GetImage() { + IImageFormat format = TestEnvironment.GetImageFormat(this.FilePath); IImageDecoder decoder = TestEnvironment.GetReferenceDecoder(this.FilePath); - return this.GetImage(decoder); + return this.GetImage(format, decoder); } - public override Image GetImage(IImageDecoder decoder) + public override Image GetImage(IImageFormat format, IImageDecoder decoder) { + Guard.NotNull(format, nameof(format)); Guard.NotNull(decoder, nameof(decoder)); if (!TestEnvironment.Is64BitProcess) { - return this.LoadImage(decoder); + return this.LoadImage(format, decoder); } // int bufferCapacity = this.Configuration.MemoryAllocator.GetBufferCapacityInBytes(); int bufferCapacity = 500; var key = new Key(this.PixelType, this.FilePath, bufferCapacity, decoder); - Image cachedImage = Cache.GetOrAdd(key, _ => this.LoadImage(decoder)); + Image cachedImage = Cache.GetOrAdd(key, _ => this.LoadImage(format, decoder)); return cachedImage.Clone(this.Configuration); } - public override Task> GetImageAsync(IImageDecoder decoder) + public override Task> GetImageAsync(IImageFormat format, IImageDecoder decoder) { + Guard.NotNull(format, nameof(format)); Guard.NotNull(decoder, nameof(decoder)); // Used in small subset of decoder tests, no caching. string path = Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, this.FilePath); - return Image.LoadAsync(this.Configuration, path, decoder); + ImageSharp.Configuration configuration = this.Configuration.Clone(); + configuration.ImageFormatsManager.SetDecoder(format, decoder); + DecoderOptions options = new() + { + Configuration = configuration + }; + + return Image.LoadAsync(options, path); } public override void Deserialize(IXunitSerializationInfo info) @@ -189,10 +194,17 @@ public override void Serialize(IXunitSerializationInfo info) info.AddValue("path", this.FilePath); } - private Image LoadImage(IImageDecoder decoder) + private Image LoadImage(IImageFormat format, IImageDecoder decoder) { - var testFile = TestFile.Create(this.FilePath); - return Image.Load(this.Configuration, testFile.Bytes, decoder); + TestFile testFile = TestFile.Create(this.FilePath); + ImageSharp.Configuration configuration = this.Configuration.Clone(); + configuration.ImageFormatsManager.SetDecoder(format, decoder); + DecoderOptions options = new() + { + Configuration = configuration + }; + + return Image.Load(options, testFile.Bytes); } } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index bc21e84..d6ef180 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -49,9 +49,9 @@ public static TestImageProvider File( /// A test image. public abstract Image GetImage(); - public virtual Image GetImage(IImageDecoder decoder) => throw new NotSupportedException($"Decoder specific GetImage() is not supported with {this.GetType().Name}!"); + public virtual Image GetImage(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException($"Decoder specific GetImage() is not supported with {this.GetType().Name}!"); - public virtual Task> GetImageAsync(IImageDecoder decoder) => throw new NotSupportedException($"Decoder specific GetImageAsync() is not supported with {this.GetType().Name}!"); + public virtual Task> GetImageAsync(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException($"Decoder specific GetImageAsync() is not supported with {this.GetType().Name}!"); /// /// Returns an instance to the test case with the necessary traits. diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs index d20483c..3459765 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs @@ -267,20 +267,25 @@ static FileInfo Find(DirectoryInfo root, string name) internal static IImageDecoder GetReferenceDecoder(string filePath) { IImageFormat format = GetImageFormat(filePath); - return Configuration.ImageFormatsManager.FindDecoder(format); + return Configuration.ImageFormatsManager.GetDecoder(format); } internal static IImageEncoder GetReferenceEncoder(string filePath) { IImageFormat format = GetImageFormat(filePath); - return Configuration.ImageFormatsManager.FindEncoder(format); + return Configuration.ImageFormatsManager.GetEncoder(format); } internal static IImageFormat GetImageFormat(string filePath) { string extension = Path.GetExtension(filePath); - return Configuration.ImageFormatsManager.FindFormatByFileExtension(extension); + if (!Configuration.ImageFormatsManager.TryFindFormatByFileExtension(extension, out IImageFormat format)) + { + throw new NotSupportedException($"No image format found for extension '{extension}'!"); + } + + return format; } private static void ConfigureCodecs( @@ -301,7 +306,7 @@ private static ImageSharp.Configuration CreateDefaultConfiguration() cfg.ConfigureCodecs( PngFormat.Instance, - new PngDecoder(), + PngDecoder.Instance, new PngEncoder(), new PngImageFormatDetector()); diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs index 4626dcb..14941ee 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs @@ -213,9 +213,17 @@ public static Image GetReferenceOutputImage( throw new FileNotFoundException($"Reference output file {referenceOutputFile} is missing", referenceOutputFile); } + IImageFormat format = TestEnvironment.GetImageFormat(referenceOutputFile); decoder ??= TestEnvironment.GetReferenceDecoder(referenceOutputFile); - return Image.Load(referenceOutputFile, decoder); + ImageSharp.Configuration configuration = ImageSharp.Configuration.Default.Clone(); + configuration.ImageFormatsManager.SetDecoder(format, decoder); + DecoderOptions options = new() + { + Configuration = configuration + }; + + return Image.Load(options, referenceOutputFile); } } } From ab9992c55f1935d70841bb485b87b80a3b3ec0a0 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:34:51 +0200 Subject: [PATCH 02/12] Update test dependencies --- .../ImageSharp.Textures.Benchmarks.csproj | 4 ++-- .../ImageSharp.Textures.InteractiveTest.csproj | 6 +++--- .../ImageSharp.Textures.Tests.csproj | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj b/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj index ed42250..df56f86 100644 --- a/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj +++ b/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj b/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj index 08d6c73..fe46b9c 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj +++ b/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj @@ -13,10 +13,10 @@ - + - - + + diff --git a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj index 7e608c3..3234123 100644 --- a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj +++ b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj @@ -9,9 +9,9 @@ - + - + From 3b430f612087ecb43133adbe27d4d78021034e14 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:41:40 +0200 Subject: [PATCH 03/12] Update workflow --- .github/workflows/build-and-test.yml | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 05df432..1ba9cf8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -15,31 +15,15 @@ jobs: matrix: options: - os: ubuntu-latest - framework: net5.0 + framework: net8.0 runtime: -x64 codecov: false - os: macos-latest - framework: net5.0 + framework: net8.0 runtime: -x64 codecov: false - os: windows-latest - framework: net5.0 - runtime: -x64 - codecov: false - - os: ubuntu-latest - framework: netcoreapp3.1 - runtime: -x64 - codecov: true - - os: macos-latest - framework: netcoreapp3.1 - runtime: -x64 - codecov: false - - os: windows-latest - framework: netcoreapp3.1 - runtime: -x64 - codecov: false - - os: windows-latest - framework: netcoreapp2.1 + framework: net8.0 runtime: -x64 codecov: false @@ -86,10 +70,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 5.0.x - 3.1.x - 2.1.x + 8.0.x - name: Build shell: pwsh From 32a2d747a0440c33e568017b220454f6f37ec945 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:55:54 +0200 Subject: [PATCH 04/12] Update test dependencies in targets --- tests/Directory.Build.targets | 14 +++++++------- .../ImageSharp.Textures.Benchmarks.csproj | 6 +++--- .../ImageSharp.Textures.InteractiveTest.csproj | 6 +++--- .../ImageSharp.Textures.Tests.csproj | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets index 7f30c9a..e27e1a5 100644 --- a/tests/Directory.Build.targets +++ b/tests/Directory.Build.targets @@ -17,15 +17,15 @@ - - - + + + - - + + - - + + diff --git a/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj b/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj index df56f86..528ca0c 100644 --- a/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj +++ b/tests/ImageSharp.Textures.Benchmarks/ImageSharp.Textures.Benchmarks.csproj @@ -12,9 +12,9 @@ - - - + + + diff --git a/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj b/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj index fe46b9c..08d6c73 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj +++ b/tests/ImageSharp.Textures.InteractiveTest/ImageSharp.Textures.InteractiveTest.csproj @@ -13,10 +13,10 @@ - + - - + + diff --git a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj index 3234123..63eddb3 100644 --- a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj +++ b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj @@ -9,9 +9,9 @@ - - - + + + From bd216b668c19bb127fb689836a73a2bd882d3b74 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 09:59:53 +0200 Subject: [PATCH 05/12] Update license --- .../Exceptions/TextureFormatException.cs | 2 +- .../Exceptions/TextureProcessingException.cs | 2 +- .../UnknownTextureFormatException.cs | 2 +- .../Common/Extensions/StreamExtensions.cs | 2 +- .../Common/Extensions/ToStringExtension.cs | 2 +- .../Common/Helpers/FloatHelper.cs | 2 +- .../Common/Helpers/PixelUtils.cs | 2 +- src/ImageSharp.Textures/Configuration.cs | 2 +- .../Formats/Dds/DdsConfigurationModule.cs | 2 +- .../Formats/Dds/DdsConstants.cs | 2 +- .../Formats/Dds/DdsDecoder.cs | 2 +- .../Formats/Dds/DdsDecoderCore.cs | 2 +- .../Formats/Dds/DdsFormat.cs | 2 +- .../Formats/Dds/DdsFourCC.cs | 2 +- .../Formats/Dds/DdsHeader.cs | 2 +- .../Formats/Dds/DdsHeaderDxt10.cs | 2 +- .../Formats/Dds/DdsImageFormatDetector.cs | 2 +- .../Formats/Dds/DdsPixelFormat.cs | 2 +- .../Formats/Dds/DdsProcessor.cs | 2 +- .../Formats/Dds/DdsSurfaceType.cs | 2 +- .../Formats/Dds/DdsTools.cs | 2 +- .../Dds/Enums/D3d10ResourceDimension.cs | 2 +- .../Dds/Enums/D3d10ResourceMiscFlags.cs | 2 +- .../Formats/Dds/Enums/D3dFormat.cs | 2 +- .../Formats/Dds/Enums/DdsCaps1.cs | 2 +- .../Formats/Dds/Enums/DdsCaps2.cs | 2 +- .../Formats/Dds/Enums/DdsFlags.cs | 2 +- .../Formats/Dds/Enums/DdsPixelFormatFlags.cs | 2 +- .../Formats/Dds/Enums/DxgiFormat.cs | 2 +- .../Dds/Extensions/DdsHeaderExtensions.cs | 2 +- .../Formats/Dds/IDdsDecoderOptions.cs | 2 +- .../Formats/ITextureDecoder.cs | 2 +- .../Formats/ITextureEncoder.cs | 2 +- .../Formats/ITextureFormat.cs | 2 +- .../Formats/ITextureFormatDetector.cs | 2 +- .../Formats/ITextureFormatManager.cs | 2 +- .../Formats/ITextureInfoDetector.cs | 2 +- .../Ktx/Enums/GlBaseInternalPixelFormat.cs | 2 +- .../Ktx/Enums/GlInternalPixelFormat.cs | 2 +- .../Formats/Ktx/Enums/GlPixelFormat.cs | 2 +- .../Formats/Ktx/Enums/GlType.cs | 2 +- .../Formats/Ktx/Enums/KtxEndianness.cs | 2 +- .../Formats/Ktx/IKtxDecoderOptions.cs | 2 +- .../Formats/Ktx/KtxConfigurationModule.cs | 2 +- .../Formats/Ktx/KtxConstants.cs | 2 +- .../Formats/Ktx/KtxDecoder.cs | 2 +- .../Formats/Ktx/KtxDecoderCore.cs | 2 +- .../Formats/Ktx/KtxFormat.cs | 2 +- .../Formats/Ktx/KtxHeader.cs | 2 +- .../Formats/Ktx/KtxImageFormatDetector.cs | 2 +- .../Formats/Ktx/KtxProcessor.cs | 2 +- .../Formats/Ktx2/Enums/VkFormat.cs | 2 +- .../Formats/Ktx2/IKtx2DecoderOptions.cs | 2 +- .../Formats/Ktx2/Ktx2ConfigurationModule.cs | 2 +- .../Formats/Ktx2/Ktx2Constants.cs | 2 +- .../Formats/Ktx2/Ktx2Decoder.cs | 2 +- .../Formats/Ktx2/Ktx2DecoderCore.cs | 2 +- .../Formats/Ktx2/Ktx2Format.cs | 2 +- .../Formats/Ktx2/Ktx2Header.cs | 6 ++--- .../Formats/Ktx2/Ktx2ImageFormatDetector.cs | 2 +- .../Formats/Ktx2/Ktx2Processor.cs | 2 +- .../Formats/Ktx2/LevelIndex.cs | 2 +- .../Formats/TextureFormatManager.cs | 2 +- .../Formats/TextureTypeInfo.cs | 2 +- .../IConfigurationModule.cs | 2 +- src/ImageSharp.Textures/IO/IFileSystem.cs | 2 +- src/ImageSharp.Textures/IO/LocalFileSystem.cs | 2 +- src/ImageSharp.Textures/ITexture.cs | 2 +- src/ImageSharp.Textures/ITextureInfo.cs | 2 +- .../ImageSharp.Textures.csproj | 2 +- src/ImageSharp.Textures/MipMap.cs | 2 +- src/ImageSharp.Textures/MipMap{TBlock}.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Ayuv.cs | 2 +- .../PixelFormats/ColorSpaceConversion.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Fp32.cs | 2 +- .../PixelFormats/Generated/Bgr32.cs | 2 +- .../PixelFormats/Generated/Bgr555.cs | 2 +- .../Generated/D32_FLOAT_S8X24_UINT.cs | 2 +- .../Generated/PixelGenerator.ignore | 24 +++++++++---------- .../PixelFormats/Generated/PixelGenerator.tt | 2 +- .../PixelFormats/Generated/R11G11B10Float.cs | 2 +- .../PixelFormats/Generated/Rg32Float.cs | 2 +- .../PixelFormats/Generated/Rg64.cs | 2 +- .../PixelFormats/Generated/Rg64Float.cs | 2 +- .../PixelFormats/Generated/Rgb32.cs | 2 +- .../PixelFormats/Generated/Rgb565.cs | 2 +- .../PixelFormats/Generated/Rgb96.cs | 2 +- .../PixelFormats/Generated/Rgb96Float.cs | 2 +- .../PixelFormats/Generated/Rgba128.cs | 2 +- .../PixelFormats/Generated/Rgba128Float.cs | 2 +- .../PixelFormats/Generated/Rgba4444.cs | 2 +- .../PixelFormats/Generated/Rgba5551.cs | 2 +- .../PixelFormats/Generated/Rgba64Float.cs | 2 +- src/ImageSharp.Textures/PixelFormats/L32.cs | 2 +- .../PixelFormats/R16Float.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Rg16.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Rg32.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Y410.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Y416.cs | 2 +- src/ImageSharp.Textures/Texture.Decode.cs | 2 +- src/ImageSharp.Textures/Texture.FromBytes.cs | 2 +- src/ImageSharp.Textures/Texture.FromFile.cs | 2 +- src/ImageSharp.Textures/Texture.FromStream.cs | 2 +- src/ImageSharp.Textures/Texture.cs | 2 +- .../TextureFormats/CubemapTexture.cs | 2 +- .../TextureFormats/Decoding/A8.cs | 2 +- .../TextureFormats/Decoding/Ayuv.cs | 2 +- .../TextureFormats/Decoding/Bc4.cs | 2 +- .../TextureFormats/Decoding/Bc4s.cs | 2 +- .../TextureFormats/Decoding/Bc5.cs | 2 +- .../TextureFormats/Decoding/Bc5s.cs | 2 +- .../TextureFormats/Decoding/Bc6h.cs | 2 +- .../TextureFormats/Decoding/Bc6hEField.cs | 2 +- .../Decoding/Bc6hModeDescriptor.cs | 2 +- .../TextureFormats/Decoding/Bc6hModeInfo.cs | 2 +- .../TextureFormats/Decoding/Bc6hs.cs | 2 +- .../Decoding/Bc6hsModeDescriptor.cs | 2 +- .../TextureFormats/Decoding/Bc6hsModeInfo.cs | 2 +- .../TextureFormats/Decoding/Bc7.cs | 2 +- .../TextureFormats/Decoding/Bc7ModeInfo.cs | 2 +- .../TextureFormats/Decoding/Bgr24.cs | 2 +- .../TextureFormats/Decoding/Bgr32.cs | 2 +- .../TextureFormats/Decoding/Bgr555.cs | 2 +- .../TextureFormats/Decoding/Bgr565.cs | 2 +- .../TextureFormats/Decoding/Bgra16.cs | 2 +- .../TextureFormats/Decoding/Bgra32.cs | 2 +- .../TextureFormats/Decoding/Bgra4444.cs | 2 +- .../TextureFormats/Decoding/Bgra5551.cs | 2 +- .../TextureFormats/Decoding/Dxt1.cs | 2 +- .../TextureFormats/Decoding/Dxt3.cs | 2 +- .../TextureFormats/Decoding/Dxt5.cs | 2 +- .../TextureFormats/Decoding/Etc1.cs | 2 +- .../TextureFormats/Decoding/Etc2.cs | 2 +- .../TextureFormats/Decoding/EtcDecoder.cs | 2 +- .../TextureFormats/Decoding/Fp32.cs | 2 +- .../TextureFormats/Decoding/Grgb32.cs | 2 +- .../TextureFormats/Decoding/Helper.cs | 2 +- .../TextureFormats/Decoding/IBlock.cs | 2 +- .../TextureFormats/Decoding/IBlock{TSelf}.cs | 2 +- .../TextureFormats/Decoding/L16.cs | 2 +- .../TextureFormats/Decoding/L32.cs | 2 +- .../TextureFormats/Decoding/L8.cs | 2 +- .../TextureFormats/Decoding/La16.cs | 2 +- .../Decoding/PixelFormats/Constants.cs | 2 +- .../Decoding/PixelFormats/Helpers.cs | 2 +- .../Decoding/PixelFormats/IntColor.cs | 2 +- .../Decoding/PixelFormats/IntEndPntPair.cs | 2 +- .../Decoding/PixelFormats/LdrColorA.cs | 2 +- .../TextureFormats/Decoding/R16Float.cs | 2 +- .../TextureFormats/Decoding/Rg16.cs | 2 +- .../TextureFormats/Decoding/Rg32.cs | 2 +- .../TextureFormats/Decoding/Rg32Float.cs | 2 +- .../TextureFormats/Decoding/Rg64.cs | 2 +- .../TextureFormats/Decoding/Rg64Float.cs | 2 +- .../TextureFormats/Decoding/Rgb111110Float.cs | 2 +- .../TextureFormats/Decoding/Rgb24.cs | 2 +- .../TextureFormats/Decoding/Rgb32.cs | 2 +- .../TextureFormats/Decoding/Rgb48.cs | 2 +- .../TextureFormats/Decoding/Rgb565.cs | 2 +- .../TextureFormats/Decoding/Rgb96.cs | 2 +- .../TextureFormats/Decoding/Rgb96Float.cs | 2 +- .../TextureFormats/Decoding/Rgba1010102.cs | 2 +- .../TextureFormats/Decoding/Rgba128.cs | 2 +- .../TextureFormats/Decoding/Rgba128Float.cs | 2 +- .../TextureFormats/Decoding/Rgba32.cs | 2 +- .../TextureFormats/Decoding/Rgba4444.cs | 2 +- .../TextureFormats/Decoding/Rgba5551.cs | 2 +- .../TextureFormats/Decoding/Rgba64.cs | 2 +- .../TextureFormats/Decoding/Rgba64Float.cs | 2 +- .../TextureFormats/Decoding/Rgbg32.cs | 2 +- .../TextureFormats/Decoding/Y210.cs | 2 +- .../TextureFormats/Decoding/Y216.cs | 2 +- .../TextureFormats/Decoding/Y410.cs | 2 +- .../TextureFormats/Decoding/Y416.cs | 2 +- .../TextureFormats/Decoding/Yuy2.cs | 2 +- .../TextureFormats/FlatTexture.cs | 2 +- .../TextureFormats/VolumeTexture.cs | 2 +- src/ImageSharp.Textures/TextureInfo.cs | 2 +- .../ImageSharp.Textures.Benchmarks/Config.cs | 2 +- .../ImageSharp.Textures.Benchmarks/Program.cs | 2 +- .../ApplicationManager.cs | 2 +- .../Extensions.cs | 4 ++-- .../Program.cs | 2 +- .../ResourceLoader.cs | 4 ++-- .../UI/Button.cs | 2 +- .../UI/MenuBar.cs | 2 +- .../UI/TitleBar.cs | 2 +- .../UI/Widgets.cs | 2 +- .../UI/Wizard.cs | 2 +- .../UI/WizardPage.cs | 4 ++-- .../UI/WizardPages/Preview.cs | 2 +- .../UI/WizardPages/Welcome.cs | 2 +- .../UIManager.cs | 2 +- .../Enums/TestTextureFormat.cs | 2 +- .../Enums/TestTextureTool.cs | 2 +- .../Enums/TestTextureType.cs | 2 +- .../Formats/Dds/DdsDecoderCubemapTests.cs | 2 +- .../Formats/Dds/DdsDecoderFlatTests.cs | 2 +- .../Formats/Dds/DdsDecoderTexConvFlatTests.cs | 2 +- .../Formats/Dds/DdsDecoderVolumeTests.cs | 2 +- .../Formats/Ktx/KtxDecoderTests.cs | 2 +- .../Formats/PixelFormat/PixelFormatTests.cs | 2 +- tests/ImageSharp.Textures.Tests/TestFile.cs | 2 +- tests/ImageSharp.Textures.Tests/TestImages.cs | 2 +- .../Attributes/GroupOutputAttribute.cs | 2 +- .../Attributes/WithFileAttribute.cs | 2 +- .../ImageComparison/ExactImageComparer.cs | 2 +- .../ImageDimensionsMismatchException.cs | 2 +- .../Exceptions/ImagesSimilarityException.cs | 2 +- .../ImageComparison/ImageComparer.cs | 2 +- .../ImageComparison/ImageSimilarityReport.cs | 2 +- .../ImageComparison/PixelDifference.cs | 2 +- .../ImageComparison/TolerantImageComparer.cs | 2 +- .../ImageProviders/FileProvider.cs | 2 +- .../ImageProviders/ITestImageProvider.cs | 2 +- .../ImageProviders/TestImageProvider.cs | 2 +- .../TestUtilities/ImagingTestCaseUtility.cs | 2 +- .../TestUtilities/PixelTypes.cs | 2 +- .../TestUtilities/TestEnvironment.cs | 2 +- .../TestUtilities/TestImageExtensions.cs | 2 +- .../TestUtilities/TestUtils.cs | 2 +- .../TextureProviders/ITestTextureProvider.cs | 2 +- .../TextureProviders/TestTextureProvider.cs | 2 +- tests/Images/TestEnvironment.cs | 2 +- tests/Images/TestTextures.cs | 2 +- 225 files changed, 241 insertions(+), 241 deletions(-) diff --git a/src/ImageSharp.Textures/Common/Exceptions/TextureFormatException.cs b/src/ImageSharp.Textures/Common/Exceptions/TextureFormatException.cs index eb53a6b..8fd3c01 100644 --- a/src/ImageSharp.Textures/Common/Exceptions/TextureFormatException.cs +++ b/src/ImageSharp.Textures/Common/Exceptions/TextureFormatException.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Common/Exceptions/TextureProcessingException.cs b/src/ImageSharp.Textures/Common/Exceptions/TextureProcessingException.cs index 2d3f4f0..ba360be 100644 --- a/src/ImageSharp.Textures/Common/Exceptions/TextureProcessingException.cs +++ b/src/ImageSharp.Textures/Common/Exceptions/TextureProcessingException.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Common/Exceptions/UnknownTextureFormatException.cs b/src/ImageSharp.Textures/Common/Exceptions/UnknownTextureFormatException.cs index 466efcf..05bce3f 100644 --- a/src/ImageSharp.Textures/Common/Exceptions/UnknownTextureFormatException.cs +++ b/src/ImageSharp.Textures/Common/Exceptions/UnknownTextureFormatException.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Common.Exceptions { diff --git a/src/ImageSharp.Textures/Common/Extensions/StreamExtensions.cs b/src/ImageSharp.Textures/Common/Extensions/StreamExtensions.cs index 0b992bc..274a022 100644 --- a/src/ImageSharp.Textures/Common/Extensions/StreamExtensions.cs +++ b/src/ImageSharp.Textures/Common/Extensions/StreamExtensions.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers; diff --git a/src/ImageSharp.Textures/Common/Extensions/ToStringExtension.cs b/src/ImageSharp.Textures/Common/Extensions/ToStringExtension.cs index 254b179..da8ec12 100644 --- a/src/ImageSharp.Textures/Common/Extensions/ToStringExtension.cs +++ b/src/ImageSharp.Textures/Common/Extensions/ToStringExtension.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Text; diff --git a/src/ImageSharp.Textures/Common/Helpers/FloatHelper.cs b/src/ImageSharp.Textures/Common/Helpers/FloatHelper.cs index db2c28b..98b8de5 100644 --- a/src/ImageSharp.Textures/Common/Helpers/FloatHelper.cs +++ b/src/ImageSharp.Textures/Common/Helpers/FloatHelper.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; diff --git a/src/ImageSharp.Textures/Common/Helpers/PixelUtils.cs b/src/ImageSharp.Textures/Common/Helpers/PixelUtils.cs index c89db74..ed7907b 100644 --- a/src/ImageSharp.Textures/Common/Helpers/PixelUtils.cs +++ b/src/ImageSharp.Textures/Common/Helpers/PixelUtils.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; using SixLabors.ImageSharp.PixelFormats; diff --git a/src/ImageSharp.Textures/Configuration.cs b/src/ImageSharp.Textures/Configuration.cs index f8a9920..d68b472 100644 --- a/src/ImageSharp.Textures/Configuration.cs +++ b/src/ImageSharp.Textures/Configuration.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsConfigurationModule.cs b/src/ImageSharp.Textures/Formats/Dds/DdsConfigurationModule.cs index aa5022a..c81d20b 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsConfigurationModule.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsConfigurationModule.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Dds { diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsConstants.cs b/src/ImageSharp.Textures/Formats/Dds/DdsConstants.cs index 5574fa5..0caac84 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsConstants.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsConstants.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsDecoder.cs b/src/ImageSharp.Textures/Formats/Dds/DdsDecoder.cs index a4a20f7..6291bf5 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsDecoder.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsDecoder.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs b/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs index 2186248..f2349a6 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsFormat.cs b/src/ImageSharp.Textures/Formats/Dds/DdsFormat.cs index 82cf2a7..7028ce0 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsFormat.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsFourCC.cs b/src/ImageSharp.Textures/Formats/Dds/DdsFourCC.cs index e19136a..2f92233 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsFourCC.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsFourCC.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Textures.Formats.Dds diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsHeader.cs b/src/ImageSharp.Textures/Formats/Dds/DdsHeader.cs index 864d974..27e1271 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsHeader.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsHeader.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsHeaderDxt10.cs b/src/ImageSharp.Textures/Formats/Dds/DdsHeaderDxt10.cs index dc6aff5..2549492 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsHeaderDxt10.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsHeaderDxt10.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs b/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs index ea6ea1a..8c3d93f 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsPixelFormat.cs b/src/ImageSharp.Textures/Formats/Dds/DdsPixelFormat.cs index 9b7409f..76c4c46 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsPixelFormat.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsPixelFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs b/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs index e76dc30..60a51cc 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsSurfaceType.cs b/src/ImageSharp.Textures/Formats/Dds/DdsSurfaceType.cs index 47c4831..187359e 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsSurfaceType.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsSurfaceType.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Dds { diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsTools.cs b/src/ImageSharp.Textures/Formats/Dds/DdsTools.cs index 1e08505..7402f52 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsTools.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsTools.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using SixLabors.ImageSharp.Textures.Formats.Dds.Emums; diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceDimension.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceDimension.cs index 8119ac3..056fb47 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceDimension.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceDimension.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Dds.Emums { diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceMiscFlags.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceMiscFlags.cs index 590a80b..76dad60 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceMiscFlags.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/D3d10ResourceMiscFlags.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/D3dFormat.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/D3dFormat.cs index f8a348d..37d63ea 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/D3dFormat.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/D3dFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Dds.Emums { diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps1.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps1.cs index 3cb4ea7..abd4d7e 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps1.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps1.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps2.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps2.cs index 2e406eb..ae88ac0 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps2.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsCaps2.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsFlags.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsFlags.cs index 017eb47..ae311d0 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsFlags.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsFlags.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsPixelFormatFlags.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsPixelFormatFlags.cs index 16f2837..4fc301c 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/DdsPixelFormatFlags.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/DdsPixelFormatFlags.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Dds/Enums/DxgiFormat.cs b/src/ImageSharp.Textures/Formats/Dds/Enums/DxgiFormat.cs index 9c343f6..dc4be9a 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Enums/DxgiFormat.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Enums/DxgiFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Textures.Formats.Dds.Emums diff --git a/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs b/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs index 07c17b2..c34e7b1 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Formats.Dds.Emums; diff --git a/src/ImageSharp.Textures/Formats/Dds/IDdsDecoderOptions.cs b/src/ImageSharp.Textures/Formats/Dds/IDdsDecoderOptions.cs index 200a941..40a9b0c 100644 --- a/src/ImageSharp.Textures/Formats/Dds/IDdsDecoderOptions.cs +++ b/src/ImageSharp.Textures/Formats/Dds/IDdsDecoderOptions.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Dds { diff --git a/src/ImageSharp.Textures/Formats/ITextureDecoder.cs b/src/ImageSharp.Textures/Formats/ITextureDecoder.cs index 2b7381b..c1e3498 100644 --- a/src/ImageSharp.Textures/Formats/ITextureDecoder.cs +++ b/src/ImageSharp.Textures/Formats/ITextureDecoder.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats { diff --git a/src/ImageSharp.Textures/Formats/ITextureEncoder.cs b/src/ImageSharp.Textures/Formats/ITextureEncoder.cs index 931bae6..a58ad86 100644 --- a/src/ImageSharp.Textures/Formats/ITextureEncoder.cs +++ b/src/ImageSharp.Textures/Formats/ITextureEncoder.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats { diff --git a/src/ImageSharp.Textures/Formats/ITextureFormat.cs b/src/ImageSharp.Textures/Formats/ITextureFormat.cs index ec48841..bfd5297 100644 --- a/src/ImageSharp.Textures/Formats/ITextureFormat.cs +++ b/src/ImageSharp.Textures/Formats/ITextureFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs b/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs index dd203c8..5457af9 100644 --- a/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs b/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs index e351315..e639dee 100644 --- a/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Concurrent; diff --git a/src/ImageSharp.Textures/Formats/ITextureInfoDetector.cs b/src/ImageSharp.Textures/Formats/ITextureInfoDetector.cs index 947f20e..3865e17 100644 --- a/src/ImageSharp.Textures/Formats/ITextureInfoDetector.cs +++ b/src/ImageSharp.Textures/Formats/ITextureInfoDetector.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlBaseInternalPixelFormat.cs b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlBaseInternalPixelFormat.cs index 05f2eb4..bd585fe 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlBaseInternalPixelFormat.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlBaseInternalPixelFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx.Enums { diff --git a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlInternalPixelFormat.cs b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlInternalPixelFormat.cs index b7cb17d..0597c74 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlInternalPixelFormat.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlInternalPixelFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx { diff --git a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlPixelFormat.cs b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlPixelFormat.cs index b0bc286..c709c88 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlPixelFormat.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlPixelFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx { diff --git a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlType.cs b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlType.cs index 851d991..db93328 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/Enums/GlType.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/Enums/GlType.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx.Enums { diff --git a/src/ImageSharp.Textures/Formats/Ktx/Enums/KtxEndianness.cs b/src/ImageSharp.Textures/Formats/Ktx/Enums/KtxEndianness.cs index e25eb84..4864d1a 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/Enums/KtxEndianness.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/Enums/KtxEndianness.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx { diff --git a/src/ImageSharp.Textures/Formats/Ktx/IKtxDecoderOptions.cs b/src/ImageSharp.Textures/Formats/Ktx/IKtxDecoderOptions.cs index f9e31e6..e2b1c39 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/IKtxDecoderOptions.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/IKtxDecoderOptions.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx { diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxConfigurationModule.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxConfigurationModule.cs index 5fbcedf..81d2de6 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxConfigurationModule.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxConfigurationModule.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx { diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxConstants.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxConstants.cs index a912e0e..4b2fd31 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxConstants.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxConstants.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxDecoder.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxDecoder.cs index 05184f5..4f7aa56 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxDecoder.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxDecoder.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxDecoderCore.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxDecoderCore.cs index 63fb110..8a6255b 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxDecoderCore.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxDecoderCore.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.IO; using SixLabors.ImageSharp.Memory; diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxFormat.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxFormat.cs index 17d6c89..a46ba1a 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxFormat.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs index 63c153a..0876659 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs index 296ad71..91f5467 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxProcessor.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxProcessor.cs index 206fd8a..88ac7f2 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxProcessor.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxProcessor.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Enums/VkFormat.cs b/src/ImageSharp.Textures/Formats/Ktx2/Enums/VkFormat.cs index 741e06a..a3e8973 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Enums/VkFormat.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Enums/VkFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Textures.Formats.Ktx2.Enums diff --git a/src/ImageSharp.Textures/Formats/Ktx2/IKtx2DecoderOptions.cs b/src/ImageSharp.Textures/Formats/Ktx2/IKtx2DecoderOptions.cs index 943cde5..b534ff2 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/IKtx2DecoderOptions.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/IKtx2DecoderOptions.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx2 { diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ConfigurationModule.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ConfigurationModule.cs index 6490d5f..93e05c5 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ConfigurationModule.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ConfigurationModule.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats.Ktx2 { diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Constants.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Constants.cs index 459270e..0305799 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Constants.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Constants.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Decoder.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Decoder.cs index ea9c2c3..0442a62 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Decoder.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Decoder.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2DecoderCore.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2DecoderCore.cs index eba5fdf..6decbef 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2DecoderCore.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2DecoderCore.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Format.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Format.cs index 78f94c5..84a6ddf 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Format.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Format.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs index 4d5a7ba..6b380ab 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; @@ -105,7 +105,7 @@ public Ktx2Header( /// /// Gets the supercompression scheme. /// supercompressionScheme indicates if a supercompression scheme has been applied to the data in levelImages. - /// It must be one of the values from Table 2, “Supercompression Schemes”. A value of 0 indicates no supercompression. + /// It must be one of the values from Table 2, “Supercompression Schemesâ€. A value of 0 indicates no supercompression. /// public uint SupercompressionScheme { get; } @@ -139,7 +139,7 @@ public Ktx2Header( /// /// Gets the number of bytes of supercompressionGlobalData. - /// For supercompression schemes for which no reference is provided in the Global Data Format column of Table 2, “Supercompression Schemes”. the value must be 0. + /// For supercompression schemes for which no reference is provided in the Global Data Format column of Table 2, “Supercompression Schemesâ€. the value must be 0. /// public ulong SgdByteLength { get; } diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs index cf4468f..af99577 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs index 9522d7a..4f4923b 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/src/ImageSharp.Textures/Formats/Ktx2/LevelIndex.cs b/src/ImageSharp.Textures/Formats/Ktx2/LevelIndex.cs index 5877724..80d38f6 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/LevelIndex.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/LevelIndex.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Runtime.InteropServices; diff --git a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs index f970676..4053632 100644 --- a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Concurrent; diff --git a/src/ImageSharp.Textures/Formats/TextureTypeInfo.cs b/src/ImageSharp.Textures/Formats/TextureTypeInfo.cs index 9f9ba88..ab63201 100644 --- a/src/ImageSharp.Textures/Formats/TextureTypeInfo.cs +++ b/src/ImageSharp.Textures/Formats/TextureTypeInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Formats { diff --git a/src/ImageSharp.Textures/IConfigurationModule.cs b/src/ImageSharp.Textures/IConfigurationModule.cs index fd149b6..1336239 100644 --- a/src/ImageSharp.Textures/IConfigurationModule.cs +++ b/src/ImageSharp.Textures/IConfigurationModule.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures { diff --git a/src/ImageSharp.Textures/IO/IFileSystem.cs b/src/ImageSharp.Textures/IO/IFileSystem.cs index 197ccb9..a36fd7e 100644 --- a/src/ImageSharp.Textures/IO/IFileSystem.cs +++ b/src/ImageSharp.Textures/IO/IFileSystem.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.IO { diff --git a/src/ImageSharp.Textures/IO/LocalFileSystem.cs b/src/ImageSharp.Textures/IO/LocalFileSystem.cs index fd04b76..1ff7fb9 100644 --- a/src/ImageSharp.Textures/IO/LocalFileSystem.cs +++ b/src/ImageSharp.Textures/IO/LocalFileSystem.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.IO { diff --git a/src/ImageSharp.Textures/ITexture.cs b/src/ImageSharp.Textures/ITexture.cs index e1ae4ce..8c97835 100644 --- a/src/ImageSharp.Textures/ITexture.cs +++ b/src/ImageSharp.Textures/ITexture.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/ITextureInfo.cs b/src/ImageSharp.Textures/ITextureInfo.cs index db63a53..35443f6 100644 --- a/src/ImageSharp.Textures/ITextureInfo.cs +++ b/src/ImageSharp.Textures/ITextureInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Formats; diff --git a/src/ImageSharp.Textures/ImageSharp.Textures.csproj b/src/ImageSharp.Textures/ImageSharp.Textures.csproj index 068d917..ba8a1bb 100644 --- a/src/ImageSharp.Textures/ImageSharp.Textures.csproj +++ b/src/ImageSharp.Textures/ImageSharp.Textures.csproj @@ -7,7 +7,6 @@ SixLabors.ImageSharp.Textures SixLabors.ImageSharp.Textures sixlabors.imagesharp.textures.128.png - Apache-2.0 https://github.com/SixLabors/ImageSharp.Textures/ $(RepositoryUrl) Texture Surface BASIS DDS KTX KTX2 ETC1 ETC2 DXT1 DXT3 DXT5 BC5 BC6 BC7 @@ -28,6 +27,7 @@ + diff --git a/src/ImageSharp.Textures/MipMap.cs b/src/ImageSharp.Textures/MipMap.cs index 20b78b7..c0e5a51 100644 --- a/src/ImageSharp.Textures/MipMap.cs +++ b/src/ImageSharp.Textures/MipMap.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures { diff --git a/src/ImageSharp.Textures/MipMap{TBlock}.cs b/src/ImageSharp.Textures/MipMap{TBlock}.cs index 47abf4a..9d51b59 100644 --- a/src/ImageSharp.Textures/MipMap{TBlock}.cs +++ b/src/ImageSharp.Textures/MipMap{TBlock}.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.TextureFormats.Decoding; diff --git a/src/ImageSharp.Textures/PixelFormats/Ayuv.cs b/src/ImageSharp.Textures/PixelFormats/Ayuv.cs index ef44891..926e192 100644 --- a/src/ImageSharp.Textures/PixelFormats/Ayuv.cs +++ b/src/ImageSharp.Textures/PixelFormats/Ayuv.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/ColorSpaceConversion.cs b/src/ImageSharp.Textures/PixelFormats/ColorSpaceConversion.cs index d81967b..36f78ee 100644 --- a/src/ImageSharp.Textures/PixelFormats/ColorSpaceConversion.cs +++ b/src/ImageSharp.Textures/PixelFormats/ColorSpaceConversion.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Fp32.cs b/src/ImageSharp.Textures/PixelFormats/Fp32.cs index 3a42cea..9c84d65 100644 --- a/src/ImageSharp.Textures/PixelFormats/Fp32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Fp32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs index ec689f2..0aceac2 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs index 0a1c300..8c77dff 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs b/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs index 0b8afd4..dc3a009 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore index d7cbbf6..1f06e56 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore +++ b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -187,7 +187,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -375,7 +375,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -554,7 +554,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -733,7 +733,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -913,7 +913,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -1089,7 +1089,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -1259,7 +1259,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -1429,7 +1429,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -1605,7 +1605,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -1782,7 +1782,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; @@ -1961,7 +1961,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats } } // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt index 1ac6761..4d5b47c 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt +++ b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt @@ -192,7 +192,7 @@ manager.StartNewFile($"{pixelInfo.Name}.cs"); #>// Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. <#= Helper.GenerateUsings(pixelInfo) #> diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs index 19c9d08..7816f83 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs index 908129d..8adf7c4 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs index 7b04ada..f3d0e33 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs index f09b314..012bfe4 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs index 769e84d..fd15a77 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs index be62de3..fd8a77e 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs index 34e101e..c27c733 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs index f63bef7..b0ed25a 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs index 8398c1d..ce711d9 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs index eab0e6a..3114460 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs index f929bcc..0cd5e2b 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs index d5914b0..7af7e4b 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs index 045bb8c..057c58e 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/L32.cs b/src/ImageSharp.Textures/PixelFormats/L32.cs index 0c3e37b..b6e4c99 100644 --- a/src/ImageSharp.Textures/PixelFormats/L32.cs +++ b/src/ImageSharp.Textures/PixelFormats/L32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Numerics; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp.Textures/PixelFormats/R16Float.cs b/src/ImageSharp.Textures/PixelFormats/R16Float.cs index b7d74a5..ac554ab 100644 --- a/src/ImageSharp.Textures/PixelFormats/R16Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/R16Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Rg16.cs b/src/ImageSharp.Textures/PixelFormats/Rg16.cs index 980f43d..5fc6931 100644 --- a/src/ImageSharp.Textures/PixelFormats/Rg16.cs +++ b/src/ImageSharp.Textures/PixelFormats/Rg16.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Rg32.cs b/src/ImageSharp.Textures/PixelFormats/Rg32.cs index 8164651..34da70b 100644 --- a/src/ImageSharp.Textures/PixelFormats/Rg32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Rg32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Y410.cs b/src/ImageSharp.Textures/PixelFormats/Y410.cs index 07b17dd..33ad854 100644 --- a/src/ImageSharp.Textures/PixelFormats/Y410.cs +++ b/src/ImageSharp.Textures/PixelFormats/Y410.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/PixelFormats/Y416.cs b/src/ImageSharp.Textures/PixelFormats/Y416.cs index fb65ec3..6203af0 100644 --- a/src/ImageSharp.Textures/PixelFormats/Y416.cs +++ b/src/ImageSharp.Textures/PixelFormats/Y416.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/Texture.Decode.cs b/src/ImageSharp.Textures/Texture.Decode.cs index 2b7ea4b..c3a63b1 100644 --- a/src/ImageSharp.Textures/Texture.Decode.cs +++ b/src/ImageSharp.Textures/Texture.Decode.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/src/ImageSharp.Textures/Texture.FromBytes.cs b/src/ImageSharp.Textures/Texture.FromBytes.cs index aacc72b..be436df 100644 --- a/src/ImageSharp.Textures/Texture.FromBytes.cs +++ b/src/ImageSharp.Textures/Texture.FromBytes.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/src/ImageSharp.Textures/Texture.FromFile.cs b/src/ImageSharp.Textures/Texture.FromFile.cs index 02761d7..9e0e5f4 100644 --- a/src/ImageSharp.Textures/Texture.FromFile.cs +++ b/src/ImageSharp.Textures/Texture.FromFile.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/src/ImageSharp.Textures/Texture.FromStream.cs b/src/ImageSharp.Textures/Texture.FromStream.cs index ce9db69..f9b3795 100644 --- a/src/ImageSharp.Textures/Texture.FromStream.cs +++ b/src/ImageSharp.Textures/Texture.FromStream.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/Texture.cs b/src/ImageSharp.Textures/Texture.cs index 9484e76..c4f97e4 100644 --- a/src/ImageSharp.Textures/Texture.cs +++ b/src/ImageSharp.Textures/Texture.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs b/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs index 0dac106..b39ff3d 100644 --- a/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs +++ b/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/A8.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/A8.cs index b247cad..98be4a8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/A8.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/A8.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Ayuv.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Ayuv.cs index 344db71..7277cba 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Ayuv.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Ayuv.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs index 8b55a52..e650a48 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs index da7992e..6b2f6ec 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs index b9dafe6..6075a47 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs index d6175b3..1592b8a 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs index 5e99a49..1280b43 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Diagnostics; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hEField.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hEField.cs index 7be85a5..fd26730 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hEField.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hEField.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeDescriptor.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeDescriptor.cs index d02b3fe..3bc2f8b 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeDescriptor.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeDescriptor.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeInfo.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeInfo.cs index 2d3bf63..4a460ce 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeInfo.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hModeInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.TextureFormats.Decoding.PixelFormats; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs index 694d618..d2be696 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Diagnostics; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeDescriptor.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeDescriptor.cs index 72cbc7c..97e2fd8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeDescriptor.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeDescriptor.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeInfo.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeInfo.cs index 034b88f..0c9047e 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeInfo.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hsModeInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.TextureFormats.Decoding.PixelFormats; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs index 66e7184..6063322 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Diagnostics; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7ModeInfo.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7ModeInfo.cs index ad6a07c..e3debea 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7ModeInfo.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7ModeInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.TextureFormats.Decoding.PixelFormats; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr24.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr24.cs index 88e8597..d349a91 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr24.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr24.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr32.cs index 1d91d2b..b3374ce 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr555.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr555.cs index 053b389..1d0ddbe 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr555.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr555.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr565.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr565.cs index 56604bc..e8d1ee2 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr565.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgr565.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra16.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra16.cs index 436fee9..0ff9443 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra16.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra16.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra32.cs index 7e24ee0..a2f5e85 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra4444.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra4444.cs index bf730be..97b6796 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra4444.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra4444.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra5551.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra5551.cs index 4ae23b7..a52919e 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra5551.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bgra5551.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs index 3ec5680..7345901 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Common.Helpers; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs index b30f6a9..aa72f76 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Common.Helpers; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs index 3bddba5..d796401 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Common.Helpers; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Etc1.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Etc1.cs index aa52afa..7ce1acb 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Etc1.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Etc1.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Etc2.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Etc2.cs index d7efc80..0b59fa3 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Etc2.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Etc2.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs index 89d7823..be1d1b2 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Buffers.Binary; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Fp32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Fp32.cs index e152d96..2e5d553 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Fp32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Fp32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Grgb32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Grgb32.cs index c81fb12..bf02c55 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Grgb32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Grgb32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Runtime.InteropServices; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Helper.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Helper.cs index 1e99884..e755cc8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Helper.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Helper.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock.cs index 41e855c..99edf38 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock{TSelf}.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock{TSelf}.cs index 0e5f1ad..d656dc1 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock{TSelf}.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/IBlock{TSelf}.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/L16.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/L16.cs index 1029ef5..8951fa6 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/L16.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/L16.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/L32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/L32.cs index 1e20487..32813f6 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/L32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/L32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/L8.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/L8.cs index a537953..e43d7d8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/L8.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/L8.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/La16.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/La16.cs index 892f64c..98aa5ff 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/La16.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/La16.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Constants.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Constants.cs index a73e0af..60fc792 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Constants.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Constants.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding.PixelFormats diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Helpers.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Helpers.cs index 53eb2ec..0b3ce4f 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Helpers.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/Helpers.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntColor.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntColor.cs index 7a92776..7bceb86 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntColor.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntColor.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding.PixelFormats { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntEndPntPair.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntEndPntPair.cs index 3d3fb96..50dd10d 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntEndPntPair.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/IntEndPntPair.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding.PixelFormats { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs index 86c9749..dbee681 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Diagnostics; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/R16Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/R16Float.cs index 53dedaa..6701581 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/R16Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/R16Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg16.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg16.cs index ed692c9..a9747f0 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg16.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg16.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32.cs index 5284935..f3df0a7 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32Float.cs index 06fe416..b825362 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg32Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64.cs index e00b5f9..ef5cacb 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64Float.cs index b4c0482..216a1b9 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rg64Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb111110Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb111110Float.cs index 0f5ec84..2eed524 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb111110Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb111110Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb24.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb24.cs index 8d47318..905cfd8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb24.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb24.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb32.cs index 2c0934a..76f4a80 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb48.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb48.cs index e95016f..70de61e 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb48.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb48.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb565.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb565.cs index 7ddbde1..7d245e8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb565.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb565.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96.cs index b695385..5e3557b 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96Float.cs index 76d6a6d..0260a2f 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgb96Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba1010102.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba1010102.cs index 47b2b3f..c1fab15 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba1010102.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba1010102.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128.cs index d5ed7c5..06bfe86 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128Float.cs index c89d1f6..2e2329d 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba128Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba32.cs index 11a95c6..af7859e 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba4444.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba4444.cs index 0fefba7..25a1c4d 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba4444.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba4444.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba5551.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba5551.cs index 4cf37e9..8e56023 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba5551.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba5551.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64.cs index f092a81..1022896 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64Float.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64Float.cs index 6006b55..ec517a8 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64Float.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgba64Float.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.PixelFormats; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgbg32.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgbg32.cs index c9b5e02..71612c4 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Rgbg32.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Rgbg32.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Runtime.InteropServices; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Y210.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Y210.cs index 0b9a087..e924fc3 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Y210.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Y210.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Y216.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Y216.cs index 50e3ae0..88e0945 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Y216.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Y216.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Y410.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Y410.cs index 2f6b79b..6679bb7 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Y410.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Y410.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Y416.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Y416.cs index 36b9f09..aee555b 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Y416.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Y416.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.TextureFormats.Decoding { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Yuy2.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Yuy2.cs index 8e92061..275e52e 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Yuy2.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Yuy2.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs b/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs index 2de5b48..e94dea0 100644 --- a/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs +++ b/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs b/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs index 33b259e..a4b3e4d 100644 --- a/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs +++ b/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/src/ImageSharp.Textures/TextureInfo.cs b/src/ImageSharp.Textures/TextureInfo.cs index 18afae2..53f8e83 100644 --- a/src/ImageSharp.Textures/TextureInfo.cs +++ b/src/ImageSharp.Textures/TextureInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Formats; diff --git a/tests/ImageSharp.Textures.Benchmarks/Config.cs b/tests/ImageSharp.Textures.Benchmarks/Config.cs index cf49f51..f57970a 100644 --- a/tests/ImageSharp.Textures.Benchmarks/Config.cs +++ b/tests/ImageSharp.Textures.Benchmarks/Config.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using BenchmarkDotNet.Configs; using BenchmarkDotNet.Diagnosers; diff --git a/tests/ImageSharp.Textures.Benchmarks/Program.cs b/tests/ImageSharp.Textures.Benchmarks/Program.cs index aa5861a..287b56e 100644 --- a/tests/ImageSharp.Textures.Benchmarks/Program.cs +++ b/tests/ImageSharp.Textures.Benchmarks/Program.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Reflection; using BenchmarkDotNet.Running; diff --git a/tests/ImageSharp.Textures.InteractiveTest/ApplicationManager.cs b/tests/ImageSharp.Textures.InteractiveTest/ApplicationManager.cs index e497088..f1e7147 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/ApplicationManager.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/ApplicationManager.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.InteractiveTest/Extensions.cs b/tests/ImageSharp.Textures.InteractiveTest/Extensions.cs index 46c0728..f342e50 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/Extensions.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/Extensions.cs @@ -1,5 +1,5 @@ -// Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.InteractiveTest/Program.cs b/tests/ImageSharp.Textures.InteractiveTest/Program.cs index 774ccf6..759c1b7 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/Program.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/Program.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using ImGuiNET; diff --git a/tests/ImageSharp.Textures.InteractiveTest/ResourceLoader.cs b/tests/ImageSharp.Textures.InteractiveTest/ResourceLoader.cs index 4b163e6..f7ab619 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/ResourceLoader.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/ResourceLoader.cs @@ -1,5 +1,5 @@ -// Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/Button.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/Button.cs index 4cbc0c5..c163405 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/Button.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/Button.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/MenuBar.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/MenuBar.cs index 1a99c3a..37b9606 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/MenuBar.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/MenuBar.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using ImGuiNET; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/TitleBar.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/TitleBar.cs index e97b800..ad93a5f 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/TitleBar.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/TitleBar.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Numerics; using ImGuiNET; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/Widgets.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/Widgets.cs index ffee53e..453ae26 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/Widgets.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/Widgets.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/Wizard.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/Wizard.cs index b1a83d1..fc48ce3 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/Wizard.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/Wizard.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Numerics; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPage.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPage.cs index 7ec98a0..2563785 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPage.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPage.cs @@ -1,5 +1,5 @@ -// Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.InteractiveTest.UI { diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Preview.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Preview.cs index a204bd0..81384ee 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Preview.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Preview.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Welcome.cs b/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Welcome.cs index e2a5db9..893a9cd 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Welcome.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UI/WizardPages/Welcome.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using ImGuiNET; diff --git a/tests/ImageSharp.Textures.InteractiveTest/UIManager.cs b/tests/ImageSharp.Textures.InteractiveTest/UIManager.cs index 6e2bbd0..9abaf4d 100644 --- a/tests/ImageSharp.Textures.InteractiveTest/UIManager.cs +++ b/tests/ImageSharp.Textures.InteractiveTest/UIManager.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Numerics; using ImGuiNET; diff --git a/tests/ImageSharp.Textures.Tests/Enums/TestTextureFormat.cs b/tests/ImageSharp.Textures.Tests/Enums/TestTextureFormat.cs index 8c95425..f737c79 100644 --- a/tests/ImageSharp.Textures.Tests/Enums/TestTextureFormat.cs +++ b/tests/ImageSharp.Textures.Tests/Enums/TestTextureFormat.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests.Enums { diff --git a/tests/ImageSharp.Textures.Tests/Enums/TestTextureTool.cs b/tests/ImageSharp.Textures.Tests/Enums/TestTextureTool.cs index ce73a8b..169d4da 100644 --- a/tests/ImageSharp.Textures.Tests/Enums/TestTextureTool.cs +++ b/tests/ImageSharp.Textures.Tests/Enums/TestTextureTool.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests.Enums { diff --git a/tests/ImageSharp.Textures.Tests/Enums/TestTextureType.cs b/tests/ImageSharp.Textures.Tests/Enums/TestTextureType.cs index 7c229f8..d550f16 100644 --- a/tests/ImageSharp.Textures.Tests/Enums/TestTextureType.cs +++ b/tests/ImageSharp.Textures.Tests/Enums/TestTextureType.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests.Enums { diff --git a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderCubemapTests.cs b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderCubemapTests.cs index 683fb68..aed5e79 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderCubemapTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderCubemapTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Formats.Dds; using SixLabors.ImageSharp.Textures.Tests.Enums; diff --git a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderFlatTests.cs b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderFlatTests.cs index d79de4e..1186142 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderFlatTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderFlatTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using SixLabors.ImageSharp.Textures.Formats.Dds; diff --git a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderTexConvFlatTests.cs b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderTexConvFlatTests.cs index def1c2b..e2ad337 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderTexConvFlatTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderTexConvFlatTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using SixLabors.ImageSharp.Textures.Formats.Dds; diff --git a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderVolumeTests.cs b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderVolumeTests.cs index 49dbf5c..0a3f897 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderVolumeTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/Dds/DdsDecoderVolumeTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Formats.Dds; using SixLabors.ImageSharp.Textures.Tests.Enums; diff --git a/tests/ImageSharp.Textures.Tests/Formats/Ktx/KtxDecoderTests.cs b/tests/ImageSharp.Textures.Tests/Formats/Ktx/KtxDecoderTests.cs index f7f01de..1fbacc6 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/Ktx/KtxDecoderTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/Ktx/KtxDecoderTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Textures.Formats.Ktx; diff --git a/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs b/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs index 660f2d8..9424898 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.PixelFormats; using Xunit; diff --git a/tests/ImageSharp.Textures.Tests/TestFile.cs b/tests/ImageSharp.Textures.Tests/TestFile.cs index 5630c5c..bc4c0ce 100644 --- a/tests/ImageSharp.Textures.Tests/TestFile.cs +++ b/tests/ImageSharp.Textures.Tests/TestFile.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Concurrent; diff --git a/tests/ImageSharp.Textures.Tests/TestImages.cs b/tests/ImageSharp.Textures.Tests/TestImages.cs index c2123db..d3df36c 100644 --- a/tests/ImageSharp.Textures.Tests/TestImages.cs +++ b/tests/ImageSharp.Textures.Tests/TestImages.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests { diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs index 245fa9d..cb024df 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs index 4361110..fe06bc5 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs index 4b39d16..3035fad 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs index 080ea32..f59af42 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImageDimensionsMismatchException.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities.ImageComparison.Exceptions { diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImagesSimilarityException.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImagesSimilarityException.cs index 37f3846..38c0454 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImagesSimilarityException.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/Exceptions/ImagesSimilarityException.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities.ImageComparison.Exceptions { diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs index 6b94fb1..d79105b 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Generic; using System.Linq; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs index f0d6b1b..cfa9654 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/PixelDifference.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/PixelDifference.cs index d667672..46153a6 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/PixelDifference.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/PixelDifference.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Numerics; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs index f2fb1f4..b7d5659 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs index 46e6509..6e04d29 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.Collections.Concurrent; using System.Reflection; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/ITestImageProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/ITestImageProvider.cs index 5345635..5ff70bd 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/ITestImageProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/ITestImageProvider.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities.ImageProviders { diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index d6ef180..3476922 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Reflection; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs index 8d80d40..769816d 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/PixelTypes.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/PixelTypes.cs index 8bc6b36..6499cf5 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/PixelTypes.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/PixelTypes.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs index 3459765..bc01a8b 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TestEnvironment.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Diagnostics; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs index 14941ee..5218853 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TestImageExtensions.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TestUtils.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TestUtils.cs index 11503af..cd3e4c6 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TestUtils.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TestUtils.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.Collections.Generic; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/ITestTextureProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/ITestTextureProvider.cs index c3138e4..757107c 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/ITestTextureProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/ITestTextureProvider.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using SixLabors.ImageSharp.Textures.Tests.Enums; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs index e95bf95..f6431e7 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System.IO; using System.Text; diff --git a/tests/Images/TestEnvironment.cs b/tests/Images/TestEnvironment.cs index ad20951..73c8189 100644 --- a/tests/Images/TestEnvironment.cs +++ b/tests/Images/TestEnvironment.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. using System; using System.IO; diff --git a/tests/Images/TestTextures.cs b/tests/Images/TestTextures.cs index 83277de..6f57d93 100644 --- a/tests/Images/TestTextures.cs +++ b/tests/Images/TestTextures.cs @@ -1,5 +1,5 @@ // Copyright (c) Six Labors. -// Licensed under the Apache License, Version 2.0. +// Licensed under the Six Labors Split License. namespace SixLabors.ImageSharp.Textures.Tests { From c59e7e06249b2acc793c2a05ad02438168a7270d Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:23:39 +0200 Subject: [PATCH 06/12] Fix general build errors --- .../Formats/Dds/DdsProcessor.cs | 259 ++++++++---------- .../Formats/ITextureFormatManager.cs | 5 +- .../Formats/Ktx/KtxHeader.cs | 2 +- .../Formats/Ktx2/Ktx2Header.cs | 2 +- .../Formats/Ktx2/Ktx2Processor.cs | 142 +++++----- .../Formats/TextureFormatManager.cs | 5 +- src/ImageSharp.Textures/PixelFormats/Ayuv.cs | 34 ++- src/ImageSharp.Textures/PixelFormats/Fp32.cs | 41 ++- .../Generated/D32_FLOAT_S8X24_UINT.cs | 2 + src/ImageSharp.Textures/PixelFormats/Y410.cs | 27 +- src/ImageSharp.Textures/PixelFormats/Y416.cs | 27 +- src/ImageSharp.Textures/Texture.FromStream.cs | 5 +- .../TextureFormats/CubemapTexture.cs | 7 +- .../TextureFormats/Decoding/Bc4.cs | 2 +- .../TextureFormats/Decoding/Bc4s.cs | 2 +- .../TextureFormats/Decoding/Bc5.cs | 2 +- .../TextureFormats/Decoding/Bc5s.cs | 2 +- .../TextureFormats/Decoding/Bc6h.cs | 2 +- .../TextureFormats/Decoding/Bc6hs.cs | 2 +- .../TextureFormats/Decoding/Bc7.cs | 2 +- .../TextureFormats/Decoding/Dxt1.cs | 2 +- .../TextureFormats/Decoding/Dxt3.cs | 2 +- .../TextureFormats/Decoding/Dxt5.cs | 2 +- .../TextureFormats/Decoding/EtcDecoder.cs | 2 +- .../Decoding/PixelFormats/LdrColorA.cs | 24 +- .../TextureFormats/FlatTexture.cs | 7 +- .../TextureFormats/VolumeTexture.cs | 7 +- .../Formats/PixelFormat/PixelFormatTests.cs | 11 +- .../Attributes/GroupOutputAttribute.cs | 1 + .../Attributes/WithFileAttribute.cs | 7 +- .../ImageComparison/ImageComparer.cs | 12 +- .../ImageComparison/ImageSimilarityReport.cs | 13 +- .../ImageComparison/TolerantImageComparer.cs | 3 +- .../ImageProviders/FileProvider.cs | 6 +- .../ImageProviders/TestImageProvider.cs | 9 +- .../TestUtilities/ImagingTestCaseUtility.cs | 56 +--- .../TextureProviders/TestTextureProvider.cs | 21 +- tests/Images/TestEnvironment.cs | 4 +- 38 files changed, 386 insertions(+), 375 deletions(-) diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs b/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs index 60a51cc..73508b9 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs @@ -10,6 +10,8 @@ using Fp32 = SixLabors.ImageSharp.Textures.TextureFormats.Decoding.Fp32; using L32 = SixLabors.ImageSharp.Textures.TextureFormats.Decoding.L32; +#nullable enable + namespace SixLabors.ImageSharp.Textures.Formats.Dds { /// @@ -50,83 +52,58 @@ public MipMap[] DecodeDds(Stream stream, int width, int height, int count) { Guard.MustBeGreaterThan(count, 0, nameof(count)); - switch (this.DdsHeader.PixelFormat.FourCC) + return this.DdsHeader.PixelFormat.FourCC switch { - case DdsFourCc.None: - case DdsFourCc.R16FLOAT: - case DdsFourCc.R16G16FLOAT: - case DdsFourCc.R16G16B16A16SNORM: - case DdsFourCc.R16G16B16A16UNORM: - case DdsFourCc.R16G16B16A16FLOAT: - case DdsFourCc.R32FLOAT: - case DdsFourCc.R32G32FLOAT: - case DdsFourCc.R32G32B32A32FLOAT: - case DdsFourCc.YUY2: - case DdsFourCc.RGBG: - case DdsFourCc.GRGB: - return this.ProcessUncompressed(stream, width, height, count); - case DdsFourCc.DXT1: - return this.AllocateMipMaps(stream, width, height, count); - case DdsFourCc.DXT2: - case DdsFourCc.DXT4: - throw new NotSupportedException("Due to patentsCan, DXT2 or DXT4 cannot be supported."); - case DdsFourCc.DXT3: - return this.AllocateMipMaps(stream, width, height, count); - case DdsFourCc.DXT5: - return this.AllocateMipMaps(stream, width, height, count); - case DdsFourCc.DX10: - return this.GetDx10Dds(stream, width, height, count); - case DdsFourCc.ATI1: - case DdsFourCc.BC4U: - return this.AllocateMipMaps(stream, width, height, count); - case DdsFourCc.BC4S: - return this.AllocateMipMaps(stream, width, height, count); - case DdsFourCc.ATI2: - case DdsFourCc.BC5U: - return this.AllocateMipMaps(stream, width, height, count); - case DdsFourCc.BC5S: - return this.AllocateMipMaps(stream, width, height, count); - default: - throw new NotSupportedException($"FourCC: {this.DdsHeader.PixelFormat.FourCC.FourCcToString()} not supported."); - } + DdsFourCc.None + or DdsFourCc.R16FLOAT + or DdsFourCc.R16G16FLOAT + or DdsFourCc.R16G16B16A16SNORM + or DdsFourCc.R16G16B16A16UNORM + or DdsFourCc.R16G16B16A16FLOAT + or DdsFourCc.R32FLOAT + or DdsFourCc.R32G32FLOAT + or DdsFourCc.R32G32B32A32FLOAT + or DdsFourCc.YUY2 + or DdsFourCc.RGBG + or DdsFourCc.GRGB => this.ProcessUncompressed(stream, width, height, count), + DdsFourCc.DXT1 => AllocateMipMaps(stream, width, height, count), + DdsFourCc.DXT2 or DdsFourCc.DXT4 => throw new NotSupportedException("Due to patents Can, DXT2 or DXT4 cannot be supported."), + DdsFourCc.DXT3 => AllocateMipMaps(stream, width, height, count), + DdsFourCc.DXT5 => AllocateMipMaps(stream, width, height, count), + DdsFourCc.DX10 => this.GetDx10Dds(stream, width, height, count), + DdsFourCc.ATI1 or DdsFourCc.BC4U => AllocateMipMaps(stream, width, height, count), + DdsFourCc.BC4S => AllocateMipMaps(stream, width, height, count), + DdsFourCc.ATI2 or DdsFourCc.BC5U => AllocateMipMaps(stream, width, height, count), + DdsFourCc.BC5S => AllocateMipMaps(stream, width, height, count), + _ => throw new NotSupportedException($"FourCC: {this.DdsHeader.PixelFormat.FourCC.FourCcToString()} not supported."), + }; } public MipMap[] ProcessUncompressed(Stream stream, int width, int height, int count) { uint bitsPerPixel = this.DdsHeader.PixelFormat.RGBBitCount; - switch (bitsPerPixel) + return bitsPerPixel switch { - case 8: - return this.EightBitImageFormat(stream, width, height, count); - case 16: - return this.SixteenBitImageFormat(stream, width, height, count); - case 24: - return this.TwentyFourBitImageFormat(stream, width, height, count); - case 32: - return this.ThirtyTwoBitImageFormat(stream, width, height, count); - default: - // For unknown reason some formats do not have the bitsPerPixel set in the header (its zero). - switch (this.DdsHeader.PixelFormat.FourCC) - { - case DdsFourCc.R16FLOAT: - return this.SixteenBitImageFormat(stream, width, height, count); - case DdsFourCc.R32FLOAT: - case DdsFourCc.R16G16FLOAT: - case DdsFourCc.YUY2: - case DdsFourCc.RGBG: - case DdsFourCc.GRGB: - return this.ThirtyTwoBitImageFormat(stream, width, height, count); - case DdsFourCc.R16G16B16A16SNORM: - case DdsFourCc.R16G16B16A16UNORM: - case DdsFourCc.R16G16B16A16FLOAT: - case DdsFourCc.R32G32FLOAT: - return this.SixtyFourBitImageFormat(stream, width, height, count); - case DdsFourCc.R32G32B32A32FLOAT: - return this.HundredTwentyEightBitImageFormat(stream, width, height, count); - } - - throw new Exception($"Unrecognized rgb bit count: {this.DdsHeader.PixelFormat.RGBBitCount}"); - } + 8 => this.EightBitImageFormat(stream, width, height, count), + 16 => this.SixteenBitImageFormat(stream, width, height, count), + 24 => this.TwentyFourBitImageFormat(stream, width, height, count), + 32 => this.ThirtyTwoBitImageFormat(stream, width, height, count), + _ => this.DdsHeader.PixelFormat.FourCC switch + { + DdsFourCc.R16FLOAT => this.SixteenBitImageFormat(stream, width, height, count), + DdsFourCc.R32FLOAT + or DdsFourCc.R16G16FLOAT + or DdsFourCc.YUY2 + or DdsFourCc.RGBG + or DdsFourCc.GRGB => this.ThirtyTwoBitImageFormat(stream, width, height, count), + DdsFourCc.R16G16B16A16SNORM + or DdsFourCc.R16G16B16A16UNORM + or DdsFourCc.R16G16B16A16FLOAT + or DdsFourCc.R32G32FLOAT => this.SixtyFourBitImageFormat(stream, width, height, count), + DdsFourCc.R32G32B32A32FLOAT => this.HundredTwentyEightBitImageFormat(stream, width, height, count), + _ => throw new ArgumentOutOfRangeException($"Unrecognized rgb bit count: {this.DdsHeader.PixelFormat.RGBBitCount}"), + }, // For unknown reason some formats do not have the bitsPerPixel set in the header (its zero). + }; } /// @@ -137,7 +114,7 @@ public MipMap[] ProcessUncompressed(Stream stream, int width, int height, int co /// The height of the texture at level 0. /// The mipmap count. /// The decoded mipmaps. - private MipMap[] AllocateMipMaps(Stream stream, int width, int height, int count) + private static MipMap[] AllocateMipMaps(Stream stream, int width, int height, int count) where TBlock : struct, IBlock { var blockFormat = default(TBlock); @@ -180,15 +157,15 @@ private MipMap[] EightBitImageFormat(Stream stream, int width, int height, int c if (pixelFormat.RBitMask == 0x0 && pixelFormat.GBitMask == 0x0 && pixelFormat.BBitMask == 0x0) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xFF && pixelFormat.GBitMask == 0x0 && pixelFormat.BBitMask == 0x0) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } - throw new Exception("Unsupported 8 bit format"); + throw new NotSupportedException("Unsupported 8 bit format"); } private MipMap[] SixteenBitImageFormat(Stream stream, int width, int height, int count) @@ -199,45 +176,45 @@ private MipMap[] SixteenBitImageFormat(Stream stream, int width, int height, int if (hasAlpha && pixelFormat.RBitMask == 0xF00 && pixelFormat.GBitMask == 0xF0 && pixelFormat.BBitMask == 0xF) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0x7C00 && pixelFormat.GBitMask == 0x3E0 && pixelFormat.BBitMask == 0x1F) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (hasAlpha && pixelFormat.RBitMask == 0x7C00 && pixelFormat.GBitMask == 0x3E0 && pixelFormat.BBitMask == 0x1F) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xF800 && pixelFormat.GBitMask == 0x7E0 && pixelFormat.BBitMask == 0x1F) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (hasAlpha && pixelFormat.RBitMask == 0xFF && pixelFormat.GBitMask == 0x0 && pixelFormat.BBitMask == 0x0) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xFFFF && pixelFormat.GBitMask == 0x0 && pixelFormat.BBitMask == 0x0) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xFF && pixelFormat.GBitMask == 0xFF00 && pixelFormat.BBitMask == 0x0) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.R16FLOAT) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } - throw new Exception("Unsupported 16 bit format"); + throw new NotSupportedException("Unsupported 16 bit format"); } private MipMap[] TwentyFourBitImageFormat(Stream stream, int width, int height, int count) @@ -248,10 +225,10 @@ private MipMap[] TwentyFourBitImageFormat(Stream stream, int width, int height, if (!hasAlpha && pixelFormat.RBitMask == 0xFF0000 && pixelFormat.GBitMask == 0xFF00 && pixelFormat.BBitMask == 0xFF) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } - throw new Exception("Unsupported 24 bit format"); + throw new NotSupportedException("Unsupported 24 bit format"); } private MipMap[] ThirtyTwoBitImageFormat(Stream stream, int width, int height, int count) @@ -262,55 +239,55 @@ private MipMap[] ThirtyTwoBitImageFormat(Stream stream, int width, int height, i if (hasAlpha && pixelFormat.RBitMask == 0xFF0000 && pixelFormat.GBitMask == 0xFF00 && pixelFormat.BBitMask == 0xFF) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (hasAlpha && pixelFormat.RBitMask == 0xFF && pixelFormat.GBitMask == 0xFF00 && pixelFormat.BBitMask == 0xFF0000) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xFF0000 && pixelFormat.GBitMask == 0xFF00 && pixelFormat.BBitMask == 0xFF) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xFF && pixelFormat.GBitMask == 0xFF00 && pixelFormat.BBitMask == 0xFF0000) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (!hasAlpha && pixelFormat.RBitMask == 0xFFFF && pixelFormat.GBitMask == 0xFFFF0000 && pixelFormat.BBitMask == 0x0) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.R32FLOAT) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.R16G16FLOAT) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.YUY2) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.RGBG) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.GRGB) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } - throw new Exception("Unsupported 32 bit format"); + throw new NotSupportedException("Unsupported 32 bit format"); } private MipMap[] SixtyFourBitImageFormat(Stream stream, int width, int height, int count) @@ -319,20 +296,20 @@ private MipMap[] SixtyFourBitImageFormat(Stream stream, int width, int height, i if (pixelFormat.FourCC == DdsFourCc.R16G16B16A16SNORM || pixelFormat.FourCC == DdsFourCc.R16G16B16A16UNORM) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.R32G32FLOAT) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } if (pixelFormat.FourCC == DdsFourCc.R16G16B16A16FLOAT) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } - throw new Exception("Unsupported 64 bit format"); + throw new NotSupportedException("Unsupported 64 bit format"); } private MipMap[] HundredTwentyEightBitImageFormat(Stream stream, int width, int height, int count) @@ -341,10 +318,10 @@ private MipMap[] HundredTwentyEightBitImageFormat(Stream stream, int width, int if (pixelFormat.FourCC == DdsFourCc.R32G32B32A32FLOAT || pixelFormat.FourCC == DdsFourCc.R32FLOAT) { - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); } - throw new Exception("Unsupported 128 bit format"); + throw new NotSupportedException("Unsupported 128 bit format"); } /* @@ -359,34 +336,34 @@ private MipMap[] GetDx10Dds(Stream stream, int width, int height, int count) case DxgiFormat.BC1_Typeless: case DxgiFormat.BC1_UNorm_SRGB: case DxgiFormat.BC1_UNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC2_Typeless: case DxgiFormat.BC2_UNorm: case DxgiFormat.BC2_UNorm_SRGB: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC3_Typeless: case DxgiFormat.BC3_UNorm: case DxgiFormat.BC3_UNorm_SRGB: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC4_Typeless: case DxgiFormat.BC4_UNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC4_SNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC5_Typeless: case DxgiFormat.BC5_UNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC5_SNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC6H_Typeless: case DxgiFormat.BC6H_UF16: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC6H_SF16: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.BC7_Typeless: case DxgiFormat.BC7_UNorm: case DxgiFormat.BC7_UNorm_SRGB: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R8G8B8A8_Typeless: case DxgiFormat.R8G8B8A8_UNorm: case DxgiFormat.R8G8B8A8_UNorm_SRGB: @@ -396,99 +373,99 @@ private MipMap[] GetDx10Dds(Stream stream, int width, int height, int count) case DxgiFormat.B8G8R8X8_Typeless: case DxgiFormat.B8G8R8X8_UNorm: case DxgiFormat.B8G8R8X8_UNorm_SRGB: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.B8G8R8A8_Typeless: case DxgiFormat.B8G8R8A8_UNorm: case DxgiFormat.B8G8R8A8_UNorm_SRGB: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G32B32A32_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G32B32A32_Typeless: case DxgiFormat.R32G32B32A32_UInt: case DxgiFormat.R32G32B32A32_SInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G32B32_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G32B32_Typeless: case DxgiFormat.R32G32B32_UInt: case DxgiFormat.R32G32B32_SInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R16G16B16A16_Typeless: case DxgiFormat.R16G16B16A16_Float: case DxgiFormat.R16G16B16A16_UNorm: case DxgiFormat.R16G16B16A16_UInt: case DxgiFormat.R16G16B16A16_SNorm: case DxgiFormat.R16G16B16A16_SInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G32_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G32_Typeless: case DxgiFormat.R32G32_UInt: case DxgiFormat.R32G32_SInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R10G10B10A2_Typeless: case DxgiFormat.R10G10B10A2_UNorm: case DxgiFormat.R10G10B10A2_UInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R16G16_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R16G16_Typeless: case DxgiFormat.R16G16_UNorm: case DxgiFormat.R16G16_UInt: case DxgiFormat.R16G16_SNorm: case DxgiFormat.R16G16_SInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32_Typeless: case DxgiFormat.R32_UInt: case DxgiFormat.R32_SInt: // Treating single channel format as 32 bit gray image. - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R8G8_Typeless: case DxgiFormat.R8G8_UNorm: case DxgiFormat.R8G8_UInt: case DxgiFormat.R8G8_SNorm: case DxgiFormat.R8G8_SInt: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R16_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R16_Typeless: case DxgiFormat.R16_UNorm: case DxgiFormat.R16_UInt: case DxgiFormat.R16_SNorm: case DxgiFormat.R16_SInt: // Treating single channel format as 16 bit gray image. - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R8_Typeless: case DxgiFormat.R8_UNorm: case DxgiFormat.R8_UInt: case DxgiFormat.R8_SNorm: case DxgiFormat.R8_SInt: // Treating single channel format as 8 bit gray image. - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.A8_UNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R1_UNorm: - throw new Exception("not implemented"); + throw new NotImplementedException($"{nameof(DxgiFormat.R1_UNorm)} is currently not implemented"); case DxgiFormat.R11G11B10_Float: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.Y410: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.Y416: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.Y210: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.Y216: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.AYUV: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.YUY2: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R8G8_B8G8_UNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.G8R8_G8B8_UNorm: - return this.AllocateMipMaps(stream, width, height, count); + return AllocateMipMaps(stream, width, height, count); case DxgiFormat.R32G8X24_Typeless: case DxgiFormat.D32_Float_S8X24_UInt: case DxgiFormat.R32_Float_X8X24_Typeless: diff --git a/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs b/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs index e639dee..afe2836 100644 --- a/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs @@ -83,10 +83,7 @@ public void AddImageFormat(ITextureFormat format) lock (HashLock) { - if (!this.imageFormats.Contains(format)) - { - this.imageFormats.Add(format); - } + _ = this.imageFormats.Add(format); } } diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs index 0876659..67ccc7c 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxHeader.cs @@ -137,7 +137,7 @@ public static KtxHeader Parse(ReadOnlySpan data) { if (data.Length < KtxConstants.KtxHeaderSize) { - throw new ArgumentException(nameof(data), $"Ktx header must be {KtxConstants.KtxHeaderSize} bytes. Was {data.Length} bytes."); + throw new ArgumentException($"Ktx header must be {KtxConstants.KtxHeaderSize} bytes. Was {data.Length} bytes.", nameof(data)); } var endianness = (KtxEndianness)BinaryPrimitives.ReadUInt32LittleEndian(data); diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs index 6b380ab..341757f 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Header.cs @@ -147,7 +147,7 @@ public static Ktx2Header Parse(ReadOnlySpan data) { if (data.Length < Ktx2Constants.KtxHeaderSize) { - throw new ArgumentException(nameof(data), $"Ktx2 header must be {Ktx2Constants.KtxHeaderSize} bytes. Was {data.Length} bytes."); + throw new ArgumentException($"Ktx2 header must be {Ktx2Constants.KtxHeaderSize} bytes. Was {data.Length} bytes.", nameof(data)); } return new Ktx2Header( diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs index 4f4923b..4dbd30d 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2Processor.cs @@ -51,112 +51,112 @@ public MipMap[] DecodeMipMaps(Stream stream, int width, int height, LevelIndex[] case VkFormat.VK_FORMAT_R8_SINT: case VkFormat.VK_FORMAT_R8_SRGB: // Single channel textures will be decoded to luminance image. - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16_UNORM: case VkFormat.VK_FORMAT_R16_SNORM: case VkFormat.VK_FORMAT_R16_UINT: case VkFormat.VK_FORMAT_R16_SINT: // Single channel textures will be decoded to luminance image. - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16_SFLOAT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R8G8_UNORM: case VkFormat.VK_FORMAT_R8G8_SNORM: case VkFormat.VK_FORMAT_R8G8_UINT: case VkFormat.VK_FORMAT_R8G8_SINT: case VkFormat.VK_FORMAT_R8G8_SRGB: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16_UNORM: case VkFormat.VK_FORMAT_R16G16_SNORM: case VkFormat.VK_FORMAT_R16G16_UINT: case VkFormat.VK_FORMAT_R16G16_SINT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32_UINT: case VkFormat.VK_FORMAT_R32G32_SINT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32_SFLOAT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16B16_UNORM: case VkFormat.VK_FORMAT_R16G16B16_SNORM: case VkFormat.VK_FORMAT_R16G16B16_UINT: case VkFormat.VK_FORMAT_R16G16B16_SINT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16B16A16_UNORM: case VkFormat.VK_FORMAT_R16G16B16A16_SNORM: case VkFormat.VK_FORMAT_R16G16B16A16_UINT: case VkFormat.VK_FORMAT_R16G16B16A16_SINT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16B16A16_SFLOAT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32_UINT: case VkFormat.VK_FORMAT_R32G32B32_SINT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32_SFLOAT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32A32_UINT: case VkFormat.VK_FORMAT_R32G32B32A32_SINT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32A32_SFLOAT: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_B8G8R8_UNORM: case VkFormat.VK_FORMAT_B8G8R8_SNORM: case VkFormat.VK_FORMAT_B8G8R8_UINT: case VkFormat.VK_FORMAT_B8G8R8_SINT: case VkFormat.VK_FORMAT_B8G8R8_SRGB: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R8G8B8_UNORM: case VkFormat.VK_FORMAT_R8G8B8_SNORM: case VkFormat.VK_FORMAT_R8G8B8_UINT: case VkFormat.VK_FORMAT_R8G8B8_SINT: case VkFormat.VK_FORMAT_R8G8B8_SRGB: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R5G6B5_UNORM_PACK16: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R4G4B4A4_UNORM_PACK16: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_B8G8R8A8_UNORM: case VkFormat.VK_FORMAT_B8G8R8A8_SNORM: case VkFormat.VK_FORMAT_B8G8R8A8_UINT: case VkFormat.VK_FORMAT_B8G8R8A8_SINT: case VkFormat.VK_FORMAT_B8G8R8A8_SRGB: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_B5G5R5A1_UNORM_PACK16: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_B5G6R5_UNORM_PACK16: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_B4G4R4A4_UNORM_PACK16: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R8G8B8A8_UNORM: case VkFormat.VK_FORMAT_R8G8B8A8_SNORM: case VkFormat.VK_FORMAT_R8G8B8A8_UINT: case VkFormat.VK_FORMAT_R8G8B8A8_SINT: case VkFormat.VK_FORMAT_R8G8B8A8_SRGB: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_R5G5B5A1_UNORM_PACK16: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC1_RGB_UNORM_BLOCK: case VkFormat.VK_FORMAT_BC1_RGBA_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC2_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC3_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC4_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC4_SNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC5_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC5_SNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC6H_UFLOAT_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC6H_SFLOAT_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC7_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); case VkFormat.VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: - return this.AllocateMipMaps(memoryStream, width, height, levelIndices); + return AllocateMipMaps(memoryStream, width, height, levelIndices); } throw new NotSupportedException("The pixel format is not supported"); @@ -183,109 +183,109 @@ public CubemapTexture DecodeCubeMap(Stream stream, int width, int height, LevelI case VkFormat.VK_FORMAT_R8_UINT: case VkFormat.VK_FORMAT_R8_SINT: case VkFormat.VK_FORMAT_R8_SRGB: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16_UNORM: case VkFormat.VK_FORMAT_R16_SNORM: case VkFormat.VK_FORMAT_R16_UINT: case VkFormat.VK_FORMAT_R16_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R8G8_UNORM: case VkFormat.VK_FORMAT_R8G8_SNORM: case VkFormat.VK_FORMAT_R8G8_UINT: case VkFormat.VK_FORMAT_R8G8_SINT: case VkFormat.VK_FORMAT_R8G8_SRGB: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16_UNORM: case VkFormat.VK_FORMAT_R16G16_SNORM: case VkFormat.VK_FORMAT_R16G16_UINT: case VkFormat.VK_FORMAT_R16G16_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16B16_UNORM: case VkFormat.VK_FORMAT_R16G16B16_SNORM: case VkFormat.VK_FORMAT_R16G16B16_UINT: case VkFormat.VK_FORMAT_R16G16B16_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16B16A16_UNORM: case VkFormat.VK_FORMAT_R16G16B16A16_SNORM: case VkFormat.VK_FORMAT_R16G16B16A16_UINT: case VkFormat.VK_FORMAT_R16G16B16A16_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16_SFLOAT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R16G16B16A16_SFLOAT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32_UINT: case VkFormat.VK_FORMAT_R32G32_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32_SFLOAT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32_UINT: case VkFormat.VK_FORMAT_R32G32B32_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32_SFLOAT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32A32_UINT: case VkFormat.VK_FORMAT_R32G32B32A32_SINT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R32G32B32A32_SFLOAT: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_B8G8R8_UNORM: case VkFormat.VK_FORMAT_B8G8R8_SNORM: case VkFormat.VK_FORMAT_B8G8R8_UINT: case VkFormat.VK_FORMAT_B8G8R8_SINT: case VkFormat.VK_FORMAT_B8G8R8_SRGB: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R8G8B8_UNORM: case VkFormat.VK_FORMAT_R8G8B8_SNORM: case VkFormat.VK_FORMAT_R8G8B8_UINT: case VkFormat.VK_FORMAT_R8G8B8_SINT: case VkFormat.VK_FORMAT_R8G8B8_SRGB: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R5G6B5_UNORM_PACK16: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R4G4B4A4_UNORM_PACK16: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_B8G8R8A8_UNORM: case VkFormat.VK_FORMAT_B8G8R8A8_SNORM: case VkFormat.VK_FORMAT_B8G8R8A8_UINT: case VkFormat.VK_FORMAT_B8G8R8A8_SINT: case VkFormat.VK_FORMAT_B8G8R8A8_SRGB: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_B5G5R5A1_UNORM_PACK16: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_B5G6R5_UNORM_PACK16: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_B4G4R4A4_UNORM_PACK16: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R8G8B8A8_UNORM: case VkFormat.VK_FORMAT_R8G8B8A8_SNORM: case VkFormat.VK_FORMAT_R8G8B8A8_UINT: case VkFormat.VK_FORMAT_R8G8B8A8_SINT: case VkFormat.VK_FORMAT_R8G8B8A8_SRGB: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_R5G5B5A1_UNORM_PACK16: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC1_RGB_UNORM_BLOCK: case VkFormat.VK_FORMAT_BC1_RGBA_UNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC2_UNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC4_UNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC4_SNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC5_UNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC5_SNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC6H_UFLOAT_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC6H_SFLOAT_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_BC7_UNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); case VkFormat.VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: - return this.AllocateCubeMap(stream, width, height, levelIndices); + return AllocateCubeMap(stream, width, height, levelIndices); } throw new NotSupportedException("The pixel format is not supported"); @@ -299,7 +299,7 @@ public CubemapTexture DecodeCubeMap(Stream stream, int width, int height, LevelI /// The height of the texture at level 0. /// The start offsets and byte length of each texture. /// The decoded mipmaps. - private MipMap[] AllocateMipMaps(Stream stream, int width, int height, LevelIndex[] levelIndices) + private static MipMap[] AllocateMipMaps(Stream stream, int width, int height, LevelIndex[] levelIndices) where TBlock : struct, IBlock { var blockFormat = default(TBlock); @@ -318,7 +318,7 @@ private MipMap[] AllocateMipMaps(Stream stream, int width, int height, L return mipMaps; } - private CubemapTexture AllocateCubeMap(Stream stream, int width, int height, LevelIndex[] levelIndices) + private static CubemapTexture AllocateCubeMap(Stream stream, int width, int height, LevelIndex[] levelIndices) where TBlock : struct, IBlock { var numberOfMipMaps = levelIndices.Length; diff --git a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs index 4053632..85f4e6e 100644 --- a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs @@ -83,10 +83,7 @@ public void AddImageFormat(ITextureFormat format) lock (HashLock) { - if (!this.imageFormats.Contains(format)) - { - this.imageFormats.Add(format); - } + _ = this.imageFormats.Add(format); } } diff --git a/src/ImageSharp.Textures/PixelFormats/Ayuv.cs b/src/ImageSharp.Textures/PixelFormats/Ayuv.cs index 926e192..b3af0a1 100644 --- a/src/ImageSharp.Textures/PixelFormats/Ayuv.cs +++ b/src/ImageSharp.Textures/PixelFormats/Ayuv.cs @@ -2,10 +2,13 @@ // Licensed under the Six Labors Split License. using System; +using System.Diagnostics.CodeAnalysis; using System.Numerics; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.PixelFormats; +#nullable enable + namespace SixLabors.ImageSharp.Textures.PixelFormats { /// @@ -22,15 +25,33 @@ public struct Ayuv : IPixel, IPackedVector public uint Yuv { [MethodImpl(MethodImplOptions.AggressiveInlining)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + readonly get => Unsafe.As(ref Unsafe.AsRef(in this)); [MethodImpl(MethodImplOptions.AggressiveInlining)] set => Unsafe.As(ref this) = value; } - /// + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is equal to the parameter; otherwise, false. + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool Equals(Ayuv other) => this.Yuv.Equals(other.Yuv); + public static bool operator ==(Ayuv left, Ayuv right) => left.Equals(right); + + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is not equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator !=(Ayuv left, Ayuv right) => !left.Equals(right); /// public override readonly string ToString() @@ -122,5 +143,12 @@ public readonly Vector4 ToVector4() // B = 1.1644Y' + 2.0172Cb' return ColorSpaceConversion.YuvToRgba8Bit(y, u, v, a); } + + /// + public override readonly bool Equals(object? obj) => obj is Ayuv ayuv && this.Equals(ayuv); + + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public readonly bool Equals(Ayuv other) => this.Yuv.Equals(other.Yuv); } } diff --git a/src/ImageSharp.Textures/PixelFormats/Fp32.cs b/src/ImageSharp.Textures/PixelFormats/Fp32.cs index 9c84d65..a2a800e 100644 --- a/src/ImageSharp.Textures/PixelFormats/Fp32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Fp32.cs @@ -31,6 +31,28 @@ public Fp32(float x) /// public float PackedValue { get; set; } + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator ==(Fp32 left, Fp32 right) => left.Equals(right); + + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is not equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator !=(Fp32 left, Fp32 right) => !left.Equals(right); + /// public PixelOperations CreatePixelOperations() => new(); @@ -90,22 +112,21 @@ public Fp32(float x) [MethodImpl(MethodImplOptions.AggressiveInlining)] public void FromRgb24(Rgb24 source) => this.FromScaledVector4(source.ToScaledVector4()); - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void FromRgba32(Rgba32 source) => this.FromScaledVector4(source.ToScaledVector4()); - - /// + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ToRgba32(ref Rgba32 dest) => dest.FromScaledVector4(this.ToScaledVector4()); + public void FromRgb48(Rgb48 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void FromRgb48(Rgb48 source) => this.FromScaledVector4(source.ToScaledVector4()); + public void FromRgba32(Rgba32 source) => this.FromScaledVector4(source.ToScaledVector4()); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); + /// + public void ToRgba32(ref Rgba32 dest) => throw new NotImplementedException(); + /// /// Expands the packed representation into a . /// The vector components are typically expanded in least to greatest significance order. @@ -115,11 +136,11 @@ public Fp32(float x) public Vector ToVector() => new Vector(this.PackedValue); /// - public override bool Equals(object obj) => obj is Fp32 other && this.Equals(other); + public override readonly bool Equals(object obj) => obj is Fp32 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool Equals(Fp32 other) => this.PackedValue.Equals(other.PackedValue); + public readonly bool Equals(Fp32 other) => this.PackedValue.Equals(other.PackedValue); /// public override string ToString() @@ -130,7 +151,7 @@ public override string ToString() /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public override int GetHashCode() => this.PackedValue.GetHashCode(); + public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(MethodImplOptions.AggressiveInlining)] private static float Pack(Vector vector) => vector[0]; diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs b/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs index dc3a009..f08f48a 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs @@ -16,7 +16,9 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats /// Ranges from [0, 0] to [1, 1] in vector form. /// /// +#pragma warning disable CA1707 // Identifiers should not contain underscores public partial struct D32_FLOAT_S8X24_UINT : IPixel, IPackedVector +#pragma warning restore CA1707 // Identifiers should not contain underscores { /// /// Initializes a new instance of the struct. diff --git a/src/ImageSharp.Textures/PixelFormats/Y410.cs b/src/ImageSharp.Textures/PixelFormats/Y410.cs index 33ad854..22d3206 100644 --- a/src/ImageSharp.Textures/PixelFormats/Y410.cs +++ b/src/ImageSharp.Textures/PixelFormats/Y410.cs @@ -22,12 +22,37 @@ public struct Y410 : IPixel, IPackedVector public uint Yuv { [MethodImpl(MethodImplOptions.AggressiveInlining)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + readonly get => Unsafe.As(ref Unsafe.AsRef(in this)); [MethodImpl(MethodImplOptions.AggressiveInlining)] set => Unsafe.As(ref this) = value; } + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator ==(Y410 left, Y410 right) => left.Equals(right); + + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is not equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator !=(Y410 left, Y410 right) => !left.Equals(right); + + /// + public override readonly bool Equals(object obj) => obj is Y410 other && this.Equals(other); + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly bool Equals(Y410 other) => this.Yuv.Equals(other.Yuv); diff --git a/src/ImageSharp.Textures/PixelFormats/Y416.cs b/src/ImageSharp.Textures/PixelFormats/Y416.cs index 6203af0..c63c4ca 100644 --- a/src/ImageSharp.Textures/PixelFormats/Y416.cs +++ b/src/ImageSharp.Textures/PixelFormats/Y416.cs @@ -22,12 +22,37 @@ public struct Y416 : IPixel, IPackedVector public ulong Yuv { [MethodImpl(MethodImplOptions.AggressiveInlining)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + readonly get => Unsafe.As(ref Unsafe.AsRef(in this)); [MethodImpl(MethodImplOptions.AggressiveInlining)] set => Unsafe.As(ref this) = value; } + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator ==(Y416 left, Y416 right) => left.Equals(right); + + /// + /// Compares two objects for equality. + /// + /// The on the left side of the operand. + /// The on the right side of the operand. + /// + /// True if the parameter is not equal to the parameter; otherwise, false. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool operator !=(Y416 left, Y416 right) => !left.Equals(right); + + /// + public override readonly bool Equals(object obj) => obj is Y416 other && this.Equals(other); + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly bool Equals(Y416 other) => this.Yuv.Equals(other.Yuv); diff --git a/src/ImageSharp.Textures/Texture.FromStream.cs b/src/ImageSharp.Textures/Texture.FromStream.cs index f9b3795..38d5f9c 100644 --- a/src/ImageSharp.Textures/Texture.FromStream.cs +++ b/src/ImageSharp.Textures/Texture.FromStream.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Text; using SixLabors.ImageSharp.Textures.Common.Exceptions; @@ -150,11 +151,11 @@ public static Texture Load(Configuration config, Stream stream, out ITextureForm } var sb = new StringBuilder(); - sb.AppendLine("Image cannot be loaded. Available decoders:"); + _ = sb.AppendLine("Image cannot be loaded. Available decoders:"); foreach (KeyValuePair val in config.ImageFormatsManager.ImageDecoders) { - sb.AppendLine($" - {val.Key.Name} : {val.Value.GetType().Name}"); + _ = sb.AppendLine(CultureInfo.InvariantCulture, $" - {val.Key.Name} : {val.Value.GetType().Name}"); } throw new UnknownTextureFormatException(sb.ToString()); diff --git a/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs b/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs index b39ff3d..fc51a3d 100644 --- a/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs +++ b/src/ImageSharp.Textures/TextureFormats/CubemapTexture.cs @@ -79,11 +79,6 @@ protected override void Dispose(bool disposing) /// internal override void EnsureNotDisposed() - { - if (this.isDisposed) - { - throw new ObjectDisposedException("Trying to execute an operation on a disposed image."); - } - } + => ObjectDisposedException.ThrowIf(this.isDisposed, "Trying to execute an operation on a disposed image."); } } diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs index e650a48..9fc8045 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4.cs @@ -35,7 +35,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Bc4 self = this; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs index 6b2f6ec..e70f157 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc4s.cs @@ -37,7 +37,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Bc4s self = this; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs index 6075a47..d1f535f 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5.cs @@ -38,7 +38,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Bc5 self = this; byte[] firstGradient = new byte[8]; byte[] secondGradient = new byte[8]; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs index 1592b8a..abd1b52 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc5s.cs @@ -35,7 +35,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Bc5s self = this; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs index 1280b43..6636c9f 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6h.cs @@ -293,7 +293,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Bc6h self = this; byte[] currentBlock = new byte[this.CompressedBytesPerBlock]; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs index d2be696..0de87e6 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc6hs.cs @@ -293,7 +293,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Bc6hs self = this; byte[] currentBlock = new byte[this.CompressedBytesPerBlock]; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs index 6063322..a10234f 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Bc7.cs @@ -67,7 +67,7 @@ public Image GetImage(byte[] blockData, int width, int height) public byte[] Decompress(byte[] blockData, int width, int height) { byte[] currentBlock = new byte[this.CompressedBytesPerBlock]; - IBlock self = this; + Bc7 self = this; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => { diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs index 7345901..635826c 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt1.cs @@ -35,7 +35,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Dxt1 self = this; var colors = new ImageSharp.PixelFormats.Rgb24[4]; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs index aa72f76..c00291d 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt3.cs @@ -35,7 +35,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Dxt3 self = this; var colors = new ImageSharp.PixelFormats.Rgb24[4]; return Helper.InMemoryDecode(blockData, width, height, (stream, data, streamIndex, dataIndex, stride) => diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs index d796401..f16df74 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/Dxt5.cs @@ -35,7 +35,7 @@ public Image GetImage(byte[] blockData, int width, int height) /// public byte[] Decompress(byte[] blockData, int width, int height) { - IBlock self = this; + Dxt5 self = this; byte[] alpha = new byte[8]; var colors = new ImageSharp.PixelFormats.Rgb24[4]; diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs index be1d1b2..32b1a65 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/EtcDecoder.cs @@ -192,7 +192,7 @@ public static void DecodeEtc2Block(Span payload, Span decodedPixelSp int b = payload[2] & 0xF8; b += Complement3BitShifted(payload[2] & 7); - decodedPixelSpan.Fill(0); + decodedPixelSpan.Clear(); if ((r & 0xFF07) != 0) { ProcessBlockEtc2TMode(payload, decodedPixelSpan); diff --git a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs index dbee681..f7e1ce3 100644 --- a/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs +++ b/src/ImageSharp.Textures/TextureFormats/Decoding/PixelFormats/LdrColorA.cs @@ -52,22 +52,14 @@ public LdrColorA(byte r, byte g, byte b, byte a) public byte this[int uElement] { - get + get => uElement switch { - switch (uElement) - { - case 0: - return this.R; - case 1: - return this.G; - case 2: - return this.B; - case 3: - return this.A; - default: - throw new IndexOutOfRangeException(); - } - } + 0 => this.R, + 1 => this.G, + 2 => this.B, + 3 => this.A, + _ => throw new ArgumentOutOfRangeException(nameof(uElement)), + }; set { @@ -86,7 +78,7 @@ public byte this[int uElement] this.A = value; break; default: - throw new IndexOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(uElement)); } } } diff --git a/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs b/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs index e94dea0..b1f0183 100644 --- a/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs +++ b/src/ImageSharp.Textures/TextureFormats/FlatTexture.cs @@ -45,11 +45,6 @@ protected override void Dispose(bool disposing) /// internal override void EnsureNotDisposed() - { - if (this.isDisposed) - { - throw new ObjectDisposedException("Trying to execute an operation on a disposed image."); - } - } + => ObjectDisposedException.ThrowIf(this.isDisposed, "Trying to execute an operation on a disposed image."); } } diff --git a/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs b/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs index a4b3e4d..2a514e9 100644 --- a/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs +++ b/src/ImageSharp.Textures/TextureFormats/VolumeTexture.cs @@ -45,11 +45,6 @@ protected override void Dispose(bool disposing) /// internal override void EnsureNotDisposed() - { - if (this.isDisposed) - { - throw new ObjectDisposedException("Trying to execute an operation on a disposed image."); - } - } + => ObjectDisposedException.ThrowIf(this.isDisposed, "Trying to execute an operation on a disposed image."); } } diff --git a/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs b/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs index 9424898..6810375 100644 --- a/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs +++ b/tests/ImageSharp.Textures.Tests/Formats/PixelFormat/PixelFormatTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. +using System.Globalization; using SixLabors.ImageSharp.Textures.PixelFormats; using Xunit; using Rg16 = SixLabors.ImageSharp.Textures.PixelFormats.Rg16; @@ -21,12 +22,12 @@ public void Test_Rg16() var testPixel = new Rg16(x, y); - Assert.Equal($"Rg16({x}, {y})", testPixel.ToString()); + Assert.Equal(string.Format(CultureInfo.InvariantCulture, "Rg16({0}, {1})", x, y), testPixel.ToString()); var destPixel = new ImageSharp.PixelFormats.Rgba32(0); testPixel.ToRgba32(ref destPixel); - Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X")); + Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X", CultureInfo.InvariantCulture)); Assert.Equal(i == 0 ? 255 : 0, destPixel.R); Assert.Equal(i == 1 ? 255 : 0, destPixel.G); @@ -54,7 +55,7 @@ public void Test_Bgr555() var destPixel = new ImageSharp.PixelFormats.Rgba32(0); testPixel.ToRgba32(ref destPixel); - Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X")); + Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X", CultureInfo.InvariantCulture)); Assert.Equal(i == 0 ? 255 : 0, destPixel.R); Assert.Equal(i == 1 ? 255 : 0, destPixel.G); @@ -82,7 +83,7 @@ public void Test_Bgr32() var destPixel = new ImageSharp.PixelFormats.Rgba32(0); testPixel.ToRgba32(ref destPixel); - Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X")); + Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X", CultureInfo.InvariantCulture)); Assert.Equal(i == 0 ? 255 : 0, destPixel.R); Assert.Equal(i == 1 ? 255 : 0, destPixel.G); @@ -110,7 +111,7 @@ public void Test_Rgb32() var destPixel = new ImageSharp.PixelFormats.Rgba32(0); testPixel.ToRgba32(ref destPixel); - Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X")); + Assert.Equal(hexValues[i], testPixel.PackedValue.ToString("X", CultureInfo.InvariantCulture)); Assert.Equal(i == 0 ? 255 : 0, destPixel.R); Assert.Equal(i == 1 ? 255 : 0, destPixel.G); diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs index cb024df..6888d67 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/GroupOutputAttribute.cs @@ -8,6 +8,7 @@ namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities.Attributes /// /// The output produced by this test class should be grouped into the specified subfolder. /// + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] public class GroupOutputAttribute : Attribute { public GroupOutputAttribute(string subfolder) => this.Subfolder = subfolder; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs index fe06bc5..b8eed78 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/Attributes/WithFileAttribute.cs @@ -32,10 +32,7 @@ public WithFileAttribute(TestTextureFormat textureFormat, TestTextureType textur public override IEnumerable GetData(MethodInfo testMethod) { - if (testMethod == null) - { - throw new ArgumentNullException(nameof(testMethod)); - } + ArgumentNullException.ThrowIfNull(testMethod); string[] featureLevels = this.textureTool == TestTextureTool.TexConv ? new[] { "9.1", "9.2", "9.3", "10.0", "10.1", "11.0", "11.1", "12.0", "12.1" } : new[] { string.Empty }; @@ -49,7 +46,7 @@ public override IEnumerable GetData(MethodInfo testMethod) } string[] files = Directory.GetFiles(path); - string[] filteredFiles = files.Where(f => this.isRegex ? new Regex(this.inputFile).IsMatch(Path.GetFileName(f)) : Path.GetFileName(f).Equals(this.inputFile, StringComparison.CurrentCultureIgnoreCase)).ToArray(); + string[] filteredFiles = files.Where(f => this.isRegex ? new Regex(this.inputFile).IsMatch(Path.GetFileName(f)) : Path.GetFileName(f).Equals(this.inputFile, StringComparison.OrdinalIgnoreCase)).ToArray(); foreach (string file in filteredFiles) { var testTextureProvider = new TestTextureProvider(testMethod.Name, this.textureFormat, this.textureType, this.textureTool, file, false); diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs index d79105b..eb37d80 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Collections.Generic; +using System.Globalization; using System.Linq; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Textures.Tests.TestUtilities.ImageComparison.Exceptions; @@ -12,17 +13,10 @@ public abstract class ImageComparer { public static ImageComparer Exact { get; } = Tolerant(0, 0); - /// - /// Returns an instance of . - /// Individual manhattan pixel difference is only added to total image difference when the individual difference is over 'perPixelManhattanThreshold'. - /// public static ImageComparer Tolerant( float imageThreshold = TolerantImageComparer.DefaultImageThreshold, int perPixelManhattanThreshold = 0) => new TolerantImageComparer(imageThreshold, perPixelManhattanThreshold); - /// - /// Returns Tolerant(imageThresholdInPercents/100) - /// public static ImageComparer TolerantPercentage(float imageThresholdInPercents, int perPixelManhattanThreshold = 0) => Tolerant(imageThresholdInPercents / 100F, perPixelManhattanThreshold); @@ -59,7 +53,7 @@ public static void VerifySimilarity( throw new ImagesSimilarityException("Image frame count does not match!"); } - ImageSimilarityReport report = comparer.CompareImages(expected, actual); + ImageSimilarityReport report = comparer.CompareImages(expected, actual); if ((report.TotalNormalizedDifference ?? 0F) != 0F) { throw new ImagesSimilarityException(report.ToString()); @@ -84,7 +78,7 @@ public static void VerifySimilarityIgnoreRegion( throw new ImagesSimilarityException("Image frame count does not match!"); } - ImageSimilarityReport report = comparer.CompareImages(expected, actual); + ImageSimilarityReport report = comparer.CompareImages(expected, actual); if ((report.TotalNormalizedDifference ?? 0F) != 0F) { IEnumerable outsideChanges = report.Differences.Where( diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs index cfa9654..0a1e4d4 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageSimilarityReport.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using SixLabors.ImageSharp.PixelFormats; @@ -11,6 +12,9 @@ namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities.ImageComparison { public class ImageSimilarityReport { + // Provide an empty non-generic instance to avoid CA1000 in generic type. + public static ImageSimilarityReport Empty => new ImageSimilarityReport(null, null, Array.Empty(), 0f); + protected ImageSimilarityReport( object expectedImage, object actualImage, @@ -44,7 +48,7 @@ public string DifferencePercentageString } else { - return $"{this.TotalNormalizedDifference.Value * 100:0.0000}%"; + return string.Format(CultureInfo.InvariantCulture, "{0:0.0000}%", this.TotalNormalizedDifference.Value * 100); } } } @@ -64,7 +68,7 @@ private string PrintDifference() if (this.TotalNormalizedDifference.HasValue) { sb.AppendLine(); - sb.AppendLine($"Total difference: {this.DifferencePercentageString}"); + sb.AppendLine(string.Format(CultureInfo.InvariantCulture, "Total difference: {0}", this.DifferencePercentageString)); } int max = Math.Min(5, this.Differences.Length); @@ -74,7 +78,7 @@ private string PrintDifference() sb.Append(this.Differences[i]); if (i < max - 1) { - sb.AppendFormat(";{0}", Environment.NewLine); + sb.AppendFormat(CultureInfo.InvariantCulture, ";{0}", Environment.NewLine); } } @@ -100,9 +104,6 @@ public ImageSimilarityReport( { } - public static ImageSimilarityReport Empty => - new ImageSimilarityReport(null, null, Enumerable.Empty(), 0f); - public new Image ExpectedImage => (Image)base.ExpectedImage; public new Image ActualImage => (Image)base.ActualImage; diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs index b7d5659..acfd577 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs @@ -110,7 +110,8 @@ public override ImageSimilarityReport CompareImages.Empty; + // Construct an empty generic report explicitly. + return new ImageSimilarityReport(expected, actual, [], 0f); } } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs index 6e04d29..3b5e5f9 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -13,11 +13,11 @@ namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities.ImageProviders public abstract partial class TestImageProvider : IXunitSerializable where TPixel : unmanaged, IPixel { - internal class FileProvider : TestImageProvider, IXunitSerializable + internal sealed class FileProvider : TestImageProvider, IXunitSerializable { // Need PixelTypes in the dictionary key, because result images of TestImageProvider.FileProvider // are shared between PixelTypes.Color & PixelTypes.Rgba32 - private class Key : IEquatable + private sealed class Key : IEquatable { private readonly Tuple commonValues; @@ -45,7 +45,7 @@ private static Dictionary GetDecoderParameters(IImageDecoder cus PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo p in properties) { - string key = $"{type.FullName}.{p.Name}"; + string key = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", type.FullName, p.Name); object value = p.GetValue(customDecoder); data[key] = value; } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 3476922..9f293f1 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -38,6 +38,9 @@ public abstract partial class TestImageProvider : ITestImageProvider, IX public string OutputSubfolderName { get; private set; } + /// + /// Returns a file backed provider. + /// public static TestImageProvider File( string filePath, MethodInfo testMethod = null, @@ -49,9 +52,9 @@ public static TestImageProvider File( /// A test image. public abstract Image GetImage(); - public virtual Image GetImage(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException($"Decoder specific GetImage() is not supported with {this.GetType().Name}!"); + public virtual Image GetImage(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Decoder specific GetImage() is not supported with {0}!", this.GetType().Name)); - public virtual Task> GetImageAsync(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException($"Decoder specific GetImageAsync() is not supported with {this.GetType().Name}!"); + public virtual Task> GetImageAsync(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Decoder specific GetImageAsync() is not supported with {0}!", this.GetType().Name)); /// /// Returns an instance to the test case with the necessary traits. @@ -118,6 +121,6 @@ protected TestImageProvider Init(MethodInfo testMethod, PixelTypes pixel return this.Init(testMethod?.DeclaringType.Name, testMethod?.Name, subfolder, pixelTypeOverride); } - public override string ToString() => $"{this.SourceFileOrDescription}[{this.PixelType}]"; + public override string ToString() => string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}[{1}]", this.SourceFileOrDescription, this.PixelType); } } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs index 769816d..132f806 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Reflection; @@ -11,34 +12,12 @@ namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities { - /// - /// Utility class to provide information about the test image & the test case for the test code, - /// and help managing IO. - /// public class ImagingTestCaseUtility { - /// - /// Gets or sets the name of the TPixel in the owner. - /// public string PixelTypeName { get; set; } = string.Empty; - - /// - /// Gets or sets the name of the file which is provided by. - /// Or a short string describing the image in the case of a non-file based image provider. - /// public string SourceFileOrDescription { get; set; } = string.Empty; - - /// - /// Gets or sets the test group name. - /// By default this is the name of the test class, but it's possible to change it. - /// public string TestGroupName { get; set; } = string.Empty; - public string OutputSubfolderName { get; set; } = string.Empty; - - /// - /// Gets or sets the name of the test case (by default). - /// public string TestName { get; set; } = string.Empty; private string GetTestOutputFileNameImpl( @@ -66,7 +45,7 @@ private string GetTestOutputFileNameImpl( extension = ".bmp"; } - extension = extension.ToLower(); + extension = extension.ToLowerInvariant(); if (extension[0] != '.') { @@ -96,17 +75,10 @@ private string GetTestOutputFileNameImpl( details = '_' + details; } - return TestUtils.AsInvariantString($"{this.GetTestOutputDir()}{Path.DirectorySeparatorChar}{this.TestName}{pixName}{fn}{details}{extension}"); + string composed = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6}", this.GetTestOutputDir(), Path.DirectorySeparatorChar, this.TestName, pixName, fn, details, extension); + return composed; // Already invariant } - /// - /// Gets the recommended file name for the output of the test - /// - /// The required extension - /// The settings modifying the output path - /// A boolean indicating whether to append the pixel type to output file name. - /// A boolean indicating whether to append SourceFileOrDescription to the test output file name. - /// The file test name public string GetTestOutputFileName( string extension = null, object testOutputDetails = null, @@ -117,7 +89,7 @@ public string GetTestOutputFileName( if (testOutputDetails is FormattableString fs) { - detailsString = fs.AsInvariantString(); + detailsString = FormattableString.Invariant(fs); } else if (testOutputDetails is string s) { @@ -129,7 +101,7 @@ public string GetTestOutputFileName( TypeInfo info = type.GetTypeInfo(); if (info.IsPrimitive || info.IsEnum || type == typeof(decimal)) { - detailsString = TestUtils.AsInvariantString($"{testOutputDetails}"); + detailsString = string.Format(CultureInfo.InvariantCulture, "{0}", testOutputDetails); } else { @@ -138,7 +110,7 @@ public string GetTestOutputFileName( detailsString = string.Join( "_", properties.ToDictionary(x => x.Name, x => x.GetValue(testOutputDetails)) - .Select(x => TestUtils.AsInvariantString($"{x.Key}-{x.Value}"))); + .Select(x => string.Format(CultureInfo.InvariantCulture, "{0}-{1}", x.Key, x.Value))); } } @@ -149,16 +121,6 @@ public string GetTestOutputFileName( appendSourceFileOrDescription); } - /// - /// Encodes image by the format matching the required extension, than saves it to the recommended output file. - /// - /// The image instance. - /// The requested extension. - /// Optional encoder. - /// Additional information to append to the test output file name. - /// A value indicating whether to append the pixel type to the test output file name. - /// A boolean indicating whether to append SourceFileOrDescription to the test output file name. - /// The path to the saved image file. public string SaveTestOutputFile( Image image, string extension = null, @@ -199,7 +161,7 @@ public IEnumerable GetTestOutputFileNamesMultiFrame( for (int i = 0; i < frameCount; i++) { - string filePath = $"{baseDir}/{i:D2}.{extension}"; + string filePath = string.Format(CultureInfo.InvariantCulture, "{0}/{1:D2}.{2}", baseDir, i, extension); yield return filePath; } } @@ -212,7 +174,7 @@ public string[] SaveTestOutputFileMultiFrame( bool appendPixelTypeToFileName = true) where TPixel : unmanaged, IPixel { - encoder ??= TestEnvironment.GetReferenceEncoder($"foo.{extension}"); + encoder ??= TestEnvironment.GetReferenceEncoder(string.Format(CultureInfo.InvariantCulture, "foo.{0}", extension)); string[] files = this.GetTestOutputFileNamesMultiFrame( image.Frames.Count, diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs index f6431e7..372164d 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/TextureProviders/TestTextureProvider.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text; +using System.Globalization; using SixLabors.ImageSharp.Textures.Formats; using SixLabors.ImageSharp.Textures.Tests.Enums; using SixLabors.ImageSharp.Textures.TextureFormats; @@ -70,14 +71,14 @@ private void SaveMipMaps(MipMap[] mipMaps, string name) for (int i = 0; i < mipMaps.Length; i++) { - string filename = $"mipmap-{i + 1}"; + string filename = string.Format(CultureInfo.InvariantCulture, "mipmap-{0}", i + 1); if (!string.IsNullOrEmpty(name)) { - filename = $"{filename}-{name}"; + filename = string.Format(CultureInfo.InvariantCulture, "{0}-{1}", filename, name); } using Image image = mipMaps[i].GetImage(); - image.Save(Path.Combine(path, $"{filename}.png")); + image.Save(Path.Combine(path, string.Format(CultureInfo.InvariantCulture, "{0}.png", filename))); } } @@ -107,7 +108,7 @@ public void SaveTextures(Texture texture) { for (int i = 0; i < volumeTexture.Slices.Count; i++) { - this.SaveMipMaps(volumeTexture.Slices[i].MipMaps.ToArray(), $"slice{i + 1}"); + this.SaveMipMaps(volumeTexture.Slices[i].MipMaps.ToArray(), string.Format(CultureInfo.InvariantCulture, "slice{0}", i + 1)); } } } @@ -116,12 +117,12 @@ public override string ToString() { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine(); - stringBuilder.AppendLine($"Method Name: {this.MethodName}"); - stringBuilder.AppendLine($"Texture Format: {this.TextureFormat}"); - stringBuilder.AppendLine($"Texture Type: {this.TextureType}"); - stringBuilder.AppendLine($"Texture Tool: {this.TextureTool}"); - stringBuilder.AppendLine($"Input File: {this.InputFile}"); - stringBuilder.AppendLine($"Is Regex: {this.IsRegex}"); + stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Method Name: {0}", this.MethodName)); + stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Texture Format: {0}", this.TextureFormat)); + stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Texture Type: {0}", this.TextureType)); + stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Texture Tool: {0}", this.TextureTool)); + stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Input File: {0}", this.InputFile)); + stringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "Is Regex: {0}", this.IsRegex)); return stringBuilder.ToString(); } } diff --git a/tests/Images/TestEnvironment.cs b/tests/Images/TestEnvironment.cs index 73c8189..79a36a4 100644 --- a/tests/Images/TestEnvironment.cs +++ b/tests/Images/TestEnvironment.cs @@ -47,14 +47,14 @@ private static string GetSolutionDirectoryFullPathImpl() } catch (Exception ex) { - throw new Exception( + throw new DirectoryNotFoundException( $"Unable to find ImageSharp solution directory from {assemblyLocation} because of {ex.GetType().Name}!", ex); } if (directory == null) { - throw new Exception($"Unable to find ImageSharp solution directory from {assemblyLocation}!"); + throw new DirectoryNotFoundException($"Unable to find ImageSharp solution directory from {assemblyLocation}!"); } } From ea9e871e48cf97abadd1df48f728d1dbe34e1715 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 13:51:35 +0200 Subject: [PATCH 07/12] Implement nullable --- .../Formats/Dds/DdsDecoderCore.cs | 2 +- .../Formats/Dds/DdsImageFormatDetector.cs | 2 +- .../Formats/Dds/DdsProcessor.cs | 2 -- .../Dds/Extensions/DdsHeaderExtensions.cs | 2 +- .../Formats/ITextureFormatDetector.cs | 2 +- .../Formats/ITextureFormatManager.cs | 12 ++++----- .../Formats/Ktx/KtxImageFormatDetector.cs | 2 +- .../Formats/Ktx2/Ktx2ImageFormatDetector.cs | 2 +- .../Formats/TextureFormatManager.cs | 12 ++++----- .../ImageSharp.Textures.csproj | 6 +++++ src/ImageSharp.Textures/PixelFormats/Ayuv.cs | 2 -- src/ImageSharp.Textures/PixelFormats/Fp32.cs | 2 +- .../PixelFormats/Generated/Bgr32.cs | 2 +- .../PixelFormats/Generated/Bgr555.cs | 2 +- .../Generated/D32_FLOAT_S8X24_UINT.cs | 2 +- .../Generated/PixelGenerator.ignore | 22 ++++++++-------- .../PixelFormats/Generated/PixelGenerator.tt | 2 +- .../PixelFormats/Generated/R11G11B10Float.cs | 2 +- .../PixelFormats/Generated/Rg32Float.cs | 2 +- .../PixelFormats/Generated/Rg64.cs | 2 +- .../PixelFormats/Generated/Rg64Float.cs | 2 +- .../PixelFormats/Generated/Rgb32.cs | 2 +- .../PixelFormats/Generated/Rgb565.cs | 2 +- .../PixelFormats/Generated/Rgb96.cs | 2 +- .../PixelFormats/Generated/Rgb96Float.cs | 2 +- .../PixelFormats/Generated/Rgba128.cs | 2 +- .../PixelFormats/Generated/Rgba128Float.cs | 2 +- .../PixelFormats/Generated/Rgba4444.cs | 2 +- .../PixelFormats/Generated/Rgba5551.cs | 2 +- .../PixelFormats/Generated/Rgba64Float.cs | 2 +- src/ImageSharp.Textures/PixelFormats/L32.cs | 2 +- .../PixelFormats/R16Float.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Rg16.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Rg32.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Y410.cs | 2 +- src/ImageSharp.Textures/PixelFormats/Y416.cs | 2 +- src/ImageSharp.Textures/Texture.Decode.cs | 12 ++++----- src/ImageSharp.Textures/Texture.FromBytes.cs | 26 +++++++++---------- src/ImageSharp.Textures/Texture.FromFile.cs | 20 +++++++------- src/ImageSharp.Textures/Texture.FromStream.cs | 18 ++++++------- 40 files changed, 97 insertions(+), 95 deletions(-) diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs b/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs index f2349a6..1bb1d0b 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsDecoderCore.cs @@ -108,7 +108,7 @@ public Texture DecodeTexture(Stream stream) } else if (this.ddsHeader.IsCubemap()) { - DdsSurfaceType[] faces = this.ddsHeader.GetExistingCubemapFaces(); + DdsSurfaceType[] faces = this.ddsHeader.GetExistingCubemapFaces() ?? Array.Empty(); var texture = new CubemapTexture(); for (int face = 0; face < faces.Length; face++) diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs b/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs index 8c3d93f..0a35243 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsImageFormatDetector.cs @@ -15,7 +15,7 @@ public sealed class DdsImageFormatDetector : ITextureFormatDetector public int HeaderSize => 8; /// - public ITextureFormat DetectFormat(ReadOnlySpan header) => this.IsSupportedFileFormat(header) ? DdsFormat.Instance : null; + public ITextureFormat? DetectFormat(ReadOnlySpan header) => this.IsSupportedFileFormat(header) ? DdsFormat.Instance : null; private bool IsSupportedFileFormat(ReadOnlySpan header) { diff --git a/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs b/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs index 73508b9..2c976ff 100644 --- a/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs +++ b/src/ImageSharp.Textures/Formats/Dds/DdsProcessor.cs @@ -10,8 +10,6 @@ using Fp32 = SixLabors.ImageSharp.Textures.TextureFormats.Decoding.Fp32; using L32 = SixLabors.ImageSharp.Textures.TextureFormats.Decoding.L32; -#nullable enable - namespace SixLabors.ImageSharp.Textures.Formats.Dds { /// diff --git a/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs b/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs index c34e7b1..faf92f8 100644 --- a/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs +++ b/src/ImageSharp.Textures/Formats/Dds/Extensions/DdsHeaderExtensions.cs @@ -156,7 +156,7 @@ public static int ComputeDepth(this DdsHeader ddsHeader) /// /// Types of cube map faces stored in this cube map or null if this is not a cubemap. /// - public static DdsSurfaceType[] GetExistingCubemapFaces(this DdsHeader ddsHeader) + public static DdsSurfaceType[]? GetExistingCubemapFaces(this DdsHeader ddsHeader) { int depth = ddsHeader.ComputeDepth(); var result = new DdsSurfaceType[depth]; diff --git a/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs b/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs index 5457af9..3e24a6f 100644 --- a/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/ITextureFormatDetector.cs @@ -21,6 +21,6 @@ public interface ITextureFormatDetector /// /// The containing the file header. /// returns the mime type of detected otherwise returns null - ITextureFormat DetectFormat(ReadOnlySpan header); + ITextureFormat? DetectFormat(ReadOnlySpan header); } } diff --git a/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs b/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs index afe2836..f551e7c 100644 --- a/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/ITextureFormatManager.cs @@ -92,7 +92,7 @@ public void AddImageFormat(ITextureFormat format) /// /// The extension to discover /// The if found otherwise null - public ITextureFormat FindFormatByFileExtension(string extension) + public ITextureFormat? FindFormatByFileExtension(string extension) { Guard.NotNullOrWhiteSpace(extension, nameof(extension)); @@ -109,7 +109,7 @@ public ITextureFormat FindFormatByFileExtension(string extension) /// /// The mime-type to discover /// The if found; otherwise null - public ITextureFormat FindFormatByMimeType(string mimeType) => this.imageFormats.FirstOrDefault(x => x.MimeTypes.Contains(mimeType, StringComparer.OrdinalIgnoreCase)); + public ITextureFormat? FindFormatByMimeType(string mimeType) => this.imageFormats.FirstOrDefault(x => x.MimeTypes.Contains(mimeType, StringComparer.OrdinalIgnoreCase)); /// /// Sets a specific image encoder as the encoder for a specific image format. @@ -158,11 +158,11 @@ public void AddImageFormatDetector(ITextureFormatDetector detector) /// /// The format to discover /// The if found otherwise null - public ITextureDecoder FindDecoder(ITextureFormat format) + public ITextureDecoder? FindDecoder(ITextureFormat format) { Guard.NotNull(format, nameof(format)); - return this.mimeTypeDecoders.TryGetValue(format, out ITextureDecoder decoder) + return this.mimeTypeDecoders.TryGetValue(format, out ITextureDecoder? decoder) ? decoder : null; } @@ -172,11 +172,11 @@ public ITextureDecoder FindDecoder(ITextureFormat format) /// /// The format to discover /// The if found otherwise null - public ITextureEncoder FindEncoder(ITextureFormat format) + public ITextureEncoder? FindEncoder(ITextureFormat format) { Guard.NotNull(format, nameof(format)); - return this.mimeTypeEncoders.TryGetValue(format, out ITextureEncoder encoder) + return this.mimeTypeEncoders.TryGetValue(format, out ITextureEncoder? encoder) ? encoder : null; } diff --git a/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs b/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs index 91f5467..4d4f9c7 100644 --- a/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/Ktx/KtxImageFormatDetector.cs @@ -14,7 +14,7 @@ public sealed class KtxImageFormatDetector : ITextureFormatDetector public int HeaderSize => 12; /// - public ITextureFormat DetectFormat(ReadOnlySpan header) => this.IsSupportedFileFormat(header) ? KtxFormat.Instance : null; + public ITextureFormat? DetectFormat(ReadOnlySpan header) => this.IsSupportedFileFormat(header) ? KtxFormat.Instance : null; private bool IsSupportedFileFormat(ReadOnlySpan header) { diff --git a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs index af99577..c1ab087 100644 --- a/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs +++ b/src/ImageSharp.Textures/Formats/Ktx2/Ktx2ImageFormatDetector.cs @@ -14,7 +14,7 @@ public sealed class Ktx2ImageFormatDetector : ITextureFormatDetector public int HeaderSize => 12; /// - public ITextureFormat DetectFormat(ReadOnlySpan header) => this.IsSupportedFileFormat(header) ? Ktx2Format.Instance : null; + public ITextureFormat? DetectFormat(ReadOnlySpan header) => this.IsSupportedFileFormat(header) ? Ktx2Format.Instance : null; private bool IsSupportedFileFormat(ReadOnlySpan header) { diff --git a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs index 85f4e6e..71a771b 100644 --- a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs @@ -92,7 +92,7 @@ public void AddImageFormat(ITextureFormat format) /// /// The extension to discover /// The if found otherwise null - public ITextureFormat FindFormatByFileExtension(string extension) + public ITextureFormat? FindFormatByFileExtension(string extension) { Guard.NotNullOrWhiteSpace(extension, nameof(extension)); @@ -109,7 +109,7 @@ public ITextureFormat FindFormatByFileExtension(string extension) /// /// The mime-type to discover /// The if found; otherwise null - public ITextureFormat FindFormatByMimeType(string mimeType) => this.imageFormats.FirstOrDefault(x => x.MimeTypes.Contains(mimeType, StringComparer.OrdinalIgnoreCase)); + public ITextureFormat? FindFormatByMimeType(string mimeType) => this.imageFormats.FirstOrDefault(x => x.MimeTypes.Contains(mimeType, StringComparer.OrdinalIgnoreCase)); /// /// Sets a specific image encoder as the encoder for a specific image format. @@ -158,11 +158,11 @@ public void AddImageFormatDetector(ITextureFormatDetector detector) /// /// The format to discover /// The if found otherwise null - public ITextureDecoder FindDecoder(ITextureFormat format) + public ITextureDecoder? FindDecoder(ITextureFormat format) { Guard.NotNull(format, nameof(format)); - return this.mimeTypeDecoders.TryGetValue(format, out ITextureDecoder decoder) + return this.mimeTypeDecoders.TryGetValue(format, out ITextureDecoder? decoder) ? decoder : null; } @@ -172,11 +172,11 @@ public ITextureDecoder FindDecoder(ITextureFormat format) /// /// The format to discover /// The if found otherwise null - public ITextureEncoder FindEncoder(ITextureFormat format) + public ITextureEncoder? FindEncoder(ITextureFormat format) { Guard.NotNull(format, nameof(format)); - return this.mimeTypeEncoders.TryGetValue(format, out ITextureEncoder encoder) + return this.mimeTypeEncoders.TryGetValue(format, out ITextureEncoder? encoder) ? encoder : null; } diff --git a/src/ImageSharp.Textures/ImageSharp.Textures.csproj b/src/ImageSharp.Textures/ImageSharp.Textures.csproj index ba8a1bb..2f3ea42 100644 --- a/src/ImageSharp.Textures/ImageSharp.Textures.csproj +++ b/src/ImageSharp.Textures/ImageSharp.Textures.csproj @@ -13,6 +13,12 @@ A texture loading and manipulation library; written in C# + + + enable + Nullable + + diff --git a/src/ImageSharp.Textures/PixelFormats/Ayuv.cs b/src/ImageSharp.Textures/PixelFormats/Ayuv.cs index b3af0a1..f31800b 100644 --- a/src/ImageSharp.Textures/PixelFormats/Ayuv.cs +++ b/src/ImageSharp.Textures/PixelFormats/Ayuv.cs @@ -7,8 +7,6 @@ using System.Runtime.CompilerServices; using SixLabors.ImageSharp.PixelFormats; -#nullable enable - namespace SixLabors.ImageSharp.Textures.PixelFormats { /// diff --git a/src/ImageSharp.Textures/PixelFormats/Fp32.cs b/src/ImageSharp.Textures/PixelFormats/Fp32.cs index a2a800e..828dd0f 100644 --- a/src/ImageSharp.Textures/PixelFormats/Fp32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Fp32.cs @@ -136,7 +136,7 @@ public Fp32(float x) public Vector ToVector() => new Vector(this.PackedValue); /// - public override readonly bool Equals(object obj) => obj is Fp32 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Fp32 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs index 0aceac2..bac1a29 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs @@ -145,7 +145,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Bgr32 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Bgr32 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs index 8c77dff..3eb78bc 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs @@ -145,7 +145,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Bgr555 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Bgr555 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs b/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs index f08f48a..5c8c2fb 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs @@ -150,7 +150,7 @@ public Vector4 ToVector4() public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is D32_FLOAT_S8X24_UINT other && this.Equals(other); + public override bool Equals(object? obj) => obj is D32_FLOAT_S8X24_UINT other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore index 1f06e56..a36f7e8 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore +++ b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.ignore @@ -169,7 +169,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba128Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba128Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -357,7 +357,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba128 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba128 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -536,7 +536,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgb96Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgb96Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -715,7 +715,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgb96 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgb96 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -883,7 +883,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba64Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba64Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1061,7 +1061,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rg32Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg32Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1241,7 +1241,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rg64Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg64Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1411,7 +1411,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rg64 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg64 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1577,7 +1577,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is D32_FLOAT_S8X24_UINT other && this.Equals(other); + public override bool Equals(object? obj) => obj is D32_FLOAT_S8X24_UINT other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1753,7 +1753,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Bgr555 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Bgr555 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1931,7 +1931,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba5551 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba5551 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt index 4d5b47c..4ab4fe6 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt +++ b/src/ImageSharp.Textures/PixelFormats/Generated/PixelGenerator.tt @@ -296,7 +296,7 @@ namespace SixLabors.ImageSharp.Textures.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is <#= pixelInfo.Name #> other && this.Equals(other); + public override bool Equals(object? obj) => obj is <#= pixelInfo.Name #> other && this.Equals(other); <#= Helper.GenerateEquals(pixelInfo, 8) #> diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs index 7816f83..0be3301 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs @@ -152,7 +152,7 @@ public void ToRgba32(ref Rgba32 dest) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is R11G11B10Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is R11G11B10Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs index 8adf7c4..36100cf 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rg32Float.cs @@ -145,7 +145,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rg32Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg32Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs index f3d0e33..fd44428 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64.cs @@ -149,7 +149,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rg64 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg64 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs index 012bfe4..7eb39b5 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rg64Float.cs @@ -149,7 +149,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rg64Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg64Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs index fd15a77..4791df5 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb32.cs @@ -145,7 +145,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgb32 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgb32 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs index fd8a77e..1eff83a 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb565.cs @@ -148,7 +148,7 @@ public void ToRgba32(ref Rgba32 dest) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgb565 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgb565 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs index c27c733..13fac46 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96.cs @@ -158,7 +158,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgb96 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgb96 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs index b0ed25a..ab1cd9d 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgb96Float.cs @@ -158,7 +158,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgb96Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgb96Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs index ce711d9..c4728c3 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128.cs @@ -167,7 +167,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba128 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba128 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs index 3114460..f21a864 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba128Float.cs @@ -167,7 +167,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba128Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba128Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs index 0cd5e2b..64b7d7d 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba4444.cs @@ -146,7 +146,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba4444 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba4444 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs index 7af7e4b..7c99ac4 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba5551.cs @@ -146,7 +146,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba5551 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba5551 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs index 057c58e..8cd8db4 100644 --- a/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/Generated/Rgba64Float.cs @@ -150,7 +150,7 @@ public void ToRgba32(ref Rgba32 dest) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is Rgba64Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rgba64Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/L32.cs b/src/ImageSharp.Textures/PixelFormats/L32.cs index b6e4c99..97caeef 100644 --- a/src/ImageSharp.Textures/PixelFormats/L32.cs +++ b/src/ImageSharp.Textures/PixelFormats/L32.cs @@ -150,7 +150,7 @@ public void ToRgba32(ref Rgba32 dest) public PixelOperations CreatePixelOperations() => new(); /// - public override readonly bool Equals(object obj) => obj is L16 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is L16 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/R16Float.cs b/src/ImageSharp.Textures/PixelFormats/R16Float.cs index ac554ab..d951de2 100644 --- a/src/ImageSharp.Textures/PixelFormats/R16Float.cs +++ b/src/ImageSharp.Textures/PixelFormats/R16Float.cs @@ -127,7 +127,7 @@ public void FromVector4(Vector4 vector) public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override bool Equals(object obj) => obj is R16Float other && this.Equals(other); + public override bool Equals(object? obj) => obj is R16Float other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Rg16.cs b/src/ImageSharp.Textures/PixelFormats/Rg16.cs index 5fc6931..70a4ef6 100644 --- a/src/ImageSharp.Textures/PixelFormats/Rg16.cs +++ b/src/ImageSharp.Textures/PixelFormats/Rg16.cs @@ -147,7 +147,7 @@ public void FromVector4(Vector4 vector) public Vector2 ToVector2() => new Vector2(this.PackedValue & 0xFF, (this.PackedValue >> 8) & 0xFF) / Max; /// - public override bool Equals(object obj) => obj is Rg16 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg16 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Rg32.cs b/src/ImageSharp.Textures/PixelFormats/Rg32.cs index 34da70b..d87dc6b 100644 --- a/src/ImageSharp.Textures/PixelFormats/Rg32.cs +++ b/src/ImageSharp.Textures/PixelFormats/Rg32.cs @@ -147,7 +147,7 @@ public void FromVector4(Vector4 vector) public Vector2 ToVector2() => new Vector2(this.PackedValue & 0xFF, (this.PackedValue >> 8) & 0xFF) / Max; /// - public override bool Equals(object obj) => obj is Rg32 other && this.Equals(other); + public override bool Equals(object? obj) => obj is Rg32 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Y410.cs b/src/ImageSharp.Textures/PixelFormats/Y410.cs index 22d3206..701a145 100644 --- a/src/ImageSharp.Textures/PixelFormats/Y410.cs +++ b/src/ImageSharp.Textures/PixelFormats/Y410.cs @@ -51,7 +51,7 @@ public uint Yuv public static bool operator !=(Y410 left, Y410 right) => !left.Equals(right); /// - public override readonly bool Equals(object obj) => obj is Y410 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Y410 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/PixelFormats/Y416.cs b/src/ImageSharp.Textures/PixelFormats/Y416.cs index c63c4ca..33887f0 100644 --- a/src/ImageSharp.Textures/PixelFormats/Y416.cs +++ b/src/ImageSharp.Textures/PixelFormats/Y416.cs @@ -51,7 +51,7 @@ public ulong Yuv public static bool operator !=(Y416 left, Y416 right) => !left.Equals(right); /// - public override readonly bool Equals(object obj) => obj is Y416 other && this.Equals(other); + public override readonly bool Equals(object? obj) => obj is Y416 other && this.Equals(other); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp.Textures/Texture.Decode.cs b/src/ImageSharp.Textures/Texture.Decode.cs index c3a63b1..0fd0fff 100644 --- a/src/ImageSharp.Textures/Texture.Decode.cs +++ b/src/ImageSharp.Textures/Texture.Decode.cs @@ -21,7 +21,7 @@ public abstract partial class Texture /// The image stream to read the header from. /// The configuration. /// The mime type or null if none found. - private static ITextureFormat InternalDetectFormat(Stream stream, Configuration config) + private static ITextureFormat? InternalDetectFormat(Stream stream, Configuration config) { // 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. @@ -52,7 +52,7 @@ private static ITextureFormat InternalDetectFormat(Stream stream, Configuration /// The configuration. /// The IImageFormat. /// The image format or null if none found. - private static ITextureDecoder DiscoverDecoder(Stream stream, Configuration config, out ITextureFormat format) + private static ITextureDecoder? DiscoverDecoder(Stream stream, Configuration config, out ITextureFormat? format) { format = InternalDetectFormat(stream, config); @@ -66,9 +66,9 @@ private static ITextureDecoder DiscoverDecoder(Stream stream, Configuration conf /// /// The stream. /// the configuration. - private static (Texture Texture, ITextureFormat Format) DecodeTexture(Stream stream, Configuration config) + private static (Texture? Texture, ITextureFormat? Format) DecodeTexture(Stream stream, Configuration config) { - ITextureDecoder decoder = DiscoverDecoder(stream, config, out ITextureFormat format); + ITextureDecoder? decoder = DiscoverDecoder(stream, config, out ITextureFormat? format); if (decoder is null) { return (null, null); @@ -86,9 +86,9 @@ private static (Texture Texture, ITextureFormat Format) DecodeTexture(Stream str /// /// The or null if suitable info detector not found. /// - private static (ITextureInfo Info, ITextureFormat Format) InternalIdentity(Stream stream, Configuration config) + private static (ITextureInfo? Info, ITextureFormat? Format) InternalIdentity(Stream stream, Configuration config) { - if (DiscoverDecoder(stream, config, out ITextureFormat format) is not ITextureInfoDetector detector) + if (DiscoverDecoder(stream, config, out ITextureFormat? format) is not ITextureInfoDetector detector) { return (null, null); } diff --git a/src/ImageSharp.Textures/Texture.FromBytes.cs b/src/ImageSharp.Textures/Texture.FromBytes.cs index be436df..bd3a1fd 100644 --- a/src/ImageSharp.Textures/Texture.FromBytes.cs +++ b/src/ImageSharp.Textures/Texture.FromBytes.cs @@ -17,7 +17,7 @@ public abstract partial class Texture /// /// The byte array containing encoded texture data to read the header from. /// The format or null if none found. - public static ITextureFormat DetectFormat(byte[] data) => DetectFormat(Configuration.Default, data); + public static ITextureFormat? DetectFormat(byte[] data) => DetectFormat(Configuration.Default, data); /// /// By reading the header on the provided byte array this calculates the images format. @@ -25,7 +25,7 @@ public abstract partial class Texture /// The configuration. /// The byte array containing encoded texture data to read the header from. /// The mime type or null if none found. - public static ITextureFormat DetectFormat(Configuration config, byte[] data) + public static ITextureFormat? DetectFormat(Configuration config, byte[] data) { using (var stream = new MemoryStream(data)) { @@ -38,7 +38,7 @@ public static ITextureFormat DetectFormat(Configuration config, byte[] data) /// /// The byte array containing encoded texture data to read the header from. /// The format or null if none found. - public static ITextureFormat DetectFormat(ReadOnlySpan data) => DetectFormat(Configuration.Default, data); + public static ITextureFormat? DetectFormat(ReadOnlySpan data) => DetectFormat(Configuration.Default, data); /// /// By reading the header on the provided byte array this calculates the images format. @@ -46,7 +46,7 @@ public static ITextureFormat DetectFormat(Configuration config, byte[] data) /// The configuration. /// The byte array containing encoded texture data to read the header from. /// The mime type or null if none found. - public static ITextureFormat DetectFormat(Configuration config, ReadOnlySpan data) + public static ITextureFormat? DetectFormat(Configuration config, ReadOnlySpan data) { int maxHeaderSize = config.MaxHeaderSize; if (maxHeaderSize <= 0) @@ -56,7 +56,7 @@ public static ITextureFormat DetectFormat(Configuration config, ReadOnlySpan /// The or null if suitable info detector not found. /// - public static ITextureInfo Identify(byte[] data) => Identify(data, out ITextureFormat _); + public static ITextureInfo? Identify(byte[] data) => Identify(data, out ITextureFormat? _); /// /// Reads the raw image information from the specified stream without fully decoding it. @@ -88,7 +88,7 @@ public static ITextureFormat DetectFormat(Configuration config, ReadOnlySpan /// The or null if suitable info detector not found. /// - public static ITextureInfo Identify(byte[] data, out ITextureFormat format) => Identify(Configuration.Default, data, out format); + public static ITextureInfo? Identify(byte[] data, out ITextureFormat? format) => Identify(Configuration.Default, data, out format); /// /// Reads the raw texture information from the specified stream without fully decoding it. @@ -102,7 +102,7 @@ public static ITextureFormat DetectFormat(Configuration config, ReadOnlySpan /// The or null if suitable info detector is not found. /// - public static ITextureInfo Identify(Configuration configuration, byte[] data, out ITextureFormat format) + public static ITextureInfo? Identify(Configuration configuration, byte[] data, out ITextureFormat? format) { Guard.NotNull(data, nameof(data)); @@ -118,7 +118,7 @@ public static ITextureInfo Identify(Configuration configuration, byte[] data, ou /// The byte array containing texture data. /// The detected format. /// The . - public static Texture Load(byte[] data, out ITextureFormat format) => + public static Texture? Load(byte[] data, out ITextureFormat? format) => Load(Configuration.Default, data, out format); /// @@ -135,7 +135,7 @@ public static Texture Load(byte[] data, out ITextureFormat format) => /// The config for the decoder. /// The byte array containing encoded texture data. /// The . - public static Texture Load(Configuration config, byte[] data) => Load(config, data, out _); + public static Texture? Load(Configuration config, byte[] data) => Load(config, data, out _); /// /// Load a new instance of from the given encoded byte array. @@ -159,7 +159,7 @@ public static Texture Load(Configuration config, byte[] data, ITextureDecoder de /// The byte array containing texture data. /// The mime type of the decoded texture. /// The . - public static Texture Load(Configuration config, byte[] data, out ITextureFormat format) + public static Texture? Load(Configuration config, byte[] data, out ITextureFormat? format) { using (var stream = new MemoryStream(data)) { @@ -189,7 +189,7 @@ public static Texture Load(ReadOnlySpan data, ITextureDecoder decoder) => /// The byte span containing texture data. /// The detected format. /// The . - public static Texture Load(ReadOnlySpan data, out ITextureFormat format) => + public static Texture Load(ReadOnlySpan data, out ITextureFormat? format) => Load(Configuration.Default, data, out format); /// @@ -231,7 +231,7 @@ public static unsafe Texture Load( public static unsafe Texture Load( Configuration config, ReadOnlySpan data, - out ITextureFormat format) + out ITextureFormat? format) { fixed (byte* ptr = &data.GetPinnableReference()) { diff --git a/src/ImageSharp.Textures/Texture.FromFile.cs b/src/ImageSharp.Textures/Texture.FromFile.cs index 9e0e5f4..ede6ded 100644 --- a/src/ImageSharp.Textures/Texture.FromFile.cs +++ b/src/ImageSharp.Textures/Texture.FromFile.cs @@ -17,7 +17,7 @@ public abstract partial class Texture /// /// The image file to open and to read the header from. /// The mime type or null if none found. - public static ITextureFormat DetectFormat(string filePath) => DetectFormat(Configuration.Default, filePath); + public static ITextureFormat? DetectFormat(string filePath) => DetectFormat(Configuration.Default, filePath); /// /// By reading the header on the provided file this calculates the images mime type. @@ -25,7 +25,7 @@ public abstract partial class Texture /// The configuration. /// The image file to open and to read the header from. /// The mime type or null if none found. - public static ITextureFormat DetectFormat(Configuration config, string filePath) + public static ITextureFormat? DetectFormat(Configuration config, string filePath) { config ??= Configuration.Default; using (Stream file = config.FileSystem.OpenRead(filePath)) @@ -41,8 +41,8 @@ public static ITextureFormat DetectFormat(Configuration config, string filePath) /// /// The or null if suitable info detector not found. /// - public static ITextureInfo Identify(string filePath) - => Identify(filePath, out ITextureFormat _); + public static ITextureInfo? Identify(string filePath) + => Identify(filePath, out ITextureFormat? _); /// /// Reads the raw texture information from the specified stream without fully decoding it. @@ -52,7 +52,7 @@ public static ITextureInfo Identify(string filePath) /// /// The or null if suitable info detector not found. /// - public static ITextureInfo Identify(string filePath, out ITextureFormat format) + public static ITextureInfo? Identify(string filePath, out ITextureFormat? format) => Identify(Configuration.Default, filePath, out format); /// @@ -65,7 +65,7 @@ public static ITextureInfo Identify(string filePath, out ITextureFormat format) /// /// The or null if suitable info detector is not found. /// - public static ITextureInfo Identify(Configuration configuration, string filePath, out ITextureFormat format) + public static ITextureInfo? Identify(Configuration configuration, string filePath, out ITextureFormat? format) { Guard.NotNull(configuration, nameof(configuration)); using (Stream file = configuration.FileSystem.OpenRead(filePath)) @@ -82,7 +82,7 @@ public static ITextureInfo Identify(Configuration configuration, string filePath /// Thrown if the stream is not readable nor seekable. /// /// The . - public static Texture Load(string path) => Load(Configuration.Default, path); + public static Texture? Load(string path) => Load(Configuration.Default, path); /// /// Create a new instance of the class from the given file. @@ -93,7 +93,7 @@ public static ITextureInfo Identify(Configuration configuration, string filePath /// Thrown if the stream is not readable nor seekable. /// /// A new . - public static Texture Load(string path, out ITextureFormat format) => Load(Configuration.Default, path, out format); + public static Texture? Load(string path, out ITextureFormat? format) => Load(Configuration.Default, path, out format); /// /// Create a new instance of the class from the given file. @@ -104,7 +104,7 @@ public static ITextureInfo Identify(Configuration configuration, string filePath /// Thrown if the stream is not readable nor seekable. /// /// The . - public static Texture Load(Configuration config, string path) => Load(config, path, out _); + public static Texture? Load(Configuration config, string path) => Load(config, path, out _); /// /// Create a new instance of the class from the given file. @@ -146,7 +146,7 @@ public static Texture Load(Configuration config, string path, ITextureDecoder de /// Thrown if the stream is not readable nor seekable. /// /// The . - public static Texture Load(Configuration config, string path, out ITextureFormat format) + public static Texture? Load(Configuration config, string path, out ITextureFormat? format) { using (Stream stream = config.FileSystem.OpenRead(path)) { diff --git a/src/ImageSharp.Textures/Texture.FromStream.cs b/src/ImageSharp.Textures/Texture.FromStream.cs index 38d5f9c..b44988a 100644 --- a/src/ImageSharp.Textures/Texture.FromStream.cs +++ b/src/ImageSharp.Textures/Texture.FromStream.cs @@ -22,7 +22,7 @@ public abstract partial class Texture /// The image stream to read the header from. /// Thrown if the stream is not readable. /// The format type or null if none found. - public static ITextureFormat DetectFormat(Stream stream) => DetectFormat(Configuration.Default, stream); + public static ITextureFormat? DetectFormat(Stream stream) => DetectFormat(Configuration.Default, stream); /// /// By reading the header on the provided stream this calculates the images format type. @@ -31,7 +31,7 @@ public abstract partial class Texture /// The image stream to read the header from. /// Thrown if the stream is not readable. /// The format type or null if none found. - public static ITextureFormat DetectFormat(Configuration config, Stream stream) + public static ITextureFormat? DetectFormat(Configuration config, Stream stream) => WithSeekableStream(config, stream, s => InternalDetectFormat(s, config)); /// @@ -42,7 +42,7 @@ public static ITextureFormat DetectFormat(Configuration config, Stream stream) /// /// The or null if suitable info detector not found. /// - public static ITextureInfo Identify(Stream stream) => Identify(stream, out ITextureFormat _); + public static ITextureInfo? Identify(Stream stream) => Identify(stream, out ITextureFormat? _); /// /// By reading the header on the provided stream this reads the raw image information. @@ -53,7 +53,7 @@ public static ITextureFormat DetectFormat(Configuration config, Stream stream) /// /// The or null if suitable info detector not found. /// - public static ITextureInfo Identify(Stream stream, out ITextureFormat format) => Identify(Configuration.Default, stream, out format); + public static ITextureInfo? Identify(Stream stream, out ITextureFormat? format) => Identify(Configuration.Default, stream, out format); /// /// Reads the raw image information from the specified stream without fully decoding it. @@ -65,9 +65,9 @@ public static ITextureFormat DetectFormat(Configuration config, Stream stream) /// /// The or null if suitable info detector is not found. /// - public static ITextureInfo Identify(Configuration config, Stream stream, out ITextureFormat format) + public static ITextureInfo? Identify(Configuration config, Stream stream, out ITextureFormat? format) { - (ITextureInfo Info, ITextureFormat Format) data = WithSeekableStream(config, stream, s => InternalIdentity(s, config ?? Configuration.Default)); + (ITextureInfo? Info, ITextureFormat? Format) data = WithSeekableStream(config, stream, s => InternalIdentity(s, config ?? Configuration.Default)); format = data.Format; return data.Info; @@ -82,7 +82,7 @@ public static ITextureInfo Identify(Configuration config, Stream stream, out ITe /// Thrown if the stream is not readable. /// Image cannot be loaded. /// The . - public static Texture Load(Stream stream, out ITextureFormat format) => Load(Configuration.Default, stream, out format); + public static Texture Load(Stream stream, out ITextureFormat? format) => Load(Configuration.Default, stream, out format); /// /// Decode a new instance of the class from the given stream. @@ -138,10 +138,10 @@ public static Texture Load(Configuration config, Stream stream, ITextureDecoder /// Thrown if the stream is not readable. /// Image cannot be loaded. /// A new . - public static Texture Load(Configuration config, Stream stream, out ITextureFormat format) + public static Texture Load(Configuration config, Stream stream, out ITextureFormat? format) { config ??= Configuration.Default; - (Texture Img, ITextureFormat Format) data = WithSeekableStream(config, stream, s => DecodeTexture(s, config)); + (Texture? Img, ITextureFormat? Format) data = WithSeekableStream(config, stream, s => DecodeTexture(s, config)); format = data.Format; From e4f2ade4bef00c63c04456bb5d7fa4a06c74a4bf Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:11:27 +0200 Subject: [PATCH 08/12] Fix license and packaging --- src/ImageSharp.Textures/ImageSharp.Textures.csproj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ImageSharp.Textures/ImageSharp.Textures.csproj b/src/ImageSharp.Textures/ImageSharp.Textures.csproj index 2f3ea42..8fadb42 100644 --- a/src/ImageSharp.Textures/ImageSharp.Textures.csproj +++ b/src/ImageSharp.Textures/ImageSharp.Textures.csproj @@ -7,6 +7,7 @@ SixLabors.ImageSharp.Textures SixLabors.ImageSharp.Textures sixlabors.imagesharp.textures.128.png + LICENSE https://github.com/SixLabors/ImageSharp.Textures/ $(RepositoryUrl) Texture Surface BASIS DDS KTX KTX2 ETC1 ETC2 DXT1 DXT3 DXT5 BC5 BC6 BC7 @@ -34,11 +35,6 @@ - - - - - From f89450a20e3acd34d24bb4841efa84f2ff90edf0 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:25:10 +0200 Subject: [PATCH 09/12] Tidy --- .../ImageComparison/ImageComparer.cs | 9 ++++ .../ImageProviders/FileProvider.cs | 3 +- .../ImageProviders/TestImageProvider.cs | 9 ++-- .../TestUtilities/ImagingTestCaseUtility.cs | 52 ++++++++++++++++++- 4 files changed, 67 insertions(+), 6 deletions(-) diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs index eb37d80..c2b9d74 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageComparison/ImageComparer.cs @@ -13,10 +13,19 @@ public abstract class ImageComparer { public static ImageComparer Exact { get; } = Tolerant(0, 0); + /// + /// Returns an instance of . + /// Individual manhattan pixel difference is only added to total image difference when the individual difference is over 'perPixelManhattanThreshold'. + /// + /// The comparer. public static ImageComparer Tolerant( float imageThreshold = TolerantImageComparer.DefaultImageThreshold, int perPixelManhattanThreshold = 0) => new TolerantImageComparer(imageThreshold, perPixelManhattanThreshold); + /// + /// Returns Tolerant(imageThresholdInPercents/100) + /// + /// The comparer. public static ImageComparer TolerantPercentage(float imageThresholdInPercents, int perPixelManhattanThreshold = 0) => Tolerant(imageThresholdInPercents / 100F, perPixelManhattanThreshold); diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs index 3b5e5f9..1a163be 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/FileProvider.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Collections.Concurrent; +using System.Globalization; using System.Reflection; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.PixelFormats; @@ -45,7 +46,7 @@ private static Dictionary GetDecoderParameters(IImageDecoder cus PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo p in properties) { - string key = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", type.FullName, p.Name); + string key = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", type.FullName, p.Name); object value = p.GetValue(customDecoder); data[key] = value; } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 9f293f1..490cc22 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System; +using System.Globalization; using System.Reflection; using System.Threading.Tasks; using Castle.Core.Internal; @@ -52,9 +53,11 @@ public static TestImageProvider File( /// A test image. public abstract Image GetImage(); - public virtual Image GetImage(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Decoder specific GetImage() is not supported with {0}!", this.GetType().Name)); + public virtual Image GetImage(IImageFormat format, IImageDecoder decoder) + => throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Decoder specific GetImage() is not supported with {0}!", this.GetType().Name)); - public virtual Task> GetImageAsync(IImageFormat format, IImageDecoder decoder) => throw new NotSupportedException(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Decoder specific GetImageAsync() is not supported with {0}!", this.GetType().Name)); + public virtual Task> GetImageAsync(IImageFormat format, IImageDecoder decoder) + => throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Decoder specific GetImageAsync() is not supported with {0}!", this.GetType().Name)); /// /// Returns an instance to the test case with the necessary traits. @@ -121,6 +124,6 @@ protected TestImageProvider Init(MethodInfo testMethod, PixelTypes pixel return this.Init(testMethod?.DeclaringType.Name, testMethod?.Name, subfolder, pixelTypeOverride); } - public override string ToString() => string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}[{1}]", this.SourceFileOrDescription, this.PixelType); + public override string ToString() => string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", this.SourceFileOrDescription, this.PixelType); } } diff --git a/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs b/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs index 132f806..e143076 100644 --- a/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs +++ b/tests/ImageSharp.Textures.Tests/TestUtilities/ImagingTestCaseUtility.cs @@ -12,12 +12,34 @@ namespace SixLabors.ImageSharp.Textures.Tests.TestUtilities { + /// + /// Utility class to provide information about the test image & the test case for the test code, + /// and help managing IO. + /// public class ImagingTestCaseUtility { + /// + /// Gets or sets the name of the TPixel in the owner. + /// public string PixelTypeName { get; set; } = string.Empty; + + /// + /// Gets or sets the name of the file which is provided by. + /// Or a short string describing the image in the case of a non-file based image provider. + /// public string SourceFileOrDescription { get; set; } = string.Empty; + + /// + /// Gets or sets the test group name. + /// By default this is the name of the test class, but it's possible to change it. + /// public string TestGroupName { get; set; } = string.Empty; + public string OutputSubfolderName { get; set; } = string.Empty; + + /// + /// Gets or sets the name of the test case (by default). + /// public string TestName { get; set; } = string.Empty; private string GetTestOutputFileNameImpl( @@ -75,10 +97,26 @@ private string GetTestOutputFileNameImpl( details = '_' + details; } - string composed = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}{6}", this.GetTestOutputDir(), Path.DirectorySeparatorChar, this.TestName, pixName, fn, details, extension); - return composed; // Already invariant + return string.Format( + CultureInfo.InvariantCulture, + "{0}{1}{2}{3}{4}{5}{6}", + this.GetTestOutputDir(), + Path.DirectorySeparatorChar, + this.TestName, + pixName, + fn, + details, + extension); } + /// + /// Gets the recommended file name for the output of the test + /// + /// The required extension + /// The settings modifying the output path + /// A boolean indicating whether to append the pixel type to output file name. + /// A boolean indicating whether to append SourceFileOrDescription to the test output file name. + /// The file test name public string GetTestOutputFileName( string extension = null, object testOutputDetails = null, @@ -121,6 +159,16 @@ public string GetTestOutputFileName( appendSourceFileOrDescription); } + /// + /// Encodes image by the format matching the required extension, than saves it to the recommended output file. + /// + /// The image instance. + /// The requested extension. + /// Optional encoder. + /// Additional information to append to the test output file name. + /// A value indicating whether to append the pixel type to the test output file name. + /// A boolean indicating whether to append SourceFileOrDescription to the test output file name. + /// The path to the saved image file. public string SaveTestOutputFile( Image image, string extension = null, From 3027c86631a7236e5172599f527d06f056f5c1e8 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Thu, 23 Oct 2025 22:58:09 +0200 Subject: [PATCH 10/12] Don't return null when loading textures --- .../Formats/TextureFormatManager.cs | 334 ++++++------- src/ImageSharp.Textures/Texture.Decode.cs | 156 +++---- src/ImageSharp.Textures/Texture.FromBytes.cs | 441 +++++++++--------- src/ImageSharp.Textures/Texture.FromFile.cs | 270 ++++++----- src/ImageSharp.Textures/Texture.FromStream.cs | 331 ++++++------- 5 files changed, 773 insertions(+), 759 deletions(-) diff --git a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs index 71a771b..11d36fb 100644 --- a/src/ImageSharp.Textures/Formats/TextureFormatManager.cs +++ b/src/ImageSharp.Textures/Formats/TextureFormatManager.cs @@ -1,189 +1,211 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System; using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Text; +using SixLabors.ImageSharp.Textures.Common.Exceptions; -namespace SixLabors.ImageSharp.Textures.Formats +namespace SixLabors.ImageSharp.Textures.Formats; + +/// +/// Collection of Image Formats to be used in class. +/// +public class TextureFormatManager { /// - /// Collection of Image Formats to be used in class. + /// Used for locking against as there is no ConcurrentSet type. + /// + /// + private static readonly object HashLock = new(); + + /// + /// The list of supported keyed to mime types. /// - public class TextureFormatManager + private readonly ConcurrentDictionary mimeTypeEncoders = new(); + + /// + /// The list of supported keyed to mime types. + /// + private readonly ConcurrentDictionary mimeTypeDecoders = new(); + + /// + /// The list of supported s. + /// + private readonly HashSet imageFormats = []; + + /// + /// The list of supported s. + /// + private ConcurrentBag imageFormatDetectors = []; + + /// + /// Initializes a new instance of the class. + /// + public TextureFormatManager() { - /// - /// Used for locking against as there is no ConcurrentSet type. - /// - /// - private static readonly object HashLock = new object(); - - /// - /// The list of supported keyed to mime types. - /// - private readonly ConcurrentDictionary mimeTypeEncoders = new ConcurrentDictionary(); - - /// - /// The list of supported keyed to mime types. - /// - private readonly ConcurrentDictionary mimeTypeDecoders = new ConcurrentDictionary(); - - /// - /// The list of supported s. - /// - private readonly HashSet imageFormats = new HashSet(); - - /// - /// The list of supported s. - /// - private ConcurrentBag imageFormatDetectors = new ConcurrentBag(); - - /// - /// Initializes a new instance of the class. - /// - public TextureFormatManager() + } + + /// + /// Gets the maximum header size of all the formats. + /// + internal int MaxHeaderSize { get; private set; } + + /// + /// Gets the currently registered s. + /// + public IEnumerable ImageFormats => this.imageFormats; + + /// + /// Gets the currently registered s. + /// + internal IEnumerable FormatDetectors => this.imageFormatDetectors; + + /// + /// Gets the currently registered s. + /// + internal IEnumerable> ImageDecoders => this.mimeTypeDecoders; + + /// + /// Gets the currently registered s. + /// + internal IEnumerable> ImageEncoders => this.mimeTypeEncoders; + + /// + /// Registers a new format provider. + /// + /// The format to register as a known format. + public void AddImageFormat(ITextureFormat format) + { + Guard.NotNull(format, nameof(format)); + Guard.NotNull(format.MimeTypes, nameof(format.MimeTypes)); + Guard.NotNull(format.FileExtensions, nameof(format.FileExtensions)); + + lock (HashLock) { + _ = this.imageFormats.Add(format); } + } + + /// + /// For the specified file extensions type find the e . + /// + /// The extension to discover + /// The if found otherwise null + public ITextureFormat? FindFormatByFileExtension(string extension) + { + Guard.NotNullOrWhiteSpace(extension, nameof(extension)); - /// - /// Gets the maximum header size of all the formats. - /// - internal int MaxHeaderSize { get; private set; } - - /// - /// Gets the currently registered s. - /// - public IEnumerable ImageFormats => this.imageFormats; - - /// - /// Gets the currently registered s. - /// - internal IEnumerable FormatDetectors => this.imageFormatDetectors; - - /// - /// Gets the currently registered s. - /// - internal IEnumerable> ImageDecoders => this.mimeTypeDecoders; - - /// - /// Gets the currently registered s. - /// - internal IEnumerable> ImageEncoders => this.mimeTypeEncoders; - - /// - /// Registers a new format provider. - /// - /// The format to register as a known format. - public void AddImageFormat(ITextureFormat format) + if (extension[0] == '.') { - Guard.NotNull(format, nameof(format)); - Guard.NotNull(format.MimeTypes, nameof(format.MimeTypes)); - Guard.NotNull(format.FileExtensions, nameof(format.FileExtensions)); - - lock (HashLock) - { - _ = this.imageFormats.Add(format); - } + extension = extension.Substring(1); } - /// - /// For the specified file extensions type find the e . - /// - /// The extension to discover - /// The if found otherwise null - public ITextureFormat? FindFormatByFileExtension(string extension) - { - Guard.NotNullOrWhiteSpace(extension, nameof(extension)); + return this.imageFormats.FirstOrDefault(x => x.FileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase)); + } - if (extension[0] == '.') - { - extension = extension.Substring(1); - } + /// + /// For the specified mime type find the . + /// + /// The mime-type to discover + /// The if found; otherwise null + public ITextureFormat? FindFormatByMimeType(string mimeType) => this.imageFormats.FirstOrDefault(x => x.MimeTypes.Contains(mimeType, StringComparer.OrdinalIgnoreCase)); - return this.imageFormats.FirstOrDefault(x => x.FileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase)); - } + /// + /// Sets a specific image encoder as the encoder for a specific image format. + /// + /// The image format to register the encoder for. + /// The encoder to use, + public void SetEncoder(ITextureFormat imageFormat, ITextureEncoder encoder) + { + Guard.NotNull(imageFormat, nameof(imageFormat)); + Guard.NotNull(encoder, nameof(encoder)); + this.AddImageFormat(imageFormat); + this.mimeTypeEncoders.AddOrUpdate(imageFormat, encoder, (s, e) => encoder); + } - /// - /// For the specified mime type find the . - /// - /// The mime-type to discover - /// The if found; otherwise null - public ITextureFormat? FindFormatByMimeType(string mimeType) => this.imageFormats.FirstOrDefault(x => x.MimeTypes.Contains(mimeType, StringComparer.OrdinalIgnoreCase)); - - /// - /// Sets a specific image encoder as the encoder for a specific image format. - /// - /// The image format to register the encoder for. - /// The encoder to use, - public void SetEncoder(ITextureFormat imageFormat, ITextureEncoder encoder) - { - Guard.NotNull(imageFormat, nameof(imageFormat)); - Guard.NotNull(encoder, nameof(encoder)); - this.AddImageFormat(imageFormat); - this.mimeTypeEncoders.AddOrUpdate(imageFormat, encoder, (s, e) => encoder); - } + /// + /// Sets a specific image decoder as the decoder for a specific image format. + /// + /// The image format to register the encoder for. + /// The decoder to use, + public void SetDecoder(ITextureFormat imageFormat, ITextureDecoder decoder) + { + Guard.NotNull(imageFormat, nameof(imageFormat)); + Guard.NotNull(decoder, nameof(decoder)); + this.AddImageFormat(imageFormat); + this.mimeTypeDecoders.AddOrUpdate(imageFormat, decoder, (s, e) => decoder); + } - /// - /// Sets a specific image decoder as the decoder for a specific image format. - /// - /// The image format to register the encoder for. - /// The decoder to use, - public void SetDecoder(ITextureFormat imageFormat, ITextureDecoder decoder) + /// + /// Removes all the registered image format detectors. + /// + public void ClearImageFormatDetectors() => this.imageFormatDetectors = new ConcurrentBag(); + + /// + /// Adds a new detector for detecting mime types. + /// + /// The detector to add + public void AddImageFormatDetector(ITextureFormatDetector detector) + { + Guard.NotNull(detector, nameof(detector)); + this.imageFormatDetectors.Add(detector); + this.SetMaxHeaderSize(); + } + + /// + /// For the specified mime type find the decoder. + /// + /// The format to discover + /// The if found otherwise null + /// The input format is not recognized. + public ITextureDecoder FindDecoder(ITextureFormat format) + { + Guard.NotNull(format, nameof(format)); + + if (!this.mimeTypeDecoders.TryGetValue(format, out ITextureDecoder? decoder)) { - Guard.NotNull(imageFormat, nameof(imageFormat)); - Guard.NotNull(decoder, nameof(decoder)); - this.AddImageFormat(imageFormat); - this.mimeTypeDecoders.AddOrUpdate(imageFormat, decoder, (s, e) => decoder); + ThrowInvalidDecoder(this); } - /// - /// Removes all the registered image format detectors. - /// - public void ClearImageFormatDetectors() => this.imageFormatDetectors = new ConcurrentBag(); + return decoder; + } + + /// + /// For the specified mime type find the encoder. + /// + /// The format to discover + /// The if found otherwise null + /// The input format is not recognized. + public ITextureEncoder FindEncoder(ITextureFormat format) + { + Guard.NotNull(format, nameof(format)); - /// - /// Adds a new detector for detecting mime types. - /// - /// The detector to add - public void AddImageFormatDetector(ITextureFormatDetector detector) + if (!this.mimeTypeEncoders.TryGetValue(format, out ITextureEncoder? encoder)) { - Guard.NotNull(detector, nameof(detector)); - this.imageFormatDetectors.Add(detector); - this.SetMaxHeaderSize(); + ThrowInvalidDecoder(this); } - /// - /// For the specified mime type find the decoder. - /// - /// The format to discover - /// The if found otherwise null - public ITextureDecoder? FindDecoder(ITextureFormat format) - { - Guard.NotNull(format, nameof(format)); + return encoder; + } - return this.mimeTypeDecoders.TryGetValue(format, out ITextureDecoder? decoder) - ? decoder - : null; - } + /// + /// Sets the max header size. + /// + private void SetMaxHeaderSize() => this.MaxHeaderSize = this.imageFormatDetectors.Max(x => x.HeaderSize); - /// - /// For the specified mime type find the encoder. - /// - /// The format to discover - /// The if found otherwise null - public ITextureEncoder? FindEncoder(ITextureFormat format) - { - Guard.NotNull(format, nameof(format)); + [DoesNotReturn] + internal static void ThrowInvalidDecoder(TextureFormatManager manager) + { + StringBuilder sb = new(); + sb = sb.AppendLine("Texture cannot be loaded. Available decoders:"); - return this.mimeTypeEncoders.TryGetValue(format, out ITextureEncoder? encoder) - ? encoder - : null; + foreach (KeyValuePair val in manager.ImageDecoders) + { + sb = sb.AppendFormat(CultureInfo.InvariantCulture, " - {0} : {1}{2}", val.Key.Name, val.Value.GetType().Name, Environment.NewLine); } - /// - /// Sets the max header size. - /// - private void SetMaxHeaderSize() => this.MaxHeaderSize = this.imageFormatDetectors.Max(x => x.HeaderSize); + throw new UnknownTextureFormatException(sb.ToString()); } } diff --git a/src/ImageSharp.Textures/Texture.Decode.cs b/src/ImageSharp.Textures/Texture.Decode.cs index 0fd0fff..80eb860 100644 --- a/src/ImageSharp.Textures/Texture.Decode.cs +++ b/src/ImageSharp.Textures/Texture.Decode.cs @@ -1,99 +1,99 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System; -using System.IO; -using System.Linq; using SixLabors.ImageSharp.Memory; +using SixLabors.ImageSharp.Textures.Common.Exceptions; using SixLabors.ImageSharp.Textures.Common.Extensions; using SixLabors.ImageSharp.Textures.Formats; -namespace SixLabors.ImageSharp.Textures +namespace SixLabors.ImageSharp.Textures; + +/// +/// Adds static methods allowing the decoding of new images. +/// +public abstract partial class Texture { - /// - /// Adds static methods allowing the decoding of new images. - /// - public abstract partial class Texture + /// + /// By reading the header on the provided stream this calculates the images format. + /// + /// The image stream to read the header from. + /// The configuration. + /// The mime type. + /// The input format is not recognized. + private static ITextureFormat InternalDetectFormat(Stream stream, Configuration config) { - /// - /// By reading the header on the provided stream this calculates the images format. - /// - /// The image stream to read the header from. - /// The configuration. - /// The mime type or null if none found. - private static ITextureFormat? InternalDetectFormat(Stream stream, Configuration config) + // 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) { - // 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; - } + TextureFormatManager.ThrowInvalidDecoder(config.ImageFormatsManager); + } - using System.Buffers.IMemoryOwner buffer = config.MemoryAllocator.Allocate(headerSize, AllocationOptions.Clean); - long startPosition = stream.Position; - Span bufferSpan = buffer.Memory.Span; - stream.Read(bufferSpan, 0, headerSize); - stream.Position = startPosition; + using System.Buffers.IMemoryOwner buffer = config.MemoryAllocator.Allocate(headerSize, AllocationOptions.Clean); + long startPosition = stream.Position; + Span bufferSpan = buffer.Memory.Span; + stream.Read(bufferSpan, 0, headerSize); + stream.Position = startPosition; - // 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.Memory.Span)).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. + ITextureFormat? format = config.ImageFormatsManager.FormatDetectors + .Where(x => x.HeaderSize <= headerSize) + .Select(x => x.DetectFormat(buffer.Memory.Span)) + .LastOrDefault(x => x is not null); - /// - /// By reading the header on the provided stream this calculates the images format. - /// - /// The image stream to read the header from. - /// The configuration. - /// The IImageFormat. - /// The image format or null if none found. - private static ITextureDecoder? DiscoverDecoder(Stream stream, Configuration config, out ITextureFormat? format) - { - format = InternalDetectFormat(stream, config); + TextureFormatManager.ThrowInvalidDecoder(config.ImageFormatsManager); - return format != null - ? config.ImageFormatsManager.FindDecoder(format) - : null; - } + return format; + } - /// - /// Decodes the image stream to the current image. - /// - /// The stream. - /// the configuration. - private static (Texture? Texture, ITextureFormat? Format) DecodeTexture(Stream stream, Configuration config) - { - ITextureDecoder? decoder = DiscoverDecoder(stream, config, out ITextureFormat? format); - if (decoder is null) - { - return (null, null); - } + /// + /// By reading the header on the provided stream this calculates the images format. + /// + /// The image stream to read the header from. + /// The configuration. + /// The IImageFormat. + /// The image format. + /// The input format is not recognized. + private static ITextureDecoder DiscoverDecoder(Stream stream, Configuration config, out ITextureFormat format) + { + format = InternalDetectFormat(stream, config); - Texture texture = decoder.DecodeTexture(config, stream); - return (texture, format); - } + return config.ImageFormatsManager.FindDecoder(format); + } - /// - /// Reads the raw image information from the specified stream. - /// - /// The stream. - /// the configuration. - /// - /// The or null if suitable info detector not found. - /// - private static (ITextureInfo? Info, ITextureFormat? Format) InternalIdentity(Stream stream, Configuration config) - { - if (DiscoverDecoder(stream, config, out ITextureFormat? format) is not ITextureInfoDetector detector) - { - return (null, null); - } + /// + /// Decodes the image stream to the current image. + /// + /// The stream. + /// the configuration. + /// The input format is not recognized. + private static (Texture Texture, ITextureFormat Format) DecodeTexture(Stream stream, Configuration config) + { + ITextureDecoder decoder = DiscoverDecoder(stream, config, out ITextureFormat? format); + + Texture texture = decoder.DecodeTexture(config, stream); + return (texture, format); + } - return (detector?.Identify(config, stream), format); + /// + /// Reads the raw image information from the specified stream. + /// + /// The stream. + /// the configuration. + /// + /// The . + /// + /// The input format is not recognized. + private static (ITextureInfo Info, ITextureFormat Format) InternalIdentity(Stream stream, Configuration config) + { + if (DiscoverDecoder(stream, config, out ITextureFormat? format) is not ITextureInfoDetector detector) + { + throw new UnknownTextureFormatException("No suitable info detector found for the given stream."); } + + return (detector.Identify(config, stream), format); } } diff --git a/src/ImageSharp.Textures/Texture.FromBytes.cs b/src/ImageSharp.Textures/Texture.FromBytes.cs index bd3a1fd..53e994e 100644 --- a/src/ImageSharp.Textures/Texture.FromBytes.cs +++ b/src/ImageSharp.Textures/Texture.FromBytes.cs @@ -1,245 +1,240 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System; -using System.IO; +using SixLabors.ImageSharp.Textures.Common.Exceptions; using SixLabors.ImageSharp.Textures.Formats; -namespace SixLabors.ImageSharp.Textures +namespace SixLabors.ImageSharp.Textures; + +/// +/// Adds static methods allowing the creation of new image from a byte array. +/// +public abstract partial class Texture { - /// - /// Adds static methods allowing the creation of new image from a byte array. - /// - public abstract partial class Texture + /// + /// By reading the header on the provided byte array this calculates the images format. + /// + /// The byte array containing encoded texture data to read the header from. + /// The format. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureFormat DetectFormat(byte[] data) => DetectFormat(Configuration.Default, data); + + /// + /// By reading the header on the provided byte array this calculates the images format. + /// + /// The byte array containing encoded texture data to read the header from. + /// The format. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureFormat DetectFormat(ReadOnlySpan data) => DetectFormat(Configuration.Default, data); + + /// + /// By reading the header on the provided byte array this calculates the images format. + /// + /// The configuration. + /// The byte array containing encoded texture data to read the header from. + /// The mime type. + /// The options are null. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static unsafe ITextureFormat DetectFormat(Configuration config, ReadOnlySpan buffer) { - /// - /// By reading the header on the provided byte array this calculates the images format. - /// - /// The byte array containing encoded texture data to read the header from. - /// The format or null if none found. - public static ITextureFormat? DetectFormat(byte[] data) => DetectFormat(Configuration.Default, data); - - /// - /// By reading the header on the provided byte array this calculates the images format. - /// - /// The configuration. - /// The byte array containing encoded texture data to read the header from. - /// The mime type or null if none found. - public static ITextureFormat? DetectFormat(Configuration config, byte[] data) - { - using (var stream = new MemoryStream(data)) - { - return DetectFormat(config, stream); - } - } + Guard.NotNull(config, nameof(config)); - /// - /// By reading the header on the provided byte array this calculates the images format. - /// - /// The byte array containing encoded texture data to read the header from. - /// The format or null if none found. - public static ITextureFormat? DetectFormat(ReadOnlySpan data) => DetectFormat(Configuration.Default, data); - - /// - /// By reading the header on the provided byte array this calculates the images format. - /// - /// The configuration. - /// The byte array containing encoded texture data to read the header from. - /// The mime type or null if none found. - public static ITextureFormat? DetectFormat(Configuration config, ReadOnlySpan data) + fixed (byte* ptr = buffer) { - int maxHeaderSize = config.MaxHeaderSize; - if (maxHeaderSize <= 0) - { - return null; - } - - foreach (ITextureFormatDetector detector in config.ImageFormatsManager.FormatDetectors) - { - ITextureFormat? f = detector.DetectFormat(data); - - if (f != null) - { - return f; - } - } - - return default; + using UnmanagedMemoryStream stream = new(ptr, buffer.Length); + return DetectFormat(config, stream); } + } - /// - /// Reads the raw texture information from the specified stream without fully decoding it. - /// - /// The byte array containing encoded texture data to read the header from. - /// The data is null. - /// The data is not readable. - /// - /// The or null if suitable info detector not found. - /// - public static ITextureInfo? Identify(byte[] data) => Identify(data, out ITextureFormat? _); - - /// - /// Reads the raw image information from the specified stream without fully decoding it. - /// - /// The byte array containing encoded texture data to read the header from. - /// The format type of the decoded texture. - /// The data is null. - /// The data is not readable. - /// - /// The or null if suitable info detector not found. - /// - public static ITextureInfo? Identify(byte[] data, out ITextureFormat? format) => Identify(Configuration.Default, data, out format); - - /// - /// Reads the raw texture information from the specified stream without fully decoding it. - /// - /// The configuration. - /// The byte array containing encoded texture data to read the header from. - /// The format type of the decoded texture. - /// The configuration is null. - /// The data is null. - /// The data is not readable. - /// - /// The or null if suitable info detector is not found. - /// - public static ITextureInfo? Identify(Configuration configuration, byte[] data, out ITextureFormat? format) - { - Guard.NotNull(data, nameof(data)); + /// + /// Reads the raw texture information from the specified stream without fully decoding it. + /// + /// The byte array containing encoded texture data to read the header from. + /// + /// The . + /// + /// The data is null. + /// The data is not readable. + /// Texture cannot be loaded. + public static ITextureInfo Identify(byte[] data) => Identify(data, out ITextureFormat? _); + + /// + /// Reads the raw image information from the specified stream without fully decoding it. + /// + /// The byte array containing encoded texture data to read the header from. + /// The format type of the decoded texture. + /// + /// The . + /// + /// The data is null. + /// The data is not readable. + /// Texture cannot be loaded. + public static ITextureInfo Identify(byte[] data, out ITextureFormat? format) => Identify(Configuration.Default, data, out format); + + /// + /// Reads the raw texture information from the specified stream without fully decoding it. + /// + /// The configuration. + /// The byte array containing encoded texture data to read the header from. + /// The format type of the decoded texture. + /// + /// The or null if suitable info detector is not found. + /// + /// The data or configuration is null. + /// The data is not readable. + /// Texture cannot be loaded. + public static ITextureInfo Identify(Configuration configuration, byte[] data, out ITextureFormat? format) + { + Guard.NotNull(data, nameof(data)); - using (var stream = new MemoryStream(data, 0, data.Length, false, true)) - { - return Identify(configuration, stream, out format); - } - } + using MemoryStream stream = new(data, 0, data.Length, false, true); + return Identify(configuration, stream, out format); + } - /// - /// Load a new instance of from the given encoded byte array. - /// - /// The byte array containing texture data. - /// The detected format. - /// The . - public static Texture? Load(byte[] data, out ITextureFormat? format) => - Load(Configuration.Default, data, out format); - - /// - /// Load a new instance of from the given encoded byte array. - /// - /// The byte array containing encoded texture data. - /// The decoder. - /// The . - public static Texture Load(byte[] data, ITextureDecoder decoder) => Load(Configuration.Default, data, decoder); - - /// - /// Load a new instance of from the given encoded byte array. - /// - /// The config for the decoder. - /// The byte array containing encoded texture data. - /// The . - public static Texture? Load(Configuration config, byte[] data) => Load(config, data, out _); - - /// - /// Load a new instance of from the given encoded byte array. - /// - /// The config for the decoder. - /// The byte array containing texture data. - /// The decoder. - /// The . - public static Texture Load(Configuration config, byte[] data, ITextureDecoder decoder) - { - using (var stream = new MemoryStream(data)) - { - return Load(config, stream, decoder); - } - } + /// + /// Load a new instance of from the given encoded byte array. + /// + /// The byte array containing texture data. + /// The detected format. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(byte[] data, out ITextureFormat? format) => + Load(Configuration.Default, data, out format); + + /// + /// Load a new instance of from the given encoded byte array. + /// + /// The byte array containing encoded texture data. + /// The decoder. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(byte[] data, ITextureDecoder decoder) => Load(Configuration.Default, data, decoder); + + /// + /// Load a new instance of from the given encoded byte array. + /// + /// The config for the decoder. + /// The byte array containing encoded texture data. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, byte[] data) => Load(config, data, out _); + + /// + /// Load a new instance of from the given encoded byte array. + /// + /// The config for the decoder. + /// The byte array containing texture data. + /// The decoder. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, byte[] data, ITextureDecoder decoder) + { + using MemoryStream stream = new(data); + return Load(config, stream, decoder); + } - /// - /// Load a new instance of from the given encoded byte array. - /// - /// The config for the decoder. - /// The byte array containing texture data. - /// The mime type of the decoded texture. - /// The . - public static Texture? Load(Configuration config, byte[] data, out ITextureFormat? format) - { - using (var stream = new MemoryStream(data)) - { - return Load(config, stream, out format); - } - } + /// + /// Load a new instance of from the given encoded byte array. + /// + /// The config for the decoder. + /// The byte array containing texture data. + /// The mime type of the decoded texture. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, byte[] data, out ITextureFormat? format) + { + using MemoryStream stream = new(data); + return Load(config, stream, out format); + } - /// - /// Load a new instance of from the given encoded byte span. - /// - /// The byte span containing texture data. - /// The . - public static Texture Load(ReadOnlySpan data) => Load(Configuration.Default, data); - - /// - /// Load a new instance of from the given encoded byte span. - /// - /// The byte span containing texture data. - /// The decoder. - /// The . - public static Texture Load(ReadOnlySpan data, ITextureDecoder decoder) => - Load(Configuration.Default, data, decoder); - - /// - /// Load a new instance of from the given encoded byte array. - /// - /// The byte span containing texture data. - /// The detected format. - /// The . - public static Texture Load(ReadOnlySpan data, out ITextureFormat? format) => - Load(Configuration.Default, data, out format); - - /// - /// Decodes a new instance of from the given encoded byte span. - /// - /// The configuration options. - /// The byte span containing texture data. - /// The . - public static Texture Load(Configuration config, ReadOnlySpan data) => Load(config, data, out _); - - /// - /// Load a new instance of from the given encoded byte span. - /// - /// The Configuration. - /// The byte span containing texture data. - /// The decoder. - /// The . - public static unsafe Texture Load( - Configuration config, - ReadOnlySpan data, - ITextureDecoder decoder) + /// + /// Load a new instance of from the given encoded byte span. + /// + /// The byte span containing texture data. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(ReadOnlySpan data) => Load(Configuration.Default, data); + + /// + /// Load a new instance of from the given encoded byte span. + /// + /// The byte span containing texture data. + /// The decoder. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(ReadOnlySpan data, ITextureDecoder decoder) => + Load(Configuration.Default, data, decoder); + + /// + /// Load a new instance of from the given encoded byte array. + /// + /// The byte span containing texture data. + /// The detected format. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(ReadOnlySpan data, out ITextureFormat? format) => + Load(Configuration.Default, data, out format); + + /// + /// Decodes a new instance of from the given encoded byte span. + /// + /// The configuration options. + /// The byte span containing texture data. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, ReadOnlySpan data) => Load(config, data, out _); + + /// + /// Load a new instance of from the given encoded byte span. + /// + /// The Configuration. + /// The byte span containing texture data. + /// The decoder. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static unsafe Texture Load( + Configuration config, + ReadOnlySpan data, + ITextureDecoder decoder) + { + fixed (byte* ptr = &data.GetPinnableReference()) { - fixed (byte* ptr = &data.GetPinnableReference()) - { - using (var stream = new UnmanagedMemoryStream(ptr, data.Length)) - { - return Load(config, stream, decoder); - } - } + using UnmanagedMemoryStream stream = new(ptr, data.Length); + return Load(config, stream, decoder); } + } - /// - /// Load a new instance of from the given encoded byte span. - /// - /// The configuration options. - /// The byte span containing texture data. - /// The of the decoded texture.> - /// The . - public static unsafe Texture Load( - Configuration config, - ReadOnlySpan data, - out ITextureFormat? format) + /// + /// Load a new instance of from the given encoded byte span. + /// + /// The configuration options. + /// The byte span containing texture data. + /// The of the decoded texture.> + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static unsafe Texture Load( + Configuration config, + ReadOnlySpan data, + out ITextureFormat? format) + { + fixed (byte* ptr = &data.GetPinnableReference()) { - fixed (byte* ptr = &data.GetPinnableReference()) - { - using (var stream = new UnmanagedMemoryStream(ptr, data.Length)) - { - return Load(config, stream, out format); - } - } + using UnmanagedMemoryStream stream = new(ptr, data.Length); + return Load(config, stream, out format); } } } diff --git a/src/ImageSharp.Textures/Texture.FromFile.cs b/src/ImageSharp.Textures/Texture.FromFile.cs index ede6ded..eb7cc67 100644 --- a/src/ImageSharp.Textures/Texture.FromFile.cs +++ b/src/ImageSharp.Textures/Texture.FromFile.cs @@ -1,157 +1,153 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System; -using System.IO; +using SixLabors.ImageSharp.Textures.Common.Exceptions; using SixLabors.ImageSharp.Textures.Formats; -namespace SixLabors.ImageSharp.Textures +namespace SixLabors.ImageSharp.Textures; + +/// +/// Adds static methods allowing the creation of new image from a given file. +/// +public abstract partial class Texture { - /// - /// Adds static methods allowing the creation of new image from a given file. - /// - public abstract partial class Texture - { - /// - /// By reading the header on the provided file this calculates the images mime type. - /// - /// The image file to open and to read the header from. - /// The mime type or null if none found. - public static ITextureFormat? DetectFormat(string filePath) => DetectFormat(Configuration.Default, filePath); + /// + /// By reading the header on the provided file this calculates the images mime type. + /// + /// The image file to open and to read the header from. + /// The mime type. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureFormat DetectFormat(string filePath) => DetectFormat(Configuration.Default, filePath); - /// - /// By reading the header on the provided file this calculates the images mime type. - /// - /// The configuration. - /// The image file to open and to read the header from. - /// The mime type or null if none found. - public static ITextureFormat? DetectFormat(Configuration config, string filePath) - { - config ??= Configuration.Default; - using (Stream file = config.FileSystem.OpenRead(filePath)) - { - return DetectFormat(config, file); - } - } + /// + /// By reading the header on the provided file this calculates the images mime type. + /// + /// The configuration. + /// The image file to open and to read the header from. + /// The mime type. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureFormat DetectFormat(Configuration config, string filePath) + { + config ??= Configuration.Default; + using Stream file = config.FileSystem.OpenRead(filePath); + return DetectFormat(config, file); + } - /// - /// Reads the raw texture information from the specified stream without fully decoding it. - /// - /// The texture file to open and to read the header from. - /// - /// The or null if suitable info detector not found. - /// - public static ITextureInfo? Identify(string filePath) - => Identify(filePath, out ITextureFormat? _); + /// + /// Reads the raw texture information from the specified stream without fully decoding it. + /// + /// The texture file to open and to read the header from. + /// + /// The . + /// + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureInfo Identify(string filePath) + => Identify(filePath, out ITextureFormat? _); - /// - /// Reads the raw texture information from the specified stream without fully decoding it. - /// - /// The image file to open and to read the header from. - /// The format type of the decoded texture. - /// - /// The or null if suitable info detector not found. - /// - public static ITextureInfo? Identify(string filePath, out ITextureFormat? format) - => Identify(Configuration.Default, filePath, out format); + /// + /// Reads the raw texture information from the specified stream without fully decoding it. + /// + /// The image file to open and to read the header from. + /// The format type of the decoded texture. + /// + /// The . + /// + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureInfo Identify(string filePath, out ITextureFormat? format) + => Identify(Configuration.Default, filePath, out format); - /// - /// Reads the raw texture information from the specified stream without fully decoding it. - /// - /// The configuration. - /// The image file to open and to read the header from. - /// The format type of the decoded texture. - /// The configuration is null. - /// - /// The or null if suitable info detector is not found. - /// - public static ITextureInfo? Identify(Configuration configuration, string filePath, out ITextureFormat? format) - { - Guard.NotNull(configuration, nameof(configuration)); - using (Stream file = configuration.FileSystem.OpenRead(filePath)) - { - return Identify(configuration, file, out format); - } - } + /// + /// Reads the raw texture information from the specified stream without fully decoding it. + /// + /// The configuration. + /// The image file to open and to read the header from. + /// The format type of the decoded texture. + /// + /// The . + /// + /// The configuration is null. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureInfo Identify(Configuration configuration, string filePath, out ITextureFormat? format) + { + Guard.NotNull(configuration, nameof(configuration)); + using Stream file = configuration.FileSystem.OpenRead(filePath); + return Identify(configuration, file, out format); + } - /// - /// Create a new instance of the class from the given file. - /// - /// The file path to the image. - /// - /// Thrown if the stream is not readable nor seekable. - /// - /// The . - public static Texture? Load(string path) => Load(Configuration.Default, path); + /// + /// Create a new instance of the class from the given file. + /// + /// The file path to the image. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(string path) => Load(Configuration.Default, path); - /// - /// Create a new instance of the class from the given file. - /// - /// The file path to the image. - /// The mime type of the decoded image. - /// - /// Thrown if the stream is not readable nor seekable. - /// - /// A new . - public static Texture? Load(string path, out ITextureFormat? format) => Load(Configuration.Default, path, out format); + /// + /// Create a new instance of the class from the given file. + /// + /// The file path to the image. + /// The mime type of the decoded image. + /// A new . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(string path, out ITextureFormat? format) => Load(Configuration.Default, path, out format); - /// - /// Create a new instance of the class from the given file. - /// - /// The config for the decoder. - /// The file path to the image. - /// - /// Thrown if the stream is not readable nor seekable. - /// - /// The . - public static Texture? Load(Configuration config, string path) => Load(config, path, out _); + /// + /// Create a new instance of the class from the given file. + /// + /// The config for the decoder. + /// The file path to the image. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, string path) => Load(config, path, out _); - /// - /// Create a new instance of the class from the given file. - /// - /// The Configuration. - /// The file path to the image. - /// The decoder. - /// - /// Thrown if the stream is not readable nor seekable. - /// - /// The . - public static Texture Load(Configuration config, string path, ITextureDecoder decoder) + /// + /// Create a new instance of the class from the given file. + /// + /// The Configuration. + /// The file path to the image. + /// The decoder. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, string path, ITextureDecoder decoder) + { + using (Stream stream = config.FileSystem.OpenRead(path)) { - using (Stream stream = config.FileSystem.OpenRead(path)) - { - return Load(config, stream, decoder); - } + return Load(config, stream, decoder); } + } - /// - /// Create a new instance of the class from the given file. - /// - /// The file path to the image. - /// The decoder. - /// - /// Thrown if the stream is not readable nor seekable. - /// - /// The . - public static Texture Load(string path, ITextureDecoder decoder) => Load(Configuration.Default, path, decoder); + /// + /// Create a new instance of the class from the given file. + /// + /// The file path to the image. + /// The decoder. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(string path, ITextureDecoder decoder) => Load(Configuration.Default, path, decoder); - /// - /// Create a new instance of the class from the given file. - /// The pixel type is selected by the decoder. - /// - /// The configuration options. - /// The file path to the image. - /// The mime type of the decoded image. - /// - /// Thrown if the stream is not readable nor seekable. - /// - /// The . - public static Texture? Load(Configuration config, string path, out ITextureFormat? format) - { - using (Stream stream = config.FileSystem.OpenRead(path)) - { - return Load(config, stream, out format); - } - } + /// + /// Create a new instance of the class from the given file. + /// The pixel type is selected by the decoder. + /// + /// The configuration options. + /// The file path to the image. + /// The mime type of the decoded image. + /// The . + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, string path, out ITextureFormat? format) + { + using Stream stream = config.FileSystem.OpenRead(path); + return Load(config, stream, out format); } } diff --git a/src/ImageSharp.Textures/Texture.FromStream.cs b/src/ImageSharp.Textures/Texture.FromStream.cs index b44988a..fcd7dfd 100644 --- a/src/ImageSharp.Textures/Texture.FromStream.cs +++ b/src/ImageSharp.Textures/Texture.FromStream.cs @@ -1,189 +1,190 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; using SixLabors.ImageSharp.Textures.Common.Exceptions; using SixLabors.ImageSharp.Textures.Formats; -namespace SixLabors.ImageSharp.Textures +namespace SixLabors.ImageSharp.Textures; + +/// +/// Adds static methods allowing the creation of new image from a given stream. +/// +public abstract partial class Texture { - /// - /// Adds static methods allowing the creation of new image from a given stream. - /// - public abstract partial class Texture + /// + /// By reading the header on the provided stream this calculates the images format type. + /// + /// The image stream to read the header from. + /// The format type. + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureFormat DetectFormat(Stream stream) => DetectFormat(Configuration.Default, stream); + + /// + /// By reading the header on the provided stream this calculates the images format type. + /// + /// The configuration. + /// The image stream to read the header from. + /// The format type. + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureFormat DetectFormat(Configuration config, Stream stream) + => WithSeekableStream(config, stream, s => InternalDetectFormat(s, config)); + + /// + /// By reading the header on the provided stream this reads the raw image information. + /// + /// The image stream to read the header from. + /// + /// The . + /// + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureInfo Identify(Stream stream) => Identify(stream, out ITextureFormat? _); + + /// + /// By reading the header on the provided stream this reads the raw image information. + /// + /// The image stream to read the header from. + /// The format type of the decoded image. + /// + /// The . + /// + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureInfo Identify(Stream stream, out ITextureFormat? format) => Identify(Configuration.Default, stream, out format); + + /// + /// Reads the raw image information from the specified stream without fully decoding it. + /// + /// The configuration. + /// The image stream to read the information from. + /// The format type of the decoded image. + /// + /// The . + /// + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static ITextureInfo Identify(Configuration config, Stream stream, out ITextureFormat format) { - /// - /// By reading the header on the provided stream this calculates the images format type. - /// - /// The image stream to read the header from. - /// Thrown if the stream is not readable. - /// The format type or null if none found. - public static ITextureFormat? DetectFormat(Stream stream) => DetectFormat(Configuration.Default, stream); - - /// - /// By reading the header on the provided stream this calculates the images format type. - /// - /// The configuration. - /// The image stream to read the header from. - /// Thrown if the stream is not readable. - /// The format type or null if none found. - public static ITextureFormat? DetectFormat(Configuration config, Stream stream) - => WithSeekableStream(config, stream, s => InternalDetectFormat(s, config)); - - /// - /// By reading the header on the provided stream this reads the raw image information. - /// - /// The image stream to read the header from. - /// Thrown if the stream is not readable. - /// - /// The or null if suitable info detector not found. - /// - public static ITextureInfo? Identify(Stream stream) => Identify(stream, out ITextureFormat? _); - - /// - /// By reading the header on the provided stream this reads the raw image information. - /// - /// The image stream to read the header from. - /// The format type of the decoded image. - /// Thrown if the stream is not readable. - /// - /// The or null if suitable info detector not found. - /// - public static ITextureInfo? Identify(Stream stream, out ITextureFormat? format) => Identify(Configuration.Default, stream, out format); - - /// - /// Reads the raw image information from the specified stream without fully decoding it. - /// - /// The configuration. - /// The image stream to read the information from. - /// The format type of the decoded image. - /// Thrown if the stream is not readable. - /// - /// The or null if suitable info detector is not found. - /// - public static ITextureInfo? Identify(Configuration config, Stream stream, out ITextureFormat? format) - { - (ITextureInfo? Info, ITextureFormat? Format) data = WithSeekableStream(config, stream, s => InternalIdentity(s, config ?? Configuration.Default)); - - format = data.Format; - return data.Info; - } + (ITextureInfo info, format) = WithSeekableStream(config, stream, s => InternalIdentity(s, config ?? Configuration.Default)); - /// - /// Decode a new instance of the class from the given stream. - /// The pixel format is selected by the decoder. - /// - /// The stream containing image information. - /// The format type of the decoded image. - /// Thrown if the stream is not readable. - /// Image cannot be loaded. - /// The . - public static Texture Load(Stream stream, out ITextureFormat? format) => Load(Configuration.Default, stream, out format); - - /// - /// Decode a new instance of the class from the given stream. - /// The pixel format is selected by the decoder. - /// - /// The stream containing image information. - /// Thrown if the stream is not readable. - /// Image cannot be loaded. - /// The . - public static Texture Load(Stream stream) => Load(Configuration.Default, stream); - - /// - /// Decode a new instance of the class from the given stream. - /// The pixel format is selected by the decoder. - /// - /// The stream containing image information. - /// The decoder. - /// Thrown if the stream is not readable. - /// Image cannot be loaded. - /// The . - public static Texture Load(Stream stream, ITextureDecoder decoder) => Load(Configuration.Default, stream, decoder); - - /// - /// Decode a new instance of the class from the given stream. - /// The pixel format is selected by the decoder. - /// - /// The config for the decoder. - /// The stream containing image information. - /// The decoder. - /// Thrown if the stream is not readable. - /// Image cannot be loaded. - /// A new .> - public static Texture Load(Configuration config, Stream stream, ITextureDecoder decoder) => - WithSeekableStream(config, stream, s => decoder.DecodeTexture(config, s)); - - /// - /// Decode a new instance of the class from the given stream. - /// - /// The config for the decoder. - /// The stream containing image information. - /// Thrown if the stream is not readable. - /// Image cannot be loaded. - /// A new .> - public static Texture Load(Configuration config, Stream stream) => Load(config, stream, out _); - - /// - /// Decode a new instance of the class from the given stream. - /// The pixel format is selected by the decoder. - /// - /// The configuration options. - /// The stream containing image information. - /// The format type of the decoded image. - /// Thrown if the stream is not readable. - /// Image cannot be loaded. - /// A new . - public static Texture Load(Configuration config, Stream stream, out ITextureFormat? format) - { - config ??= Configuration.Default; - (Texture? Img, ITextureFormat? Format) data = WithSeekableStream(config, stream, s => DecodeTexture(s, config)); + return info; + } - format = data.Format; + /// + /// Decode a new instance of the class from the given stream. + /// The pixel format is selected by the decoder. + /// + /// The stream containing image information. + /// The format type of the decoded image. + /// The . + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Stream stream, out ITextureFormat? format) => Load(Configuration.Default, stream, out format); + + /// + /// Decode a new instance of the class from the given stream. + /// The pixel format is selected by the decoder. + /// + /// The stream containing image information. + /// The . + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Stream stream) => Load(Configuration.Default, stream); + + /// + /// Decode a new instance of the class from the given stream. + /// The pixel format is selected by the decoder. + /// + /// The stream containing image information. + /// The decoder. + /// The . + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Stream stream, ITextureDecoder decoder) => Load(Configuration.Default, stream, decoder); + + /// + /// Decode a new instance of the class from the given stream. + /// The pixel format is selected by the decoder. + /// + /// The config for the decoder. + /// The stream containing image information. + /// The decoder. + /// A new . + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, Stream stream, ITextureDecoder decoder) => + WithSeekableStream(config, stream, s => decoder.DecodeTexture(config, s)); + + /// + /// Decode a new instance of the class from the given stream. + /// + /// The config for the decoder. + /// The stream containing image information. + /// A new . + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, Stream stream) => Load(config, stream, out _); + + /// + /// Decode a new instance of the class from the given stream. + /// The pixel format is selected by the decoder. + /// + /// The configuration options. + /// The stream containing image information. + /// The format type of the decoded image. + /// A new . + /// Thrown if the stream is not readable. + /// The image format is not supported. + /// The encoded texture format is unknown. + public static Texture Load(Configuration config, Stream stream, out ITextureFormat? format) + { + config ??= Configuration.Default; + (Texture texture, ITextureFormat textureFormat) = WithSeekableStream(config, stream, s => DecodeTexture(s, config)); - if (data.Img != null) - { - return data.Img; - } + format = textureFormat; - var sb = new StringBuilder(); - _ = sb.AppendLine("Image cannot be loaded. Available decoders:"); + if (texture is null) + { + TextureFormatManager.ThrowInvalidDecoder(config.ImageFormatsManager); + } - foreach (KeyValuePair val in config.ImageFormatsManager.ImageDecoders) - { - _ = sb.AppendLine(CultureInfo.InvariantCulture, $" - {val.Key.Name} : {val.Value.GetType().Name}"); - } + return texture; + } - throw new UnknownTextureFormatException(sb.ToString()); + private static T WithSeekableStream(Configuration config, Stream stream, Func action) + { + if (!stream.CanRead) + { + throw new NotSupportedException("Cannot read from the stream."); } - private static T WithSeekableStream(Configuration config, Stream stream, Func action) + if (stream.CanSeek) { - if (!stream.CanRead) + if (config.ReadOrigin == ReadOrigin.Begin) { - throw new NotSupportedException("Cannot read from the stream."); + stream.Position = 0; } - if (stream.CanSeek) - { - if (config.ReadOrigin == ReadOrigin.Begin) - { - stream.Position = 0; - } - - return action(stream); - } + return action(stream); + } - // We want to be able to load images from things like HttpContext.Request.Body - using var memoryStream = new MemoryStream(); - stream.CopyTo(memoryStream); - memoryStream.Position = 0; + // We want to be able to load images from things like HttpContext.Request.Body + using var memoryStream = new MemoryStream(); + stream.CopyTo(memoryStream); + memoryStream.Position = 0; - return action(memoryStream); - } + return action(memoryStream); } } From e8c02bbdc2809c5504e29b05411cd559b83848ac Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 7 Nov 2025 17:00:01 +0100 Subject: [PATCH 11/12] Correctly return detected format --- src/ImageSharp.Textures/Texture.Decode.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp.Textures/Texture.Decode.cs b/src/ImageSharp.Textures/Texture.Decode.cs index 80eb860..b08b6a0 100644 --- a/src/ImageSharp.Textures/Texture.Decode.cs +++ b/src/ImageSharp.Textures/Texture.Decode.cs @@ -44,7 +44,10 @@ private static ITextureFormat InternalDetectFormat(Stream stream, Configuration .Select(x => x.DetectFormat(buffer.Memory.Span)) .LastOrDefault(x => x is not null); - TextureFormatManager.ThrowInvalidDecoder(config.ImageFormatsManager); + if (format is null) + { + TextureFormatManager.ThrowInvalidDecoder(config.ImageFormatsManager); + } return format; } From 265fa3aac98b0bd3dc51ba5ad046e8bc6b072b71 Mon Sep 17 00:00:00 2001 From: Erik White <26148654+Erik-White@users.noreply.github.com> Date: Fri, 7 Nov 2025 17:01:46 +0100 Subject: [PATCH 12/12] Fix tests to run locally --- tests/Directory.Build.targets | 1 + .../ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets index e27e1a5..403f68c 100644 --- a/tests/Directory.Build.targets +++ b/tests/Directory.Build.targets @@ -26,6 +26,7 @@ + diff --git a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj index 63eddb3..c3edc69 100644 --- a/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj +++ b/tests/ImageSharp.Textures.Tests/ImageSharp.Textures.Tests.csproj @@ -6,12 +6,14 @@ AnyCPU;x64;x86 SixLabors.ImageSharp.Textures.Tests SixLabors.ImageSharp.Textures.Tests + true +