diff --git a/sources/Interop/D2D1/um/d2d1/D2D1.cs b/sources/Interop/D2D1/um/d2d1/D2D1.cs index 86c61a31d2..d769af2f80 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1.cs @@ -14,6 +14,20 @@ public static unsafe partial class D2D1 [return: NativeTypeName("HRESULT")] public static extern int D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, [NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("const D2D1_FACTORY_OPTIONS *")] D2D1_FACTORY_OPTIONS* pFactoryOptions, [NativeTypeName("void **")] void** ppIFactory); + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1MakeRotateMatrix", ExactSpelling = true)] + public static extern void D2D1MakeRotateMatrix([NativeTypeName("FLOAT")] float angle, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F center, [NativeTypeName("D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1MakeSkewMatrix", ExactSpelling = true)] + public static extern void D2D1MakeSkewMatrix([NativeTypeName("FLOAT")] float angleX, [NativeTypeName("FLOAT")] float angleY, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F center, [NativeTypeName("D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1IsMatrixInvertible", ExactSpelling = true)] + [return: NativeTypeName("BOOL")] + public static extern int D2D1IsMatrixInvertible([NativeTypeName("const D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1InvertMatrix", ExactSpelling = true)] + [return: NativeTypeName("BOOL")] + public static extern int D2D1InvertMatrix([NativeTypeName("D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); + [return: NativeTypeName("HRESULT")] public static int D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, [NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("void **")] void** factory) { diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_ARC_SEGMENT.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_ARC_SEGMENT.Manual.cs index ed09c196ba..9308f45b2c 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_ARC_SEGMENT.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_ARC_SEGMENT.Manual.cs @@ -3,17 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_ARC_SEGMENT { - public D2D1_ARC_SEGMENT(in D2D_POINT_2F point, in D2D_SIZE_F size, float rotationAngle, D2D1_SWEEP_DIRECTION sweepDirection, D2D1_ARC_SIZE arcSize) + public D2D1_ARC_SEGMENT([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point, [NativeTypeName("const D2D1_SIZE_F &")] in D2D_SIZE_F size, [NativeTypeName("FLOAT")] float rotationAngle, D2D1_SWEEP_DIRECTION sweepDirection, D2D1_ARC_SIZE arcSize) { - this.point = point; - this.size = size; - this.rotationAngle = rotationAngle; - this.sweepDirection = sweepDirection; - this.arcSize = arcSize; + this = ArcSegment(point, size, rotationAngle, sweepDirection, arcSize); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_BEZIER_SEGMENT.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_BEZIER_SEGMENT.Manual.cs index c52b1fcb3a..7e980f46e4 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_BEZIER_SEGMENT.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_BEZIER_SEGMENT.Manual.cs @@ -3,15 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_BEZIER_SEGMENT { - public D2D1_BEZIER_SEGMENT(in D2D_POINT_2F point1, in D2D_POINT_2F point2, in D2D_POINT_2F point3) + public D2D1_BEZIER_SEGMENT([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point1, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point2, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point3) { - this.point1 = point1; - this.point2 = point2; - this.point3 = point3; + this = BezierSegment(point1, point2, point3); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_BRUSH_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_BRUSH_PROPERTIES.Manual.cs index d8e6064480..2cd601f8e1 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_BRUSH_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_BRUSH_PROPERTIES.Manual.cs @@ -3,17 +3,19 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_BITMAP_INTERPOLATION_MODE; +using static TerraFX.Interop.D2D1_EXTEND_MODE; + namespace TerraFX.Interop { public partial struct D2D1_BITMAP_BRUSH_PROPERTIES { - public static readonly D2D1_BITMAP_BRUSH_PROPERTIES DEFAULT = new D2D1_BITMAP_BRUSH_PROPERTIES(D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR); + public static readonly D2D1_BITMAP_BRUSH_PROPERTIES DEFAULT = new D2D1_BITMAP_BRUSH_PROPERTIES(D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_CLAMP, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR); - public D2D1_BITMAP_BRUSH_PROPERTIES(D2D1_EXTEND_MODE extendModeX, D2D1_EXTEND_MODE extendModeY, D2D1_BITMAP_INTERPOLATION_MODE interpolationMode) + public D2D1_BITMAP_BRUSH_PROPERTIES(D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR) { - this.extendModeX = extendModeX; - this.extendModeY = extendModeY; - this.interpolationMode = interpolationMode; + this = BitmapBrushProperties(extendModeX, extendModeY, interpolationMode); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_PROPERTIES.Manual.cs index e944426dfd..65f4980056 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_BITMAP_PROPERTIES.Manual.cs @@ -3,17 +3,17 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_BITMAP_PROPERTIES { - public static readonly D2D1_BITMAP_PROPERTIES DEFAULT = new D2D1_BITMAP_PROPERTIES(D2D1_PIXEL_FORMAT.DEFAULT, 96.0f, 96.0f); + public static readonly D2D1_BITMAP_PROPERTIES DEFAULT = new D2D1_BITMAP_PROPERTIES(default, 96.0f, 96.0f); - public D2D1_BITMAP_PROPERTIES(D2D1_PIXEL_FORMAT pixelFormat, float dpiX, float dpiY) + public D2D1_BITMAP_PROPERTIES([NativeTypeName("const D2D1_PIXEL_FORMAT &")] in D2D1_PIXEL_FORMAT pixelFormat = default, [NativeTypeName("FLOAT")] float dpiX = 96.0f, [NativeTypeName("FLOAT")] float dpiY = 96.0f) { - this.pixelFormat = pixelFormat; - this.dpiX = dpiX; - this.dpiY = dpiY; + this = BitmapProperties(pixelFormat, dpiX, dpiY); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_BRUSH_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_BRUSH_PROPERTIES.Manual.cs index 34114457fc..0fe588f509 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_BRUSH_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_BRUSH_PROPERTIES.Manual.cs @@ -4,6 +4,7 @@ // Original source is Copyright © Microsoft. All rights reserved. using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1; namespace TerraFX.Interop { @@ -11,10 +12,13 @@ public partial struct D2D1_BRUSH_PROPERTIES { public static readonly D2D1_BRUSH_PROPERTIES DEFAULT = new D2D1_BRUSH_PROPERTIES(1.0f, D2D_MATRIX_3X2_F.Identity); - public D2D1_BRUSH_PROPERTIES(float opacity, in D2D_MATRIX_3X2_F transform) + public D2D1_BRUSH_PROPERTIES([NativeTypeName("FLOAT")] float opacity = 1.0f) : this(opacity, IdentityMatrix) { - this.opacity = opacity; - this.transform = transform; + } + + public D2D1_BRUSH_PROPERTIES([NativeTypeName("FLOAT"), Optional, DefaultParameterValue(1.0f)] float opacity, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F transform) + { + this = BrushProperties(opacity, transform); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_DRAWING_STATE_DESCRIPTION.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_DRAWING_STATE_DESCRIPTION.Manual.cs index 5622ae8e22..daed75ba0d 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_DRAWING_STATE_DESCRIPTION.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_DRAWING_STATE_DESCRIPTION.Manual.cs @@ -3,19 +3,25 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_TEXT_ANTIALIAS_MODE; + namespace TerraFX.Interop { public partial struct D2D1_DRAWING_STATE_DESCRIPTION { - public static readonly D2D1_DRAWING_STATE_DESCRIPTION DEFAULT = new D2D1_DRAWING_STATE_DESCRIPTION(D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE.D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, 0ul, 0ul, D2D_MATRIX_3X2_F.Identity); + public static readonly D2D1_DRAWING_STATE_DESCRIPTION DEFAULT = new D2D1_DRAWING_STATE_DESCRIPTION(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, 0, 0, IdentityMatrix); + + public D2D1_DRAWING_STATE_DESCRIPTION(D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, [NativeTypeName("D2D1_TAG")] ulong tag1 = 0, [NativeTypeName("D2D1_TAG")] ulong tag2 = 0) + : this(antialiasMode, textAntialiasMode, tag1, tag2, IdentityMatrix) + { + } - public D2D1_DRAWING_STATE_DESCRIPTION(D2D1_ANTIALIAS_MODE antialiasMode, D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode, ulong tag1, ulong tag2, D2D_MATRIX_3X2_F transform) + public D2D1_DRAWING_STATE_DESCRIPTION([Optional] D2D1_ANTIALIAS_MODE antialiasMode, [Optional] D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode, [NativeTypeName("D2D1_TAG"), Optional] ulong tag1, [NativeTypeName("D2D1_TAG"), Optional] ulong tag2, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] D2D_MATRIX_3X2_F transform) { - this.antialiasMode = antialiasMode; - this.textAntialiasMode = textAntialiasMode; - this.tag1 = tag1; - this.tag2 = tag2; - this.transform = transform; + this = DrawingStateDescription(antialiasMode, textAntialiasMode, tag1, tag2, transform); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_ELLIPSE.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_ELLIPSE.Manual.cs index f4c169bc33..620b6b9476 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_ELLIPSE.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_ELLIPSE.Manual.cs @@ -3,15 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_ELLIPSE { - public D2D1_ELLIPSE(in D2D_POINT_2F center, float radiusX, float radiusY) + public D2D1_ELLIPSE([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F center, [NativeTypeName("FLOAT")] float radiusX, [NativeTypeName("FLOAT")] float radiusY) { - point = center; - this.radiusX = radiusX; - this.radiusY = radiusY; + this = Ellipse(center, radiusX, radiusY); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_GRADIENT_STOP.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_GRADIENT_STOP.Manual.cs index 9138cab4be..11ca50806a 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_GRADIENT_STOP.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_GRADIENT_STOP.Manual.cs @@ -3,14 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_GRADIENT_STOP { - public D2D1_GRADIENT_STOP(float position, in DXGI_RGBA color) + public D2D1_GRADIENT_STOP([NativeTypeName("FLOAT")] float position, [NativeTypeName("const D2D1_COLOR_F &")] in DXGI_RGBA color) { - this.position = position; - this.color = color; + this = GradientStop(position, color); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_HWND_RENDER_TARGET_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_HWND_RENDER_TARGET_PROPERTIES.Manual.cs index 9d57d00506..f150da753d 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_HWND_RENDER_TARGET_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_HWND_RENDER_TARGET_PROPERTIES.Manual.cs @@ -4,20 +4,16 @@ // Original source is Copyright © Microsoft. All rights reserved. using System; +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_PRESENT_OPTIONS; namespace TerraFX.Interop { public partial struct D2D1_HWND_RENDER_TARGET_PROPERTIES { - public D2D1_HWND_RENDER_TARGET_PROPERTIES(IntPtr hwnd, D2D_SIZE_U pixelSize, D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS.D2D1_PRESENT_OPTIONS_NONE) - { - this.hwnd = hwnd; - this.pixelSize = pixelSize; - this.presentOptions = presentOptions; - } - - public D2D1_HWND_RENDER_TARGET_PROPERTIES(IntPtr hwnd, D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS.D2D1_PRESENT_OPTIONS_NONE) : this(hwnd, new D2D_SIZE_U(0, 0), presentOptions) + public D2D1_HWND_RENDER_TARGET_PROPERTIES([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U pixelSize = default, D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS_NONE) { + this = HwndRenderTargetProperties(hwnd, pixelSize, presentOptions); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_LAYER_PARAMETERS.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_LAYER_PARAMETERS.Manual.cs index 4e6711b5d4..6b31de0b0a 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_LAYER_PARAMETERS.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_LAYER_PARAMETERS.Manual.cs @@ -3,21 +3,35 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_LAYER_OPTIONS; + namespace TerraFX.Interop { public unsafe partial struct D2D1_LAYER_PARAMETERS { - public static readonly D2D1_LAYER_PARAMETERS DEFAULT = new D2D1_LAYER_PARAMETERS(D2D_RECT_F.Infinite, null, D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D_MATRIX_3X2_F.Identity, 1.0f, null, D2D1_LAYER_OPTIONS.D2D1_LAYER_OPTIONS_NONE); + public static readonly D2D1_LAYER_PARAMETERS DEFAULT = new D2D1_LAYER_PARAMETERS(InfiniteRect, null, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, IdentityMatrix, 1.0f, null, D2D1_LAYER_OPTIONS_NONE); + + public D2D1_LAYER_PARAMETERS([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + : this(InfiniteRect, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions) + { + } + + public D2D1_LAYER_PARAMETERS([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + : this(contentBounds, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions) + { + } + + public D2D1_LAYER_PARAMETERS([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + : this(InfiniteRect, geometricMask, maskAntialiasMode, maskTransform, opacity, opacityBrush, layerOptions) + { + } - public D2D1_LAYER_PARAMETERS(D2D_RECT_F contentBounds, ID2D1Geometry* geometricMask, D2D1_ANTIALIAS_MODE maskAntialiasMode, D2D_MATRIX_3X2_F maskTransform, float opacity, ID2D1Brush* opacityBrush, D2D1_LAYER_OPTIONS layerOptions) + public D2D1_LAYER_PARAMETERS([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) { - this.contentBounds = contentBounds; - this.geometricMask = geometricMask; - this.maskAntialiasMode = maskAntialiasMode; - this.maskTransform = maskTransform; - this.opacity = opacity; - this.opacityBrush = opacityBrush; - this.layerOptions = layerOptions; + this = LayerParameters(contentBounds, geometricMask, maskAntialiasMode, maskTransform, opacity, opacityBrush, layerOptions); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES.Manual.cs index 7d50acfaca..f523f9974e 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES.Manual.cs @@ -3,14 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES { - public D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES(in D2D_POINT_2F startPoint, in D2D_POINT_2F endPoint) + public D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F startPoint, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F endPoint) { - this.startPoint = startPoint; - this.endPoint = endPoint; + this = LinearGradientBrushProperties(startPoint, endPoint); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_QUADRATIC_BEZIER_SEGMENT.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_QUADRATIC_BEZIER_SEGMENT.Manual.cs index b1f90ed5cd..9d4e67a0d7 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_QUADRATIC_BEZIER_SEGMENT.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_QUADRATIC_BEZIER_SEGMENT.Manual.cs @@ -3,14 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_QUADRATIC_BEZIER_SEGMENT { - public D2D1_QUADRATIC_BEZIER_SEGMENT(in D2D_POINT_2F point1, in D2D_POINT_2F point2) + public D2D1_QUADRATIC_BEZIER_SEGMENT([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point1, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point2) { - this.point1 = point1; - this.point2 = point2; + this = QuadraticBezierSegment(point1, point2); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES.Manual.cs index 34bce0bdf8..e8c9292c06 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES.Manual.cs @@ -3,16 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES { - public D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES(in D2D_POINT_2F center, in D2D_POINT_2F gradientOriginOffset, float radiusX, float radiusY) + public D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F center, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F gradientOriginOffset, [NativeTypeName("FLOAT")] float radiusX, [NativeTypeName("FLOAT")] float radiusY) { - this.center = center; - this.gradientOriginOffset = gradientOriginOffset; - this.radiusX = radiusX; - this.radiusY = radiusY; + this = RadialGradientBrushProperties(center, gradientOriginOffset, radiusX, radiusY); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_RENDER_TARGET_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_RENDER_TARGET_PROPERTIES.Manual.cs index 5ab2d5b33c..95f89102c9 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_RENDER_TARGET_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_RENDER_TARGET_PROPERTIES.Manual.cs @@ -3,20 +3,20 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_FEATURE_LEVEL; +using static TerraFX.Interop.D2D1_RENDER_TARGET_TYPE; +using static TerraFX.Interop.D2D1_RENDER_TARGET_USAGE; + namespace TerraFX.Interop { public partial struct D2D1_RENDER_TARGET_PROPERTIES { - public static readonly D2D1_RENDER_TARGET_PROPERTIES DEFAULT = new D2D1_RENDER_TARGET_PROPERTIES(D2D1_RENDER_TARGET_TYPE.D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1_PIXEL_FORMAT.DEFAULT, 0.0f, 0.0f, D2D1_RENDER_TARGET_USAGE.D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL.D2D1_FEATURE_LEVEL_DEFAULT); + public static readonly D2D1_RENDER_TARGET_PROPERTIES DEFAULT = new D2D1_RENDER_TARGET_PROPERTIES(D2D1_RENDER_TARGET_TYPE_DEFAULT, default, 0.0f, 0.0f, D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_DEFAULT); - public D2D1_RENDER_TARGET_PROPERTIES(D2D1_RENDER_TARGET_TYPE type, D2D1_PIXEL_FORMAT pixelFormat, float dpiX, float dpiY, D2D1_RENDER_TARGET_USAGE usage, D2D1_FEATURE_LEVEL minLevel) + public D2D1_RENDER_TARGET_PROPERTIES(D2D1_RENDER_TARGET_TYPE type = D2D1_RENDER_TARGET_TYPE_DEFAULT, [NativeTypeName("const D2D1_PIXEL_FORMAT &")] in D2D1_PIXEL_FORMAT pixelFormat = default, [NativeTypeName("FLOAT")] float dpiX = 0.0f, [NativeTypeName("FLOAT")] float dpiY = 0.0f, D2D1_RENDER_TARGET_USAGE usage = D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL minLevel = D2D1_FEATURE_LEVEL_DEFAULT) { - this.type = type; - this.pixelFormat = pixelFormat; - this.dpiX = dpiX; - this.dpiY = dpiY; - this.usage = usage; - this.minLevel = minLevel; + this = RenderTargetProperties(type, pixelFormat, dpiX, dpiY, usage, minLevel); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_ROUNDED_RECT.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_ROUNDED_RECT.Manual.cs index 429a1dd276..0fc1b47bd8 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_ROUNDED_RECT.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_ROUNDED_RECT.Manual.cs @@ -3,15 +3,15 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_ROUNDED_RECT { - public D2D1_ROUNDED_RECT(in D2D_RECT_F rect, float radiusX, float radiusY) + public D2D1_ROUNDED_RECT([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F rect, [NativeTypeName("FLOAT")] float radiusX, [NativeTypeName("FLOAT")] float radiusY) { - this.rect = rect; - this.radiusX = radiusX; - this.radiusY = radiusY; + this = RoundedRect(rect, radiusX, radiusY); } } } diff --git a/sources/Interop/D2D1/um/d2d1/D2D1_STROKE_STYLE_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1/D2D1_STROKE_STYLE_PROPERTIES.Manual.cs index 1cea8b2e16..b4460c1658 100644 --- a/sources/Interop/D2D1/um/d2d1/D2D1_STROKE_STYLE_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1/D2D1_STROKE_STYLE_PROPERTIES.Manual.cs @@ -3,21 +3,20 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_CAP_STYLE; +using static TerraFX.Interop.D2D1_DASH_STYLE; +using static TerraFX.Interop.D2D1_LINE_JOIN; + namespace TerraFX.Interop { public partial struct D2D1_STROKE_STYLE_PROPERTIES { - public static readonly D2D1_STROKE_STYLE_PROPERTIES DEFAULT = new D2D1_STROKE_STYLE_PROPERTIES(D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN.D2D1_LINE_JOIN_MITER, 10.0f, D2D1_DASH_STYLE.D2D1_DASH_STYLE_SOLID, 0.0f); + public static readonly D2D1_STROKE_STYLE_PROPERTIES DEFAULT = new D2D1_STROKE_STYLE_PROPERTIES(D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN_MITER, 10.0f, D2D1_DASH_STYLE_SOLID, 0.0f); - public D2D1_STROKE_STYLE_PROPERTIES(D2D1_CAP_STYLE startCap, D2D1_CAP_STYLE endCap, D2D1_CAP_STYLE dashCap, D2D1_LINE_JOIN lineJoin, float miterLimit, D2D1_DASH_STYLE dashStyle, float dashOffset) + public D2D1_STROKE_STYLE_PROPERTIES(D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER, [NativeTypeName("FLOAT")] float miterLimit = 10.0f, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID, [NativeTypeName("FLOAT")] float dashOffset = 0.0f) { - this.startCap = startCap; - this.endCap = endCap; - this.dashCap = dashCap; - this.lineJoin = lineJoin; - this.miterLimit = miterLimit; - this.dashStyle = dashStyle; - this.dashOffset = dashOffset; + this = StrokeStyleProperties(startCap, endCap, dashCap, lineJoin, miterLimit, dashStyle, dashOffset); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1.cs index 2f6d3f8d63..2a6937320f 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1.cs @@ -20,5 +20,16 @@ public static unsafe partial class D2D1 [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1ConvertColorSpace", ExactSpelling = true)] [return: NativeTypeName("D2D1_COLOR_F")] public static extern DXGI_RGBA D2D1ConvertColorSpace(D2D1_COLOR_SPACE sourceColorSpace, D2D1_COLOR_SPACE destinationColorSpace, [NativeTypeName("const D2D1_COLOR_F *")] DXGI_RGBA* color); + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1SinCos", ExactSpelling = true)] + public static extern void D2D1SinCos([NativeTypeName("FLOAT")] float angle, [NativeTypeName("FLOAT *")] float* s, [NativeTypeName("FLOAT *")] float* c); + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1Tan", ExactSpelling = true)] + [return: NativeTypeName("FLOAT")] + public static extern float D2D1Tan([NativeTypeName("FLOAT")] float angle); + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1Vec3Length", ExactSpelling = true)] + [return: NativeTypeName("FLOAT")] + public static extern float D2D1Vec3Length([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y, [NativeTypeName("FLOAT")] float z); } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_BRUSH_PROPERTIES1.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_BRUSH_PROPERTIES1.Manual.cs index 5adcf11e5e..f11c689dc1 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_BRUSH_PROPERTIES1.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_BRUSH_PROPERTIES1.Manual.cs @@ -3,17 +3,19 @@ // Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_EXTEND_MODE; +using static TerraFX.Interop.D2D1_INTERPOLATION_MODE; + namespace TerraFX.Interop { public partial struct D2D1_BITMAP_BRUSH_PROPERTIES1 { - public static readonly D2D1_BITMAP_BRUSH_PROPERTIES1 DEFAULT = new D2D1_BITMAP_BRUSH_PROPERTIES1(D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE.D2D1_INTERPOLATION_MODE_LINEAR); + public static readonly D2D1_BITMAP_BRUSH_PROPERTIES1 DEFAULT = new D2D1_BITMAP_BRUSH_PROPERTIES1(D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE_LINEAR); - public D2D1_BITMAP_BRUSH_PROPERTIES1(D2D1_EXTEND_MODE extendModeX, D2D1_EXTEND_MODE extendModeY, D2D1_INTERPOLATION_MODE interpolationMode) + public D2D1_BITMAP_BRUSH_PROPERTIES1(D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR) { - this.extendModeX = extendModeX; - this.extendModeY = extendModeY; - this.interpolationMode = interpolationMode; + this = BitmapBrushProperties1(extendModeX, extendModeY, interpolationMode); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_PROPERTIES1.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_PROPERTIES1.Manual.cs index 720dd41afa..2e2ee0de1c 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_PROPERTIES1.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_BITMAP_PROPERTIES1.Manual.cs @@ -3,19 +3,18 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_BITMAP_OPTIONS; + namespace TerraFX.Interop { public unsafe partial struct D2D1_BITMAP_PROPERTIES1 { - public static readonly D2D1_BITMAP_PROPERTIES1 DEFAULT = new D2D1_BITMAP_PROPERTIES1(D2D1_BITMAP_OPTIONS.D2D1_BITMAP_OPTIONS_NONE, D2D1_PIXEL_FORMAT.DEFAULT, 96.0f, 96.0f, null); + public static readonly D2D1_BITMAP_PROPERTIES1 DEFAULT = new D2D1_BITMAP_PROPERTIES1(D2D1_BITMAP_OPTIONS_NONE, default, 96.0f, 96.0f, null); - public D2D1_BITMAP_PROPERTIES1(D2D1_BITMAP_OPTIONS bitmapOptions, D2D1_PIXEL_FORMAT pixelFormat, float dpiX, float dpiY, ID2D1ColorContext* colorContext) + public D2D1_BITMAP_PROPERTIES1(D2D1_BITMAP_OPTIONS bitmapOptions = D2D1_BITMAP_OPTIONS_NONE, [NativeTypeName("const D2D1_PIXEL_FORMAT")] D2D1_PIXEL_FORMAT pixelFormat = default, [NativeTypeName("FLOAT")] float dpiX = 96.0f, [NativeTypeName("FLOAT")] float dpiY = 96.0f, ID2D1ColorContext* colorContext = null) { - this.bitmapOptions = bitmapOptions; - this.pixelFormat = pixelFormat; - this.dpiX = dpiX; - this.dpiY = dpiY; - this.colorContext = colorContext; + this = BitmapProperties1(bitmapOptions, pixelFormat, dpiX, dpiY, colorContext); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_CREATION_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_CREATION_PROPERTIES.Manual.cs index 3d3955dfc5..a220cfd75a 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_CREATION_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_CREATION_PROPERTIES.Manual.cs @@ -3,15 +3,15 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_CREATION_PROPERTIES { public D2D1_CREATION_PROPERTIES(D2D1_THREADING_MODE threadingMode, D2D1_DEBUG_LEVEL debugLevel, D2D1_DEVICE_CONTEXT_OPTIONS options) { - this.threadingMode = threadingMode; - this.debugLevel = debugLevel; - this.options = options; + this = CreationProperties(threadingMode, debugLevel, options); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_DRAWING_STATE_DESCRIPTION1.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_DRAWING_STATE_DESCRIPTION1.Manual.cs index 1cb9bfa971..0389d46a98 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_DRAWING_STATE_DESCRIPTION1.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_DRAWING_STATE_DESCRIPTION1.Manual.cs @@ -3,25 +3,27 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_PRIMITIVE_BLEND; +using static TerraFX.Interop.D2D1_TEXT_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_UNIT_MODE; + namespace TerraFX.Interop { public partial struct D2D1_DRAWING_STATE_DESCRIPTION1 { - public static readonly D2D1_DRAWING_STATE_DESCRIPTION1 DEFAULT = new D2D1_DRAWING_STATE_DESCRIPTION1(D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE.D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, 0, 0, D2D_MATRIX_3X2_F.Identity, D2D1_PRIMITIVE_BLEND.D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE.D2D1_UNIT_MODE_DIPS); + public static readonly D2D1_DRAWING_STATE_DESCRIPTION1 DEFAULT = new D2D1_DRAWING_STATE_DESCRIPTION1(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, 0, 0, D2D_MATRIX_3X2_F.Identity, D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE_DIPS); - public D2D1_DRAWING_STATE_DESCRIPTION1(D2D1_ANTIALIAS_MODE antialiasMode, D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode, ulong tag1, ulong tag2, D2D_MATRIX_3X2_F transform, D2D1_PRIMITIVE_BLEND primitiveBlend, D2D1_UNIT_MODE unitMode) + public D2D1_DRAWING_STATE_DESCRIPTION1(D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, [NativeTypeName("D2D1_TAG")] ulong tag1 = 0, [NativeTypeName("D2D1_TAG")] ulong tag2 = 0, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS) + : this(antialiasMode, textAntialiasMode, tag1, tag2, IdentityMatrix, primitiveBlend, unitMode) { - this.antialiasMode = antialiasMode; - this.textAntialiasMode = textAntialiasMode; - this.tag1 = tag1; - this.tag2 = tag2; - this.transform = transform; - this.primitiveBlend = primitiveBlend; - this.unitMode = unitMode; } - public D2D1_DRAWING_STATE_DESCRIPTION1(D2D1_DRAWING_STATE_DESCRIPTION desc, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND.D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE.D2D1_UNIT_MODE_DIPS) : this(desc.antialiasMode, desc.textAntialiasMode, desc.tag1, desc.tag2, desc.transform, primitiveBlend, unitMode) + public D2D1_DRAWING_STATE_DESCRIPTION1([Optional] D2D1_ANTIALIAS_MODE antialiasMode, [Optional] D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode, [NativeTypeName("D2D1_TAG"), Optional] ulong tag1, [NativeTypeName("D2D1_TAG"), Optional] ulong tag2, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F transform, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS) { + this = DrawingStateDescription1(antialiasMode, textAntialiasMode, tag1, tag2, transform, primitiveBlend, unitMode); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_EFFECT_INPUT_DESCRIPTION.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_EFFECT_INPUT_DESCRIPTION.Manual.cs index dd77b9fc0a..6400690eef 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_EFFECT_INPUT_DESCRIPTION.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_EFFECT_INPUT_DESCRIPTION.Manual.cs @@ -3,15 +3,15 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public unsafe partial struct D2D1_EFFECT_INPUT_DESCRIPTION { - public D2D1_EFFECT_INPUT_DESCRIPTION(ID2D1Effect* effect, uint inputIndex, D2D_RECT_F inputRectangle) + public D2D1_EFFECT_INPUT_DESCRIPTION([NativeTypeName("ID2D1Effect *")] ID2D1Effect* effect, [NativeTypeName("UINT32")] uint inputIndex, [NativeTypeName("D2D1_RECT_F")] D2D_RECT_F inputRectangle) { - this.effect = effect; - this.inputIndex = inputIndex; - this.inputRectangle = inputRectangle; + this = EffectInputDescription(effect, inputIndex, inputRectangle); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_IMAGE_BRUSH_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_IMAGE_BRUSH_PROPERTIES.Manual.cs index 817d28d485..423c579469 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_IMAGE_BRUSH_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_IMAGE_BRUSH_PROPERTIES.Manual.cs @@ -3,16 +3,17 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_EXTEND_MODE; +using static TerraFX.Interop.D2D1_INTERPOLATION_MODE; + namespace TerraFX.Interop { public partial struct D2D1_IMAGE_BRUSH_PROPERTIES { - public D2D1_IMAGE_BRUSH_PROPERTIES(D2D_RECT_F sourceRectangle, D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE.D2D1_INTERPOLATION_MODE_LINEAR) + public D2D1_IMAGE_BRUSH_PROPERTIES([NativeTypeName("D2D1_RECT_F")] D2D_RECT_F sourceRectangle, D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR) { - this.sourceRectangle = sourceRectangle; - this.extendModeX = extendModeX; - this.extendModeY = extendModeY; - this.interpolationMode = interpolationMode; + this = ImageBrushProperties(sourceRectangle, extendModeX, extendModeY, interpolationMode); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_LAYER_PARAMETERS1.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_LAYER_PARAMETERS1.Manual.cs index e903c235ba..68068a2b70 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_LAYER_PARAMETERS1.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_LAYER_PARAMETERS1.Manual.cs @@ -3,21 +3,35 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_LAYER_OPTIONS1; + namespace TerraFX.Interop { public unsafe partial struct D2D1_LAYER_PARAMETERS1 { - public static readonly D2D1_LAYER_PARAMETERS1 DEFAULT = new D2D1_LAYER_PARAMETERS1(D2D_RECT_F.Infinite, null, D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D_MATRIX_3X2_F.Identity, 1.0f, null, D2D1_LAYER_OPTIONS1.D2D1_LAYER_OPTIONS1_NONE); + public static readonly D2D1_LAYER_PARAMETERS1 DEFAULT = new D2D1_LAYER_PARAMETERS1(InfiniteRect, null, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, IdentityMatrix, 1.0f, null, D2D1_LAYER_OPTIONS1_NONE); + + public D2D1_LAYER_PARAMETERS1([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + : this(InfiniteRect, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions) + { + } + + public D2D1_LAYER_PARAMETERS1([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + : this(contentBounds, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions) + { + } + + public D2D1_LAYER_PARAMETERS1([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + : this(InfiniteRect, geometricMask, maskAntialiasMode, maskTransform, opacity, opacityBrush, layerOptions) + { + } - public D2D1_LAYER_PARAMETERS1(D2D_RECT_F contentBounds, ID2D1Geometry* geometricMask, D2D1_ANTIALIAS_MODE maskAntialiasMode, D2D_MATRIX_3X2_F maskTransform, float opacity, ID2D1Brush* opacityBrush, D2D1_LAYER_OPTIONS1 layerOptions) + public D2D1_LAYER_PARAMETERS1([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) { - this.contentBounds = contentBounds; - this.geometricMask = geometricMask; - this.maskAntialiasMode = maskAntialiasMode; - this.maskTransform = maskTransform; - this.opacity = opacity; - this.opacityBrush = opacityBrush; - this.layerOptions = layerOptions; + this = LayerParameters1(contentBounds, geometricMask, maskAntialiasMode, maskTransform, opacity, opacityBrush, layerOptions); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_PRINT_CONTROL_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_PRINT_CONTROL_PROPERTIES.Manual.cs index c504ca4d55..6ebb041ed9 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_PRINT_CONTROL_PROPERTIES.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_PRINT_CONTROL_PROPERTIES.Manual.cs @@ -3,17 +3,19 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_COLOR_SPACE; +using static TerraFX.Interop.D2D1_PRINT_FONT_SUBSET_MODE; + namespace TerraFX.Interop { public partial struct D2D1_PRINT_CONTROL_PROPERTIES { - public static readonly D2D1_PRINT_CONTROL_PROPERTIES DEFAULT = new D2D1_PRINT_CONTROL_PROPERTIES(D2D1_PRINT_FONT_SUBSET_MODE.D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, 150.0f, D2D1_COLOR_SPACE.D2D1_COLOR_SPACE_SRGB); + public static readonly D2D1_PRINT_CONTROL_PROPERTIES DEFAULT = new D2D1_PRINT_CONTROL_PROPERTIES(D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, 150.0f, D2D1_COLOR_SPACE_SRGB); - public D2D1_PRINT_CONTROL_PROPERTIES(D2D1_PRINT_FONT_SUBSET_MODE fontSubset, float rasterDpi, D2D1_COLOR_SPACE colorSpace) + public D2D1_PRINT_CONTROL_PROPERTIES(D2D1_PRINT_FONT_SUBSET_MODE fontSubsetMode = D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, [NativeTypeName("FLOAT")] float rasterDpi = 150.0f, D2D1_COLOR_SPACE colorSpace = D2D1_COLOR_SPACE_SRGB) { - this.fontSubset = fontSubset; - rasterDPI = rasterDpi; - this.colorSpace = colorSpace; + this = PrintControlProperties(fontSubsetMode, rasterDpi, colorSpace); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_RENDERING_CONTROLS.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_RENDERING_CONTROLS.Manual.cs index 7253be79af..b31252a139 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_RENDERING_CONTROLS.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_RENDERING_CONTROLS.Manual.cs @@ -3,14 +3,15 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; + namespace TerraFX.Interop { public partial struct D2D1_RENDERING_CONTROLS { - public D2D1_RENDERING_CONTROLS(D2D1_BUFFER_PRECISION bufferPrecision, D2D_SIZE_U tileSize) + public D2D1_RENDERING_CONTROLS(D2D1_BUFFER_PRECISION bufferPrecision, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U tileSize) { - this.bufferPrecision = bufferPrecision; - this.tileSize = tileSize; + this = RenderingControls(bufferPrecision, tileSize); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1/D2D1_STROKE_STYLE_PROPERTIES1.Manual.cs b/sources/Interop/D2D1/um/d2d1_1/D2D1_STROKE_STYLE_PROPERTIES1.Manual.cs index cccdb88901..1584137011 100644 --- a/sources/Interop/D2D1/um/d2d1_1/D2D1_STROKE_STYLE_PROPERTIES1.Manual.cs +++ b/sources/Interop/D2D1/um/d2d1_1/D2D1_STROKE_STYLE_PROPERTIES1.Manual.cs @@ -3,22 +3,21 @@ // Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1; +using static TerraFX.Interop.D2D1_CAP_STYLE; +using static TerraFX.Interop.D2D1_DASH_STYLE; +using static TerraFX.Interop.D2D1_LINE_JOIN; +using static TerraFX.Interop.D2D1_STROKE_TRANSFORM_TYPE; + namespace TerraFX.Interop { public partial struct D2D1_STROKE_STYLE_PROPERTIES1 { - public static readonly D2D1_STROKE_STYLE_PROPERTIES1 DEFAULT = new D2D1_STROKE_STYLE_PROPERTIES1(D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN.D2D1_LINE_JOIN_MITER, 10.0f, D2D1_DASH_STYLE.D2D1_DASH_STYLE_SOLID, 0.0f, D2D1_STROKE_TRANSFORM_TYPE.D2D1_STROKE_TRANSFORM_TYPE_NORMAL); + public static readonly D2D1_STROKE_STYLE_PROPERTIES1 DEFAULT = new D2D1_STROKE_STYLE_PROPERTIES1(D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN_MITER, 10.0f, D2D1_DASH_STYLE_SOLID, 0.0f, D2D1_STROKE_TRANSFORM_TYPE_NORMAL); - public D2D1_STROKE_STYLE_PROPERTIES1(D2D1_CAP_STYLE startCap, D2D1_CAP_STYLE endCap, D2D1_CAP_STYLE dashCap, D2D1_LINE_JOIN lineJoin, float miterLimit, D2D1_DASH_STYLE dashStyle, float dashOffset, D2D1_STROKE_TRANSFORM_TYPE transformType) + public D2D1_STROKE_STYLE_PROPERTIES1(D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER, [NativeTypeName("FLOAT")] float miterLimit = 10.0f, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID, [NativeTypeName("FLOAT")] float dashOffset = 0.0f, D2D1_STROKE_TRANSFORM_TYPE transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL) { - this.startCap = startCap; - this.endCap = endCap; - this.dashCap = dashCap; - this.lineJoin = lineJoin; - this.miterLimit = miterLimit; - this.dashStyle = dashStyle; - this.dashOffset = dashOffset; - this.transformType = transformType; + this = StrokeStyleProperties1(startCap, endCap, dashCap, lineJoin, miterLimit, dashStyle, dashOffset, transformType); } } } diff --git a/sources/Interop/D2D1/um/d2d1_1helper/D2D1.Manual.cs b/sources/Interop/D2D1/um/d2d1_1helper/D2D1.Manual.cs new file mode 100644 index 0000000000..016719eeb3 --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_1helper/D2D1.Manual.cs @@ -0,0 +1,307 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_1helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_BITMAP_OPTIONS; +using static TerraFX.Interop.D2D1_BORDER_MODE; +using static TerraFX.Interop.D2D1_CAP_STYLE; +using static TerraFX.Interop.D2D1_COLOR_SPACE; +using static TerraFX.Interop.D2D1_DASH_STYLE; +using static TerraFX.Interop.D2D1_DPICOMPENSATION_PROP; +using static TerraFX.Interop.D2D1_EXTEND_MODE; +using static TerraFX.Interop.D2D1_INTERPOLATION_MODE; +using static TerraFX.Interop.D2D1_LAYER_OPTIONS1; +using static TerraFX.Interop.D2D1_LINE_JOIN; +using static TerraFX.Interop.D2D1_PRIMITIVE_BLEND; +using static TerraFX.Interop.D2D1_PRINT_FONT_SUBSET_MODE; +using static TerraFX.Interop.D2D1_STROKE_TRANSFORM_TYPE; +using static TerraFX.Interop.D2D1_TEXT_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_UNIT_MODE; +using static TerraFX.Interop.Windows; + +namespace TerraFX.Interop +{ + public static unsafe partial class D2D1 + { + [return: NativeTypeName("D2D1_COLOR_F")] + public static DXGI_RGBA ConvertColorSpace(D2D1_COLOR_SPACE sourceColorSpace, D2D1_COLOR_SPACE destinationColorSpace, [NativeTypeName("const D2D1_COLOR_F &")] DXGI_RGBA* color) + { + return D2D1ConvertColorSpace(sourceColorSpace, destinationColorSpace, color); + } + + public static D2D1_DRAWING_STATE_DESCRIPTION1 DrawingStateDescription1(D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, [NativeTypeName("D2D1_TAG")] ulong tag1 = 0, [NativeTypeName("D2D1_TAG")] ulong tag2 = 0, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS) + { + return DrawingStateDescription1(antialiasMode, textAntialiasMode, tag1, tag2, IdentityMatrix, primitiveBlend, unitMode); + } + + public static D2D1_DRAWING_STATE_DESCRIPTION1 DrawingStateDescription1([Optional] D2D1_ANTIALIAS_MODE antialiasMode, [Optional] D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode, [NativeTypeName("D2D1_TAG"), Optional] ulong tag1, [NativeTypeName("D2D1_TAG"), Optional] ulong tag2, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F transform, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS) + { + D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription1; + + drawingStateDescription1.antialiasMode = antialiasMode; + drawingStateDescription1.textAntialiasMode = textAntialiasMode; + drawingStateDescription1.tag1 = tag1; + drawingStateDescription1.tag2 = tag2; + drawingStateDescription1.transform = transform; + drawingStateDescription1.primitiveBlend = primitiveBlend; + drawingStateDescription1.unitMode = unitMode; + + return drawingStateDescription1; + } + + public static D2D1_DRAWING_STATE_DESCRIPTION1 DrawingStateDescription1([NativeTypeName("const D2D1_DRAWING_STATE_DESCRIPTION &")] in D2D1_DRAWING_STATE_DESCRIPTION desc, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND_SOURCE_OVER, D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE_DIPS) + { + D2D1_DRAWING_STATE_DESCRIPTION1 drawingStateDescription1; + + drawingStateDescription1.antialiasMode = desc.antialiasMode; + drawingStateDescription1.textAntialiasMode = desc.textAntialiasMode; + drawingStateDescription1.tag1 = desc.tag1; + drawingStateDescription1.tag2 = desc.tag2; + drawingStateDescription1.transform = desc.transform; + drawingStateDescription1.primitiveBlend = primitiveBlend; + drawingStateDescription1.unitMode = unitMode; + + return drawingStateDescription1; + } + + public static D2D1_BITMAP_PROPERTIES1 BitmapProperties1(D2D1_BITMAP_OPTIONS bitmapOptions = D2D1_BITMAP_OPTIONS_NONE, [NativeTypeName("const D2D1_PIXEL_FORMAT")] D2D1_PIXEL_FORMAT pixelFormat = default, [NativeTypeName("FLOAT")] float dpiX = 96.0f, [NativeTypeName("FLOAT")] float dpiY = 96.0f, ID2D1ColorContext *colorContext = null) + { + D2D1_BITMAP_PROPERTIES1 bitmapProperties = new D2D1_BITMAP_PROPERTIES1 + { + pixelFormat = pixelFormat, + dpiX = dpiX, + dpiY = dpiY, + bitmapOptions = bitmapOptions, + colorContext = colorContext + }; + return bitmapProperties; + } + + public static D2D1_LAYER_PARAMETERS1 LayerParameters1([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + { + return LayerParameters1(InfiniteRect, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions); + } + + public static D2D1_LAYER_PARAMETERS1 LayerParameters1([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + { + return LayerParameters1(contentBounds, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions); + } + + public static D2D1_LAYER_PARAMETERS1 LayerParameters1([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + { + return LayerParameters1(InfiniteRect, geometricMask, maskAntialiasMode, maskTransform, opacity, opacityBrush, layerOptions); + } + + public static D2D1_LAYER_PARAMETERS1 LayerParameters1([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1_NONE) + { + D2D1_LAYER_PARAMETERS1 layerParameters = default; + + layerParameters.contentBounds = contentBounds; + layerParameters.geometricMask = geometricMask; + layerParameters.maskAntialiasMode = maskAntialiasMode; + layerParameters.maskTransform = maskTransform; + layerParameters.opacity = opacity; + layerParameters.opacityBrush = opacityBrush; + layerParameters.layerOptions = layerOptions; + + return layerParameters; + } + + public static D2D1_STROKE_STYLE_PROPERTIES1 StrokeStyleProperties1(D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER, [NativeTypeName("FLOAT")] float miterLimit = 10.0f, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID, [NativeTypeName("FLOAT")] float dashOffset = 0.0f, D2D1_STROKE_TRANSFORM_TYPE transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL) + { + D2D1_STROKE_STYLE_PROPERTIES1 strokeStyleProperties; + + strokeStyleProperties.startCap = startCap; + strokeStyleProperties.endCap = endCap; + strokeStyleProperties.dashCap = dashCap; + strokeStyleProperties.lineJoin = lineJoin; + strokeStyleProperties.miterLimit = miterLimit; + strokeStyleProperties.dashStyle = dashStyle; + strokeStyleProperties.dashOffset = dashOffset; + strokeStyleProperties.transformType = transformType; + + return strokeStyleProperties; + } + + public static D2D1_IMAGE_BRUSH_PROPERTIES ImageBrushProperties([NativeTypeName("D2D1_RECT_F")] D2D_RECT_F sourceRectangle, D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR) + { + D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties; + + imageBrushProperties.extendModeX = extendModeX; + imageBrushProperties.extendModeY = extendModeY; + imageBrushProperties.interpolationMode = interpolationMode; + imageBrushProperties.sourceRectangle = sourceRectangle; + + return imageBrushProperties; + } + + public static D2D1_BITMAP_BRUSH_PROPERTIES1 BitmapBrushProperties1(D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR) + { + D2D1_BITMAP_BRUSH_PROPERTIES1 bitmapBrush1Properties; + + bitmapBrush1Properties.extendModeX = extendModeX; + bitmapBrush1Properties.extendModeY = extendModeY; + bitmapBrush1Properties.interpolationMode = interpolationMode; + + return bitmapBrush1Properties; + } + + public static D2D1_PRINT_CONTROL_PROPERTIES PrintControlProperties(D2D1_PRINT_FONT_SUBSET_MODE fontSubsetMode = D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, [NativeTypeName("FLOAT")] float rasterDpi = 150.0f, D2D1_COLOR_SPACE colorSpace = D2D1_COLOR_SPACE_SRGB) + { + D2D1_PRINT_CONTROL_PROPERTIES printControlProps; + + printControlProps.fontSubset = fontSubsetMode; + printControlProps.rasterDPI = rasterDpi; + printControlProps.colorSpace = colorSpace; + + return printControlProps; + } + + public static D2D1_RENDERING_CONTROLS RenderingControls(D2D1_BUFFER_PRECISION bufferPrecision, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U tileSize) + { + D2D1_RENDERING_CONTROLS renderingControls; + + renderingControls.bufferPrecision = bufferPrecision; + renderingControls.tileSize = tileSize; + + return renderingControls; + } + + public static D2D1_EFFECT_INPUT_DESCRIPTION EffectInputDescription([NativeTypeName("ID2D1Effect *")] ID2D1Effect* effect, [NativeTypeName("UINT32")] uint inputIndex, [NativeTypeName("D2D1_RECT_F")] D2D_RECT_F inputRectangle) + { + D2D1_EFFECT_INPUT_DESCRIPTION description; + + description.effect = effect; + description.inputIndex = inputIndex; + description.inputRectangle = inputRectangle; + + return description; + } + + public static D2D1_CREATION_PROPERTIES CreationProperties(D2D1_THREADING_MODE threadingMode, D2D1_DEBUG_LEVEL debugLevel, D2D1_DEVICE_CONTEXT_OPTIONS options) + { + D2D1_CREATION_PROPERTIES creationProperties; + + creationProperties.threadingMode = threadingMode; + creationProperties.debugLevel = debugLevel; + creationProperties.options = options; + + return creationProperties; + } + + [return: NativeTypeName("D2D1_VECTOR_2F")] + public static D2D_VECTOR_2F Vector2F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f) + { + D2D_VECTOR_2F vec2 = new D2D_VECTOR_2F + { + x = x, + y = y, + }; + return vec2; + } + + [return: NativeTypeName("D2D1_VECTOR_2F")] + public static D2D_VECTOR_3F Vector3F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f, [NativeTypeName("FLOAT")] float z = 0.0f) + { + D2D_VECTOR_3F vec3 = new D2D_VECTOR_3F + { + x = x, + y = y, + z = z, + }; + return vec3; + } + + [return: NativeTypeName("D2D1_VECTOR_2F")] + public static D2D_VECTOR_4F Vector4F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f, [NativeTypeName("FLOAT")] float z = 0.0f, [NativeTypeName("FLOAT")] float w = 0.0f) + { + D2D_VECTOR_4F vec4 = new D2D_VECTOR_4F + { + x = x, + y = y, + z = z, + w = w, + }; + return vec4; + } + + [return: NativeTypeName("D2D1_POINT_2L")] + public static POINT Point2L([NativeTypeName("INT32")] int x = 0, [NativeTypeName("INT32")] int y = 0) + { + POINT point = new POINT + { + x = x, + y = y, + }; + return point; + } + + [return: NativeTypeName("D2D1_RECT_L")] + public static RECT RectL([NativeTypeName("INT32")] int left = 0, [NativeTypeName("INT32")] int top = 0, [NativeTypeName("INT32")] int right = 0, [NativeTypeName("INT32")] int bottom = 0) + { + RECT rect = new RECT + { + left = left, + top = top, + right = right, + bottom = bottom, + }; + return rect; + } + + [return: NativeTypeName("HRESULT")] + public static int SetDpiCompensatedEffectInput([NativeTypeName("ID2D1DeviceContext *")] ID2D1DeviceContext *deviceContext, [NativeTypeName("ID2D1Effect *")] ID2D1Effect *effect, [NativeTypeName("UINT32")] uint inputIndex, [NativeTypeName("ID2D1Bitmap *")] ID2D1Bitmap* inputBitmap, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE_LINEAR, D2D1_BORDER_MODE borderMode = D2D1_BORDER_MODE_HARD) + { + int hr = S_OK; + ID2D1Effect *dpiCompensationEffect = null; + + if (inputBitmap != null) + { + effect->SetInput(inputIndex, null); + return hr; + } + + Guid effectId = CLSID_D2D1DpiCompensation; + hr = deviceContext->CreateEffect(&effectId, &dpiCompensationEffect); + + if (SUCCEEDED(hr)) + { + if (SUCCEEDED(hr)) + { + dpiCompensationEffect->SetInput(0, (ID2D1Image*)inputBitmap); + + D2D_POINT_2F bitmapDpi; + + inputBitmap->GetDpi(&bitmapDpi.x, &bitmapDpi.y); + hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_INPUT_DPI, &bitmapDpi); + } + + if (SUCCEEDED(hr)) + { + hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_INTERPOLATION_MODE, &interpolationMode); + } + + if (SUCCEEDED(hr)) + { + hr = dpiCompensationEffect->SetValue(D2D1_DPICOMPENSATION_PROP_BORDER_MODE, &borderMode); + } + + if (SUCCEEDED(hr)) + { + effect->SetInputEffect(inputIndex, dpiCompensationEffect); + } + + if (dpiCompensationEffect != null) + { + dpiCompensationEffect->Release(); + } + } + + return hr; + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_2helper/D2D1.Manual.cs b/sources/Interop/D2D1/um/d2d1_2helper/D2D1.Manual.cs new file mode 100644 index 0000000000..ac9081d504 --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_2helper/D2D1.Manual.cs @@ -0,0 +1,19 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_2helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +namespace TerraFX.Interop +{ + public static unsafe partial class D2D1 + { + [return: NativeTypeName("FLOAT")] + public static float ComputeFlatteningTolerance([NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F matrix, [NativeTypeName("FLOAT")] float dpiX = 96.0f, [NativeTypeName("FLOAT")] float dpiY = 96.0f, [NativeTypeName("FLOAT")] float maxZoomFactor = 1.0f) + { + D2D_MATRIX_3X2_F dpiDependentTransform = matrix * D2D_MATRIX_3X2_F.Scale(dpiX / 96.0f, dpiY / 96.0f); + float absMaxZoomFactor = (maxZoomFactor > 0) ? maxZoomFactor : -maxZoomFactor; + + return D2D1_DEFAULT_FLATTENING_TOLERANCE / (absMaxZoomFactor * D2D1ComputeMaximumScaleFactor(&dpiDependentTransform)); + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_3/D2D1_GRADIENT_MESH_PATCH.Manual.cs.cs b/sources/Interop/D2D1/um/d2d1_3/D2D1_GRADIENT_MESH_PATCH.Manual.cs.cs new file mode 100644 index 0000000000..9ebabb1f1b --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_3/D2D1_GRADIENT_MESH_PATCH.Manual.cs.cs @@ -0,0 +1,22 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using static TerraFX.Interop.D2D1; + +namespace TerraFX.Interop +{ + public partial struct D2D1_GRADIENT_MESH_PATCH + { + public D2D1_GRADIENT_MESH_PATCH([NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point00, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point01, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point02, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point03, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point10, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point11, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point12, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point13, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point20, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point21, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point22, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point23, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point30, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point31, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point32, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point33, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color00, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color03, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color30, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color33, D2D1_PATCH_EDGE_MODE topEdgeMode, D2D1_PATCH_EDGE_MODE leftEdgeMode, D2D1_PATCH_EDGE_MODE bottomEdgeMode, D2D1_PATCH_EDGE_MODE rightEdgeMode) + { + this = GradientMeshPatch(point00, point01, point02, point03, point10, point11, point12, point13, point20, point21, point22, point23, point30, point31, point32, point33, color00, color03, color30, color33, topEdgeMode, leftEdgeMode, bottomEdgeMode, rightEdgeMode); + } + + public static D2D1_GRADIENT_MESH_PATCH FromCoonsPatch([NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point0, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point1, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point2, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point3, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point4, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point5, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point6, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point7, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point8, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point9, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point10, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point11, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color0, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color1, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color2, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color3, D2D1_PATCH_EDGE_MODE topEdgeMode, D2D1_PATCH_EDGE_MODE leftEdgeMode, D2D1_PATCH_EDGE_MODE bottomEdgeMode, D2D1_PATCH_EDGE_MODE rightEdgeMode) + { + return GradientMeshPatchFromCoonsPatch(point0, point1, point2, point3, point4, point5, point6, point7, point8, point9, point10, point11, color0, color1, color2, color3, topEdgeMode, leftEdgeMode, bottomEdgeMode, rightEdgeMode); + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_BEZIER_SEGMENT.Manual.cs b/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_BEZIER_SEGMENT.Manual.cs new file mode 100644 index 0000000000..d7f7516599 --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_BEZIER_SEGMENT.Manual.cs @@ -0,0 +1,17 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using static TerraFX.Interop.D2D1; + +namespace TerraFX.Interop +{ + public partial struct D2D1_INK_BEZIER_SEGMENT + { + public D2D1_INK_BEZIER_SEGMENT([NativeTypeName("const D2D1_INK_POINT &")] in D2D1_INK_POINT point1, [NativeTypeName("const D2D1_INK_POINT &")] in D2D1_INK_POINT point2, [NativeTypeName("const D2D1_INK_POINT &")] in D2D1_INK_POINT point3) + { + this = InkBezierSegment(point1, point2, point3); + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_POINT.Manual.cs b/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_POINT.Manual.cs new file mode 100644 index 0000000000..4fdf2e26bf --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_POINT.Manual.cs @@ -0,0 +1,17 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using static TerraFX.Interop.D2D1; + +namespace TerraFX.Interop +{ + public partial struct D2D1_INK_POINT + { + public D2D1_INK_POINT([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point, [NativeTypeName("FLOAT")] float radius) + { + this = InkPoint(point, radius); + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_STYLE_PROPERTIES.Manual.cs b/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_STYLE_PROPERTIES.Manual.cs new file mode 100644 index 0000000000..2ec2df1945 --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_3/D2D1_INK_STYLE_PROPERTIES.Manual.cs @@ -0,0 +1,17 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using static TerraFX.Interop.D2D1; + +namespace TerraFX.Interop +{ + public partial struct D2D1_INK_STYLE_PROPERTIES + { + public D2D1_INK_STYLE_PROPERTIES(D2D1_INK_NIB_SHAPE nibShape, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F nibTransform) + { + this = InkStyleProperties(nibShape, nibTransform); + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_3/D2D1_SIMPLE_COLOR_PROFILE.Manual.cs b/sources/Interop/D2D1/um/d2d1_3/D2D1_SIMPLE_COLOR_PROFILE.Manual.cs new file mode 100644 index 0000000000..cd98d8e986 --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_3/D2D1_SIMPLE_COLOR_PROFILE.Manual.cs @@ -0,0 +1,17 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using static TerraFX.Interop.D2D1; + +namespace TerraFX.Interop +{ + public partial struct D2D1_SIMPLE_COLOR_PROFILE + { + public D2D1_SIMPLE_COLOR_PROFILE([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F redPrimary, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F greenPrimary, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F bluePrimary, [NativeTypeName("const D2D1_GAMMA1")] D2D1_GAMMA1 gamma, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F whitePointXZ) + { + this = SimpleColorProfile(redPrimary, greenPrimary, bluePrimary, gamma, whitePointXZ); + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1_3helper/D2D1.Manual.cs b/sources/Interop/D2D1/um/d2d1_3helper/D2D1.Manual.cs new file mode 100644 index 0000000000..f45b3dbbae --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1_3helper/D2D1.Manual.cs @@ -0,0 +1,134 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +namespace TerraFX.Interop +{ + public static unsafe partial class D2D1 + { + public static D2D1_GRADIENT_MESH_PATCH GradientMeshPatch([NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point00, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point01, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point02, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point03, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point10, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point11, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point12, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point13, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point20, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point21, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point22, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point23, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point30, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point31, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point32, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point33, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color00, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color03, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color30, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color33, D2D1_PATCH_EDGE_MODE topEdgeMode, D2D1_PATCH_EDGE_MODE leftEdgeMode, D2D1_PATCH_EDGE_MODE bottomEdgeMode, D2D1_PATCH_EDGE_MODE rightEdgeMode) + { + D2D1_GRADIENT_MESH_PATCH newPatch; + + newPatch.point00 = point00; + newPatch.point01 = point01; + newPatch.point02 = point02; + newPatch.point03 = point03; + newPatch.point10 = point10; + newPatch.point11 = point11; + newPatch.point12 = point12; + newPatch.point13 = point13; + newPatch.point20 = point20; + newPatch.point21 = point21; + newPatch.point22 = point22; + newPatch.point23 = point23; + newPatch.point30 = point30; + newPatch.point31 = point31; + newPatch.point32 = point32; + newPatch.point33 = point33; + newPatch.color00 = color00; + newPatch.color03 = color03; + newPatch.color30 = color30; + newPatch.color33 = color33; + newPatch.topEdgeMode = topEdgeMode; + newPatch.leftEdgeMode = leftEdgeMode; + newPatch.bottomEdgeMode = bottomEdgeMode; + newPatch.rightEdgeMode = rightEdgeMode; + + return newPatch; + } + + public static D2D1_GRADIENT_MESH_PATCH GradientMeshPatchFromCoonsPatch([NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point0, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point1, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point2, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point3, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point4, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point5, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point6, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point7, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point8, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point9, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point10, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point11, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color0, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color1, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color2, [NativeTypeName("D2D1_COLOR_F")] DXGI_RGBA color3, D2D1_PATCH_EDGE_MODE topEdgeMode, D2D1_PATCH_EDGE_MODE leftEdgeMode, D2D1_PATCH_EDGE_MODE bottomEdgeMode, D2D1_PATCH_EDGE_MODE rightEdgeMode) + { + D2D1_GRADIENT_MESH_PATCH newPatch; + + newPatch.point00 = point0; + newPatch.point01 = point1; + newPatch.point02 = point2; + newPatch.point03 = point3; + newPatch.point13 = point4; + newPatch.point23 = point5; + newPatch.point33 = point6; + newPatch.point32 = point7; + newPatch.point31 = point8; + newPatch.point30 = point9; + newPatch.point20 = point10; + newPatch.point10 = point11; + + D2D1GetGradientMeshInteriorPointsFromCoonsPatch(&point0, &point1, &point2, &point3, &point4, &point5, &point6, &point7, &point8, &point9, &point10, &point11, &newPatch.point11, &newPatch.point12, &newPatch.point21, &newPatch.point22); + + newPatch.color00 = color0; + newPatch.color03 = color1; + newPatch.color33 = color2; + newPatch.color30 = color3; + newPatch.topEdgeMode = topEdgeMode; + newPatch.leftEdgeMode = leftEdgeMode; + newPatch.bottomEdgeMode = bottomEdgeMode; + newPatch.rightEdgeMode = rightEdgeMode; + + return newPatch; + } + + public static D2D1_INK_POINT InkPoint([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point, [NativeTypeName("FLOAT")] float radius) + { + D2D1_INK_POINT inkPoint; + + inkPoint.x = point.x; + inkPoint.y = point.y; + inkPoint.radius = radius; + + return inkPoint; + } + + public static D2D1_INK_BEZIER_SEGMENT InkBezierSegment([NativeTypeName("const D2D1_INK_POINT &")] in D2D1_INK_POINT point1, [NativeTypeName("const D2D1_INK_POINT &")] in D2D1_INK_POINT point2, [NativeTypeName("const D2D1_INK_POINT &")] in D2D1_INK_POINT point3) + { + D2D1_INK_BEZIER_SEGMENT inkBezierSegment; + + inkBezierSegment.point1 = point1; + inkBezierSegment.point2 = point2; + inkBezierSegment.point3 = point3; + + return inkBezierSegment; + } + + public static D2D1_INK_STYLE_PROPERTIES InkStyleProperties(D2D1_INK_NIB_SHAPE nibShape, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F nibTransform) + { + D2D1_INK_STYLE_PROPERTIES inkStyleProperties; + + inkStyleProperties.nibShape = nibShape; + inkStyleProperties.nibTransform = nibTransform; + + return inkStyleProperties; + } + + public static D2D_RECT_U InfiniteRectU + { + [return: NativeTypeName("D2D1_RECT_U")] + get + { + D2D_RECT_U rect = new D2D_RECT_U + { + left = 0u, + top = 0u, + right = uint.MaxValue, + bottom = uint.MaxValue + }; + return rect; + } + } + + public static D2D1_SIMPLE_COLOR_PROFILE SimpleColorProfile([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F redPrimary, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F greenPrimary, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F bluePrimary, [NativeTypeName("const D2D1_GAMMA1")] D2D1_GAMMA1 gamma, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F whitePointXZ) + { + D2D1_SIMPLE_COLOR_PROFILE simpleColorProfile; + + simpleColorProfile.redPrimary = redPrimary; + simpleColorProfile.greenPrimary = greenPrimary; + simpleColorProfile.bluePrimary = bluePrimary; + simpleColorProfile.gamma = gamma; + simpleColorProfile.whitePointXZ = whitePointXZ; + + return simpleColorProfile; + } + } +} diff --git a/sources/Interop/D2D1/um/d2d1helper/D2D1.Manual.cs b/sources/Interop/D2D1/um/d2d1helper/D2D1.Manual.cs new file mode 100644 index 0000000000..8a36e7dcf2 --- /dev/null +++ b/sources/Interop/D2D1/um/d2d1helper/D2D1.Manual.cs @@ -0,0 +1,351 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using System; +using System.Runtime.InteropServices; +using static TerraFX.Interop.D2D1_ALPHA_MODE; +using static TerraFX.Interop.D2D1_ANTIALIAS_MODE; +using static TerraFX.Interop.D2D1_BITMAP_INTERPOLATION_MODE; +using static TerraFX.Interop.D2D1_CAP_STYLE; +using static TerraFX.Interop.D2D1_DASH_STYLE; +using static TerraFX.Interop.D2D1_EXTEND_MODE; +using static TerraFX.Interop.D2D1_FEATURE_LEVEL; +using static TerraFX.Interop.D2D1_LAYER_OPTIONS; +using static TerraFX.Interop.D2D1_LINE_JOIN; +using static TerraFX.Interop.D2D1_PRESENT_OPTIONS; +using static TerraFX.Interop.D2D1_RENDER_TARGET_TYPE; +using static TerraFX.Interop.D2D1_RENDER_TARGET_USAGE; +using static TerraFX.Interop.D2D1_TEXT_ANTIALIAS_MODE; +using static TerraFX.Interop.DXGI_FORMAT; + +namespace TerraFX.Interop +{ + public static unsafe partial class D2D1 + { + [return: NativeTypeName("FLOAT")] + public static float FloatMax() + { + return float.MaxValue; + } + + [return: NativeTypeName("D2D1_POINT_2F")] + public static D2D_POINT_2F Point2F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f) + { + D2D_POINT_2F point = new D2D_POINT_2F + { + x = x, + y = y, + }; + return point; + } + + [return: NativeTypeName("D2D1_POINT_2U")] + public static D2D_POINT_2U Point2U([NativeTypeName("UINT32")] uint x = 0, [NativeTypeName("UINT32")] uint y = 0) + { + D2D_POINT_2U point = new D2D_POINT_2U + { + x = x, + y = y, + }; + return point; + } + + [return: NativeTypeName("D2D1_SIZE_F")] + public static D2D_SIZE_F SizeF([NativeTypeName("FLOAT")] float width = 0.0f, [NativeTypeName("FLOAT")] float height = 0.0f) + { + D2D_SIZE_F size = new D2D_SIZE_F + { + width = width, + height = height, + }; + return size; + } + + [return: NativeTypeName("D2D1_SIZE_U")] + public static D2D_SIZE_U SizeU([NativeTypeName("UINT32")] uint width = 0, [NativeTypeName("UINT32")] uint height = 0) + { + D2D_SIZE_U size = new D2D_SIZE_U + { + width = width, + height = height, + }; + return size; + } + + [return: NativeTypeName("D2D1_RECT_F")] + public static D2D_RECT_F RectF([NativeTypeName("FLOAT")] float left = 0.0f, [NativeTypeName("FLOAT")] float top = 0.0f, [NativeTypeName("FLOAT")] float right = 0.0f, [NativeTypeName("FLOAT")] float bottom = 0.0f) + { + D2D_RECT_F rect = new D2D_RECT_F + { + left = left, + top = top, + right = right, + bottom = bottom, + }; + return rect; + } + + [return: NativeTypeName("D2D1_RECT_U")] + public static D2D_RECT_U RectU([NativeTypeName("UINT32")] uint left = 0, [NativeTypeName("UINT32")] uint top = 0, [NativeTypeName("UINT32")] uint right = 0, [NativeTypeName("UINT32")] uint bottom = 0) + { + D2D_RECT_U rect = new D2D_RECT_U + { + left = left, + top = top, + right = right, + bottom = bottom, + }; + return rect; + } + + public static D2D_RECT_F InfiniteRect + { + [return: NativeTypeName("D2D1_RECT_F")] + get + { + D2D_RECT_F rect = new D2D_RECT_F { + left = -FloatMax(), + top = -FloatMax(), + right = FloatMax(), + bottom = FloatMax(), + }; + return rect; + } + } + + public static D2D1_ARC_SEGMENT ArcSegment([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point, [NativeTypeName("const D2D1_SIZE_F &")] in D2D_SIZE_F size, [NativeTypeName("FLOAT")] float rotationAngle, D2D1_SWEEP_DIRECTION sweepDirection, D2D1_ARC_SIZE arcSize) + { + D2D1_ARC_SEGMENT arcSegment = new D2D1_ARC_SEGMENT + { + point = point, + size = size, + rotationAngle = rotationAngle, + sweepDirection = sweepDirection, + arcSize = arcSize, + }; + return arcSegment; + } + + public static D2D1_BEZIER_SEGMENT BezierSegment([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point1, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point2, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point3) + { + D2D1_BEZIER_SEGMENT bezierSegment = new D2D1_BEZIER_SEGMENT + { + point1 = point1, + point2 = point2, + point3 = point3 + }; + return bezierSegment; + } + + public static D2D1_ELLIPSE Ellipse([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F center, [NativeTypeName("FLOAT")] float radiusX, [NativeTypeName("FLOAT")] float radiusY) + { + D2D1_ELLIPSE ellipse; + + ellipse.point = center; + ellipse.radiusX = radiusX; + ellipse.radiusY = radiusY; + + return ellipse; + } + + public static D2D1_ROUNDED_RECT RoundedRect([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F rect, [NativeTypeName("FLOAT")] float radiusX, [NativeTypeName("FLOAT")] float radiusY) + { + D2D1_ROUNDED_RECT roundedRect; + + roundedRect.rect = rect; + roundedRect.radiusX = radiusX; + roundedRect.radiusY = radiusY; + + return roundedRect; + } + + public static D2D1_BRUSH_PROPERTIES BrushProperties([NativeTypeName("FLOAT")] float opacity = 1.0f) + { + return BrushProperties(opacity, IdentityMatrix); + } + + public static D2D1_BRUSH_PROPERTIES BrushProperties([NativeTypeName("FLOAT"), Optional, DefaultParameterValue(1.0f)] float opacity, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F transform) + { + D2D1_BRUSH_PROPERTIES brushProperties; + + brushProperties.opacity = opacity; + brushProperties.transform = transform; + + return brushProperties; + } + + public static D2D1_GRADIENT_STOP GradientStop([NativeTypeName("FLOAT")] float position, [NativeTypeName("const D2D1_COLOR_F &")] in DXGI_RGBA color) + { + D2D1_GRADIENT_STOP gradientStop = new D2D1_GRADIENT_STOP + { + position = position, + color = color, + }; + return gradientStop; + } + + public static D2D1_QUADRATIC_BEZIER_SEGMENT QuadraticBezierSegment([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point1, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point2) + { + D2D1_QUADRATIC_BEZIER_SEGMENT quadraticBezier = new D2D1_QUADRATIC_BEZIER_SEGMENT + { + point1 = point1, + point2 = point2 + }; + return quadraticBezier; + } + + public static D2D1_STROKE_STYLE_PROPERTIES StrokeStyleProperties(D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT, D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER, [NativeTypeName("FLOAT")] float miterLimit = 10.0f, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID, [NativeTypeName("FLOAT")] float dashOffset = 0.0f) + { + D2D1_STROKE_STYLE_PROPERTIES strokeStyleProperties; + + strokeStyleProperties.startCap = startCap; + strokeStyleProperties.endCap = endCap; + strokeStyleProperties.dashCap = dashCap; + strokeStyleProperties.lineJoin = lineJoin; + strokeStyleProperties.miterLimit = miterLimit; + strokeStyleProperties.dashStyle = dashStyle; + strokeStyleProperties.dashOffset = dashOffset; + + return strokeStyleProperties; + } + + public static D2D1_BITMAP_BRUSH_PROPERTIES BitmapBrushProperties(D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR) + { + D2D1_BITMAP_BRUSH_PROPERTIES bitmapBrushProperties; + + bitmapBrushProperties.extendModeX = extendModeX; + bitmapBrushProperties.extendModeY = extendModeY; + bitmapBrushProperties.interpolationMode = interpolationMode; + + return bitmapBrushProperties; + } + + public static D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES LinearGradientBrushProperties([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F startPoint, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F endPoint) + { + D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties; + + linearGradientBrushProperties.startPoint = startPoint; + linearGradientBrushProperties.endPoint = endPoint; + + return linearGradientBrushProperties; + } + + public static D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES RadialGradientBrushProperties([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F center, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F gradientOriginOffset, [NativeTypeName("FLOAT")] float radiusX, [NativeTypeName("FLOAT")] float radiusY) + { + D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties; + + radialGradientBrushProperties.center = center; + radialGradientBrushProperties.gradientOriginOffset = gradientOriginOffset; + radialGradientBrushProperties.radiusX = radiusX; + radialGradientBrushProperties.radiusY = radiusY; + + return radialGradientBrushProperties; + } + + public static D2D1_PIXEL_FORMAT PixelFormat(DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE alphaMode = D2D1_ALPHA_MODE_UNKNOWN) + { + D2D1_PIXEL_FORMAT pixelFormat; + + pixelFormat.format = dxgiFormat; + pixelFormat.alphaMode = alphaMode; + + return pixelFormat; + } + + public static D2D1_BITMAP_PROPERTIES BitmapProperties([NativeTypeName("const D2D1_PIXEL_FORMAT &")] in D2D1_PIXEL_FORMAT pixelFormat = default, [NativeTypeName("FLOAT")] float dpiX = 96.0f, [NativeTypeName("FLOAT")] float dpiY = 96.0f) + { + D2D1_BITMAP_PROPERTIES bitmapProperties; + + bitmapProperties.pixelFormat = pixelFormat; + bitmapProperties.dpiX = dpiX; + bitmapProperties.dpiY = dpiY; + + return bitmapProperties; + } + + public static D2D1_RENDER_TARGET_PROPERTIES RenderTargetProperties(D2D1_RENDER_TARGET_TYPE type = D2D1_RENDER_TARGET_TYPE_DEFAULT, [NativeTypeName("const D2D1_PIXEL_FORMAT &")] in D2D1_PIXEL_FORMAT pixelFormat = default, [NativeTypeName("FLOAT")] float dpiX = 0.0f, [NativeTypeName("FLOAT")] float dpiY = 0.0f, D2D1_RENDER_TARGET_USAGE usage = D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL minLevel = D2D1_FEATURE_LEVEL_DEFAULT) + { + D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties; + + renderTargetProperties.type = type; + renderTargetProperties.pixelFormat = pixelFormat; + renderTargetProperties.dpiX = dpiX; + renderTargetProperties.dpiY = dpiY; + renderTargetProperties.usage = usage; + renderTargetProperties.minLevel = minLevel; + + return renderTargetProperties; + } + + public static D2D1_HWND_RENDER_TARGET_PROPERTIES + HwndRenderTargetProperties([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("D2D1_SIZE_U")] D2D_SIZE_U pixelSize = default, D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS_NONE) + { + D2D1_HWND_RENDER_TARGET_PROPERTIES hwndRenderTargetProperties; + + hwndRenderTargetProperties.hwnd = hwnd; + hwndRenderTargetProperties.pixelSize = pixelSize; + hwndRenderTargetProperties.presentOptions = presentOptions; + + return hwndRenderTargetProperties; + } + + public static D2D1_LAYER_PARAMETERS LayerParameters([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + { + return LayerParameters(InfiniteRect, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions); + } + + public static D2D1_LAYER_PARAMETERS LayerParameters([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + { + return LayerParameters(contentBounds, geometricMask, maskAntialiasMode, IdentityMatrix, opacity, opacityBrush, layerOptions); + } + + public static D2D1_LAYER_PARAMETERS LayerParameters([NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush* opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + { + return LayerParameters(InfiniteRect, geometricMask, maskAntialiasMode, maskTransform, opacity, opacityBrush, layerOptions); + } + + public static D2D1_LAYER_PARAMETERS LayerParameters([NativeTypeName("const D2D1_RECT_F")] in D2D_RECT_F contentBounds, [NativeTypeName("ID2D1Geometry *"), Optional] ID2D1Geometry* geometricMask, [Optional] D2D1_ANTIALIAS_MODE maskAntialiasMode, [NativeTypeName("D2D1_MATRIX_3X2_F")] D2D_MATRIX_3X2_F maskTransform, [NativeTypeName("FLOAT")] float opacity = 1.0f, [NativeTypeName("ID2D1Brush *")] ID2D1Brush *opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE) + { + D2D1_LAYER_PARAMETERS layerParameters = default; + + layerParameters.contentBounds = contentBounds; + layerParameters.geometricMask = geometricMask; + layerParameters.maskAntialiasMode = maskAntialiasMode; + layerParameters.maskTransform = maskTransform; + layerParameters.opacity = opacity; + layerParameters.opacityBrush = opacityBrush; + layerParameters.layerOptions = layerOptions; + + return layerParameters; + } + + public static D2D1_DRAWING_STATE_DESCRIPTION DrawingStateDescription(D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, [NativeTypeName("D2D1_TAG")] ulong tag1 = 0, [NativeTypeName("D2D1_TAG")] ulong tag2 = 0) + { + return DrawingStateDescription(antialiasMode, textAntialiasMode, tag1, tag2, IdentityMatrix); + } + + public static D2D1_DRAWING_STATE_DESCRIPTION DrawingStateDescription([Optional] D2D1_ANTIALIAS_MODE antialiasMode, [Optional] D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode, [NativeTypeName("D2D1_TAG"), Optional] ulong tag1, [NativeTypeName("D2D1_TAG"), Optional] ulong tag2, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] D2D_MATRIX_3X2_F transform) + { + D2D1_DRAWING_STATE_DESCRIPTION drawingStateDescription; + + drawingStateDescription.antialiasMode = antialiasMode; + drawingStateDescription.textAntialiasMode = textAntialiasMode; + drawingStateDescription.tag1 = tag1; + drawingStateDescription.tag2 = tag2; + drawingStateDescription.transform = transform; + + return drawingStateDescription; + } + + public static D2D_MATRIX_3X2_F IdentityMatrix + { + [return: NativeTypeName("D2D1_MATRIX_3X2_F")] + get + { + return D2D_MATRIX_3X2_F.Identity; + } + } + } +} diff --git a/sources/Interop/D3D11/um/d3d11/D3D11_BOX.Manual.cs b/sources/Interop/D3D11/um/d3d11/D3D11_BOX.Manual.cs index 38a6fdcc3b..954aebe80e 100644 --- a/sources/Interop/D3D11/um/d3d11/D3D11_BOX.Manual.cs +++ b/sources/Interop/D3D11/um/d3d11/D3D11_BOX.Manual.cs @@ -19,15 +19,15 @@ public D3D11_BOX(int Left, int Top, int Front, int Right, int Bottom, int Back) back = (uint)Back; } - public static bool operator ==(D3D11_BOX l, D3D11_BOX r) => - (l.left == r.left) && - (l.top == r.top) && - (l.front == r.front) && - (l.right == r.right) && - (l.bottom == r.bottom) && - (l.back == r.back); - - public static bool operator !=(D3D11_BOX l, D3D11_BOX r) => !(l == r); + public static bool operator ==(D3D11_BOX l, D3D11_BOX r) + { + return l.left == r.left && l.top == r.top && l.front == r.front && l.right == r.right && l.bottom == r.bottom && l.back == r.back; + } + + public static bool operator !=(D3D11_BOX l, D3D11_BOX r) + { + return !(l == r); + } public override bool Equals(object? obj) => (obj is D3D11_BOX other) && Equals(other); diff --git a/sources/Interop/D3D11/um/d3d11/D3D11_VIEWPORT.Manual.cs b/sources/Interop/D3D11/um/d3d11/D3D11_VIEWPORT.Manual.cs index ba3f86cab2..796e40b1fc 100644 --- a/sources/Interop/D3D11/um/d3d11/D3D11_VIEWPORT.Manual.cs +++ b/sources/Interop/D3D11/um/d3d11/D3D11_VIEWPORT.Manual.cs @@ -172,15 +172,15 @@ public D3D11_VIEWPORT(ID3D11Texture3D* pTex3D, ID3D11RenderTargetView* pRTView, MaxDepth = maxDepth; } - public static bool operator ==(in D3D11_VIEWPORT l, in D3D11_VIEWPORT r) => - (l.TopLeftX == r.TopLeftX) && - (l.TopLeftY == r.TopLeftY) && - (l.Width == r.Width) && - (l.Height == r.Height) && - (l.MinDepth == r.MinDepth) && - (l.MaxDepth == r.MaxDepth); - - public static bool operator !=(in D3D11_VIEWPORT l, in D3D11_VIEWPORT r) => !(l == r); + public static bool operator ==(in D3D11_VIEWPORT l, in D3D11_VIEWPORT r) + { + return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; + } + + public static bool operator !=(in D3D11_VIEWPORT l, in D3D11_VIEWPORT r) + { + return !(l == r); + } public override bool Equals(object? obj) => (obj is D3D11_VIEWPORT other) && Equals(other); diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_CLEAR_VALUE.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_CLEAR_VALUE.Manual.cs index 6141ba8ba4..83d890b528 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_CLEAR_VALUE.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_CLEAR_VALUE.Manual.cs @@ -8,7 +8,7 @@ namespace TerraFX.Interop { - public unsafe partial struct D3D12_CLEAR_VALUE + public unsafe partial struct D3D12_CLEAR_VALUE : IEquatable { public D3D12_CLEAR_VALUE(DXGI_FORMAT format, [NativeTypeName("const FLOAT [4]")] float* color) { diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS.Manual.cs index 877cebc795..7ed86362f9 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS.Manual.cs @@ -8,7 +8,7 @@ namespace TerraFX.Interop { - public partial struct D3D12_RENDER_PASS_BEGINNING_ACCESS + public partial struct D3D12_RENDER_PASS_BEGINNING_ACCESS : IEquatable { public static bool operator ==([NativeTypeName("const D3D12_RENDER_PASS_BEGINNING_ACCESS &")] in D3D12_RENDER_PASS_BEGINNING_ACCESS a, [NativeTypeName("const D3D12_RENDER_PASS_BEGINNING_ACCESS &")] in D3D12_RENDER_PASS_BEGINNING_ACCESS b) { diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS.Manual.cs index 6e27cb2b83..6b88f9f434 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS.Manual.cs @@ -3,9 +3,11 @@ // Ported from d3dx12.h in DirectX-Graphics-Samples commit a7a87f1853b5540f10920518021d91ae641033fb // Original source is Copyright © Microsoft. All rights reserved. +using System; + namespace TerraFX.Interop { - public partial struct D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS + public partial struct D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS : IEquatable { public static bool operator ==([NativeTypeName("const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &")] in D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS a, [NativeTypeName("const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &")] in D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS b) { @@ -21,9 +23,6 @@ public partial struct D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS public bool Equals(D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS other) => this == other; - public override int GetHashCode() - { - return ClearValue.GetHashCode(); - } + public override int GetHashCode() => ClearValue.GetHashCode(); } } diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_DEPTH_STENCIL_DESC.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_DEPTH_STENCIL_DESC.Manual.cs index 52010c9d44..cbe8d3c48b 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_DEPTH_STENCIL_DESC.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_DEPTH_STENCIL_DESC.Manual.cs @@ -7,7 +7,7 @@ namespace TerraFX.Interop { - public partial struct D3D12_RENDER_PASS_DEPTH_STENCIL_DESC + public partial struct D3D12_RENDER_PASS_DEPTH_STENCIL_DESC : IEquatable { public static bool operator ==([NativeTypeName("const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &")] in D3D12_RENDER_PASS_DEPTH_STENCIL_DESC a, [NativeTypeName("const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &")] in D3D12_RENDER_PASS_DEPTH_STENCIL_DESC b) { @@ -38,9 +38,6 @@ public partial struct D3D12_RENDER_PASS_DEPTH_STENCIL_DESC public bool Equals(D3D12_RENDER_PASS_DEPTH_STENCIL_DESC other) => this == other; - public override int GetHashCode() - { - return HashCode.Combine(cpuDescriptor, DepthBeginningAccess, StencilBeginningAccess, DepthEndingAccess, StencilEndingAccess); - } + public override int GetHashCode() => HashCode.Combine(cpuDescriptor, DepthBeginningAccess, StencilBeginningAccess, DepthEndingAccess, StencilEndingAccess); } } diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS.Manual.cs index 24b1abbc5d..5952269fb5 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS.Manual.cs @@ -8,7 +8,7 @@ namespace TerraFX.Interop { - public partial struct D3D12_RENDER_PASS_ENDING_ACCESS + public partial struct D3D12_RENDER_PASS_ENDING_ACCESS : IEquatable { public static bool operator ==([NativeTypeName("const D3D12_RENDER_PASS_ENDING_ACCESS &")] in D3D12_RENDER_PASS_ENDING_ACCESS a, [NativeTypeName("const D3D12_RENDER_PASS_ENDING_ACCESS &")] in D3D12_RENDER_PASS_ENDING_ACCESS b) { diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS.Manual.cs index 1476dbbf59..3fbc40e2f7 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS.Manual.cs @@ -7,7 +7,7 @@ namespace TerraFX.Interop { - public unsafe partial struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS + public unsafe partial struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS : IEquatable { public static bool operator ==([NativeTypeName("const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &")] in D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS a, [NativeTypeName("const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &")] in D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS b) { @@ -41,9 +41,6 @@ public unsafe partial struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS public bool Equals(D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS other) => this == other; - public override int GetHashCode() - { - return HashCode.Combine((UIntPtr)pSrcResource, (UIntPtr)pDstResource, SubresourceCount, (UIntPtr)pSubresourceParameters, Format, ResolveMode, PreserveResolveSource); - } + public override int GetHashCode() => HashCode.Combine((UIntPtr)pSrcResource, (UIntPtr)pDstResource, SubresourceCount, (UIntPtr)pSubresourceParameters, Format, ResolveMode, PreserveResolveSource); } } diff --git a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_RENDER_TARGET_DESC.Manual.cs b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_RENDER_TARGET_DESC.Manual.cs index fb901d30a6..93fcd8b9ba 100644 --- a/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_RENDER_TARGET_DESC.Manual.cs +++ b/sources/Interop/D3D12/um/d3dx12/D3D12_RENDER_PASS_RENDER_TARGET_DESC.Manual.cs @@ -7,7 +7,7 @@ namespace TerraFX.Interop { - public partial struct D3D12_RENDER_PASS_RENDER_TARGET_DESC + public partial struct D3D12_RENDER_PASS_RENDER_TARGET_DESC : IEquatable { public static bool operator ==([NativeTypeName("const D3D12_RENDER_PASS_RENDER_TARGET_DESC &")] in D3D12_RENDER_PASS_RENDER_TARGET_DESC a, [NativeTypeName("const D3D12_RENDER_PASS_RENDER_TARGET_DESC &")] in D3D12_RENDER_PASS_RENDER_TARGET_DESC b) { @@ -32,9 +32,6 @@ public partial struct D3D12_RENDER_PASS_RENDER_TARGET_DESC public bool Equals(D3D12_RENDER_PASS_RENDER_TARGET_DESC other) => this == other; - public override int GetHashCode() - { - return HashCode.Combine(cpuDescriptor, BeginningAccess, EndingAccess); - } + public override int GetHashCode() => HashCode.Combine(cpuDescriptor, BeginningAccess, EndingAccess); } } diff --git a/sources/Interop/DCommon/DCommon.cs b/sources/Interop/DCommon/DCommon.cs deleted file mode 100644 index 891643ecf7..0000000000 --- a/sources/Interop/DCommon/DCommon.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. - -using System.Runtime.InteropServices; - -namespace TerraFX.Interop -{ - public static unsafe partial class DCommon - { - private const string D2D1LibraryPath = "D2D1"; - } -} diff --git a/sources/Interop/DCommon/um/dcommon/DCommon.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D1.Manual.cs similarity index 60% rename from sources/Interop/DCommon/um/dcommon/DCommon.Manual.cs rename to sources/Interop/DCommon/um/dcommon/D2D1.Manual.cs index 88fcc15ea9..e730586a21 100644 --- a/sources/Interop/DCommon/um/dcommon/DCommon.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D1.Manual.cs @@ -4,30 +4,32 @@ namespace TerraFX.Interop { - public static unsafe partial class DCommon + internal static unsafe partial class D2D1 { - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1MakeRotateMatrix", ExactSpelling = true)] + private const string LibraryPath = "D2D1"; + + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1MakeRotateMatrix", ExactSpelling = true)] public static extern void D2D1MakeRotateMatrix([NativeTypeName("FLOAT")] float angle, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F center, [NativeTypeName("D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1MakeSkewMatrix", ExactSpelling = true)] + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1MakeSkewMatrix", ExactSpelling = true)] public static extern void D2D1MakeSkewMatrix([NativeTypeName("FLOAT")] float angleX, [NativeTypeName("FLOAT")] float angleY, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F center, [NativeTypeName("D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1IsMatrixInvertible", ExactSpelling = true)] + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1IsMatrixInvertible", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int D2D1IsMatrixInvertible([NativeTypeName("const D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1InvertMatrix", ExactSpelling = true)] + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1InvertMatrix", ExactSpelling = true)] [return: NativeTypeName("BOOL")] public static extern int D2D1InvertMatrix([NativeTypeName("D2D1_MATRIX_3X2_F *")] D2D_MATRIX_3X2_F* matrix); - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1SinCos", ExactSpelling = true)] + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1SinCos", ExactSpelling = true)] public static extern void D2D1SinCos([NativeTypeName("FLOAT")] float angle, [NativeTypeName("FLOAT *")] float* s, [NativeTypeName("FLOAT *")] float* c); - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1Tan", ExactSpelling = true)] + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1Tan", ExactSpelling = true)] [return: NativeTypeName("FLOAT")] public static extern float D2D1Tan([NativeTypeName("FLOAT")] float angle); - [DllImport(D2D1LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1Vec3Length", ExactSpelling = true)] + [DllImport(LibraryPath, CallingConvention = CallingConvention.StdCall, EntryPoint = "D2D1Vec3Length", ExactSpelling = true)] [return: NativeTypeName("FLOAT")] public static extern float D2D1Vec3Length([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y, [NativeTypeName("FLOAT")] float z); } diff --git a/sources/Interop/DCommon/um/dcommon/D2D1_PIXEL_FORMAT.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D1_PIXEL_FORMAT.Manual.cs index 5448e5832d..96199e4acd 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D1_PIXEL_FORMAT.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D1_PIXEL_FORMAT.Manual.cs @@ -3,15 +3,16 @@ // Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. +using static TerraFX.Interop.D2D1_ALPHA_MODE; +using static TerraFX.Interop.DXGI_FORMAT; + namespace TerraFX.Interop { public partial struct D2D1_PIXEL_FORMAT { - public static readonly D2D1_PIXEL_FORMAT DEFAULT = new D2D1_PIXEL_FORMAT(DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE.D2D1_ALPHA_MODE_UNKNOWN); - - public D2D1_PIXEL_FORMAT(in DXGI_FORMAT dxgiFormat, in D2D1_ALPHA_MODE alphaMode) + public D2D1_PIXEL_FORMAT(DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE alphaMode = D2D1_ALPHA_MODE_UNKNOWN) { - format = dxgiFormat; + this.format = dxgiFormat; this.alphaMode = alphaMode; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_3X2_F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_3X2_F.Manual.cs index 8a7917245b..d4d302b093 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_3X2_F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_3X2_F.Manual.cs @@ -4,110 +4,69 @@ // Original source is Copyright © Microsoft. All rights reserved. using System; +using static TerraFX.Interop.D2D1; namespace TerraFX.Interop { public unsafe partial struct D2D_MATRIX_3X2_F : IEquatable { - public static readonly D2D_MATRIX_3X2_F Identity = new D2D_MATRIX_3X2_F( - 1.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f); - - public D2D_MATRIX_3X2_F( - float m11, float m12, float m21, - float m22, float m31, float m32) : this() + public D2D_MATRIX_3X2_F([NativeTypeName("FLOAT")] float m11, [NativeTypeName("FLOAT")] float m12, [NativeTypeName("FLOAT")] float m21, [NativeTypeName("FLOAT")] float m22, [NativeTypeName("FLOAT")] float m31, [NativeTypeName("FLOAT")] float m32) { + this = default; + Anonymous.Anonymous2._11 = m11; Anonymous.Anonymous2._12 = m12; - Anonymous.Anonymous2._21 = m21; Anonymous.Anonymous2._22 = m22; - Anonymous.Anonymous2._31 = m31; Anonymous.Anonymous2._32 = m32; } - public readonly float Determinant => (Anonymous.Anonymous2._11 * Anonymous.Anonymous2._22) - (Anonymous.Anonymous2._12 * Anonymous.Anonymous2._21); + public static readonly D2D_MATRIX_3X2_F Identity = new D2D_MATRIX_3X2_F(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f); - public readonly bool IsInvertible + public static D2D_MATRIX_3X2_F Translation([NativeTypeName("D2D1_SIZE_F")] D2D_SIZE_F size) { - get - { - fixed (D2D_MATRIX_3X2_F* matrix = &this) - { - return DCommon.D2D1IsMatrixInvertible(matrix) != 0; - } - } - } + D2D_MATRIX_3X2_F translation = default; - public readonly bool IsIdentity => - Anonymous.Anonymous2._11 == 1.0f && Anonymous.Anonymous2._12 == 0.0f && - Anonymous.Anonymous2._21 == 0.0f && Anonymous.Anonymous2._22 == 1.0f && - Anonymous.Anonymous2._31 == 0.0f && Anonymous.Anonymous2._32 == 0.0f; + translation.Anonymous.Anonymous2._11 = 1.0f; + translation.Anonymous.Anonymous2._12 = 0.0f; + translation.Anonymous.Anonymous2._21 = 0.0f; + translation.Anonymous.Anonymous2._22 = 1.0f; + translation.Anonymous.Anonymous2._31 = size.width; + translation.Anonymous.Anonymous2._32 = size.height; - public bool Invert() - { - fixed (D2D_MATRIX_3X2_F* matrix = &this) - { - return DCommon.D2D1InvertMatrix(matrix) != 0; - } + return translation; } - public void SetProduct(in D2D_MATRIX_3X2_F a, in D2D_MATRIX_3X2_F b) + public static D2D_MATRIX_3X2_F Translation([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y) { - Anonymous.Anonymous2._11 = (a.Anonymous.Anonymous2._11 * b.Anonymous.Anonymous2._11) + (a.Anonymous.Anonymous2._12 * b.Anonymous.Anonymous2._21); - Anonymous.Anonymous2._12 = (a.Anonymous.Anonymous2._11 * b.Anonymous.Anonymous2._12) + (a.Anonymous.Anonymous2._12 * b.Anonymous.Anonymous2._22); - - Anonymous.Anonymous2._21 = (a.Anonymous.Anonymous2._21 * b.Anonymous.Anonymous2._11) + (a.Anonymous.Anonymous2._22 * b.Anonymous.Anonymous2._21); - Anonymous.Anonymous2._22 = (a.Anonymous.Anonymous2._21 * b.Anonymous.Anonymous2._12) + (a.Anonymous.Anonymous2._22 * b.Anonymous.Anonymous2._22); - - Anonymous.Anonymous2._31 = (a.Anonymous.Anonymous2._31 * b.Anonymous.Anonymous2._11) + (a.Anonymous.Anonymous2._32 * b.Anonymous.Anonymous2._21) + b.Anonymous.Anonymous2._31; - Anonymous.Anonymous2._32 = (a.Anonymous.Anonymous2._31 * b.Anonymous.Anonymous2._12) + (a.Anonymous.Anonymous2._32 * b.Anonymous.Anonymous2._22) + b.Anonymous.Anonymous2._32; + return Translation(new D2D_SIZE_F(x, y)); } - public void SetProduct(D2D_MATRIX_3X2_F* a, D2D_MATRIX_3X2_F* b) + public static D2D_MATRIX_3X2_F Scale([NativeTypeName("D2D1_SIZE_F")] D2D_SIZE_F size, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F center = default) { - Anonymous.Anonymous2._11 = (a->Anonymous.Anonymous2._11 * b->Anonymous.Anonymous2._11) + (a->Anonymous.Anonymous2._12 * b->Anonymous.Anonymous2._21); - Anonymous.Anonymous2._12 = (a->Anonymous.Anonymous2._11 * b->Anonymous.Anonymous2._12) + (a->Anonymous.Anonymous2._12 * b->Anonymous.Anonymous2._22); + D2D_MATRIX_3X2_F scale = default; - Anonymous.Anonymous2._21 = (a->Anonymous.Anonymous2._21 * b->Anonymous.Anonymous2._11) + (a->Anonymous.Anonymous2._22 * b->Anonymous.Anonymous2._21); - Anonymous.Anonymous2._22 = (a->Anonymous.Anonymous2._21 * b->Anonymous.Anonymous2._12) + (a->Anonymous.Anonymous2._22 * b->Anonymous.Anonymous2._22); + scale.Anonymous.Anonymous2._11 = size.width; + scale.Anonymous.Anonymous2._12 = 0.0f; + scale.Anonymous.Anonymous2._21 = 0.0f; + scale.Anonymous.Anonymous2._22 = size.height; + scale.Anonymous.Anonymous2._31 = center.x - size.width * center.x; + scale.Anonymous.Anonymous2._32 = center.y - size.height * center.y; - Anonymous.Anonymous2._31 = (a->Anonymous.Anonymous2._31 * b->Anonymous.Anonymous2._11) + (a->Anonymous.Anonymous2._32 * b->Anonymous.Anonymous2._21) + b->Anonymous.Anonymous2._31; - Anonymous.Anonymous2._32 = (a->Anonymous.Anonymous2._31 * b->Anonymous.Anonymous2._12) + (a->Anonymous.Anonymous2._32 * b->Anonymous.Anonymous2._22) + b->Anonymous.Anonymous2._32; + return scale; } - public readonly D2D_POINT_2F TransformPoint(in D2D_POINT_2F point) => new D2D_POINT_2F((point.x * Anonymous.Anonymous2._11) + (point.y * Anonymous.Anonymous2._21) + Anonymous.Anonymous2._31, (point.x * Anonymous.Anonymous2._12) + (point.y * Anonymous.Anonymous2._22) + Anonymous.Anonymous2._32); - - public bool Equals(D2D_MATRIX_3X2_F other) => this == other; - - public override bool Equals(object? obj) => (obj is D2D_MATRIX_3X2_F other) && this == other; - - public override int GetHashCode() => HashCode.Combine( - Anonymous.Anonymous2._11, - Anonymous.Anonymous2._12, - - Anonymous.Anonymous2._21, - Anonymous.Anonymous2._22, - - Anonymous.Anonymous2._31, - Anonymous.Anonymous2._32); - - public static D2D_MATRIX_3X2_F Translation(in D2D_SIZE_F size) => new D2D_MATRIX_3X2_F(1.0f, 0.0f, 0.0f, 1.0f, size.width, size.height); - - public static D2D_MATRIX_3X2_F Translation(float x, float y) => Translation(new D2D_SIZE_F(x, y)); - - public static D2D_MATRIX_3X2_F Scale(in D2D_SIZE_F size, in D2D_POINT_2F center = default) => new D2D_MATRIX_3X2_F(size.width, 0.0f, 0.0f, size.height, center.x - (size.width * center.x), center.y - (size.height * center.y)); - - public static D2D_MATRIX_3X2_F Scale(float x, float y, in D2D_POINT_2F center) => Scale(new D2D_SIZE_F(x, y), center); - - public static D2D_MATRIX_3X2_F IdentityMatrix() => Identity; + public static D2D_MATRIX_3X2_F Scale([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y, [NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F center = default) + { + return Scale(new D2D_SIZE_F(x, y), center); + } public static D2D_MATRIX_3X2_F Rotation(float angle, D2D_POINT_2F center = default) { D2D_MATRIX_3X2_F rotation; - DCommon.D2D1MakeRotateMatrix(angle, center, &rotation); + D2D1MakeRotateMatrix(angle, center, &rotation); return rotation; } @@ -116,32 +75,58 @@ public static D2D_MATRIX_3X2_F Skew(float angleX, float angleY, D2D_POINT_2F cen { D2D_MATRIX_3X2_F skew; - DCommon.D2D1MakeSkewMatrix(angleX, angleY, center, &skew); + D2D1MakeSkewMatrix(angleX, angleY, center, &skew); return skew; } - public static bool operator ==(D2D_MATRIX_3X2_F left, D2D_MATRIX_3X2_F right) => - left.Anonymous.Anonymous2._11 == right.Anonymous.Anonymous2._11 && - left.Anonymous.Anonymous2._12 == right.Anonymous.Anonymous2._12 && - - left.Anonymous.Anonymous2._21 == right.Anonymous.Anonymous2._21 && - left.Anonymous.Anonymous2._22 == right.Anonymous.Anonymous2._22 && - - left.Anonymous.Anonymous2._31 == right.Anonymous.Anonymous2._31 && - left.Anonymous.Anonymous2._32 == right.Anonymous.Anonymous2._32; + public readonly float Determinant + { + [return: NativeTypeName("FLOAT")] + get + { + return (Anonymous.Anonymous2._11 * Anonymous.Anonymous2._22) - (Anonymous.Anonymous2._12 * Anonymous.Anonymous2._21); + } + } + + public readonly bool IsInvertible + { + get + { + fixed (D2D_MATRIX_3X2_F* matrix = &this) + { + return D2D1IsMatrixInvertible(matrix) != 0; + } + } + } - public static bool operator !=(D2D_MATRIX_3X2_F left, D2D_MATRIX_3X2_F right) => - left.Anonymous.Anonymous2._11 != right.Anonymous.Anonymous2._11 || - left.Anonymous.Anonymous2._12 != right.Anonymous.Anonymous2._12 || + public bool Invert() + { + fixed (D2D_MATRIX_3X2_F* matrix = &this) + { + return D2D1InvertMatrix(matrix) != 0; + } + } - left.Anonymous.Anonymous2._21 != right.Anonymous.Anonymous2._21 || - left.Anonymous.Anonymous2._22 != right.Anonymous.Anonymous2._22 || + public readonly bool IsIdentity + { + get + { + return Anonymous.Anonymous2._11 == 1.0f && Anonymous.Anonymous2._12 == 0.0f && Anonymous.Anonymous2._21 == 0.0f && Anonymous.Anonymous2._22 == 1.0f && Anonymous.Anonymous2._31 == 0.0f && Anonymous.Anonymous2._32 == 0.0f; + } + } - left.Anonymous.Anonymous2._31 != right.Anonymous.Anonymous2._31 || - left.Anonymous.Anonymous2._32 != right.Anonymous.Anonymous2._32; + public void SetProduct([NativeTypeName("const D2D1_MATRIX_3X2 &")] in D2D_MATRIX_3X2_F a, [NativeTypeName("const D2D1_MATRIX_3X2 &")] in D2D_MATRIX_3X2_F b) + { + Anonymous.Anonymous2._11 = (a.Anonymous.Anonymous2._11 * b.Anonymous.Anonymous2._11) + (a.Anonymous.Anonymous2._12 * b.Anonymous.Anonymous2._21); + Anonymous.Anonymous2._12 = (a.Anonymous.Anonymous2._11 * b.Anonymous.Anonymous2._12) + (a.Anonymous.Anonymous2._12 * b.Anonymous.Anonymous2._22); + Anonymous.Anonymous2._21 = (a.Anonymous.Anonymous2._21 * b.Anonymous.Anonymous2._11) + (a.Anonymous.Anonymous2._22 * b.Anonymous.Anonymous2._21); + Anonymous.Anonymous2._22 = (a.Anonymous.Anonymous2._21 * b.Anonymous.Anonymous2._12) + (a.Anonymous.Anonymous2._22 * b.Anonymous.Anonymous2._22); + Anonymous.Anonymous2._31 = (a.Anonymous.Anonymous2._31 * b.Anonymous.Anonymous2._11) + (a.Anonymous.Anonymous2._32 * b.Anonymous.Anonymous2._21) + b.Anonymous.Anonymous2._31; + Anonymous.Anonymous2._32 = (a.Anonymous.Anonymous2._31 * b.Anonymous.Anonymous2._12) + (a.Anonymous.Anonymous2._32 * b.Anonymous.Anonymous2._22) + b.Anonymous.Anonymous2._32; + } - public static D2D_MATRIX_3X2_F operator *(in D2D_MATRIX_3X2_F a, in D2D_MATRIX_3X2_F b) + public static D2D_MATRIX_3X2_F operator *([NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F a, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F b) { D2D_MATRIX_3X2_F result = default; @@ -150,6 +135,35 @@ public static D2D_MATRIX_3X2_F Skew(float angleX, float angleY, D2D_POINT_2F cen return result; } - public static D2D_POINT_2F operator *(in D2D_POINT_2F point, in D2D_MATRIX_3X2_F matrix) => matrix.TransformPoint(point); + public readonly D2D_POINT_2F TransformPoint([NativeTypeName("D2D1_POINT_2F")] D2D_POINT_2F point) + { + D2D_POINT_2F result = new D2D_POINT_2F + { + x = point.x * Anonymous.Anonymous2._11 + point.y * Anonymous.Anonymous2._21 + Anonymous.Anonymous2._31, + y= point.x * Anonymous.Anonymous2._12 + point.y * Anonymous.Anonymous2._22 + Anonymous.Anonymous2._32, + }; + return result; + } + + public static D2D_POINT_2F operator *([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F point, [NativeTypeName("const D2D1_MATRIX_3X2_F &")] in D2D_MATRIX_3X2_F matrix) + { + return matrix.TransformPoint(point); + } + + public static bool operator ==(D2D_MATRIX_3X2_F l, D2D_MATRIX_3X2_F r) + { + return l.Anonymous.Anonymous2._11 == r.Anonymous.Anonymous2._11 && l.Anonymous.Anonymous2._12 == r.Anonymous.Anonymous2._12 && l.Anonymous.Anonymous2._21 == r.Anonymous.Anonymous2._21 && l.Anonymous.Anonymous2._22 == r.Anonymous.Anonymous2._22 && l.Anonymous.Anonymous2._31 == r.Anonymous.Anonymous2._31 && l.Anonymous.Anonymous2._32 == r.Anonymous.Anonymous2._32; + } + + public static bool operator !=(D2D_MATRIX_3X2_F l, D2D_MATRIX_3X2_F r) + { + return !(l == r); + } + + public bool Equals(D2D_MATRIX_3X2_F other) => this == other; + + public override bool Equals(object? obj) => (obj is D2D_MATRIX_3X2_F other) && this == other; + + public override int GetHashCode() => HashCode.Combine(Anonymous.Anonymous2._11, Anonymous.Anonymous2._12, Anonymous.Anonymous2._21, Anonymous.Anonymous2._22, Anonymous.Anonymous2._31, Anonymous.Anonymous2._32); } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X3_F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X3_F.Manual.cs index 9cf83235ea..17db8c5b3e 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X3_F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X3_F.Manual.cs @@ -9,34 +9,36 @@ namespace TerraFX.Interop { public partial struct D2D_MATRIX_4X3_F : IEquatable { - public static readonly D2D_MATRIX_4X3_F DEFAULT = new D2D_MATRIX_4X3_F( - 1.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, 0.0f); - - public D2D_MATRIX_4X3_F( - float m11, float m12, float m13, - float m21, float m22, float m23, - float m31, float m32, float m33, - float m41, float m42, float m43) : this() + public D2D_MATRIX_4X3_F([NativeTypeName("FLOAT")] float m11, [NativeTypeName("FLOAT")] float m12, [NativeTypeName("FLOAT")] float m13, [NativeTypeName("FLOAT")] float m21, [NativeTypeName("FLOAT")] float m22, [NativeTypeName("FLOAT")] float m23, [NativeTypeName("FLOAT")] float m31, [NativeTypeName("FLOAT")] float m32, [NativeTypeName("FLOAT")] float m33, [NativeTypeName("FLOAT")] float m41, [NativeTypeName("FLOAT")] float m42, [NativeTypeName("FLOAT")] float m43) { + this = default; + Anonymous.Anonymous._11 = m11; Anonymous.Anonymous._12 = m12; Anonymous.Anonymous._13 = m13; - Anonymous.Anonymous._21 = m21; Anonymous.Anonymous._22 = m22; Anonymous.Anonymous._23 = m23; - Anonymous.Anonymous._31 = m31; Anonymous.Anonymous._32 = m32; Anonymous.Anonymous._33 = m33; - Anonymous.Anonymous._41 = m41; Anonymous.Anonymous._42 = m42; Anonymous.Anonymous._43 = m43; } + public static readonly D2D_MATRIX_4X3_F DEFAULT = new D2D_MATRIX_4X3_F(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f); + + public static bool operator ==([NativeTypeName("const D2D_MATRIX_4X3_F &")] in D2D_MATRIX_4X3_F l, [NativeTypeName("const D2D_MATRIX_4X3_F &")] in D2D_MATRIX_4X3_F r) + { + return l.Anonymous.Anonymous._11 == r.Anonymous.Anonymous._11 && l.Anonymous.Anonymous._12 == r.Anonymous.Anonymous._12 && l.Anonymous.Anonymous._13 == r.Anonymous.Anonymous._13 && l.Anonymous.Anonymous._21 == r.Anonymous.Anonymous._21 && l.Anonymous.Anonymous._22 == r.Anonymous.Anonymous._22 && l.Anonymous.Anonymous._23 == r.Anonymous.Anonymous._23 && l.Anonymous.Anonymous._31 == r.Anonymous.Anonymous._31 && l.Anonymous.Anonymous._32 == r.Anonymous.Anonymous._32 && l.Anonymous.Anonymous._33 == r.Anonymous.Anonymous._33 && l.Anonymous.Anonymous._41 == r.Anonymous.Anonymous._41 && l.Anonymous.Anonymous._42 == r.Anonymous.Anonymous._42 && l.Anonymous.Anonymous._43 == r.Anonymous.Anonymous._43; + } + + public static bool operator !=([NativeTypeName("const D2D_MATRIX_4X3_F &")] in D2D_MATRIX_4X3_F l, [NativeTypeName("const D2D_MATRIX_4X3_F &")] in D2D_MATRIX_4X3_F r) + { + return !(l == r); + } + public bool Equals(D2D_MATRIX_4X3_F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_MATRIX_4X3_F other) && this == other; @@ -44,58 +46,21 @@ public D2D_MATRIX_4X3_F( public override int GetHashCode() { var hashCode = new HashCode(); - - hashCode.Add(Anonymous.Anonymous._11); - hashCode.Add(Anonymous.Anonymous._12); - hashCode.Add(Anonymous.Anonymous._13); - - hashCode.Add(Anonymous.Anonymous._21); - hashCode.Add(Anonymous.Anonymous._22); - hashCode.Add(Anonymous.Anonymous._23); - - hashCode.Add(Anonymous.Anonymous._31); - hashCode.Add(Anonymous.Anonymous._32); - hashCode.Add(Anonymous.Anonymous._33); - - hashCode.Add(Anonymous.Anonymous._41); - hashCode.Add(Anonymous.Anonymous._42); - hashCode.Add(Anonymous.Anonymous._43); - + { + hashCode.Add(Anonymous.Anonymous._11); + hashCode.Add(Anonymous.Anonymous._12); + hashCode.Add(Anonymous.Anonymous._13); + hashCode.Add(Anonymous.Anonymous._21); + hashCode.Add(Anonymous.Anonymous._22); + hashCode.Add(Anonymous.Anonymous._23); + hashCode.Add(Anonymous.Anonymous._31); + hashCode.Add(Anonymous.Anonymous._32); + hashCode.Add(Anonymous.Anonymous._33); + hashCode.Add(Anonymous.Anonymous._41); + hashCode.Add(Anonymous.Anonymous._42); + hashCode.Add(Anonymous.Anonymous._43); + } return hashCode.ToHashCode(); } - - public static bool operator ==(D2D_MATRIX_4X3_F left, D2D_MATRIX_4X3_F right) => - left.Anonymous.Anonymous._11 == right.Anonymous.Anonymous._11 && - left.Anonymous.Anonymous._12 == right.Anonymous.Anonymous._12 && - left.Anonymous.Anonymous._13 == right.Anonymous.Anonymous._13 && - - left.Anonymous.Anonymous._21 == right.Anonymous.Anonymous._21 && - left.Anonymous.Anonymous._22 == right.Anonymous.Anonymous._22 && - left.Anonymous.Anonymous._23 == right.Anonymous.Anonymous._23 && - - left.Anonymous.Anonymous._31 == right.Anonymous.Anonymous._31 && - left.Anonymous.Anonymous._32 == right.Anonymous.Anonymous._32 && - left.Anonymous.Anonymous._33 == right.Anonymous.Anonymous._33 && - - left.Anonymous.Anonymous._41 == right.Anonymous.Anonymous._41 && - left.Anonymous.Anonymous._42 == right.Anonymous.Anonymous._42 && - left.Anonymous.Anonymous._43 == right.Anonymous.Anonymous._43; - - public static bool operator !=(D2D_MATRIX_4X3_F left, D2D_MATRIX_4X3_F right) => - left.Anonymous.Anonymous._11 != right.Anonymous.Anonymous._11 || - left.Anonymous.Anonymous._12 != right.Anonymous.Anonymous._12 || - left.Anonymous.Anonymous._13 != right.Anonymous.Anonymous._13 || - - left.Anonymous.Anonymous._21 != right.Anonymous.Anonymous._21 || - left.Anonymous.Anonymous._22 != right.Anonymous.Anonymous._22 || - left.Anonymous.Anonymous._23 != right.Anonymous.Anonymous._23 || - - left.Anonymous.Anonymous._31 != right.Anonymous.Anonymous._31 || - left.Anonymous.Anonymous._32 != right.Anonymous.Anonymous._32 || - left.Anonymous.Anonymous._33 != right.Anonymous.Anonymous._33 || - - left.Anonymous.Anonymous._41 != right.Anonymous.Anonymous._41 || - left.Anonymous.Anonymous._42 != right.Anonymous.Anonymous._42 || - left.Anonymous.Anonymous._43 != right.Anonymous.Anonymous._43; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X4_F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X4_F.Manual.cs index ac53d7410d..509fba7d9f 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X4_F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_4X4_F.Manual.cs @@ -4,298 +4,229 @@ // Original source is Copyright © Microsoft. All rights reserved. using System; +using static TerraFX.Interop.D2D1; namespace TerraFX.Interop { public unsafe partial struct D2D_MATRIX_4X4_F : IEquatable { - public static readonly D2D_MATRIX_4X4_F DEFAULT = new D2D_MATRIX_4X4_F( - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); - - public D2D_MATRIX_4X4_F( - float m11, float m12, float m13, float m14, - float m21, float m22, float m23, float m24, - float m31, float m32, float m33, float m34, - float m41, float m42, float m43, float m44) : this() + public D2D_MATRIX_4X4_F([NativeTypeName("FLOAT")] float m11, [NativeTypeName("FLOAT")] float m12, [NativeTypeName("FLOAT")] float m13, [NativeTypeName("FLOAT")] float m14, [NativeTypeName("FLOAT")] float m21, [NativeTypeName("FLOAT")] float m22, [NativeTypeName("FLOAT")] float m23, [NativeTypeName("FLOAT")] float m24, [NativeTypeName("FLOAT")] float m31, [NativeTypeName("FLOAT")] float m32, [NativeTypeName("FLOAT")] float m33, [NativeTypeName("FLOAT")] float m34, [NativeTypeName("FLOAT")] float m41, [NativeTypeName("FLOAT")] float m42, [NativeTypeName("FLOAT")] float m43, [NativeTypeName("FLOAT")] float m44) { + this = default; + Anonymous.Anonymous._11 = m11; Anonymous.Anonymous._12 = m12; Anonymous.Anonymous._13 = m13; Anonymous.Anonymous._14 = m14; - Anonymous.Anonymous._21 = m21; Anonymous.Anonymous._22 = m22; Anonymous.Anonymous._23 = m23; Anonymous.Anonymous._24 = m24; - Anonymous.Anonymous._31 = m31; Anonymous.Anonymous._32 = m32; Anonymous.Anonymous._33 = m33; Anonymous.Anonymous._34 = m34; - Anonymous.Anonymous._41 = m41; Anonymous.Anonymous._42 = m42; Anonymous.Anonymous._43 = m43; Anonymous.Anonymous._44 = m44; } - public float Determinant - { - get - { - var minor1 = Anonymous.Anonymous._41 * ((Anonymous.Anonymous._12 * ((Anonymous.Anonymous._23 * Anonymous.Anonymous._34) - (Anonymous.Anonymous._33 * Anonymous.Anonymous._24))) - (Anonymous.Anonymous._13 * ((Anonymous.Anonymous._22 * Anonymous.Anonymous._34) - (Anonymous.Anonymous._24 * Anonymous.Anonymous._32))) + (Anonymous.Anonymous._14 * ((Anonymous.Anonymous._22 * Anonymous.Anonymous._33) - (Anonymous.Anonymous._23 * Anonymous.Anonymous._32)))); - var minor2 = Anonymous.Anonymous._42 * ((Anonymous.Anonymous._11 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._34) - (Anonymous.Anonymous._31 * Anonymous.Anonymous._24))) - (Anonymous.Anonymous._13 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._34) - (Anonymous.Anonymous._24 * Anonymous.Anonymous._31))) + (Anonymous.Anonymous._14 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._33) - (Anonymous.Anonymous._23 * Anonymous.Anonymous._31)))); - var minor3 = Anonymous.Anonymous._43 * ((Anonymous.Anonymous._11 * ((Anonymous.Anonymous._22 * Anonymous.Anonymous._34) - (Anonymous.Anonymous._32 * Anonymous.Anonymous._24))) - (Anonymous.Anonymous._12 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._34) - (Anonymous.Anonymous._24 * Anonymous.Anonymous._31))) + (Anonymous.Anonymous._14 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._32) - (Anonymous.Anonymous._22 * Anonymous.Anonymous._31)))); - var minor4 = Anonymous.Anonymous._44 * ((Anonymous.Anonymous._11 * ((Anonymous.Anonymous._22 * Anonymous.Anonymous._33) - (Anonymous.Anonymous._32 * Anonymous.Anonymous._23))) - (Anonymous.Anonymous._12 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._33) - (Anonymous.Anonymous._23 * Anonymous.Anonymous._31))) + (Anonymous.Anonymous._13 * ((Anonymous.Anonymous._21 * Anonymous.Anonymous._32) - (Anonymous.Anonymous._22 * Anonymous.Anonymous._31)))); + public static readonly D2D_MATRIX_4X4_F DEFAULT = new D2D_MATRIX_4X4_F(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); - return minor1 - minor2 + minor3 - minor4; - } + public static bool operator ==([NativeTypeName("const D2D1_MATRIX_4X4_F &")] in D2D_MATRIX_4X4_F l, [NativeTypeName("const D2D1_MATRIX_4X4_F &")] in D2D_MATRIX_4X4_F r) + { + return l.Anonymous.Anonymous._11 == r.Anonymous.Anonymous._11 && l.Anonymous.Anonymous._12 == r.Anonymous.Anonymous._12 && l.Anonymous.Anonymous._13 == r.Anonymous.Anonymous._13 && l.Anonymous.Anonymous._14 == r.Anonymous.Anonymous._14 && l.Anonymous.Anonymous._21 == r.Anonymous.Anonymous._21 && l.Anonymous.Anonymous._22 == r.Anonymous.Anonymous._22 && l.Anonymous.Anonymous._23 == r.Anonymous.Anonymous._23 && l.Anonymous.Anonymous._24 == r.Anonymous.Anonymous._24 && l.Anonymous.Anonymous._31 == r.Anonymous.Anonymous._31 && l.Anonymous.Anonymous._32 == r.Anonymous.Anonymous._32 && l.Anonymous.Anonymous._33 == r.Anonymous.Anonymous._33 && l.Anonymous.Anonymous._34 == r.Anonymous.Anonymous._34 && l.Anonymous.Anonymous._41 == r.Anonymous.Anonymous._41 && l.Anonymous.Anonymous._42 == r.Anonymous.Anonymous._42 && l.Anonymous.Anonymous._43 == r.Anonymous.Anonymous._43 && l.Anonymous.Anonymous._44 == r.Anonymous.Anonymous._44; } - public bool IsIdentity => - Anonymous.Anonymous._11 == 1.0f && Anonymous.Anonymous._12 == 0.0f && Anonymous.Anonymous._13 == 0.0f && Anonymous.Anonymous._14 == 0.0f && - Anonymous.Anonymous._21 == 0.0f && Anonymous.Anonymous._22 == 1.0f && Anonymous.Anonymous._23 == 0.0f && Anonymous.Anonymous._24 == 0.0f && - Anonymous.Anonymous._31 == 0.0f && Anonymous.Anonymous._32 == 0.0f && Anonymous.Anonymous._33 == 1.0f && Anonymous.Anonymous._34 == 0.0f && - Anonymous.Anonymous._41 == 0.0f && Anonymous.Anonymous._42 == 0.0f && Anonymous.Anonymous._43 == 0.0f && Anonymous.Anonymous._44 == 1.0f; - - public void SetProduct(in D2D_MATRIX_4X4_F a, in D2D_MATRIX_4X4_F b) + public static bool operator !=([NativeTypeName("const D2D1_MATRIX_4X4_F &")] in D2D_MATRIX_4X4_F l, [NativeTypeName("const D2D1_MATRIX_4X4_F &")] in D2D_MATRIX_4X4_F r) { - Anonymous.Anonymous._11 = (a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._11) + (a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._21) + (a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._31) + (a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._41); - Anonymous.Anonymous._12 = (a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._12) + (a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._22) + (a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._32) + (a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._42); - Anonymous.Anonymous._13 = (a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._13) + (a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._23) + (a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._33) + (a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._43); - Anonymous.Anonymous._14 = (a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._14) + (a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._24) + (a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._34) + (a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._44); - - Anonymous.Anonymous._21 = (a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._11) + (a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._21) + (a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._31) + (a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._41); - Anonymous.Anonymous._22 = (a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._12) + (a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._22) + (a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._32) + (a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._42); - Anonymous.Anonymous._23 = (a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._13) + (a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._23) + (a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._33) + (a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._43); - Anonymous.Anonymous._24 = (a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._14) + (a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._24) + (a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._34) + (a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._44); - - Anonymous.Anonymous._31 = (a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._11) + (a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._21) + (a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._31) + (a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._41); - Anonymous.Anonymous._32 = (a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._12) + (a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._22) + (a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._32) + (a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._42); - Anonymous.Anonymous._33 = (a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._13) + (a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._23) + (a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._33) + (a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._43); - Anonymous.Anonymous._34 = (a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._14) + (a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._24) + (a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._34) + (a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._44); - - Anonymous.Anonymous._41 = (a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._11) + (a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._21) + (a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._31) + (a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._41); - Anonymous.Anonymous._42 = (a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._12) + (a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._22) + (a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._32) + (a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._42); - Anonymous.Anonymous._43 = (a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._13) + (a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._23) + (a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._33) + (a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._43); - Anonymous.Anonymous._44 = (a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._14) + (a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._24) + (a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._34) + (a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._44); + return !(l == r); } - public void SetProduct(D2D_MATRIX_4X4_F* a, D2D_MATRIX_4X4_F* b) + public static D2D_MATRIX_4X4_F Translation([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y, [NativeTypeName("FLOAT")] float z) { - Anonymous.Anonymous._11 = (a->Anonymous.Anonymous._11 * b->Anonymous.Anonymous._11) + (a->Anonymous.Anonymous._12 * b->Anonymous.Anonymous._21) + (a->Anonymous.Anonymous._13 * b->Anonymous.Anonymous._31) + (a->Anonymous.Anonymous._14 * b->Anonymous.Anonymous._41); - Anonymous.Anonymous._12 = (a->Anonymous.Anonymous._11 * b->Anonymous.Anonymous._12) + (a->Anonymous.Anonymous._12 * b->Anonymous.Anonymous._22) + (a->Anonymous.Anonymous._13 * b->Anonymous.Anonymous._32) + (a->Anonymous.Anonymous._14 * b->Anonymous.Anonymous._42); - Anonymous.Anonymous._13 = (a->Anonymous.Anonymous._11 * b->Anonymous.Anonymous._13) + (a->Anonymous.Anonymous._12 * b->Anonymous.Anonymous._23) + (a->Anonymous.Anonymous._13 * b->Anonymous.Anonymous._33) + (a->Anonymous.Anonymous._14 * b->Anonymous.Anonymous._43); - Anonymous.Anonymous._14 = (a->Anonymous.Anonymous._11 * b->Anonymous.Anonymous._14) + (a->Anonymous.Anonymous._12 * b->Anonymous.Anonymous._24) + (a->Anonymous.Anonymous._13 * b->Anonymous.Anonymous._34) + (a->Anonymous.Anonymous._14 * b->Anonymous.Anonymous._44); - - Anonymous.Anonymous._21 = (a->Anonymous.Anonymous._21 * b->Anonymous.Anonymous._11) + (a->Anonymous.Anonymous._22 * b->Anonymous.Anonymous._21) + (a->Anonymous.Anonymous._23 * b->Anonymous.Anonymous._31) + (a->Anonymous.Anonymous._24 * b->Anonymous.Anonymous._41); - Anonymous.Anonymous._22 = (a->Anonymous.Anonymous._21 * b->Anonymous.Anonymous._12) + (a->Anonymous.Anonymous._22 * b->Anonymous.Anonymous._22) + (a->Anonymous.Anonymous._23 * b->Anonymous.Anonymous._32) + (a->Anonymous.Anonymous._24 * b->Anonymous.Anonymous._42); - Anonymous.Anonymous._23 = (a->Anonymous.Anonymous._21 * b->Anonymous.Anonymous._13) + (a->Anonymous.Anonymous._22 * b->Anonymous.Anonymous._23) + (a->Anonymous.Anonymous._23 * b->Anonymous.Anonymous._33) + (a->Anonymous.Anonymous._24 * b->Anonymous.Anonymous._43); - Anonymous.Anonymous._24 = (a->Anonymous.Anonymous._21 * b->Anonymous.Anonymous._14) + (a->Anonymous.Anonymous._22 * b->Anonymous.Anonymous._24) + (a->Anonymous.Anonymous._23 * b->Anonymous.Anonymous._34) + (a->Anonymous.Anonymous._24 * b->Anonymous.Anonymous._44); - - Anonymous.Anonymous._31 = (a->Anonymous.Anonymous._31 * b->Anonymous.Anonymous._11) + (a->Anonymous.Anonymous._32 * b->Anonymous.Anonymous._21) + (a->Anonymous.Anonymous._33 * b->Anonymous.Anonymous._31) + (a->Anonymous.Anonymous._34 * b->Anonymous.Anonymous._41); - Anonymous.Anonymous._32 = (a->Anonymous.Anonymous._31 * b->Anonymous.Anonymous._12) + (a->Anonymous.Anonymous._32 * b->Anonymous.Anonymous._22) + (a->Anonymous.Anonymous._33 * b->Anonymous.Anonymous._32) + (a->Anonymous.Anonymous._34 * b->Anonymous.Anonymous._42); - Anonymous.Anonymous._33 = (a->Anonymous.Anonymous._31 * b->Anonymous.Anonymous._13) + (a->Anonymous.Anonymous._32 * b->Anonymous.Anonymous._23) + (a->Anonymous.Anonymous._33 * b->Anonymous.Anonymous._33) + (a->Anonymous.Anonymous._34 * b->Anonymous.Anonymous._43); - Anonymous.Anonymous._34 = (a->Anonymous.Anonymous._31 * b->Anonymous.Anonymous._14) + (a->Anonymous.Anonymous._32 * b->Anonymous.Anonymous._24) + (a->Anonymous.Anonymous._33 * b->Anonymous.Anonymous._34) + (a->Anonymous.Anonymous._34 * b->Anonymous.Anonymous._44); - - Anonymous.Anonymous._41 = (a->Anonymous.Anonymous._41 * b->Anonymous.Anonymous._11) + (a->Anonymous.Anonymous._42 * b->Anonymous.Anonymous._21) + (a->Anonymous.Anonymous._43 * b->Anonymous.Anonymous._31) + (a->Anonymous.Anonymous._44 * b->Anonymous.Anonymous._41); - Anonymous.Anonymous._42 = (a->Anonymous.Anonymous._41 * b->Anonymous.Anonymous._12) + (a->Anonymous.Anonymous._42 * b->Anonymous.Anonymous._22) + (a->Anonymous.Anonymous._43 * b->Anonymous.Anonymous._32) + (a->Anonymous.Anonymous._44 * b->Anonymous.Anonymous._42); - Anonymous.Anonymous._43 = (a->Anonymous.Anonymous._41 * b->Anonymous.Anonymous._13) + (a->Anonymous.Anonymous._42 * b->Anonymous.Anonymous._23) + (a->Anonymous.Anonymous._43 * b->Anonymous.Anonymous._33) + (a->Anonymous.Anonymous._44 * b->Anonymous.Anonymous._43); - Anonymous.Anonymous._44 = (a->Anonymous.Anonymous._41 * b->Anonymous.Anonymous._14) + (a->Anonymous.Anonymous._42 * b->Anonymous.Anonymous._24) + (a->Anonymous.Anonymous._43 * b->Anonymous.Anonymous._34) + (a->Anonymous.Anonymous._44 * b->Anonymous.Anonymous._44); + D2D_MATRIX_4X4_F translation = default; + + translation.Anonymous.Anonymous._11 = 1.0f; + translation.Anonymous.Anonymous._12 = 0.0f; + translation.Anonymous.Anonymous._13 = 0.0f; + translation.Anonymous.Anonymous._14 = 0.0f; + translation.Anonymous.Anonymous._21 = 0.0f; + translation.Anonymous.Anonymous._22 = 1.0f; + translation.Anonymous.Anonymous._23 = 0.0f; + translation.Anonymous.Anonymous._24 = 0.0f; + translation.Anonymous.Anonymous._31 = 0.0f; + translation.Anonymous.Anonymous._32 = 0.0f; + translation.Anonymous.Anonymous._33 = 1.0f; + translation.Anonymous.Anonymous._34 = 0.0f; + translation.Anonymous.Anonymous._41 = x; + translation.Anonymous.Anonymous._42 = y; + translation.Anonymous.Anonymous._43 = z; + translation.Anonymous.Anonymous._44 = 1.0f; + + return translation; } - public bool Equals(D2D_MATRIX_4X4_F other) => this == other; - - public override bool Equals(object? obj) => (obj is D2D_MATRIX_4X4_F other) && this == other; + public static D2D_MATRIX_4X4_F Scale([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y, [NativeTypeName("FLOAT")] float z) + { + D2D_MATRIX_4X4_F scale = default; + + scale.Anonymous.Anonymous._11 = x; + scale.Anonymous.Anonymous._12 = 0.0f; + scale.Anonymous.Anonymous._13 = 0.0f; + scale.Anonymous.Anonymous._14 = 0.0f; + scale.Anonymous.Anonymous._21 = 0.0f; + scale.Anonymous.Anonymous._22 = y; + scale.Anonymous.Anonymous._23 = 0.0f; + scale.Anonymous.Anonymous._24 = 0.0f; + scale.Anonymous.Anonymous._31 = 0.0f; + scale.Anonymous.Anonymous._32 = 0.0f; + scale.Anonymous.Anonymous._33 = z; + scale.Anonymous.Anonymous._34 = 0.0f; + scale.Anonymous.Anonymous._41 = 0.0f; + scale.Anonymous.Anonymous._42 = 0.0f; + scale.Anonymous.Anonymous._43 = 0.0f; + scale.Anonymous.Anonymous._44 = 1.0f; + + return scale; + } - public override int GetHashCode() + public static D2D_MATRIX_4X4_F RotationX([NativeTypeName("FLOAT")] float degreeX) { - var hashCode = new HashCode(); + float angleInRadian = degreeX * (MathF.PI / 180.0f); + float sinAngle = 0.0f; + float cosAngle = 0.0f; - hashCode.Add(Anonymous.Anonymous._11); - hashCode.Add(Anonymous.Anonymous._12); - hashCode.Add(Anonymous.Anonymous._13); - hashCode.Add(Anonymous.Anonymous._14); + D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); - hashCode.Add(Anonymous.Anonymous._21); - hashCode.Add(Anonymous.Anonymous._22); - hashCode.Add(Anonymous.Anonymous._23); - hashCode.Add(Anonymous.Anonymous._24); + D2D_MATRIX_4X4_F rotationX = new D2D_MATRIX_4X4_F(1, 0, 0, 0, 0, cosAngle, sinAngle, 0, 0, -sinAngle, cosAngle, 0, 0, 0, 0, 1); - hashCode.Add(Anonymous.Anonymous._31); - hashCode.Add(Anonymous.Anonymous._32); - hashCode.Add(Anonymous.Anonymous._33); - hashCode.Add(Anonymous.Anonymous._34); + return rotationX; + } - hashCode.Add(Anonymous.Anonymous._41); - hashCode.Add(Anonymous.Anonymous._42); - hashCode.Add(Anonymous.Anonymous._43); - hashCode.Add(Anonymous.Anonymous._44); + public static D2D_MATRIX_4X4_F RotationY([NativeTypeName("FLOAT")] float degreeY) + { + float angleInRadian = degreeY * (MathF.PI / 180.0f); + float sinAngle = 0.0f; + float cosAngle = 0.0f; - return hashCode.ToHashCode(); - } + D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); - public static D2D_MATRIX_4X4_F Translation(float x, float y, float z) => new D2D_MATRIX_4X4_F( - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - x, y, z, 1.0f); + D2D_MATRIX_4X4_F rotationY = new D2D_MATRIX_4X4_F(cosAngle, 0, -sinAngle, 0, 0, 1, 0, 0, sinAngle, 0, cosAngle, 0, 0, 0, 0, 1); - public static D2D_MATRIX_4X4_F Scale(float x, float y, float z) => new D2D_MATRIX_4X4_F( - x, 0.0f, 0.0f, 0.0f, - 0.0f, y, 0.0f, 0.0f, - 0.0f, 0.0f, z, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + return rotationY; + } - public static D2D_MATRIX_4X4_F RotationX(float degreeX) + public static D2D_MATRIX_4X4_F RotationZ([NativeTypeName("FLOAT")] float degreeZ) { - var angleInRadian = degreeX * (MathF.PI / 180.0f); - var sinAngle = 0.0f; - var cosAngle = 0.0f; + float angleInRadian = degreeZ * (MathF.PI / 180.0f); + float sinAngle = 0.0f; + float cosAngle = 0.0f; - DCommon.D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); + D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); - return new D2D_MATRIX_4X4_F( - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, cosAngle, sinAngle, 0.0f, - 0.0f, -sinAngle, cosAngle, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + D2D_MATRIX_4X4_F rotationZ = new D2D_MATRIX_4X4_F(cosAngle, sinAngle, 0, 0, -sinAngle, cosAngle, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + + return rotationZ; } - public static D2D_MATRIX_4X4_F RotationY(float degreeY) + public static D2D_MATRIX_4X4_F RotationArbitraryAxis([NativeTypeName("FLOAT")] float x, [NativeTypeName("FLOAT")] float y, [NativeTypeName("FLOAT")] float z, [NativeTypeName("FLOAT")] float degree) { - var angleInRadian = degreeY * (MathF.PI / 180.0f); - var sinAngle = 0.0f; - var cosAngle = 0.0f; + float magnitude = D2D1Vec3Length(x, y, z); + + x /= magnitude; + y /= magnitude; + z /= magnitude; + + float angleInRadian = degree * (3.141592654f / 180.0f); + float sinAngle = 0.0f; + float cosAngle = 0.0f; + + D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); - DCommon.D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); + float oneMinusCosAngle = 1 - cosAngle; + D2D_MATRIX_4X4_F rotationArb = new D2D_MATRIX_4X4_F(1 + oneMinusCosAngle * (x * x - 1), z * sinAngle + oneMinusCosAngle * x * y, -y * sinAngle + oneMinusCosAngle * x * z, 0, -z * sinAngle + oneMinusCosAngle * y * x, 1 + oneMinusCosAngle * (y * y - 1), x * sinAngle + oneMinusCosAngle * y * z, 0, y * sinAngle + oneMinusCosAngle * z * x, -x * sinAngle + oneMinusCosAngle * z * y, 1 + oneMinusCosAngle * (z * z - 1), 0, 0, 0, 0, 1); - return new D2D_MATRIX_4X4_F( - cosAngle, 0.0f, -sinAngle, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - sinAngle, 0.0f, cosAngle, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + return rotationArb; } - public static D2D_MATRIX_4X4_F RotationZ(float degreeZ) + public static D2D_MATRIX_4X4_F SkewX([NativeTypeName("FLOAT")] float degreeX) { - var angleInRadian = degreeZ * (MathF.PI / 180.0f); - var sinAngle = 0.0f; - var cosAngle = 0.0f; + float angleInRadian = degreeX * (3.141592654f / 180.0f); + float tanAngle = D2D1Tan(angleInRadian); - DCommon.D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); + D2D_MATRIX_4X4_F skewX = new D2D_MATRIX_4X4_F(1, 0, 0, 0, tanAngle, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - return new D2D_MATRIX_4X4_F( - cosAngle, sinAngle, 0.0f, 0.0f, - -sinAngle, cosAngle, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + return skewX; } - public static D2D_MATRIX_4X4_F RotationArbitraryAxis(float x, float y, float z, float degree) + public static D2D_MATRIX_4X4_F SkewY([NativeTypeName("FLOAT")] float degreeY) { - var magnitude = DCommon.D2D1Vec3Length(x, y, z); + float angleInRadian = degreeY * (3.141592654f / 180.0f); + float tanAngle = D2D1Tan(angleInRadian); - x /= magnitude; - y /= magnitude; - z /= magnitude; + D2D_MATRIX_4X4_F skewY = new D2D_MATRIX_4X4_F(1, tanAngle, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + + return skewY; + } - var angleInRadian = degree * (MathF.PI / 180.0f); - var sinAngle = 0.0f; - var cosAngle = 0.0f; + public static D2D_MATRIX_4X4_F PerspectiveProjection([NativeTypeName("FLOAT")] float depth) + { + float proj = 0; - DCommon.D2D1SinCos(angleInRadian, &sinAngle, &cosAngle); + if (depth > 0) + { + proj = -1 / depth; + } - var oneMinusCosAngle = 1 - cosAngle; + D2D_MATRIX_4X4_F projection = new D2D_MATRIX_4X4_F(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, proj, 0, 0, 0, 1); - return new D2D_MATRIX_4X4_F( - 1 + (oneMinusCosAngle * ((x * x) - 1)), (z * sinAngle) + (oneMinusCosAngle * x * y), (-y * sinAngle) + (oneMinusCosAngle * x * z), 0.0f, - (-z * sinAngle) + (oneMinusCosAngle * y * x), 1 + (oneMinusCosAngle * ((y * y) - 1)), (x * sinAngle) + (oneMinusCosAngle * y * z), 0.0f, - (y * sinAngle) + (oneMinusCosAngle * z * x), (-x * sinAngle) + (oneMinusCosAngle * z * y), 1 + (oneMinusCosAngle * ((z * z) - 1)), 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + return projection; } - public static D2D_MATRIX_4X4_F SkewX(float degreeX) + public float Determinant { - var angleInRadian = degreeX * (MathF.PI / 180.0f); - var tanAngle = DCommon.D2D1Tan(angleInRadian); - - return new D2D_MATRIX_4X4_F( - 1.0f, 0.0f, 0.0f, 0.0f, - tanAngle, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + get + { + float minor1 = Anonymous.Anonymous._41 * (Anonymous.Anonymous._12 * (Anonymous.Anonymous._23 * Anonymous.Anonymous._34 - Anonymous.Anonymous._33 * Anonymous.Anonymous._24) - Anonymous.Anonymous._13 * (Anonymous.Anonymous._22 * Anonymous.Anonymous._34 - Anonymous.Anonymous._24 * Anonymous.Anonymous._32) + Anonymous.Anonymous._14 * (Anonymous.Anonymous._22 * Anonymous.Anonymous._33 - Anonymous.Anonymous._23 * Anonymous.Anonymous._32)); + float minor2 = Anonymous.Anonymous._42 * (Anonymous.Anonymous._11 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._34 - Anonymous.Anonymous._31 * Anonymous.Anonymous._24) - Anonymous.Anonymous._13 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._34 - Anonymous.Anonymous._24 * Anonymous.Anonymous._31) + Anonymous.Anonymous._14 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._33 - Anonymous.Anonymous._23 * Anonymous.Anonymous._31)); + float minor3 = Anonymous.Anonymous._43 * (Anonymous.Anonymous._11 * (Anonymous.Anonymous._22 * Anonymous.Anonymous._34 - Anonymous.Anonymous._32 * Anonymous.Anonymous._24) - Anonymous.Anonymous._12 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._34 - Anonymous.Anonymous._24 * Anonymous.Anonymous._31) + Anonymous.Anonymous._14 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._32 - Anonymous.Anonymous._22 * Anonymous.Anonymous._31)); + float minor4 = Anonymous.Anonymous._44 * (Anonymous.Anonymous._11 * (Anonymous.Anonymous._22 * Anonymous.Anonymous._33 - Anonymous.Anonymous._32 * Anonymous.Anonymous._23) - Anonymous.Anonymous._12 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._33 - Anonymous.Anonymous._23 * Anonymous.Anonymous._31) + Anonymous.Anonymous._13 * (Anonymous.Anonymous._21 * Anonymous.Anonymous._32 - Anonymous.Anonymous._22 * Anonymous.Anonymous._31)); + + return minor1 - minor2 + minor3 - minor4; + } } - public static D2D_MATRIX_4X4_F SkewY(float degreeY) + public bool IsIdentity { - var angleInRadian = degreeY * (MathF.PI / 180.0f); - var tanAngle = DCommon.D2D1Tan(angleInRadian); - - return new D2D_MATRIX_4X4_F( - 1.0f, tanAngle, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f); + get + { + return Anonymous.Anonymous._11 == 1.0f && Anonymous.Anonymous._12 == 0.0f && Anonymous.Anonymous._13 == 0.0f && Anonymous.Anonymous._14 == 0.0f && Anonymous.Anonymous._21 == 0.0f && Anonymous.Anonymous._22 == 1.0f && Anonymous.Anonymous._23 == 0.0f && Anonymous.Anonymous._24 == 0.0f && Anonymous.Anonymous._31 == 0.0f && Anonymous.Anonymous._32 == 0.0f && Anonymous.Anonymous._33 == 1.0f && Anonymous.Anonymous._34 == 0.0f && Anonymous.Anonymous._41 == 0.0f && Anonymous.Anonymous._42 == 0.0f && Anonymous.Anonymous._43 == 0.0f && Anonymous.Anonymous._44 == 1.0f; + } } - public static D2D_MATRIX_4X4_F PerspectiveProjection(float depth) + public void SetProduct([NativeTypeName("const D2D1_MATRIX_4x4_F &")] in D2D_MATRIX_4X4_F a, [NativeTypeName("const D2D1_MATRIX_4x4_F &")] in D2D_MATRIX_4X4_F b) { - var proj = depth > 0 ? -1 / depth : 0.0f; - - return new D2D_MATRIX_4X4_F( - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, proj, - 0.0f, 0.0f, 0.0f, 1.0f); + Anonymous.Anonymous._11 = a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._11 + a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._21 + a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._31 + a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._41; + Anonymous.Anonymous._12 = a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._12 + a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._22 + a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._32 + a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._42; + Anonymous.Anonymous._13 = a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._13 + a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._23 + a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._33 + a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._43; + Anonymous.Anonymous._14 = a.Anonymous.Anonymous._11 * b.Anonymous.Anonymous._14 + a.Anonymous.Anonymous._12 * b.Anonymous.Anonymous._24 + a.Anonymous.Anonymous._13 * b.Anonymous.Anonymous._34 + a.Anonymous.Anonymous._14 * b.Anonymous.Anonymous._44; + Anonymous.Anonymous._21 = a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._11 + a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._21 + a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._31 + a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._41; + Anonymous.Anonymous._22 = a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._12 + a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._22 + a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._32 + a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._42; + Anonymous.Anonymous._23 = a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._13 + a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._23 + a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._33 + a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._43; + Anonymous.Anonymous._24 = a.Anonymous.Anonymous._21 * b.Anonymous.Anonymous._14 + a.Anonymous.Anonymous._22 * b.Anonymous.Anonymous._24 + a.Anonymous.Anonymous._23 * b.Anonymous.Anonymous._34 + a.Anonymous.Anonymous._24 * b.Anonymous.Anonymous._44; + Anonymous.Anonymous._31 = a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._11 + a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._21 + a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._31 + a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._41; + Anonymous.Anonymous._32 = a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._12 + a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._22 + a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._32 + a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._42; + Anonymous.Anonymous._33 = a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._13 + a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._23 + a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._33 + a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._43; + Anonymous.Anonymous._34 = a.Anonymous.Anonymous._31 * b.Anonymous.Anonymous._14 + a.Anonymous.Anonymous._32 * b.Anonymous.Anonymous._24 + a.Anonymous.Anonymous._33 * b.Anonymous.Anonymous._34 + a.Anonymous.Anonymous._34 * b.Anonymous.Anonymous._44; + Anonymous.Anonymous._41 = a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._11 + a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._21 + a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._31 + a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._41; + Anonymous.Anonymous._42 = a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._12 + a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._22 + a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._32 + a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._42; + Anonymous.Anonymous._43 = a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._13 + a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._23 + a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._33 + a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._43; + Anonymous.Anonymous._44 = a.Anonymous.Anonymous._41 * b.Anonymous.Anonymous._14 + a.Anonymous.Anonymous._42 * b.Anonymous.Anonymous._24 + a.Anonymous.Anonymous._43 * b.Anonymous.Anonymous._34 + a.Anonymous.Anonymous._44 * b.Anonymous.Anonymous._44; } - public static bool operator ==(D2D_MATRIX_4X4_F left, D2D_MATRIX_4X4_F right) => - left.Anonymous.Anonymous._11 == right.Anonymous.Anonymous._11 && - left.Anonymous.Anonymous._12 == right.Anonymous.Anonymous._12 && - left.Anonymous.Anonymous._13 == right.Anonymous.Anonymous._13 && - left.Anonymous.Anonymous._14 == right.Anonymous.Anonymous._14 && - - left.Anonymous.Anonymous._21 == right.Anonymous.Anonymous._21 && - left.Anonymous.Anonymous._22 == right.Anonymous.Anonymous._22 && - left.Anonymous.Anonymous._23 == right.Anonymous.Anonymous._23 && - left.Anonymous.Anonymous._24 == right.Anonymous.Anonymous._24 && - - left.Anonymous.Anonymous._31 == right.Anonymous.Anonymous._31 && - left.Anonymous.Anonymous._32 == right.Anonymous.Anonymous._32 && - left.Anonymous.Anonymous._33 == right.Anonymous.Anonymous._33 && - left.Anonymous.Anonymous._34 == right.Anonymous.Anonymous._34 && - - left.Anonymous.Anonymous._41 == right.Anonymous.Anonymous._41 && - left.Anonymous.Anonymous._42 == right.Anonymous.Anonymous._42 && - left.Anonymous.Anonymous._43 == right.Anonymous.Anonymous._43 && - left.Anonymous.Anonymous._44 == right.Anonymous.Anonymous._44; - - public static bool operator !=(D2D_MATRIX_4X4_F left, D2D_MATRIX_4X4_F right) => - left.Anonymous.Anonymous._11 != right.Anonymous.Anonymous._11 || - left.Anonymous.Anonymous._12 != right.Anonymous.Anonymous._12 || - left.Anonymous.Anonymous._13 != right.Anonymous.Anonymous._13 || - left.Anonymous.Anonymous._14 != right.Anonymous.Anonymous._14 || - - left.Anonymous.Anonymous._21 != right.Anonymous.Anonymous._21 || - left.Anonymous.Anonymous._22 != right.Anonymous.Anonymous._22 || - left.Anonymous.Anonymous._23 != right.Anonymous.Anonymous._23 || - left.Anonymous.Anonymous._24 != right.Anonymous.Anonymous._24 || - - left.Anonymous.Anonymous._31 != right.Anonymous.Anonymous._31 || - left.Anonymous.Anonymous._32 != right.Anonymous.Anonymous._32 || - left.Anonymous.Anonymous._33 != right.Anonymous.Anonymous._33 || - left.Anonymous.Anonymous._34 != right.Anonymous.Anonymous._34 || - - left.Anonymous.Anonymous._41 != right.Anonymous.Anonymous._41 || - left.Anonymous.Anonymous._42 != right.Anonymous.Anonymous._42 || - left.Anonymous.Anonymous._43 != right.Anonymous.Anonymous._43 || - left.Anonymous.Anonymous._44 != right.Anonymous.Anonymous._44; - - public static D2D_MATRIX_4X4_F operator *(in D2D_MATRIX_4X4_F a, in D2D_MATRIX_4X4_F b) + public static D2D_MATRIX_4X4_F operator *([NativeTypeName("const D2D1_MATRIX_4x4_F &")] in D2D_MATRIX_4X4_F a, [NativeTypeName("const D2D1_MATRIX_4x4_F &")] in D2D_MATRIX_4X4_F b) { D2D_MATRIX_4X4_F result = default; @@ -303,5 +234,33 @@ public static D2D_MATRIX_4X4_F PerspectiveProjection(float depth) return result; } + + public bool Equals(D2D_MATRIX_4X4_F other) => this == other; + + public override bool Equals(object? obj) => (obj is D2D_MATRIX_4X4_F other) && this == other; + + public override int GetHashCode() + { + var hashCode = new HashCode(); + { + hashCode.Add(Anonymous.Anonymous._11); + hashCode.Add(Anonymous.Anonymous._12); + hashCode.Add(Anonymous.Anonymous._13); + hashCode.Add(Anonymous.Anonymous._14); + hashCode.Add(Anonymous.Anonymous._21); + hashCode.Add(Anonymous.Anonymous._22); + hashCode.Add(Anonymous.Anonymous._23); + hashCode.Add(Anonymous.Anonymous._24); + hashCode.Add(Anonymous.Anonymous._31); + hashCode.Add(Anonymous.Anonymous._32); + hashCode.Add(Anonymous.Anonymous._33); + hashCode.Add(Anonymous.Anonymous._34); + hashCode.Add(Anonymous.Anonymous._41); + hashCode.Add(Anonymous.Anonymous._42); + hashCode.Add(Anonymous.Anonymous._43); + hashCode.Add(Anonymous.Anonymous._44); + } + return hashCode.ToHashCode(); + } } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_5X4_F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_5X4_F.Manual.cs index eccc686a75..4b488d2bf9 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_5X4_F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_MATRIX_5X4_F.Manual.cs @@ -9,46 +9,44 @@ namespace TerraFX.Interop { public partial struct D2D_MATRIX_5X4_F : IEquatable { - public static readonly D2D_MATRIX_5X4_F DEFAULT = new D2D_MATRIX_5X4_F( - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - 0.0f, 0.0f, 0.0f, 0.0f); + public static readonly D2D_MATRIX_5X4_F DEFAULT = new D2D_MATRIX_5X4_F(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); - public D2D_MATRIX_5X4_F( - float m11, float m12, float m13, float m14, - float m21, float m22, float m23, float m24, - float m31, float m32, float m33, float m34, - float m41, float m42, float m43, float m44, - float m51, float m52, float m53, float m54) : this() + public D2D_MATRIX_5X4_F([NativeTypeName("FLOAT")] float m11, [NativeTypeName("FLOAT")] float m12, [NativeTypeName("FLOAT")] float m13, [NativeTypeName("FLOAT")] float m14, [NativeTypeName("FLOAT")] float m21, [NativeTypeName("FLOAT")] float m22, [NativeTypeName("FLOAT")] float m23, [NativeTypeName("FLOAT")] float m24, [NativeTypeName("FLOAT")] float m31, [NativeTypeName("FLOAT")] float m32, [NativeTypeName("FLOAT")] float m33, [NativeTypeName("FLOAT")] float m34, [NativeTypeName("FLOAT")] float m41, [NativeTypeName("FLOAT")] float m42, [NativeTypeName("FLOAT")] float m43, [NativeTypeName("FLOAT")] float m44, [NativeTypeName("FLOAT")] float m51, [NativeTypeName("FLOAT")] float m52, [NativeTypeName("FLOAT")] float m53, [NativeTypeName("FLOAT")] float m54) { + this = default; + Anonymous.Anonymous._11 = m11; Anonymous.Anonymous._12 = m12; Anonymous.Anonymous._13 = m13; Anonymous.Anonymous._14 = m14; - Anonymous.Anonymous._21 = m21; Anonymous.Anonymous._22 = m22; Anonymous.Anonymous._23 = m23; Anonymous.Anonymous._24 = m24; - Anonymous.Anonymous._31 = m31; Anonymous.Anonymous._32 = m32; Anonymous.Anonymous._33 = m33; Anonymous.Anonymous._34 = m34; - Anonymous.Anonymous._41 = m41; Anonymous.Anonymous._42 = m42; Anonymous.Anonymous._43 = m43; Anonymous.Anonymous._44 = m44; - Anonymous.Anonymous._51 = m51; Anonymous.Anonymous._52 = m52; Anonymous.Anonymous._53 = m53; Anonymous.Anonymous._54 = m54; } + public static bool operator ==([NativeTypeName("const D2D1_MATRIX_5X4_F &")] in D2D_MATRIX_5X4_F l, [NativeTypeName("const D2D1_MATRIX_5X4_F &")] in D2D_MATRIX_5X4_F r) + { + return l.Anonymous.Anonymous._11 == r.Anonymous.Anonymous._11 && l.Anonymous.Anonymous._12 == r.Anonymous.Anonymous._12 && l.Anonymous.Anonymous._13 == r.Anonymous.Anonymous._13 && l.Anonymous.Anonymous._14 == r.Anonymous.Anonymous._14 && l.Anonymous.Anonymous._21 == r.Anonymous.Anonymous._21 && l.Anonymous.Anonymous._22 == r.Anonymous.Anonymous._22 && l.Anonymous.Anonymous._23 == r.Anonymous.Anonymous._23 && l.Anonymous.Anonymous._24 == r.Anonymous.Anonymous._24 && l.Anonymous.Anonymous._31 == r.Anonymous.Anonymous._31 && l.Anonymous.Anonymous._32 == r.Anonymous.Anonymous._32 && l.Anonymous.Anonymous._33 == r.Anonymous.Anonymous._33 && l.Anonymous.Anonymous._34 == r.Anonymous.Anonymous._34 && l.Anonymous.Anonymous._41 == r.Anonymous.Anonymous._41 && l.Anonymous.Anonymous._42 == r.Anonymous.Anonymous._42 && l.Anonymous.Anonymous._43 == r.Anonymous.Anonymous._43 && l.Anonymous.Anonymous._43 == r.Anonymous.Anonymous._44 && l.Anonymous.Anonymous._51 == r.Anonymous.Anonymous._51 && l.Anonymous.Anonymous._52 == r.Anonymous.Anonymous._52 && l.Anonymous.Anonymous._53 == r.Anonymous.Anonymous._53 && l.Anonymous.Anonymous._53 == r.Anonymous.Anonymous._54; + } + + public static bool operator !=([NativeTypeName("const D2D1_MATRIX_5X4_F &")] in D2D_MATRIX_5X4_F l, [NativeTypeName("const D2D1_MATRIX_5X4_F &")] in D2D_MATRIX_5X4_F r) + { + return !(l == r); + } + public bool Equals(D2D_MATRIX_5X4_F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_MATRIX_5X4_F other) && this == other; @@ -56,86 +54,29 @@ public D2D_MATRIX_5X4_F( public override int GetHashCode() { var hashCode = new HashCode(); - - hashCode.Add(Anonymous.Anonymous._11); - hashCode.Add(Anonymous.Anonymous._12); - hashCode.Add(Anonymous.Anonymous._13); - hashCode.Add(Anonymous.Anonymous._14); - - hashCode.Add(Anonymous.Anonymous._21); - hashCode.Add(Anonymous.Anonymous._22); - hashCode.Add(Anonymous.Anonymous._23); - hashCode.Add(Anonymous.Anonymous._24); - - hashCode.Add(Anonymous.Anonymous._31); - hashCode.Add(Anonymous.Anonymous._32); - hashCode.Add(Anonymous.Anonymous._33); - hashCode.Add(Anonymous.Anonymous._34); - - hashCode.Add(Anonymous.Anonymous._41); - hashCode.Add(Anonymous.Anonymous._42); - hashCode.Add(Anonymous.Anonymous._43); - hashCode.Add(Anonymous.Anonymous._44); - - hashCode.Add(Anonymous.Anonymous._51); - hashCode.Add(Anonymous.Anonymous._52); - hashCode.Add(Anonymous.Anonymous._53); - hashCode.Add(Anonymous.Anonymous._54); - + { + hashCode.Add(Anonymous.Anonymous._11); + hashCode.Add(Anonymous.Anonymous._12); + hashCode.Add(Anonymous.Anonymous._13); + hashCode.Add(Anonymous.Anonymous._14); + hashCode.Add(Anonymous.Anonymous._21); + hashCode.Add(Anonymous.Anonymous._22); + hashCode.Add(Anonymous.Anonymous._23); + hashCode.Add(Anonymous.Anonymous._24); + hashCode.Add(Anonymous.Anonymous._31); + hashCode.Add(Anonymous.Anonymous._32); + hashCode.Add(Anonymous.Anonymous._33); + hashCode.Add(Anonymous.Anonymous._34); + hashCode.Add(Anonymous.Anonymous._41); + hashCode.Add(Anonymous.Anonymous._42); + hashCode.Add(Anonymous.Anonymous._43); + hashCode.Add(Anonymous.Anonymous._44); + hashCode.Add(Anonymous.Anonymous._51); + hashCode.Add(Anonymous.Anonymous._52); + hashCode.Add(Anonymous.Anonymous._53); + hashCode.Add(Anonymous.Anonymous._54); + } return hashCode.ToHashCode(); } - - public static bool operator ==(D2D_MATRIX_5X4_F left, D2D_MATRIX_5X4_F right) => - left.Anonymous.Anonymous._11 == right.Anonymous.Anonymous._11 && - left.Anonymous.Anonymous._12 == right.Anonymous.Anonymous._12 && - left.Anonymous.Anonymous._13 == right.Anonymous.Anonymous._13 && - left.Anonymous.Anonymous._14 == right.Anonymous.Anonymous._14 && - - left.Anonymous.Anonymous._21 == right.Anonymous.Anonymous._21 && - left.Anonymous.Anonymous._22 == right.Anonymous.Anonymous._22 && - left.Anonymous.Anonymous._23 == right.Anonymous.Anonymous._23 && - left.Anonymous.Anonymous._24 == right.Anonymous.Anonymous._24 && - - left.Anonymous.Anonymous._31 == right.Anonymous.Anonymous._31 && - left.Anonymous.Anonymous._32 == right.Anonymous.Anonymous._32 && - left.Anonymous.Anonymous._33 == right.Anonymous.Anonymous._33 && - left.Anonymous.Anonymous._34 == right.Anonymous.Anonymous._34 && - - left.Anonymous.Anonymous._41 == right.Anonymous.Anonymous._41 && - left.Anonymous.Anonymous._42 == right.Anonymous.Anonymous._42 && - left.Anonymous.Anonymous._43 == right.Anonymous.Anonymous._43 && - left.Anonymous.Anonymous._43 == right.Anonymous.Anonymous._44 && - - left.Anonymous.Anonymous._51 == right.Anonymous.Anonymous._51 && - left.Anonymous.Anonymous._52 == right.Anonymous.Anonymous._52 && - left.Anonymous.Anonymous._53 == right.Anonymous.Anonymous._53 && - left.Anonymous.Anonymous._53 == right.Anonymous.Anonymous._54; - - public static bool operator !=(D2D_MATRIX_5X4_F left, D2D_MATRIX_5X4_F right) => - left.Anonymous.Anonymous._11 != right.Anonymous.Anonymous._11 || - left.Anonymous.Anonymous._12 != right.Anonymous.Anonymous._12 || - left.Anonymous.Anonymous._13 != right.Anonymous.Anonymous._13 || - left.Anonymous.Anonymous._14 != right.Anonymous.Anonymous._14 || - - left.Anonymous.Anonymous._21 != right.Anonymous.Anonymous._21 || - left.Anonymous.Anonymous._22 != right.Anonymous.Anonymous._22 || - left.Anonymous.Anonymous._23 != right.Anonymous.Anonymous._23 || - left.Anonymous.Anonymous._24 != right.Anonymous.Anonymous._24 || - - left.Anonymous.Anonymous._31 != right.Anonymous.Anonymous._31 || - left.Anonymous.Anonymous._32 != right.Anonymous.Anonymous._32 || - left.Anonymous.Anonymous._33 != right.Anonymous.Anonymous._33 || - left.Anonymous.Anonymous._34 != right.Anonymous.Anonymous._34 || - - left.Anonymous.Anonymous._41 != right.Anonymous.Anonymous._41 || - left.Anonymous.Anonymous._42 != right.Anonymous.Anonymous._42 || - left.Anonymous.Anonymous._43 != right.Anonymous.Anonymous._43 || - left.Anonymous.Anonymous._43 != right.Anonymous.Anonymous._44 || - - left.Anonymous.Anonymous._51 != right.Anonymous.Anonymous._51 || - left.Anonymous.Anonymous._52 != right.Anonymous.Anonymous._52 || - left.Anonymous.Anonymous._53 != right.Anonymous.Anonymous._53 || - left.Anonymous.Anonymous._53 != right.Anonymous.Anonymous._54; - } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_POINT_2F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_POINT_2F.Manual.cs index f733fe0b57..fc063bc1aa 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_POINT_2F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_POINT_2F.Manual.cs @@ -9,22 +9,26 @@ namespace TerraFX.Interop { public partial struct D2D_POINT_2F : IEquatable { - public static readonly D2D_POINT_2F DEFAULT = new D2D_POINT_2F(0.0f, 0.0f); - - public D2D_POINT_2F(float x, float y) + public D2D_POINT_2F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f) { this.x = x; this.y = y; } + public static bool operator ==([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F l, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F r) + { + return l.x == r.x && l.y == r.y; + } + + public static bool operator !=([NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F l, [NativeTypeName("const D2D1_POINT_2F &")] in D2D_POINT_2F r) + { + return !(l == r); + } + public bool Equals(D2D_POINT_2F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_POINT_2F other) && this == other; public override int GetHashCode() => HashCode.Combine(x, y); - - public static bool operator ==(D2D_POINT_2F left, D2D_POINT_2F right) => left.x == right.x && left.y == right.y; - - public static bool operator !=(D2D_POINT_2F left, D2D_POINT_2F right) => left.x != right.x || left.y != right.y; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_POINT_2U.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_POINT_2U.Manual.cs index 7786d0b6fa..d45595d70c 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_POINT_2U.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_POINT_2U.Manual.cs @@ -9,22 +9,26 @@ namespace TerraFX.Interop { public partial struct D2D_POINT_2U : IEquatable { - public static readonly D2D_POINT_2U DEFAULT = new D2D_POINT_2U(0, 0); - - public D2D_POINT_2U(uint x, uint y) + public D2D_POINT_2U([NativeTypeName("UINT32")] uint x = 0, [NativeTypeName("UINT32")] uint y = 0) { this.x = x; this.y = y; } + public static bool operator ==([NativeTypeName("const D2D1_POINT_2U &")] in D2D_POINT_2U l, [NativeTypeName("const D2D1_POINT_2U &")] in D2D_POINT_2U r) + { + return l.x == r.x && l.y == r.y; + } + + public static bool operator !=([NativeTypeName("const D2D1_POINT_2U &")] in D2D_POINT_2U l, [NativeTypeName("const D2D1_POINT_2U &")] in D2D_POINT_2U r) + { + return !(l == r); + } + public bool Equals(D2D_POINT_2U other) => this == other; public override bool Equals(object? obj) => (obj is D2D_POINT_2U other) && this == other; public override int GetHashCode() => HashCode.Combine(x, y); - - public static bool operator ==(D2D_POINT_2U left, D2D_POINT_2U right) => left.x == right.x && left.y == right.y; - - public static bool operator !=(D2D_POINT_2U left, D2D_POINT_2U right) => left.x != right.x || left.y != right.y; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_RECT_F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_RECT_F.Manual.cs index 80f2aef2ec..88eff372b9 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_RECT_F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_RECT_F.Manual.cs @@ -9,10 +9,9 @@ namespace TerraFX.Interop { public partial struct D2D_RECT_F : IEquatable { - public static readonly D2D_RECT_F DEFAULT = new D2D_RECT_F(0, 0, 0, 0); public static readonly D2D_RECT_F Infinite = new D2D_RECT_F(-float.MaxValue, -float.MaxValue, float.MaxValue, float.MaxValue); - public D2D_RECT_F(float left, float top, float right, float bottom) + public D2D_RECT_F([NativeTypeName("FLOAT")] float left = 0.0f, [NativeTypeName("FLOAT")] float top = 0.0f, [NativeTypeName("FLOAT")] float right = 0.0f, [NativeTypeName("FLOAT")] float bottom = 0.0f) { this.left = left; this.top = top; @@ -20,22 +19,20 @@ public D2D_RECT_F(float left, float top, float right, float bottom) this.bottom = bottom; } + public static bool operator ==([NativeTypeName("const D2D1_RECT_F &")] in D2D_RECT_F l, [NativeTypeName("const D2D1_RECT_F &")] in D2D_RECT_F r) + { + return l.left == r.left && l.top == r.top && l.right == r.right && l.bottom == r.bottom; + } + + public static bool operator !=([NativeTypeName("const D2D1_RECT_F &")] in D2D_RECT_F l, [NativeTypeName("const D2D1_RECT_F &")] in D2D_RECT_F r) + { + return !(l == r); + } + public bool Equals(D2D_RECT_F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_RECT_F other) && this == other; public override int GetHashCode() => HashCode.Combine(left, top, right, bottom); - - public static bool operator ==(D2D_RECT_F left, D2D_RECT_F right) => - left.left == right.left && - left.top == right.top && - left.right == right.right && - left.bottom == right.bottom; - - public static bool operator !=(D2D_RECT_F left, D2D_RECT_F right) => - left.left != right.left || - left.top != right.top || - left.right != right.right || - left.bottom != right.bottom; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_RECT_U.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_RECT_U.Manual.cs index d9a54013ed..61d89b7781 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_RECT_U.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_RECT_U.Manual.cs @@ -1,6 +1,6 @@ // Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from um/d2d1helper.h in the Windows SDK for Windows 10.0.18362.0 +// Ported from um/d2d1helper.h and um/d2d1_3helper.h in the Windows SDK for Windows 10.0.18362.0 // Original source is Copyright © Microsoft. All rights reserved. using System; @@ -9,9 +9,7 @@ namespace TerraFX.Interop { public partial struct D2D_RECT_U : IEquatable { - public static readonly D2D_RECT_U DEFAULT = new D2D_RECT_U(0, 0, 0, 0); - - public D2D_RECT_U(uint left, uint top, uint right, uint bottom) + public D2D_RECT_U([NativeTypeName("UINT32")] uint left = 0, [NativeTypeName("UINT32")] uint top = 0, [NativeTypeName("UINT32")] uint right = 0, [NativeTypeName("UINT32")] uint bottom = 0) { this.left = left; this.top = top; @@ -19,22 +17,35 @@ public D2D_RECT_U(uint left, uint top, uint right, uint bottom) this.bottom = bottom; } + public static bool operator ==([NativeTypeName("const D2D1_RECT_U &")] in D2D_RECT_U l, [NativeTypeName("const D2D1_RECT_U &")] in D2D_RECT_U r) + { + return l.left == r.left && l.top == r.top && l.right == r.right && l.bottom == r.bottom; + } + + public static bool operator !=([NativeTypeName("const D2D1_RECT_U &")] in D2D_RECT_U l, [NativeTypeName("const D2D1_RECT_U &")] in D2D_RECT_U r) + { + return !(l == r); + } + + public static D2D_RECT_U Infinite + { + [return: NativeTypeName("D2D1_RECT_U")] + get + { + D2D_RECT_U rect = new D2D_RECT_U { + left = 0u, + top = 0u, + right = uint.MaxValue, + bottom = uint.MaxValue + }; + return rect; + } + } + public bool Equals(D2D_RECT_U other) => this == other; public override bool Equals(object? obj) => (obj is D2D_RECT_U other) && this == other; public override int GetHashCode() => HashCode.Combine(left, top, right, bottom); - - public static bool operator ==(D2D_RECT_U l, D2D_RECT_U r) => - l.left == r.left && - l.top == r.top && - l.right == r.right && - l.bottom == r.bottom; - - public static bool operator !=(D2D_RECT_U l, D2D_RECT_U r) => - l.left != r.left || - l.top != r.top || - l.right != r.right || - l.bottom != r.bottom; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_SIZE_F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_SIZE_F.Manual.cs index cf4e44e25f..57f90af44f 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_SIZE_F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_SIZE_F.Manual.cs @@ -9,23 +9,26 @@ namespace TerraFX.Interop { public partial struct D2D_SIZE_F : IEquatable { - public static readonly D2D_SIZE_F DEFAULT = new D2D_SIZE_F(0.0f, 0.0f); - - public D2D_SIZE_F(float width, float height) + public D2D_SIZE_F([NativeTypeName("FLOAT")] float width = 0.0f, [NativeTypeName("FLOAT")] float height = 0.0f) { this.width = width; this.height = height; } + public static bool operator ==([NativeTypeName("const D2D1_SIZE_F &")] in D2D_SIZE_F l, [NativeTypeName("const D2D1_SIZE_F &")] in D2D_SIZE_F r) + { + return l.width == r.width && l.height == r.height; + } + + public static bool operator !=([NativeTypeName("const D2D1_SIZE_F &")] in D2D_SIZE_F l, [NativeTypeName("const D2D1_SIZE_F &")] in D2D_SIZE_F r) + { + return !(l == r); + } + public bool Equals(D2D_SIZE_F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_SIZE_F other) && this == other; public override int GetHashCode() => HashCode.Combine(width, height); - - public static bool operator ==(D2D_SIZE_F left, D2D_SIZE_F right) => left.width == right.width && left.height == right.height; - - public static bool operator !=(D2D_SIZE_F left, D2D_SIZE_F right) => left.width != right.width || left.height != right.height; - } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_SIZE_U.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_SIZE_U.Manual.cs index 70d2afe785..41d4024725 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_SIZE_U.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_SIZE_U.Manual.cs @@ -9,22 +9,26 @@ namespace TerraFX.Interop { public partial struct D2D_SIZE_U : IEquatable { - public static readonly D2D_SIZE_U DEFAULT = new D2D_SIZE_U(0, 0); - - public D2D_SIZE_U(uint width, uint height) + public D2D_SIZE_U([NativeTypeName("UINT32")] uint width = 0, [NativeTypeName("UINT32")] uint height = 0) { this.width = width; this.height = height; } + public static bool operator ==([NativeTypeName("const D2D1_SIZE_U &")] in D2D_SIZE_U l, [NativeTypeName("const D2D1_SIZE_U &")] in D2D_SIZE_U r) + { + return l.width == r.width && l.height == r.height; + } + + public static bool operator !=([NativeTypeName("const D2D1_SIZE_U &")] in D2D_SIZE_U l, [NativeTypeName("const D2D1_SIZE_U &")] in D2D_SIZE_U r) + { + return !(l == r); + } + public bool Equals(D2D_SIZE_U other) => this == other; public override bool Equals(object? obj) => (obj is D2D_SIZE_U other) && this == other; public override int GetHashCode() => HashCode.Combine(width, height); - - public static bool operator ==(D2D_SIZE_U l, D2D_SIZE_U r) => l.width == r.width && l.height == r.height; - - public static bool operator !=(D2D_SIZE_U l, D2D_SIZE_U r) => l.width != r.width || l.height != r.height; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_2F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_2F.Manual.cs index b97f7e3115..79ffc4dbd1 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_2F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_2F.Manual.cs @@ -9,22 +9,26 @@ namespace TerraFX.Interop { public partial struct D2D_VECTOR_2F : IEquatable { - public static readonly D2D_VECTOR_2F DEFAULT = new D2D_VECTOR_2F(0.0f, 0.0f); - - public D2D_VECTOR_2F(float x, float y) + public D2D_VECTOR_2F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f) { this.x = x; this.y = y; } + public static bool operator ==([NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_2F l, [NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_2F r) + { + return l.x == r.x && l.y == r.y; + } + + public static bool operator !=([NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_2F l, [NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_2F r) + { + return !(l == r); + } + public bool Equals(D2D_VECTOR_2F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_VECTOR_2F other) && this == other; public override int GetHashCode() => HashCode.Combine(x, y); - - public static bool operator ==(D2D_VECTOR_2F left, D2D_VECTOR_2F right) => left.x == right.x && left.y == right.y; - - public static bool operator !=(D2D_VECTOR_2F left, D2D_VECTOR_2F right) => left.x != right.x || left.y != right.y; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_3F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_3F.Manual.cs index 3623242032..a53b733c19 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_3F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_3F.Manual.cs @@ -9,29 +9,27 @@ namespace TerraFX.Interop { public partial struct D2D_VECTOR_3F : IEquatable { - public static readonly D2D_VECTOR_3F DEFAULT = new D2D_VECTOR_3F(0.0f, 0.0f, 0.0f); - - public D2D_VECTOR_3F(float x, float y, float z) + public D2D_VECTOR_3F([NativeTypeName("FLOAT")] float x = 0.0f, [NativeTypeName("FLOAT")] float y = 0.0f, [NativeTypeName("FLOAT")] float z = 0.0f) { this.x = x; this.y = y; this.z = z; } + public static bool operator ==([NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_3F l, [NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_3F r) + { + return l.x == r.x && l.y == r.y && l.z == r.z; + } + + public static bool operator !=([NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_3F l, [NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_3F r) + { + return !(l == r); + } + public bool Equals(D2D_VECTOR_3F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_VECTOR_3F other) && this == other; public override int GetHashCode() => HashCode.Combine(x, y, z); - - public static bool operator ==(D2D_VECTOR_3F left, D2D_VECTOR_3F right) => - left.x == right.x && - left.y == right.y && - left.z == right.z; - - public static bool operator !=(D2D_VECTOR_3F left, D2D_VECTOR_3F right) => - left.x != right.x || - left.y != right.y || - left.z != right.z; } } diff --git a/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_4F.Manual.cs b/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_4F.Manual.cs index 2e58ecf6ee..982a50b493 100644 --- a/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_4F.Manual.cs +++ b/sources/Interop/DCommon/um/dcommon/D2D_VECTOR_4F.Manual.cs @@ -10,8 +10,6 @@ namespace TerraFX.Interop { public partial struct D2D_VECTOR_4F : IEquatable { - public static readonly D2D_VECTOR_4F DEFAULT = new D2D_VECTOR_4F(0.0f, 0.0f, 0.0f, 0.0f); - public D2D_VECTOR_4F(float x, float y, float z, float w) { this.x = x; @@ -20,22 +18,20 @@ public D2D_VECTOR_4F(float x, float y, float z, float w) this.w = w; } + public static bool operator ==([NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_4F l, [NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_4F r) + { + return l.x == r.x && l.y == r.y && l.z == r.z && l.w == r.w; + } + + public static bool operator !=([NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_4F l, [NativeTypeName("const D2D_VECTOR_2F &")] in D2D_VECTOR_4F r) + { + return !(l == r); + } + public bool Equals(D2D_VECTOR_4F other) => this == other; public override bool Equals(object? obj) => (obj is D2D_VECTOR_4F other) && this == other; public override int GetHashCode() => HashCode.Combine(x, y, z, w); - - public static bool operator ==(D2D_VECTOR_4F left, D2D_VECTOR_4F right) => - left.x == right.x && - left.y == right.y && - left.z == right.z && - left.w == right.w; - - public static bool operator !=(D2D_VECTOR_4F left, D2D_VECTOR_4F right) => - left.x != right.x || - left.y != right.y || - left.z != right.z || - left.w != right.w; } } diff --git a/sources/Interop/DXGI/shared/dxgitype/ColorF.Manual.cs b/sources/Interop/DXGI/shared/dxgitype/ColorF.Manual.cs index 408853a3ef..40809908c1 100644 --- a/sources/Interop/DXGI/shared/dxgitype/ColorF.Manual.cs +++ b/sources/Interop/DXGI/shared/dxgitype/ColorF.Manual.cs @@ -146,6 +146,6 @@ public enum ColorF : uint White = 0xFFFFFF, WhiteSmoke = 0xF5F5F5, Yellow = 0xFFFF00, - YellowGreen = 0x9ACD32u + YellowGreen = 0x9ACD32, } } diff --git a/sources/Interop/DXGI/shared/dxgitype/DXGI_RGBA.Manual.cs b/sources/Interop/DXGI/shared/dxgitype/DXGI_RGBA.Manual.cs index cf0e79dbc5..1d2daef608 100644 --- a/sources/Interop/DXGI/shared/dxgitype/DXGI_RGBA.Manual.cs +++ b/sources/Interop/DXGI/shared/dxgitype/DXGI_RGBA.Manual.cs @@ -7,18 +7,11 @@ namespace TerraFX.Interop { public partial struct DXGI_RGBA { - private const uint RedShift = 16u; - private const uint GreenShift = 8u; - private const uint BlueShift = 0u; - private const uint RedMask = 0xff << (int)RedShift; - private const uint GreenMask = 0xff << (int)GreenShift; - private const uint BlueMask = 0xff << (int)BlueShift; - - public DXGI_RGBA(uint rgb, float a = 1.0f) + public DXGI_RGBA([NativeTypeName("UINT32")] uint rgb, [NativeTypeName("FLOAT")] float a = 1.0f) { - r = ((rgb & RedMask) >> (int)RedShift) / 255.0f; - g = ((rgb & GreenMask) >> (int)GreenShift) / 255.0f; - b = ((rgb & BlueMask) >> (int)BlueShift) / 255.0f; + this.r = (float)((rgb & sc_redMask) >> (int)sc_redShift) / 255.0f; + this.g = (float)((rgb & sc_greenMask) >> (int)sc_greenShift) / 255.0f; + this.b = (float)((rgb & sc_blueMask) >> (int)sc_blueShift) / 255.0f; this.a = a; } @@ -33,5 +26,13 @@ public DXGI_RGBA(float red, float green, float blue, float alpha = 1.0f) b = blue; a = alpha; } + + private const uint sc_redShift = 16; + private const uint sc_greenShift = 8; + private const uint sc_blueShift = 0; + + private const uint sc_redMask = 0xff << (int)sc_redShift; + private const uint sc_greenMask = 0xff << (int)sc_greenShift; + private const uint sc_blueMask = 0xff << (int)sc_blueShift; } } diff --git a/sources/Interop/Windows/shared/windef/POINT.Manual.cs b/sources/Interop/Windows/shared/windef/POINT.Manual.cs new file mode 100644 index 0000000000..7c829c80be --- /dev/null +++ b/sources/Interop/Windows/shared/windef/POINT.Manual.cs @@ -0,0 +1,34 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from shared/windef.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using System; + +namespace TerraFX.Interop +{ + public partial struct POINT : IEquatable + { + public POINT([NativeTypeName("INT32")] int x = 0, [NativeTypeName("INT32")] int y = 0) + { + this.x = x; + this.y = y; + } + + public static bool operator ==([NativeTypeName("const POINT &")] in POINT l, [NativeTypeName("const POINT &")] in POINT r) + { + return l.x == r.x && l.y == r.y; + } + + public static bool operator !=([NativeTypeName("const POINT &")] in POINT l, [NativeTypeName("const POINT &")] in POINT r) + { + return !(l == r); + } + + public override bool Equals(object? obj) => (obj is POINT other) && Equals(other); + + public bool Equals(POINT other) => this == other; + + public override int GetHashCode() => HashCode.Combine(x, y); + } +} diff --git a/sources/Interop/Windows/shared/windef/RECT.Manual.cs b/sources/Interop/Windows/shared/windef/RECT.Manual.cs index caf45b2b60..74d43f1932 100644 --- a/sources/Interop/Windows/shared/windef/RECT.Manual.cs +++ b/sources/Interop/Windows/shared/windef/RECT.Manual.cs @@ -17,13 +17,15 @@ public RECT([NativeTypeName("LONG")] int Left, [NativeTypeName("LONG")] int Top, bottom = Bottom; } - public static bool operator ==([NativeTypeName("const RECT &")] in RECT l, [NativeTypeName("const RECT &")] in RECT r) => - (l.left == r.left) && - (l.top == r.top) && - (l.right == r.right) && - (l.bottom == r.bottom); + public static bool operator ==([NativeTypeName("const RECT &")] in RECT l, [NativeTypeName("const RECT &")] in RECT r) + { + return l.left == r.left && l.top == r.top && l.right == r.right && l.bottom == r.bottom; + } - public static bool operator !=([NativeTypeName("const RECT &")] in RECT l, [NativeTypeName("const RECT &")] in RECT r) => !(l == r); + public static bool operator !=([NativeTypeName("const RECT &")] in RECT l, [NativeTypeName("const RECT &")] in RECT r) + { + return !(l == r); + } public override bool Equals(object? obj) => (obj is RECT other) && Equals(other); diff --git a/sources/Interop/Windows/shared/windef/SIZE.Manual.cs b/sources/Interop/Windows/shared/windef/SIZE.Manual.cs new file mode 100644 index 0000000000..75ee582fb4 --- /dev/null +++ b/sources/Interop/Windows/shared/windef/SIZE.Manual.cs @@ -0,0 +1,34 @@ +// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +// Ported from shared/windef.h in the Windows SDK for Windows 10.0.18362.0 +// Original source is Copyright © Microsoft. All rights reserved. + +using System; + +namespace TerraFX.Interop +{ + public partial struct SIZE : IEquatable + { + public SIZE([NativeTypeName("INT32")] int cx = 0, [NativeTypeName("INT32")] int cy = 0) + { + this.cx = cx; + this.cy = cy; + } + + public static bool operator ==([NativeTypeName("const SIZE &")] in SIZE l, [NativeTypeName("const SIZE &")] in SIZE r) + { + return l.cx == r.cx && l.cy == r.cy; + } + + public static bool operator !=([NativeTypeName("const SIZE &")] in SIZE l, [NativeTypeName("const SIZE &")] in SIZE r) + { + return !(l == r); + } + + public override bool Equals(object? obj) => (obj is SIZE other) && Equals(other); + + public bool Equals(SIZE other) => this == other; + + public override int GetHashCode() => HashCode.Combine(cx, cy); + } +}