diff --git a/.editorconfig b/.editorconfig
index 83670fa830..03036f8a53 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,5 +1,5 @@
-# Version: 1.6.2 (Using https://semver.org/)
-# Updated: 2020-11-02
+# Version: 2.1.0 (Using https://semver.org/)
+# Updated: 2021-03-03
# 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.
@@ -60,87 +60,84 @@ indent_size = 2
[*.{cmd,bat}]
end_of_line = crlf
+# Bash Files
+[*.sh]
+end_of_line = lf
+
# Makefiles
[Makefile]
indent_style = tab
##########################################
-# File Header (Uncomment to support file headers)
-# https://docs.microsoft.com/visualstudio/ide/reference/add-file-header
+# Default .NET Code Style Severities
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-options#scope
##########################################
-# [*.{cs,csx,cake,vb,vbx,tt,ttinclude}]
-file_header_template = Copyright (c) Six Labors.\nLicensed under the Apache License, Version 2.0.
-
-# 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
+[*.{cs,csx,cake,vb,vbx}]
+# Default Severity for all .NET Code Style rules below
+dotnet_analyzer_diagnostic.severity = warning
##########################################
-# .NET Language Conventions
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions
+# Language Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules
##########################################
-# .NET Code Style Settings
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#net-code-style-settings
+# .NET Style Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules
[*.{cs,csx,cake,vb,vbx}]
# "this." and "Me." qualifiers
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_event = true:warning
# Language keywords instead of framework type names for type references
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#language-keywords
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
# Modifier preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#normalize-modifiers
dotnet_style_require_accessibility_modifiers = always:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning
dotnet_style_readonly_field = true:warning
# Parentheses preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parentheses-preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
+dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion
# Expression-level preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences
dotnet_style_object_initializer = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_auto_properties = true:warning
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
+dotnet_diagnostic.IDE0045.severity = suggestion
dotnet_style_prefer_conditional_expression_over_return = false:suggestion
+dotnet_diagnostic.IDE0046.severity = suggestion
dotnet_style_prefer_compound_assignment = true:warning
+dotnet_style_prefer_simplified_interpolation = true:warning
+dotnet_style_prefer_simplified_boolean_expressions = true:warning
# Null-checking preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#null-checking-preferences
dotnet_style_coalesce_expression = true:warning
dotnet_style_null_propagation = true:warning
-# Parameter preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parameter-preferences
-dotnet_code_quality_unused_parameters = all:warning
-# More style options (Undocumented)
-# https://github.com/MicrosoftDocs/visualstudio-docs/issues/3641
+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.
+# 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
-# https://github.com/dotnet/roslyn/pull/40070
-dotnet_style_prefer_simplified_interpolation = true:warning
-# C# Code Style Settings
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-code-style-settings
+# C# Style Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules
[*.{cs,csx,cake}]
-# Implicit and explicit types
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types
+# 'var' preferences
csharp_style_var_for_built_in_types = never
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = false:warning
# Expression-bodied members
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members
csharp_style_expression_bodied_methods = true:warning
csharp_style_expression_bodied_constructors = true:warning
csharp_style_expression_bodied_operators = true:warning
@@ -149,47 +146,64 @@ csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_lambdas = true:warning
csharp_style_expression_bodied_local_functions = true:warning
-# Pattern matching
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#pattern-matching
+# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
-# Inlined variable declarations
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#inlined-variable-declarations
-csharp_style_inlined_variable_declaration = true:warning
+csharp_style_prefer_switch_expression = true:warning
+csharp_style_prefer_pattern_matching = true:warning
+csharp_style_prefer_not_pattern = true:warning
# Expression-level preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences
+csharp_style_inlined_variable_declaration = true:warning
csharp_prefer_simple_default_expression = true:warning
+csharp_style_pattern_local_over_anonymous_function = true:warning
+csharp_style_deconstructed_variable_declaration = true:warning
+csharp_style_prefer_index_operator = true:warning
+csharp_style_prefer_range_operator = true:warning
+csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
# "Null" checking preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-null-checking-preferences
csharp_style_throw_expression = true:warning
csharp_style_conditional_delegate_call = true:warning
# Code block preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#code-block-preferences
csharp_prefer_braces = true:warning
-# Unused value preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#unused-value-preferences
-csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
-csharp_style_unused_value_assignment_preference = discard_variable:suggestion
-# Index and range preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#index-and-range-preferences
-csharp_style_prefer_index_operator = true:warning
-csharp_style_prefer_range_operator = true:warning
-# Miscellaneous preferences
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences
-csharp_style_deconstructed_variable_declaration = true:warning
-csharp_style_pattern_local_over_anonymous_function = true:warning
+csharp_prefer_simple_using_statement = true:suggestion
+dotnet_diagnostic.IDE0063.severity = suggestion
+# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:warning
+# Modifier preferences
csharp_prefer_static_local_function = true:warning
-csharp_prefer_simple_using_statement = true:suggestion
##########################################
-# .NET Formatting Conventions
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-code-style-settings-reference#formatting-conventions
+# Unnecessary Code Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/unnecessary-code-rules
##########################################
-# Organize usings
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#organize-using-directives
+# .NET Unnecessary code rules
+[*.{cs,csx,cake,vb,vbx}]
+dotnet_code_quality_unused_parameters = all:warning
+dotnet_remove_unnecessary_suppression_exclusions = none:warning
+
+# C# Unnecessary code rules
+[*.{cs,csx,cake}]
+csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
+dotnet_diagnostic.IDE0058.severity = suggestion
+csharp_style_unused_value_assignment_preference = discard_variable:suggestion
+dotnet_diagnostic.IDE0059.severity = suggestion
+
+##########################################
+# Formatting Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules
+##########################################
+
+# .NET formatting rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#net-formatting-rules
+[*.{cs,csx,cake,vb,vbx}]
+# Organize using directives
dotnet_sort_system_directives_first = true
+dotnet_separate_import_directive_groups = false
+
+# 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
csharp_new_line_before_open_brace = all
@@ -231,14 +245,14 @@ csharp_space_around_declaration_statements = false
csharp_space_before_open_square_brackets = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_square_brackets = false
-# Wrapping options
+# Wrap options
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
##########################################
-# .NET Naming Conventions
-# https://docs.microsoft.com/visualstudio/ide/editorconfig-naming-conventions
+# .NET Naming Rules
+# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules
##########################################
[*.{cs,csx,cake,vb,vbx}]
@@ -261,8 +275,9 @@ dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_
dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T
# disallowed_style - Anything that has this style applied is marked as disallowed
dotnet_naming_style.disallowed_style.capitalization = pascal_case
-dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
-dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
+# Disabled while we investigate compatibility with VS 16.10
+#dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
+#dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
# internal_error_style - This style should never occur... if it does, it indicates a bug in file or in the parser using the file
dotnet_naming_style.internal_error_style.capitalization = pascal_case
dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____
diff --git a/.gitattributes b/.gitattributes
index 416dd0d06f..70ced69033 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -86,7 +86,6 @@
*.dll binary
*.eot binary
*.exe binary
-*.ktx binary
*.otf binary
*.pbm binary
*.pdf binary
@@ -125,3 +124,5 @@
*.tga filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.dds filter=lfs diff=lfs merge=lfs -text
+*.ktx filter=lfs diff=lfs merge=lfs -text
+*.ktx2 filter=lfs diff=lfs merge=lfs -text
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 4be3511650..8709e1318d 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -2,7 +2,7 @@
- [ ] I have written a descriptive pull-request title
- [ ] I have verified that there are no overlapping [pull-requests](https://github.com/SixLabors/ImageSharp/pulls) open
-- [ ] I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
+- [ ] I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules :cop:.
- [ ] I have provided test coverage for my change (where applicable)
### Description
diff --git a/Directory.Build.props b/Directory.Build.props
index 3a133efe7a..3df93fcd40 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -18,4 +18,13 @@
+
+
+ false
+
+
+
+ true
+
+
diff --git a/ImageSharp.sln b/ImageSharp.sln
index 8dfab6033c..83208994cb 100644
--- a/ImageSharp.sln
+++ b/ImageSharp.sln
@@ -482,9 +482,15 @@ Global
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
+ Debug-InnerLoop|Any CPU = Debug-InnerLoop|Any CPU
+ Debug-InnerLoop|x64 = Debug-InnerLoop|x64
+ Debug-InnerLoop|x86 = Debug-InnerLoop|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
+ Release-InnerLoop|Any CPU = Release-InnerLoop|Any CPU
+ Release-InnerLoop|x64 = Release-InnerLoop|x64
+ Release-InnerLoop|x86 = Release-InnerLoop|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -493,48 +499,96 @@ Global
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug|x64.Build.0 = Debug|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug|x86.ActiveCfg = Debug|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug|x86.Build.0 = Debug|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug-InnerLoop|Any CPU.ActiveCfg = Debug-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug-InnerLoop|Any CPU.Build.0 = Debug-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug-InnerLoop|x64.ActiveCfg = Debug-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug-InnerLoop|x64.Build.0 = Debug-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug-InnerLoop|x86.ActiveCfg = Debug-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Debug-InnerLoop|x86.Build.0 = Debug-InnerLoop|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release|Any CPU.Build.0 = Release|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release|x64.ActiveCfg = Release|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release|x64.Build.0 = Release|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release|x86.ActiveCfg = Release|Any CPU
{2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release|x86.Build.0 = Release|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release-InnerLoop|Any CPU.ActiveCfg = Release-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release-InnerLoop|Any CPU.Build.0 = Release-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release-InnerLoop|x64.ActiveCfg = Release-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release-InnerLoop|x64.Build.0 = Release-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release-InnerLoop|x86.ActiveCfg = Release-InnerLoop|Any CPU
+ {2AA31A1F-142C-43F4-8687-09ABCA4B3A26}.Release-InnerLoop|x86.Build.0 = Release-InnerLoop|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug|x64.ActiveCfg = Debug|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug|x64.Build.0 = Debug|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug|x86.ActiveCfg = Debug|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug|x86.Build.0 = Debug|Any CPU
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug-InnerLoop|Any CPU.ActiveCfg = Debug-InnerLoop|Any CPU
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug-InnerLoop|Any CPU.Build.0 = Debug-InnerLoop|Any CPU
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug-InnerLoop|x64.ActiveCfg = Debug-InnerLoop|x64
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug-InnerLoop|x64.Build.0 = Debug-InnerLoop|x64
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug-InnerLoop|x86.ActiveCfg = Debug-InnerLoop|x86
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Debug-InnerLoop|x86.Build.0 = Debug-InnerLoop|x86
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release|Any CPU.Build.0 = Release|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release|x64.ActiveCfg = Release|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release|x64.Build.0 = Release|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release|x86.ActiveCfg = Release|Any CPU
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release|x86.Build.0 = Release|Any CPU
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release-InnerLoop|Any CPU.ActiveCfg = Release-InnerLoop|Any CPU
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release-InnerLoop|Any CPU.Build.0 = Release-InnerLoop|Any CPU
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release-InnerLoop|x64.ActiveCfg = Release-InnerLoop|x64
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release-InnerLoop|x64.Build.0 = Release-InnerLoop|x64
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release-InnerLoop|x86.ActiveCfg = Release-InnerLoop|x86
+ {EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6}.Release-InnerLoop|x86.Build.0 = Release-InnerLoop|x86
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug|x64.ActiveCfg = Debug|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug|x64.Build.0 = Debug|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug|x86.ActiveCfg = Debug|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug|x86.Build.0 = Debug|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug-InnerLoop|Any CPU.ActiveCfg = Debug-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug-InnerLoop|Any CPU.Build.0 = Debug-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug-InnerLoop|x64.ActiveCfg = Debug-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug-InnerLoop|x64.Build.0 = Debug-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug-InnerLoop|x86.ActiveCfg = Debug-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Debug-InnerLoop|x86.Build.0 = Debug-InnerLoop|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release|Any CPU.Build.0 = Release|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release|x64.ActiveCfg = Release|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release|x64.Build.0 = Release|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release|x86.ActiveCfg = Release|Any CPU
{2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release|x86.Build.0 = Release|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release-InnerLoop|Any CPU.ActiveCfg = Release-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release-InnerLoop|Any CPU.Build.0 = Release-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release-InnerLoop|x64.ActiveCfg = Release-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release-InnerLoop|x64.Build.0 = Release-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release-InnerLoop|x86.ActiveCfg = Release-InnerLoop|Any CPU
+ {2BF743D8-2A06-412D-96D7-F448F00C5EA5}.Release-InnerLoop|x86.Build.0 = Release-InnerLoop|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Debug|x64.ActiveCfg = Debug|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Debug|x64.Build.0 = Debug|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Debug|x86.ActiveCfg = Debug|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Debug|x86.Build.0 = Debug|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Debug-InnerLoop|Any CPU.ActiveCfg = Debug-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Debug-InnerLoop|Any CPU.Build.0 = Debug-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Debug-InnerLoop|x64.ActiveCfg = Debug-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Debug-InnerLoop|x64.Build.0 = Debug-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Debug-InnerLoop|x86.ActiveCfg = Debug-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Debug-InnerLoop|x86.Build.0 = Debug-InnerLoop|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Release|Any CPU.Build.0 = Release|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Release|x64.ActiveCfg = Release|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Release|x64.Build.0 = Release|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Release|x86.ActiveCfg = Release|Any CPU
{FC527290-2F22-432C-B77B-6E815726B02C}.Release|x86.Build.0 = Release|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Release-InnerLoop|Any CPU.ActiveCfg = Release-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Release-InnerLoop|Any CPU.Build.0 = Release-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Release-InnerLoop|x64.ActiveCfg = Release-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Release-InnerLoop|x64.Build.0 = Release-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Release-InnerLoop|x86.ActiveCfg = Release-InnerLoop|Any CPU
+ {FC527290-2F22-432C-B77B-6E815726B02C}.Release-InnerLoop|x86.Build.0 = Release-InnerLoop|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/shared-infrastructure b/shared-infrastructure
index 06a7339834..41fff7bf7d 160000
--- a/shared-infrastructure
+++ b/shared-infrastructure
@@ -1 +1 @@
-Subproject commit 06a733983486638b9e38197c7c6eb197ecac43e6
+Subproject commit 41fff7bf7ddb1d118898db1ddba43b95ba6ed0bb
diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs
index 2ea456286f..ea4cd1c8c4 100644
--- a/src/ImageSharp/Advanced/AotCompilerTools.cs
+++ b/src/ImageSharp/Advanced/AotCompilerTools.cs
@@ -6,11 +6,26 @@ using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Formats;
+using SixLabors.ImageSharp.Formats.Bmp;
+using SixLabors.ImageSharp.Formats.Gif;
+using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
+using SixLabors.ImageSharp.Formats.Png;
+using SixLabors.ImageSharp.Formats.Tga;
+using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Processing.Processors;
+using SixLabors.ImageSharp.Processing.Processors.Binarization;
+using SixLabors.ImageSharp.Processing.Processors.Convolution;
using SixLabors.ImageSharp.Processing.Processors.Dithering;
+using SixLabors.ImageSharp.Processing.Processors.Drawing;
+using SixLabors.ImageSharp.Processing.Processors.Effects;
+using SixLabors.ImageSharp.Processing.Processors.Filters;
+using SixLabors.ImageSharp.Processing.Processors.Normalization;
+using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
+using SixLabors.ImageSharp.Processing.Processors.Transforms;
namespace SixLabors.ImageSharp.Advanced
{
@@ -25,180 +40,510 @@ namespace SixLabors.ImageSharp.Advanced
[ExcludeFromCodeCoverage]
internal static class AotCompilerTools
{
- static AotCompilerTools()
- {
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- System.Runtime.CompilerServices.Unsafe.SizeOf();
- }
-
///
/// This is the method that seeds the AoT compiler.
/// None of these seed methods needs to actually be called to seed the compiler.
/// The calls just need to be present when the code is compiled, and each implementation will be built.
///
+ ///
+ /// This method doesn't actually do anything but serves an important purpose...
+ /// If you are running ImageSharp on iOS and try to call SaveAsGif, it will throw an exception:
+ /// "Attempting to JIT compile method... OctreeFrameQuantizer.ConstructPalette... while running in aot-only mode."
+ /// The reason this happens is the SaveAsGif method makes heavy use of generics, which are too confusing for the AoT
+ /// compiler used on Xamarin.iOS. It spins up the JIT compiler to try and figure it out, but that is an illegal op on
+ /// iOS so it bombs out.
+ /// If you are getting the above error, you need to call this method, which will pre-seed the AoT compiler with the
+ /// necessary methods to complete the SaveAsGif call. That's it, otherwise you should NEVER need this method!!!
+ ///
+ [Preserve]
private static void SeedEverything()
{
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
- Seed();
+ try
+ {
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+ Unsafe.SizeOf();
+
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ Seed();
+ }
+ catch
+ {
+ // nop
+ }
+
+ throw new InvalidOperationException("This method is used for AOT code generation only. Do not call it at runtime.");
}
///
/// Seeds the compiler using the given pixel format.
///
/// The pixel format.
+ [Preserve]
private static void Seed()
where TPixel : unmanaged, IPixel
{
// This is we actually call all the individual methods you need to seed.
- AotCompileOctreeQuantizer();
- AotCompileWuQuantizer();
- AotCompilePaletteQuantizer();
- AotCompileDithering();
- AotCompilePixelOperations();
+ AotCompileImage();
+ AotCompileImageProcessingContextFactory();
+ AotCompileImageEncoderInternals();
+ AotCompileImageDecoderInternals();
+ AotCompileImageEncoders();
+ AotCompileImageDecoders();
+ AotCompileImageProcessors();
+ AotCompileGenericImageProcessors();
+ AotCompileResamplers();
+ AotCompileQuantizers();
+ AotCompilePixelSamplingStrategys();
+ AotCompileDithers();
+ AotCompileMemoryManagers();
Unsafe.SizeOf();
- AotCodec(new Formats.Png.PngDecoder(), new Formats.Png.PngEncoder());
- AotCodec(new Formats.Bmp.BmpDecoder(), new Formats.Bmp.BmpEncoder());
- AotCodec(new Formats.Gif.GifDecoder(), new Formats.Gif.GifEncoder());
- AotCodec(new Formats.Jpeg.JpegDecoder(), new Formats.Jpeg.JpegEncoder());
-
// TODO: Do the discovery work to figure out what works and what doesn't.
}
///
- /// This method doesn't actually do anything but serves an important purpose...
- /// If you are running ImageSharp on iOS and try to call SaveAsGif, it will throw an exception:
- /// "Attempting to JIT compile method... OctreeFrameQuantizer.ConstructPalette... while running in aot-only mode."
- /// The reason this happens is the SaveAsGif method makes heavy use of generics, which are too confusing for the AoT
- /// compiler used on Xamarin.iOS. It spins up the JIT compiler to try and figure it out, but that is an illegal op on
- /// iOS so it bombs out.
- /// If you are getting the above error, you need to call this method, which will pre-seed the AoT compiler with the
- /// necessary methods to complete the SaveAsGif call. That's it, otherwise you should NEVER need this method!!!
+ /// This method pre-seeds the for a given pixel format in the AoT compiler.
///
/// The pixel format.
- private static void AotCompileOctreeQuantizer()
+ [Preserve]
+ private static unsafe void AotCompileImage()
where TPixel : unmanaged, IPixel
{
- using (var test = new OctreeQuantizer(Configuration.Default, new OctreeQuantizer().Options))
- {
- var frame = new ImageFrame(Configuration.Default, 1, 1);
- test.QuantizeFrame(frame, frame.Bounds());
- }
+ Image img = default;
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+ img.CloneAs(default);
+
+ ImageFrame.LoadPixelData(default, default(ReadOnlySpan), default, default);
+ ImageFrame.LoadPixelData(default, default(ReadOnlySpan), default, default);
}
///
- /// This method pre-seeds the WuQuantizer in the AoT compiler for iOS.
+ /// This method pre-seeds the all in the AoT compiler.
///
/// The pixel format.
- private static void AotCompileWuQuantizer()
+ [Preserve]
+ private static void AotCompileImageProcessingContextFactory()
+ where TPixel : unmanaged, IPixel
+ => default(DefaultImageOperationsProviderFactory).CreateImageProcessingContext(default, default, default);
+
+ ///
+ /// This method pre-seeds the all in the AoT compiler.
+ ///
+ /// The pixel format.
+ [Preserve]
+ private static void AotCompileImageEncoderInternals()
where TPixel : unmanaged, IPixel
{
- using (var test = new WuQuantizer(Configuration.Default, new WuQuantizer().Options))
- {
- var frame = new ImageFrame(Configuration.Default, 1, 1);
- test.QuantizeFrame(frame, frame.Bounds());
- }
+ default(BmpEncoderCore).Encode(default, default, default);
+ default(GifEncoderCore).Encode(default, default, default);
+ default(JpegEncoderCore).Encode(default, default, default);
+ default(PngEncoderCore).Encode(default, default, default);
+ default(TgaEncoderCore).Encode(default, default, default);
}
///
- /// This method pre-seeds the PaletteQuantizer in the AoT compiler for iOS.
+ /// This method pre-seeds the all in the AoT compiler.
///
/// The pixel format.
- private static void AotCompilePaletteQuantizer()
+ [Preserve]
+ private static void AotCompileImageDecoderInternals()
where TPixel : unmanaged, IPixel
{
- using (var test = (PaletteQuantizer)new PaletteQuantizer(Array.Empty()).CreatePixelSpecificQuantizer(Configuration.Default))
- {
- var frame = new ImageFrame(Configuration.Default, 1, 1);
- test.QuantizeFrame(frame, frame.Bounds());
- }
+ default(BmpDecoderCore).Decode(default, default, default);
+ default(GifDecoderCore).Decode(default, default, default);
+ default(JpegDecoderCore).Decode(default, default, default);
+ default(PngDecoderCore).Decode(default, default, default);
+ default(TgaDecoderCore).Decode(default, default, default);
+ }
+
+ ///
+ /// This method pre-seeds the all in the AoT compiler.
+ ///
+ /// The pixel format.
+ [Preserve]
+ private static void AotCompileImageEncoders()
+ where TPixel : unmanaged, IPixel
+ {
+ AotCompileImageEncoder();
+ AotCompileImageEncoder();
+ AotCompileImageEncoder();
+ AotCompileImageEncoder();
+ AotCompileImageEncoder();
}
///
- /// This method pre-seeds the default dithering engine (FloydSteinbergDiffuser) in the AoT compiler for iOS.
+ /// This method pre-seeds the all in the AoT compiler.
///
/// The pixel format.
- private static void AotCompileDithering()
+ [Preserve]
+ private static void AotCompileImageDecoders()
where TPixel : unmanaged, IPixel
{
- ErrorDither errorDither = ErrorDither.FloydSteinberg;
- OrderedDither orderedDither = OrderedDither.Bayer2x2;
- TPixel pixel = default;
- using (var image = new ImageFrame(Configuration.Default, 1, 1))
- {
- errorDither.Dither(image, image.Bounds(), pixel, pixel, 0, 0, 0);
- orderedDither.Dither(pixel, 0, 0, 0, 0);
- }
+ AotCompileImageDecoder();
+ AotCompileImageDecoder();
+ AotCompileImageDecoder();
+ AotCompileImageDecoder();
+ AotCompileImageDecoder();
}
///
- /// This method pre-seeds the decoder and encoder for a given pixel format in the AoT compiler for iOS.
+ /// This method pre-seeds the in the AoT compiler.
///
- /// The image decoder to seed.
- /// The image encoder to seed.
/// The pixel format.
- private static void AotCodec(IImageDecoder decoder, IImageEncoder encoder)
+ /// The encoder.
+ [Preserve]
+ private static void AotCompileImageEncoder()
where TPixel : unmanaged, IPixel
+ where TEncoder : class, IImageEncoder
{
- try
- {
- decoder.Decode(Configuration.Default, null);
- }
- catch
- {
- }
+ default(TEncoder).Encode(default, default);
+ default(TEncoder).EncodeAsync(default, default, default);
+ }
- try
- {
- encoder.Encode(null, null);
- }
- catch
- {
- }
+ ///
+ /// This method pre-seeds the in the AoT compiler.
+ ///
+ /// The pixel format.
+ /// The decoder.
+ [Preserve]
+ private static void AotCompileImageDecoder()
+ where TPixel : unmanaged, IPixel
+ where TDecoder : class, IImageDecoder
+ {
+ default(TDecoder).Decode(default, default);
+ default(TDecoder).DecodeAsync(default, default, default);
+ }
+
+ ///
+ /// This method pre-seeds the all in the AoT compiler.
+ ///
+ ///
+ /// There is no structure that implements ISwizzler.
+ ///
+ /// The pixel format.
+ [Preserve]
+ private static void AotCompileImageProcessors()
+ where TPixel : unmanaged, IPixel
+ {
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+ AotCompileImageProcessor();
+
+ AotCompilerCloningImageProcessor();
+ AotCompilerCloningImageProcessor();
+ AotCompilerCloningImageProcessor();
+ AotCompilerCloningImageProcessor();
+ AotCompilerCloningImageProcessor();
+ AotCompilerCloningImageProcessor();
+ AotCompilerCloningImageProcessor();
+ }
+
+ ///
+ /// This method pre-seeds the in the AoT compiler.
+ ///
+ /// The pixel format.
+ /// The processor type
+ [Preserve]
+ private static void AotCompileImageProcessor()
+ where TPixel : unmanaged, IPixel
+ where TProc : class, IImageProcessor
+ => default(TProc).CreatePixelSpecificProcessor