diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.Factories.cs similarity index 91% rename from src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs rename to src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.Factories.cs index aeef84c0..609ae479 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapperFactory{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.Factories.cs @@ -1,16 +1,11 @@ using System; using System.Numerics; -using ComputeSharp.D2D1.Descriptors; using ComputeSharp.D2D1.Shaders.Interop.Factories; namespace ComputeSharp.D2D1.Interop; -/// -/// Provides built-in transform mapper factories for common transform mapping operations. -/// -/// The type of D2D1 pixel shader associated to the transform mapper. -public static class D2D1TransformMapperFactory - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor +/// +partial class D2D1TransformMapper { /// /// Creates an instance for an inflate transform. @@ -40,6 +35,7 @@ public static class D2D1TransformMapperFactory /// /// The input instance to retrieve the inflate amount to use (applies to all edges of the input area). /// The resulting instance for an inflate transform. + /// Thrown if is . public static D2D1TransformMapper Inflate(Accessor accessor) { default(ArgumentNullException).ThrowIfNull(accessor); @@ -74,6 +70,7 @@ public static class D2D1TransformMapperFactory /// /// The input instance to retrieve the transformation matrix to use. /// The resulting instance for an affine transform. + /// Thrown if is . public static D2D1TransformMapper Transform(Accessor accessor) { default(ArgumentNullException).ThrowIfNull(accessor); diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs index 6b5f4d19..42365ebe 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1TransformMapper{T}.cs @@ -86,7 +86,7 @@ namespace ComputeSharp.D2D1.Interop; /// /// This interface is implemented by ComputeSharp.D2D1, and it can be used through the APIs in , in several ways. /// That is, consumers can either implement a type inheriting from to implement their own fully customized transform -/// mapping logic, or they can use the helper methods exposed by to easily retrieve ready to use transforms. +/// mapping logic, or they can use the helper methods exposed by to easily retrieve ready to use transforms. /// /// /// A CCW (COM callable wrapper, see ) is also available for all @@ -94,7 +94,7 @@ namespace ComputeSharp.D2D1.Interop; /// interface, and this can then be passed to an existing D2D1 effect instance. /// /// -public abstract unsafe class D2D1TransformMapper : ICustomQueryInterface, ID2D1TransformMapperInterop +public abstract unsafe partial class D2D1TransformMapper : ICustomQueryInterface, ID2D1TransformMapperInterop where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor { /// diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs index 33c15902..950ee957 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1AffineTransformMapper{T}.cs @@ -130,9 +130,9 @@ internal abstract class D2D1AffineTransformMapper : D2D1TransformMapper { /// - /// Gets the instance to get the dynamic affine transform matrix. + /// Gets the instance to get the dynamic affine transform matrix. /// - public required D2D1TransformMapperFactory.Accessor Accessor { get; init; } + public required Accessor Accessor { get; init; } /// protected override Matrix3x2 GetParameters(D2D1DrawInfoUpdateContext drawInfoUpdateContext) diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs index ba955962..5658db2c 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/Factories/D2D1InflateTransformMapper{T}.cs @@ -79,9 +79,9 @@ internal abstract class D2D1InflateTransformMapper : D2D1TransformMapper { /// - /// Gets the instance to get the dynamic inflate amount. + /// Gets the instance to get the dynamic inflate amount. /// - public required D2D1TransformMapperFactory.Accessor Accessor { get; init; } + public required Accessor Accessor { get; init; } /// protected override (int Left, int Top, int Right, int Bottom) GetParameters(D2D1DrawInfoUpdateContext drawInfoUpdateContext) @@ -98,9 +98,9 @@ internal abstract class D2D1InflateTransformMapper : D2D1TransformMapper { /// - /// Gets the instance to get the dynamic inflate LTRB amount. + /// Gets the instance to get the dynamic inflate LTRB amount. /// - public required D2D1TransformMapperFactory.Accessor<(int, int, int, int)> Accessor { get; init; } + public required Accessor<(int, int, int, int)> Accessor { get; init; } /// protected override (int Left, int Top, int Right, int Bottom) GetParameters(D2D1DrawInfoUpdateContext drawInfoUpdateContext) diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs index 255bebd5..b934c4ab 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs @@ -20,7 +20,7 @@ public partial class D2D1TransformMapperTests [TestMethod] public unsafe void VerifyInterfaces() { - D2D1TransformMapper transformMapper = D2D1TransformMapperFactory.Inflate(4); + D2D1TransformMapper transformMapper = D2D1TransformMapper.Inflate(4); using ComPtr unknown = default; using ComPtr transformMapper2 = default; @@ -58,7 +58,7 @@ public partial class D2D1TransformMapperTests D2D1PixelShaderEffect.RegisterForD2D1Factory1(d2D1Factory2.Get(), out _); - D2D1TransformMapper transformMapper = D2D1TransformMapperFactory.Inflate(4); + D2D1TransformMapper transformMapper = D2D1TransformMapper.Inflate(4); using ComPtr transformMapper2 = default; @@ -99,7 +99,7 @@ public partial class D2D1TransformMapperTests [TestMethod] public unsafe void VerifyManagedWrapperRetrieval() { - D2D1TransformMapper transformMapper = D2D1TransformMapperFactory.Inflate(4); + D2D1TransformMapper transformMapper = D2D1TransformMapper.Inflate(4); using ComPtr unknown = default; using ComPtr transformMapperInternal = default; @@ -139,7 +139,7 @@ public partial class D2D1TransformMapperTests IUnknown** transformMapperUnknown, out GCHandle transformMapperHandle) { - D2D1TransformMapper transformMapper = D2D1TransformMapperFactory.Inflate(4); + D2D1TransformMapper transformMapper = D2D1TransformMapper.Inflate(4); Guid uuidOfTransformMapper = new("02E6D48D-B892-4FBC-AA54-119203BAB802"); diff --git a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs index 255fb506..84b6d464 100644 --- a/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs +++ b/tests/ComputeSharp.D2D1.Tests/Effects/BokehBlurEffect.cs @@ -481,7 +481,7 @@ public sealed partial class BokehBlurEffect /// /// The for the shader. /// - public static D2D1TransformMapper Transform { get; } = D2D1TransformMapperFactory.Inflate(static (in Shader shader) => (0, shader.kernelLength, 0, shader.kernelLength)); + public static D2D1TransformMapper Transform { get; } = D2D1TransformMapper.Inflate(static (in Shader shader) => (0, shader.kernelLength, 0, shader.kernelLength)); /// /// Kernel for the vertical convolution pass for real or imaginary components. @@ -528,7 +528,7 @@ public sealed partial class BokehBlurEffect /// /// The for the shader. /// - public static D2D1TransformMapper Transform { get; } = D2D1TransformMapperFactory.Inflate(static (in Shader shader) => (shader.kernelLength, 0, shader.kernelLength, 0)); + public static D2D1TransformMapper Transform { get; } = D2D1TransformMapper.Inflate(static (in Shader shader) => (shader.kernelLength, 0, shader.kernelLength, 0)); /// /// Kernel for the horizontal convolution pass. diff --git a/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs b/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs index 3086cc5b..52b42dee 100644 --- a/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/EffectsTests.cs @@ -49,7 +49,7 @@ public class EffectsTests { D2D1TestRunner.RunAndCompareShader( new PixelateEffect(new PixelateEffect.Constants(1280, 840, 16)), - D2D1TransformMapperFactory.Inflate(16), + D2D1TransformMapper.Inflate(16), "Landscape.png", "Landscape_Pixelate.png"); }