diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 4cb40d36a..d76d68c1a 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -82,24 +82,67 @@ jobs:
shell: pwsh
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
env:
- CI : True
+ CI: True
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
+ # Avoid "Please provide the repository token to upload reports via `-t :repository-token`"
+ # https://community.codecov.io/t/whitelist-github-action-servers-to-upload-without-a-token/491/10
+ # https://github.community/t5/GitHub-Actions/Make-secrets-available-to-builds-of-forks/m-p/42814/highlight/true#M5129
- name: Update Codecov
uses: iansu/codecov-action-node@v1.0.0
- if: matrix.options.codecov == true
+ if: matrix.options.codecov == true && startsWith(github.repository, 'SixLabors')
with:
- token: ${{secrets.CODECOV_TOKEN}}
- file: "coverage.${{matrix.options.framework}}.xml"
+ token: 0ef021c7-2679-4012-b42f-4bed33d99450
flags: unittests
- - name: Pack # We can use this filter as we know it happens only once and takes the most time to complete.
- if: (github.event_name == 'push') && (matrix.options.codecov == true)
+ Publish:
+ needs: [Build]
+
+ runs-on: windows-latest
+
+ if: (github.event_name == 'push')
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install NuGet
+ uses: NuGet/setup-nuget@v1
+
+ - name: Setup Git
+ shell: bash
+ run: |
+ git config --global core.autocrlf false
+ git config --global core.longpaths true
+ git fetch --prune --unshallow
+ git submodule -q update --init --recursive
+
+ - name: Fetch Tags for GitVersion
+ run: |
+ git fetch --tags
+
+ - name: Fetch master for GitVersion
+ if: github.ref != 'refs/heads/master'
+ run: git branch --create-reflog master origin/master
+
+ - name: Install GitVersion
+ uses: gittools/actions/setup-gitversion@v0.3
+ with:
+ versionSpec: "5.1.x"
+
+ - name: Use GitVersion
+ id: gitversion # step id used as reference for output values
+ uses: gittools/actions/execute-gitversion@v0.3
+
+ - name: Setup DotNet SDK
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: "3.1.101"
+
+ - name: Pack
shell: pwsh
- run: ./ci-build.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
+ run: ./ci-pack.ps1 "${{steps.gitversion.outputs.nuGetVersion}}"
- name: Publish to MyGet
- if: (github.event_name == 'push') && (matrix.options.codecov == true)
shell: pwsh
run: nuget.exe push .\artifacts\*.nupkg ${{secrets.MYGET_TOKEN}} -Source https://www.myget.org/F/sixlabors/api/v2/package
# TODO: If github.ref starts with 'refs/tags' then it was tag push and we can optionally push out package to nuget.org
diff --git a/.gitignore b/.gitignore
index 8fcb5ef40..a89cfcf10 100644
--- a/.gitignore
+++ b/.gitignore
@@ -216,7 +216,7 @@ artifacts/
*.csproj.bak
#CodeCoverage
-/ImageSharp.Coverage.xml
+*.lcov
# Tests
**/Images/ActualOutput
diff --git a/Directory.Build.props b/Directory.Build.props
index cd2f7311e..d0137e592 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -91,8 +91,9 @@
git
https://www.myget.org/F/sixlabors/api/v3/index.json;
- https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://api.nuget.org/v3/index.json;
+
+ https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json;
002400000c8000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97
true
diff --git a/ImageSharp.sln b/ImageSharp.sln
index 875ede1b2..40878c575 100644
--- a/ImageSharp.sln
+++ b/ImageSharp.sln
@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
.gitmodules = .gitmodules
ci-build.ps1 = ci-build.ps1
+ ci-pack.ps1 = ci-pack.ps1
ci-test.ps1 = ci-test.ps1
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
@@ -322,8 +323,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Tests", "tests\I
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Benchmarks", "tests\ImageSharp.Benchmarks\ImageSharp.Benchmarks.csproj", "{2BF743D8-2A06-412D-96D7-F448F00C5EA5}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Sandbox46", "tests\ImageSharp.Sandbox46\ImageSharp.Sandbox46.csproj", "{561B880A-D9EE-44EF-90F5-817C54A9D9AB}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{C0D7754B-5277-438E-ABEB-2BA34401B5A7}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
@@ -331,6 +330,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedInfrastructure", "shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.shproj", "{68A8CC40-6AED-4E96-B524-31B1158FDEEA}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Tests.ProfilingSandbox", "tests\ImageSharp.Tests.ProfilingSandbox\ImageSharp.Tests.ProfilingSandbox.csproj", "{FC527290-2F22-432C-B77B-6E815726B02C}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{68a8cc40-6aed-4e96-b524-31b1158fdeea}*SharedItemsImports = 13
@@ -380,18 +381,18 @@ Global
{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
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Debug|x64.ActiveCfg = Debug|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Debug|x64.Build.0 = Debug|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Debug|x86.ActiveCfg = Debug|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Debug|x86.Build.0 = Debug|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Release|Any CPU.Build.0 = Release|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Release|x64.ActiveCfg = Release|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Release|x64.Build.0 = Release|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Release|x86.ActiveCfg = Release|Any CPU
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB}.Release|x86.Build.0 = Release|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}.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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -415,9 +416,9 @@ Global
{E1C42A6F-913B-4A7B-B1A8-2BB62843B254} = {9DA226A1-8656-49A8-A58A-A8B5C081AD66}
{EA3000E9-2A91-4EC4-8A68-E566DEBDC4F6} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{2BF743D8-2A06-412D-96D7-F448F00C5EA5} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
- {561B880A-D9EE-44EF-90F5-817C54A9D9AB} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
{C0D7754B-5277-438E-ABEB-2BA34401B5A7} = {1799C43E-5C54-4A8F-8D64-B1475241DB0D}
{68A8CC40-6AED-4E96-B524-31B1158FDEEA} = {815C0625-CD3D-440F-9F80-2D83856AB7AE}
+ {FC527290-2F22-432C-B77B-6E815726B02C} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5F8B9D1F-CD8B-4CC5-8216-D531E25BD795}
diff --git a/README.md b/README.md
index ceb1e51d2..1e5203956 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,8 @@ SixLabors.ImageSharp
+[](https://github.com/SixLabors/ImageSharp/actions)
+[](https://codecov.io/gh/SixLabors/ImageSharp)
[](https://raw.githubusercontent.com/SixLabors/ImageSharp/master/LICENSE)
[](https://gitter.im/ImageSharp/General?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://twitter.com/intent/tweet?hashtags=imagesharp,dotnet,oss&text=ImageSharp.+A+new+cross-platform+2D+graphics+API+in+C%23&url=https%3a%2f%2fgithub.com%2fSixLabors%2fImageSharp&via=sixlabors)
@@ -45,12 +47,6 @@ The **ImageSharp** library is made up of multiple packages:
- Transform methods like Resize, Crop, Skew, Rotate - anything that alters the dimensions of the image
- Non-transform methods like Gaussian Blur, Pixelate, Edge Detection - anything that maintains the original image dimensions
-### Build Status
-
-|Build Status|Code Coverage|
-|:----------:|:-----------:|
-|[](https://github.com/SixLabors/ImageSharp/actions)|[](https://codecov.io/gh/SixLabors/ImageSharp)|
-
### Questions?
- Do you have questions? We are happy to help! Please [join our gitter channel](https://gitter.im/ImageSharp/General), or ask them on [stackoverflow](https://stackoverflow.com) using the `ImageSharp` tag. **Do not** open issues for questions!
diff --git a/ci-build.ps1 b/ci-build.ps1
index ad757dc9e..17c6e6603 100644
--- a/ci-build.ps1
+++ b/ci-build.ps1
@@ -1,20 +1,13 @@
param(
[Parameter(Mandatory, Position = 0)]
[string]$version,
- [Parameter(Mandatory = $false, Position = 1)]
- [string]$targetFramework = 'ALL'
+ [Parameter(Mandatory = $true, Position = 1)]
+ [string]$targetFramework
)
dotnet clean -c Release
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
-if ($targetFramework -ne 'ALL') {
- # Building for a specific framework.
- dotnet build -c Release -f $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
-}
-else {
-
- # Building for packing and publishing.
- dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
-}
+# Building for a specific framework.
+dotnet build -c Release -f $targetFramework /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
diff --git a/ci-pack.ps1 b/ci-pack.ps1
new file mode 100644
index 000000000..a4e846db9
--- /dev/null
+++ b/ci-pack.ps1
@@ -0,0 +1,11 @@
+param(
+ [Parameter(Mandatory, Position = 0)]
+ [string]$version
+)
+
+dotnet clean -c Release
+
+$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
+
+# Building for packing and publishing.
+dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:packageversion=$version /p:RepositoryUrl=$repositoryUrl
diff --git a/ci-test.ps1 b/ci-test.ps1
index 35a9b4646..3915ae4cc 100644
--- a/ci-test.ps1
+++ b/ci-test.ps1
@@ -17,7 +17,7 @@ if ($codecov -eq 'true') {
# Allow toggling of profile to workaround any potential JIT errors caused by code injection.
dotnet clean -c $codecovProfile
- dotnet test -c $codecovProfile -f $targetFramework /p:codecov=true
+ dotnet test --collect "XPlat Code Coverage" --settings .\tests\coverlet.runsettings -c $codecovProfile -f $targetFramework /p:CodeCov=true
}
elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) {
@@ -34,4 +34,4 @@ elseif ($platform -eq '-x86' -and $targetFramework -match $netFxRegex) {
else {
dotnet test --no-build -c Release -f $targetFramework
-}
\ No newline at end of file
+}
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 000000000..3941f7ff9
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,7 @@
+# Documentation: https://docs.codecov.io/docs/codecov-yaml
+
+codecov:
+ # Avoid "Missing base report"
+ # https://github.com/codecov/support/issues/363
+ # https://docs.codecov.io/docs/comparing-commits
+ allow_coverage_offsets: true
diff --git a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
index 9bf8943b7..d810296d6 100644
--- a/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
+++ b/src/ImageSharp/Advanced/AdvancedImageExtensions.cs
@@ -29,7 +29,23 @@ namespace SixLabors.ImageSharp.Advanced
///
The source image.
///
Returns the configuration.
public static Configuration GetConfiguration(this Image source)
- => GetConfiguration((IConfigurable)source);
+ => GetConfiguration((IConfigurationProvider)source);
+
+ ///
+ /// Gets the configuration for the image frame.
+ ///
+ ///
The source image.
+ ///
Returns the configuration.
+ public static Configuration GetConfiguration(this ImageFrame source)
+ => GetConfiguration((IConfigurationProvider)source);
+
+ ///
+ /// Gets the configuration .
+ ///
+ ///
The source image
+ ///
Returns the bounds of the image
+ private static Configuration GetConfiguration(IConfigurationProvider source)
+ => source?.Configuration ?? Configuration.Default;
///
/// Gets the representation of the pixels as a of contiguous memory in the source image's pixel format
@@ -158,17 +174,9 @@ namespace SixLabors.ImageSharp.Advanced
///
///
The source image.
///
Returns the configuration.
- internal static MemoryAllocator GetMemoryAllocator(this IConfigurable source)
+ internal static MemoryAllocator GetMemoryAllocator(this IConfigurationProvider source)
=> GetConfiguration(source).MemoryAllocator;
- ///
- /// Gets the configuration.
- ///
- ///
The source image
- ///
Returns the bounds of the image
- private static Configuration GetConfiguration(IConfigurable source)
- => source?.Configuration ?? Configuration.Default;
-
///
/// Returns a reference to the 0th element of the Pixel buffer.
/// Such a reference can be used for pinning but must never be dereferenced.
diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs
index bb4ddb7d0..142ea3f3e 100644
--- a/src/ImageSharp/Advanced/AotCompilerTools.cs
+++ b/src/ImageSharp/Advanced/AotCompilerTools.cs
@@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Advanced
private static void AotCompileOctreeQuantizer()
where TPixel : struct, IPixel
{
- using (var test = new OctreeFrameQuantizer(new OctreeQuantizer(false)))
+ using (var test = new OctreeFrameQuantizer(Configuration.Default, new OctreeQuantizer(false)))
{
test.AotGetPalette();
}
@@ -122,7 +122,7 @@ namespace SixLabors.ImageSharp.Advanced
private static void AotCompileWuQuantizer()
where TPixel : struct, IPixel
{
- using (var test = new WuFrameQuantizer(Configuration.Default.MemoryAllocator, new WuQuantizer(false)))
+ using (var test = new WuFrameQuantizer(Configuration.Default, new WuQuantizer(false)))
{
test.QuantizeFrame(new ImageFrame(Configuration.Default, 1, 1));
test.AotGetPalette();
diff --git a/src/ImageSharp/Advanced/IConfigurable.cs b/src/ImageSharp/Advanced/IConfigurable.cs
deleted file mode 100644
index 38fc83ae1..000000000
--- a/src/ImageSharp/Advanced/IConfigurable.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-namespace SixLabors.ImageSharp.Advanced
-{
- ///
- /// Encapsulates the properties for configuration.
- ///
- internal interface IConfigurable
- {
- ///
- /// Gets the configuration.
- ///
- Configuration Configuration { get; }
- }
-}
\ No newline at end of file
diff --git a/src/ImageSharp/Advanced/IConfigurationProvider.cs b/src/ImageSharp/Advanced/IConfigurationProvider.cs
new file mode 100644
index 000000000..d3e3a91aa
--- /dev/null
+++ b/src/ImageSharp/Advanced/IConfigurationProvider.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+namespace SixLabors.ImageSharp.Advanced
+{
+ ///
+ /// Defines the contract for objects that can provide access to configuration.
+ ///
+ internal interface IConfigurationProvider
+ {
+ ///
+ /// Gets the configuration which allows altering default behaviour or extending the library.
+ ///
+ Configuration Configuration { get; }
+ }
+}
diff --git a/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs b/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs
index 4833dbafd..ecefadb08 100644
--- a/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs
+++ b/src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs
@@ -26,7 +26,7 @@ namespace SixLabors.ImageSharp.Advanced.ParallelUtils
/// The method body defining the iteration logic on a single .
public static void IterateRows(Rectangle rectangle, Configuration configuration, Action body)
{
- ParallelExecutionSettings parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
+ var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
IterateRows(rectangle, parallelSettings, body);
}
diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs
index 9f26df300..619be880a 100644
--- a/src/ImageSharp/Configuration.cs
+++ b/src/ImageSharp/Configuration.cs
@@ -16,7 +16,7 @@ using SixLabors.ImageSharp.Processing;
namespace SixLabors.ImageSharp
{
///
- /// Provides configuration code which allows altering default behaviour or extending the library.
+ /// Provides configuration which allows altering default behaviour or extending the library.
///
public sealed class Configuration
{
diff --git a/src/ImageSharp/Formats/Gif/GifEncoder.cs b/src/ImageSharp/Formats/Gif/GifEncoder.cs
index fef311596..248915cb7 100644
--- a/src/ImageSharp/Formats/Gif/GifEncoder.cs
+++ b/src/ImageSharp/Formats/Gif/GifEncoder.cs
@@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
public void Encode(Image image, Stream stream)
where TPixel : struct, IPixel
{
- var encoder = new GifEncoderCore(image.GetConfiguration().MemoryAllocator, this);
+ var encoder = new GifEncoderCore(image.GetConfiguration(), this);
encoder.Encode(image, stream);
}
}
diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
index b4aae0744..a691e527e 100644
--- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs
@@ -53,11 +53,12 @@ namespace SixLabors.ImageSharp.Formats.Gif
///
/// Initializes a new instance of the class.
///
- /// The to use for buffer allocations.
+ /// The configuration which allows altering default behaviour or extending the library.
/// The options for the encoder.
- public GifEncoderCore(MemoryAllocator memoryAllocator, IGifEncoderOptions options)
+ public GifEncoderCore(Configuration configuration, IGifEncoderOptions options)
{
- this.memoryAllocator = memoryAllocator;
+ this.configuration = configuration;
+ this.memoryAllocator = configuration.MemoryAllocator;
this.quantizer = options.Quantizer;
this.colorTableMode = options.ColorTableMode;
}
@@ -74,16 +75,14 @@ namespace SixLabors.ImageSharp.Formats.Gif
Guard.NotNull(image, nameof(image));
Guard.NotNull(stream, nameof(stream));
- this.configuration = image.GetConfiguration();
-
ImageMetadata metadata = image.Metadata;
GifMetadata gifMetadata = metadata.GetGifMetadata();
- this.colorTableMode = this.colorTableMode ?? gifMetadata.ColorTableMode;
+ this.colorTableMode ??= gifMetadata.ColorTableMode;
bool useGlobalTable = this.colorTableMode == GifColorTableMode.Global;
// Quantize the image returning a palette.
IQuantizedFrame quantized;
- using (IFrameQuantizer frameQuantizer = this.quantizer.CreateFrameQuantizer(image.GetConfiguration()))
+ using (IFrameQuantizer frameQuantizer = this.quantizer.CreateFrameQuantizer(this.configuration))
{
quantized = frameQuantizer.QuantizeFrame(image.Frames.RootFrame);
}
@@ -146,7 +145,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
else
{
using (IFrameQuantizer paletteFrameQuantizer =
- new PaletteFrameQuantizer(this.quantizer.Diffuser, quantized.Palette))
+ new PaletteFrameQuantizer(this.configuration, this.quantizer.Diffuser, quantized.Palette))
{
using (IQuantizedFrame paletteQuantized = paletteFrameQuantizer.QuantizeFrame(frame))
{
@@ -172,14 +171,14 @@ namespace SixLabors.ImageSharp.Formats.Gif
if (previousFrame != null && previousMeta.ColorTableLength != frameMetadata.ColorTableLength
&& frameMetadata.ColorTableLength > 0)
{
- using (IFrameQuantizer frameQuantizer = this.quantizer.CreateFrameQuantizer(image.GetConfiguration(), frameMetadata.ColorTableLength))
+ using (IFrameQuantizer frameQuantizer = this.quantizer.CreateFrameQuantizer(this.configuration, frameMetadata.ColorTableLength))
{
quantized = frameQuantizer.QuantizeFrame(frame);
}
}
else
{
- using (IFrameQuantizer frameQuantizer = this.quantizer.CreateFrameQuantizer(image.GetConfiguration()))
+ using (IFrameQuantizer frameQuantizer = this.quantizer.CreateFrameQuantizer(this.configuration))
{
quantized = frameQuantizer.QuantizeFrame(frame);
}
@@ -202,9 +201,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
///
/// Returns the index of the most transparent color in the palette.
///
- ///
- /// The quantized.
- ///
+ /// The quantized frame.
/// The pixel format.
///
/// The .
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs
index 883a085b5..92482de2a 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs
@@ -1,9 +1,9 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Runtime.CompilerServices;
-
+using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
@@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
this.pixelBlock.LoadAndStretchEdges(frame, x, y);
Span rgbSpan = this.rgbBlock.AsSpanUnsafe();
- PixelOperations.Instance.ToRgb24(frame.Configuration, this.pixelBlock.AsSpanUnsafe(), rgbSpan);
+ PixelOperations.Instance.ToRgb24(frame.GetConfiguration(), this.pixelBlock.AsSpanUnsafe(), rgbSpan);
ref float yBlockStart = ref Unsafe.As(ref this.Y);
ref float cbBlockStart = ref Unsafe.As(ref this.Cb);
@@ -81,4 +81,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
index 57a596bcd..69a80e024 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs
@@ -144,8 +144,8 @@ namespace SixLabors.ImageSharp.Formats.Png
this.height = image.Height;
ImageMetadata metadata = image.Metadata;
- PngMetadata pngMetadata = metadata.GetFormatMetadata(PngFormat.Instance);
- PngEncoderOptionsHelpers.AdjustOptions(this.options, pngMetadata, out this.use16Bit, out this.bytesPerPixel);
+ PngMetadata pngMetadata = metadata.GetPngMetadata();
+ PngEncoderOptionsHelpers.AdjustOptions(this.options, pngMetadata, out this.use16Bit, out this.bytesPerPixel);
IQuantizedFrame quantized = PngEncoderOptionsHelpers.CreateQuantizedFrame(this.options, image);
this.bitDepth = PngEncoderOptionsHelpers.CalculateBitDepth(this.options, image, quantized);
diff --git a/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs b/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs
index e3f294886..b494c164f 100644
--- a/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs
+++ b/src/ImageSharp/Formats/Png/PngEncoderOptionsHelpers.cs
@@ -14,23 +14,28 @@ namespace SixLabors.ImageSharp.Formats.Png
internal static class PngEncoderOptionsHelpers
{
///
- /// Adjusts the options.
+ /// Adjusts the options based upon the given metadata.
///
/// The options.
/// The PNG metadata.
/// if set to true [use16 bit].
/// The bytes per pixel.
- public static void AdjustOptions(
+ public static void AdjustOptions(
PngEncoderOptions options,
PngMetadata pngMetadata,
out bool use16Bit,
out int bytesPerPixel)
+ where TPixel : struct, IPixel
{
// Always take the encoder options over the metadata values.
- options.Gamma = options.Gamma ?? pngMetadata.Gamma;
- options.ColorType = options.ColorType ?? pngMetadata.ColorType;
- options.BitDepth = options.BitDepth ?? pngMetadata.BitDepth;
- options.InterlaceMethod = options.InterlaceMethod ?? pngMetadata.InterlaceMethod;
+ options.Gamma ??= pngMetadata.Gamma;
+
+ // Use options, then check metadata, if nothing set there then we suggest
+ // a sensible default based upon the pixel format.
+ options.ColorType ??= pngMetadata.ColorType ?? SuggestColorType();
+ options.BitDepth ??= pngMetadata.BitDepth ?? SuggestBitDepth();
+
+ options.InterlaceMethod ??= pngMetadata.InterlaceMethod;
use16Bit = options.BitDepth == PngBitDepth.Bit16;
bytesPerPixel = CalculateBytesPerPixel(options.ColorType, use16Bit);
@@ -129,24 +134,68 @@ namespace SixLabors.ImageSharp.Formats.Png
/// Bytes per pixel.
private static int CalculateBytesPerPixel(PngColorType? pngColorType, bool use16Bit)
{
- switch (pngColorType)
+ return pngColorType switch
{
- case PngColorType.Grayscale:
- return use16Bit ? 2 : 1;
+ PngColorType.Grayscale => use16Bit ? 2 : 1,
+ PngColorType.GrayscaleWithAlpha => use16Bit ? 4 : 2,
+ PngColorType.Palette => 1,
+ PngColorType.Rgb => use16Bit ? 6 : 3,
- case PngColorType.GrayscaleWithAlpha:
- return use16Bit ? 4 : 2;
-
- case PngColorType.Palette:
- return 1;
+ // PngColorType.RgbWithAlpha
+ _ => use16Bit ? 8 : 4,
+ };
+ }
- case PngColorType.Rgb:
- return use16Bit ? 6 : 3;
+ ///
+ /// Returns a suggested for the given
+ /// This is not exhaustive but covers many common pixel formats.
+ ///
+ private static PngColorType SuggestColorType()
+ where TPixel : struct, IPixel
+ {
+ return typeof(TPixel) switch
+ {
+ Type t when t == typeof(A8) => PngColorType.GrayscaleWithAlpha,
+ Type t when t == typeof(Argb32) => PngColorType.RgbWithAlpha,
+ Type t when t == typeof(Bgr24) => PngColorType.Rgb,
+ Type t when t == typeof(Bgra32) => PngColorType.RgbWithAlpha,
+ Type t when t == typeof(L8) => PngColorType.Grayscale,
+ Type t when t == typeof(L16) => PngColorType.Grayscale,
+ Type t when t == typeof(La16) => PngColorType.GrayscaleWithAlpha,
+ Type t when t == typeof(La32) => PngColorType.GrayscaleWithAlpha,
+ Type t when t == typeof(Rgb24) => PngColorType.Rgb,
+ Type t when t == typeof(Rgba32) => PngColorType.RgbWithAlpha,
+ Type t when t == typeof(Rgb48) => PngColorType.Rgb,
+ Type t when t == typeof(Rgba64) => PngColorType.RgbWithAlpha,
+ Type t when t == typeof(RgbaVector) => PngColorType.RgbWithAlpha,
+ _ => PngColorType.RgbWithAlpha
+ };
+ }
- // PngColorType.RgbWithAlpha
- default:
- return use16Bit ? 8 : 4;
- }
+ ///
+ /// Returns a suggested for the given
+ /// This is not exhaustive but covers many common pixel formats.
+ ///
+ private static PngBitDepth SuggestBitDepth()
+ where TPixel : struct, IPixel
+ {
+ return typeof(TPixel) switch
+ {
+ Type t when t == typeof(A8) => PngBitDepth.Bit8,
+ Type t when t == typeof(Argb32) => PngBitDepth.Bit8,
+ Type t when t == typeof(Bgr24) => PngBitDepth.Bit8,
+ Type t when t == typeof(Bgra32) => PngBitDepth.Bit8,
+ Type t when t == typeof(L8) => PngBitDepth.Bit8,
+ Type t when t == typeof(L16) => PngBitDepth.Bit16,
+ Type t when t == typeof(La16) => PngBitDepth.Bit8,
+ Type t when t == typeof(La32) => PngBitDepth.Bit16,
+ Type t when t == typeof(Rgb24) => PngBitDepth.Bit8,
+ Type t when t == typeof(Rgba32) => PngBitDepth.Bit8,
+ Type t when t == typeof(Rgb48) => PngBitDepth.Bit16,
+ Type t when t == typeof(Rgba64) => PngBitDepth.Bit16,
+ Type t when t == typeof(RgbaVector) => PngBitDepth.Bit16,
+ _ => PngBitDepth.Bit8
+ };
}
}
}
diff --git a/src/ImageSharp/Formats/Png/PngMetadata.cs b/src/ImageSharp/Formats/Png/PngMetadata.cs
index 87a2080f0..341fc53ed 100644
--- a/src/ImageSharp/Formats/Png/PngMetadata.cs
+++ b/src/ImageSharp/Formats/Png/PngMetadata.cs
@@ -44,12 +44,12 @@ namespace SixLabors.ImageSharp.Formats.Png
/// Gets or sets the number of bits per sample or per palette index (not per pixel).
/// Not all values are allowed for all values.
///
- public PngBitDepth BitDepth { get; set; } = PngBitDepth.Bit8;
+ public PngBitDepth? BitDepth { get; set; }
///
/// Gets or sets the color type.
///
- public PngColorType ColorType { get; set; } = PngColorType.RgbWithAlpha;
+ public PngColorType? ColorType { get; set; }
///
/// Gets or sets a value indicating whether this instance should write an Adam7 interlaced image.
diff --git a/src/ImageSharp/Image.cs b/src/ImageSharp/Image.cs
index a62bfed1e..574178d39 100644
--- a/src/ImageSharp/Image.cs
+++ b/src/ImageSharp/Image.cs
@@ -16,20 +16,23 @@ namespace SixLabors.ImageSharp
/// For the non-generic type, the pixel type is only known at runtime.
/// is always implemented by a pixel-specific instance.
///
- public abstract partial class Image : IImage, IConfigurable
+ public abstract partial class Image : IImage, IConfigurationProvider
{
private Size size;
+ private readonly Configuration configuration;
///
/// Initializes a new instance of the class.
///
- ///
The
.
+ ///
+ /// The configuration which allows altering default behaviour or extending the library.
+ ///
///
The
.
///
The
.
///
The
.
protected Image(Configuration configuration, PixelTypeInfo pixelType, ImageMetadata metadata, Size size)
{
- this.Configuration = configuration ?? Configuration.Default;
+ this.configuration = configuration ?? Configuration.Default;
this.PixelType = pixelType;
this.size = size;
this.Metadata = metadata ?? new ImageMetadata();
@@ -48,11 +51,6 @@ namespace SixLabors.ImageSharp
{
}
- ///
- /// Gets the .
- ///
- protected Configuration Configuration { get; }
-
///
/// Gets the implementing the public property.
///
@@ -75,10 +73,8 @@ namespace SixLabors.ImageSharp
///
public ImageFrameCollection Frames => this.NonGenericFrameCollection;
- ///
- /// Gets the pixel buffer.
- ///
- Configuration IConfigurable.Configuration => this.Configuration;
+ ///
+ Configuration IConfigurationProvider.Configuration => this.configuration;
///
public void Dispose()
@@ -108,7 +104,7 @@ namespace SixLabors.ImageSharp
///
The pixel format.
///
The
public Image
CloneAs()
- where TPixel2 : struct, IPixel => this.CloneAs(this.Configuration);
+ where TPixel2 : struct, IPixel => this.CloneAs(this.GetConfiguration());
///
/// Returns a copy of the image in the given pixel format.
diff --git a/src/ImageSharp/ImageFrame.cs b/src/ImageSharp/ImageFrame.cs
index fe2a2b762..235840e77 100644
--- a/src/ImageSharp/ImageFrame.cs
+++ b/src/ImageSharp/ImageFrame.cs
@@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
-using SixLabors.ImageSharp.Memory;
+using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.PixelFormats;
@@ -13,37 +13,28 @@ namespace SixLabors.ImageSharp
/// In case of animated formats like gif, it contains the single frame in a animation.
/// In all other cases it is the only frame of the image.
///
- public abstract partial class ImageFrame : IDisposable
+ public abstract partial class ImageFrame : IConfigurationProvider, IDisposable
{
+ private readonly Configuration configuration;
+
///
/// Initializes a new instance of the class.
///
- /// The .
- /// The width.
- /// The height.
+ /// The configuration which allows altering default behaviour or extending the library.
+ /// The frame width.
+ /// The frame height.
/// The .
protected ImageFrame(Configuration configuration, int width, int height, ImageFrameMetadata metadata)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.NotNull(metadata, nameof(metadata));
- this.Configuration = configuration;
- this.MemoryAllocator = configuration.MemoryAllocator;
+ this.configuration = configuration ?? Configuration.Default;
this.Width = width;
this.Height = height;
this.Metadata = metadata;
}
- ///
- /// Gets the to use for buffer allocations.
- ///
- public MemoryAllocator MemoryAllocator { get; }
-
- ///
- /// Gets the instance associated with this .
- ///
- internal Configuration Configuration { get; }
-
///
/// Gets the width.
///
@@ -59,6 +50,9 @@ namespace SixLabors.ImageSharp
///
public ImageFrameMetadata Metadata { get; }
+ ///
+ Configuration IConfigurationProvider.Configuration => this.configuration;
+
///
/// Gets the size of the frame.
///
diff --git a/src/ImageSharp/ImageFrame{TPixel}.cs b/src/ImageSharp/ImageFrame{TPixel}.cs
index 85454e150..e1112c017 100644
--- a/src/ImageSharp/ImageFrame{TPixel}.cs
+++ b/src/ImageSharp/ImageFrame{TPixel}.cs
@@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp
Guard.MustBeGreaterThan(width, 0, nameof(width));
Guard.MustBeGreaterThan(height, 0, nameof(height));
- this.PixelBuffer = this.MemoryAllocator.Allocate2D(width, height, AllocationOptions.Clean);
+ this.PixelBuffer = this.GetConfiguration().MemoryAllocator.Allocate2D(width, height, AllocationOptions.Clean);
}
///
@@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp
Guard.MustBeGreaterThan(width, 0, nameof(width));
Guard.MustBeGreaterThan(height, 0, nameof(height));
- this.PixelBuffer = this.MemoryAllocator.Allocate2D(width, height);
+ this.PixelBuffer = this.GetConfiguration().MemoryAllocator.Allocate2D(width, height);
this.Clear(backgroundColor);
}
@@ -132,7 +132,7 @@ namespace SixLabors.ImageSharp
Guard.NotNull(configuration, nameof(configuration));
Guard.NotNull(source, nameof(source));
- this.PixelBuffer = this.MemoryAllocator.Allocate2D(source.PixelBuffer.Width, source.PixelBuffer.Height);
+ this.PixelBuffer = this.GetConfiguration().MemoryAllocator.Allocate2D(source.PixelBuffer.Width, source.PixelBuffer.Height);
source.PixelBuffer.GetSpan().CopyTo(this.PixelBuffer.GetSpan());
}
@@ -219,7 +219,7 @@ namespace SixLabors.ImageSharp
this.PixelBuffer.GetSpan().CopyTo(dest1);
}
- PixelOperations.Instance.To(this.Configuration, this.PixelBuffer.GetSpan(), destination);
+ PixelOperations.Instance.To(this.GetConfiguration(), this.PixelBuffer.GetSpan(), destination);
}
///
@@ -229,7 +229,7 @@ namespace SixLabors.ImageSharp
/// Clones the current instance.
///
/// The
- internal ImageFrame Clone() => this.Clone(this.Configuration);
+ internal ImageFrame Clone() => this.Clone(this.GetConfiguration());
///
/// Clones the current instance.
@@ -244,7 +244,7 @@ namespace SixLabors.ImageSharp
/// The pixel format.
/// The
internal ImageFrame CloneAs()
- where TPixel2 : struct, IPixel => this.CloneAs(this.Configuration);
+ where TPixel2 : struct, IPixel => this.CloneAs(this.GetConfiguration());
///
/// Returns a copy of the image frame in the given pixel format.
diff --git a/src/ImageSharp/Image{TPixel}.cs b/src/ImageSharp/Image{TPixel}.cs
index b7e63dc25..87bdf90a1 100644
--- a/src/ImageSharp/Image{TPixel}.cs
+++ b/src/ImageSharp/Image{TPixel}.cs
@@ -154,7 +154,7 @@ namespace SixLabors.ImageSharp
/// Clones the current image
///
/// Returns a new image with all the same metadata as the original.
- public Image Clone() => this.Clone(this.Configuration);
+ public Image Clone() => this.Clone(this.GetConfiguration());
///
/// Clones the current image with the given configuration.
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifTags.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifTags.cs
index 13fff5b6a..a4123d02f 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/ExifTags.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifTags.cs
@@ -225,7 +225,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
case ExifTagValue.ImageUniqueID:
case ExifTagValue.OwnerName:
case ExifTagValue.SerialNumber:
- case ExifTagValue.LensInfo:
+ case ExifTagValue.LensSpecification:
case ExifTagValue.LensMake:
case ExifTagValue.LensModel:
case ExifTagValue.LensSerialNumber:
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs
index f1364b2c3..2281dee49 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.Rational.cs
@@ -131,11 +131,6 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
///
public static ExifTag DigitalZoomRatio { get; } = new ExifTag(ExifTagValue.DigitalZoomRatio);
- ///
- /// Gets the LensInfo exif tag.
- ///
- public static ExifTag LensInfo { get; } = new ExifTag(ExifTagValue.LensInfo);
-
///
/// Gets the GPSAltitude exif tag.
///
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs
index 63b10e3e2..cf43a8a8a 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.RationalArray.cs
@@ -50,5 +50,10 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
/// Gets the GPSDestLongitude exif tag.
///
public static ExifTag GPSDestLongitude { get; } = new ExifTag(ExifTagValue.GPSDestLongitude);
+
+ ///
+ /// Gets the LensSpecification exif tag.
+ ///
+ public static ExifTag LensSpecification { get; } = new ExifTag(ExifTagValue.LensSpecification);
}
}
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTagValue.cs b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTagValue.cs
index 7268762c6..f70bcea37 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTagValue.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTagValue.cs
@@ -1356,9 +1356,9 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
SerialNumber = 0xA431,
///
- /// LensInfo
+ /// LensSpecification
///
- LensInfo = 0xA432,
+ LensSpecification = 0xA432,
///
/// LensMake
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValues.cs b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValues.cs
index b183c4ec9..62d3f40ac 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValues.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValues.cs
@@ -129,7 +129,6 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
case ExifTagValue.FocalPlaneYResolution: return new ExifRational(ExifTag.FocalPlaneYResolution);
case ExifTagValue.ExposureIndex: return new ExifRational(ExifTag.ExposureIndex);
case ExifTagValue.DigitalZoomRatio: return new ExifRational(ExifTag.DigitalZoomRatio);
- case ExifTagValue.LensInfo: return new ExifRational(ExifTag.LensInfo);
case ExifTagValue.GPSAltitude: return new ExifRational(ExifTag.GPSAltitude);
case ExifTagValue.GPSDOP: return new ExifRational(ExifTag.GPSDOP);
case ExifTagValue.GPSSpeed: return new ExifRational(ExifTag.GPSSpeed);
@@ -147,6 +146,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
case ExifTagValue.GPSTimestamp: return new ExifRationalArray(ExifTag.GPSTimestamp);
case ExifTagValue.GPSDestLatitude: return new ExifRationalArray(ExifTag.GPSDestLatitude);
case ExifTagValue.GPSDestLongitude: return new ExifRationalArray(ExifTag.GPSDestLongitude);
+ case ExifTagValue.LensSpecification: return new ExifRationalArray(ExifTag.LensSpecification);
case ExifTagValue.OldSubfileType: return new ExifShort(ExifTag.OldSubfileType);
case ExifTagValue.Compression: return new ExifShort(ExifTag.Compression);
diff --git a/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs b/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs
index 505b73a89..1e7d53231 100644
--- a/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs
+++ b/src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs
@@ -3,6 +3,7 @@
using System;
using System.Numerics;
+using System.Runtime.CompilerServices;
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
{
@@ -53,4 +54,4 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
return this.Equals((IccTagDataEntry)other);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs
index 15b90f02d..83bc46d8e 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs
@@ -11,7 +11,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-
namespace SixLabors.ImageSharp.PixelFormats
{
///
@@ -25,27 +24,27 @@ namespace SixLabors.ImageSharp.PixelFormats
internal class PixelOperations : PixelOperations
{
///
- internal override void FromArgb32(Configuration configuration, ReadOnlySpan source, Span destPixels)
+ public override void FromArgb32(Configuration configuration, ReadOnlySpan source, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
- source.CopyTo(destPixels);
+ source.CopyTo(destinationPixels);
}
///
- internal override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
- sourcePixels.CopyTo(destPixels);
+ sourcePixels.CopyTo(destinationPixels);
}
///
- public override void FromVector4Destructive(Configuration configuration, Span sourceVectors, Span destPixels, PixelConversionModifiers modifiers)
+ public override void FromVector4Destructive(Configuration configuration, Span sourceVectors, Span destinationPixels, PixelConversionModifiers modifiers)
{
- Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, modifiers.Remove(PixelConversionModifiers.Scale));
+ Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destinationPixels, modifiers.Remove(PixelConversionModifiers.Scale));
}
///
@@ -54,13 +53,13 @@ namespace SixLabors.ImageSharp.PixelFormats
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale));
}
///
- internal override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -70,13 +69,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void FromRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void FromRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -85,13 +84,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
}
///
- internal override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -101,13 +100,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void FromBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void FromBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -117,13 +116,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -135,13 +134,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref L8 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -153,13 +152,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref L16 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -171,13 +170,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToLa16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToLa16(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref La16 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -189,13 +188,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToLa32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToLa32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref La32 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -207,13 +206,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -225,13 +224,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgb48 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -243,13 +242,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgba64 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -261,13 +260,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -278,14 +277,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
}
///
- internal override void From(
+ public override void From(
Configuration configuration,
ReadOnlySpan sourcePixels,
Span destinationPixels)
{
PixelOperations.Instance.ToArgb32(configuration, sourcePixels, destinationPixels);
}
-
}
}
}
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs
index 7eb81764c..8f21ef2d4 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs
@@ -11,7 +11,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-
namespace SixLabors.ImageSharp.PixelFormats
{
///
@@ -25,27 +24,27 @@ namespace SixLabors.ImageSharp.PixelFormats
internal class PixelOperations : PixelOperations
{
///
- internal override void FromBgr24(Configuration configuration, ReadOnlySpan source, Span destPixels)
+ public override void FromBgr24(Configuration configuration, ReadOnlySpan source, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
- source.CopyTo(destPixels);
+ source.CopyTo(destinationPixels);
}
///
- internal override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
- sourcePixels.CopyTo(destPixels);
+ sourcePixels.CopyTo(destinationPixels);
}
///
- public override void FromVector4Destructive(Configuration configuration, Span sourceVectors, Span destPixels, PixelConversionModifiers modifiers)
+ public override void FromVector4Destructive(Configuration configuration, Span sourceVectors, Span destinationPixels, PixelConversionModifiers modifiers)
{
- Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, modifiers.Remove(PixelConversionModifiers.Scale | PixelConversionModifiers.Premultiply));
+ Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destinationPixels, modifiers.Remove(PixelConversionModifiers.Scale | PixelConversionModifiers.Premultiply));
}
///
@@ -55,13 +54,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Argb32 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Argb32 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -73,13 +72,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Bgra32 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Bgra32 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -91,13 +90,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref L8 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -109,13 +108,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref L16 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -127,13 +126,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToLa16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToLa16(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref La16 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -145,13 +144,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToLa32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToLa32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref La32 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -163,13 +162,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -181,13 +180,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgba32 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgba32 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -199,13 +198,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgb48 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -217,13 +216,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgba64 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -235,13 +234,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -252,14 +251,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
}
///
- internal override void From(
+ public override void From(
Configuration configuration,
ReadOnlySpan sourcePixels,
Span destinationPixels)
{
PixelOperations.Instance.ToBgr24(configuration, sourcePixels, destinationPixels);
}
-
}
}
}
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs
index 222ba8f6e..58a68bd03 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs
@@ -11,7 +11,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-
namespace SixLabors.ImageSharp.PixelFormats
{
///
@@ -25,27 +24,27 @@ namespace SixLabors.ImageSharp.PixelFormats
internal class PixelOperations : PixelOperations
{
///
- internal override void FromBgra32(Configuration configuration, ReadOnlySpan source, Span destPixels)
+ public override void FromBgra32(Configuration configuration, ReadOnlySpan source, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
- source.CopyTo(destPixels);
+ source.CopyTo(destinationPixels);
}
///
- internal override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
- sourcePixels.CopyTo(destPixels);
+ sourcePixels.CopyTo(destinationPixels);
}
///
- public override void FromVector4Destructive(Configuration configuration, Span sourceVectors, Span destPixels, PixelConversionModifiers modifiers)
+ public override void FromVector4Destructive(Configuration configuration, Span sourceVectors, Span destinationPixels, PixelConversionModifiers modifiers)
{
- Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, modifiers.Remove(PixelConversionModifiers.Scale));
+ Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destinationPixels, modifiers.Remove(PixelConversionModifiers.Scale));
}
///
@@ -54,13 +53,13 @@ namespace SixLabors.ImageSharp.PixelFormats
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale));
}
///
- internal override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -70,13 +69,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void FromRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void FromRgba32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -85,13 +84,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
}
///
- internal override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -101,13 +100,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void FromArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void FromArgb32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref uint sourceRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels));
- ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destPixels));
+ ref uint destRef = ref Unsafe.As(ref MemoryMarshal.GetReference(destinationPixels));
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -117,13 +116,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgr24(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -135,13 +134,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToL8(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref L8 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -153,13 +152,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToL16(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref L16 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -171,13 +170,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToLa16(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToLa16(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref La16 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -189,13 +188,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToLa32(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToLa32(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref La32 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -207,13 +206,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgb24(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -225,13 +224,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgb48(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgb48 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -243,13 +242,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToRgba64(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Rgba64 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -261,13 +260,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
///
- internal override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
- ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destPixels);
+ ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels);
for (int i = 0; i < sourcePixels.Length; i++)
{
@@ -278,14 +277,13 @@ namespace SixLabors.ImageSharp.PixelFormats
}
}
///
- internal override void From(
+ public override void From(
Configuration configuration,
ReadOnlySpan sourcePixels,
Span destinationPixels)
{
PixelOperations.Instance.ToBgra32(configuration, sourcePixels, destinationPixels);
}
-
}
}
}
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra5551.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra5551.PixelOperations.Generated.cs
index ad157b601..4def59ea1 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra5551.PixelOperations.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra5551.PixelOperations.Generated.cs
@@ -24,32 +24,32 @@ namespace SixLabors.ImageSharp.PixelFormats
internal class PixelOperations : PixelOperations
{
///
- internal override void FromBgra5551(Configuration configuration, ReadOnlySpan source, Span destPixels)
+ public override void FromBgra5551(Configuration configuration, ReadOnlySpan source, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
- source.CopyTo(destPixels);
+ source.CopyTo(destinationPixels);
}
///
- internal override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destPixels)
+ public override void ToBgra5551(Configuration configuration, ReadOnlySpan sourcePixels, Span destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
- Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
+ Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
- sourcePixels.CopyTo(destPixels);
+ sourcePixels.CopyTo(destinationPixels);
}
///