From 7c18a56fff0da427edccf12d0a477aea57b7fe8b Mon Sep 17 00:00:00 2001 From: David Hall Date: Wed, 25 Dec 2024 18:59:28 -0700 Subject: [PATCH] More DirectX work --- Core/InteropServices/Matrix.cs | 53 ++- PInvoke/DXGI/DCommon.cs | 375 ++++++++++++++- PInvoke/DXGI/DXGI.cs | 11 +- PInvoke/Direct2D/D2d1.Interfaces1.cs | 62 +-- PInvoke/Direct2D/D2d1.Interfaces2.cs | 28 +- PInvoke/Direct2D/D2d1.Interfaces3.cs | 78 +-- PInvoke/Direct2D/D2d1.Interfaces4.cs | 172 +++++-- PInvoke/Direct2D/D2d1.Interfaces5.cs | 26 +- PInvoke/Direct2D/D2d1.cs | 183 ++++---- PInvoke/Direct2D/D2d1EffectAuthor.cs | 4 +- PInvoke/Direct2D/D2d1_1.cs | 443 ++++++++++++++---- PInvoke/Direct2D/D2d1_2.cs | 108 +++-- PInvoke/Direct2D/D2d1_3.Interfaces1.cs | 132 +++--- PInvoke/Direct2D/D2d1_3.Interfaces2.cs | 126 ++--- PInvoke/Direct2D/D2d1_3.Interfaces3.cs | 56 +-- PInvoke/Direct2D/D2d1_3.cs | 216 +++++++-- PInvoke/Direct2D/WindowsCodecs.Interfaces.cs | 8 +- PInvoke/Direct2D/WindowsCodecs.Interfaces2.cs | 4 +- PInvoke/Shared/FunctionHelper.cs | 43 +- PInvoke/Shared/WinDef/COLORREF.cs | 11 +- 20 files changed, 1540 insertions(+), 599 deletions(-) diff --git a/Core/InteropServices/Matrix.cs b/Core/InteropServices/Matrix.cs index 503295f8f..bff48e993 100644 --- a/Core/InteropServices/Matrix.cs +++ b/Core/InteropServices/Matrix.cs @@ -187,23 +187,50 @@ public static Matrix CreateFilled(int rows, int columns, float value) return r; } - /// Gets an identity matrix of the specified size. + /// Gets an identity matrix of the specified balanced size. /// The rows and columns in the matrix. - /// An identity matrix. + /// An identity matrix with the value of all diagonal entries set to 1.0f. + /// The number of rows must be equal to the number of columns. + public static Matrix CreateIdentity(int dimensions) => CreateIdentity(dimensions, dimensions); + + /// Gets an identity matrix of the specified size. + /// The number of rows. + /// The number of columns. + /// An identity matrix with the value of all diagonal entries set to 1.0f. /// The number of rows must be equal to the number of columns. - public static Matrix CreateIdentity(int dimensions) + public static Matrix CreateIdentity(int rows, int columns) { - if (dimensions < 1) - throw new ArgumentOutOfRangeException(nameof(dimensions), "Dimension must be greater than 0."); - Memory m = new float[dimensions * dimensions]; + if (rows < 1) + throw new ArgumentOutOfRangeException(nameof(rows), "Rows must be greater than 0."); + if (columns < 1) + throw new ArgumentOutOfRangeException(nameof(columns), "Columns must be greater than 0."); + Memory m = new float[rows * columns]; Span sp = m.Span; - for (int i = 0; i < dimensions; i++) - { - int c1 = i * dimensions; - for (int j = 0; j < dimensions; j++) - sp[c1 + j] = i == j ? 1f : 0f; - } - return new(m, dimensions, dimensions); + for (int i = 0; i < Math.Min(rows, columns); i++) + sp[i * columns + i] = 1f; + return new(m, rows, columns); + } + + /// Creates a scaling matrix from the list of scalars. + /// + /// The scalars to use as diagonal values. Note, the resulting matrix will be one dimension larger than the number of scalars in this + /// array and that diagonal entry will be set to 1.0f. + /// + /// + /// A matrix one dimension larger than the number of scalars in whose diagnoal entries are set to each + /// subsequent value of and whose final diagonal entry will be set to 1.0f. + /// + /// scalars + /// scalars - At least one scaling value must be provided. + public static Matrix CreateScale(float[] scalars) + { + if (scalars is null) throw new ArgumentNullException(nameof(scalars)); + if (scalars.Length < 1) + throw new ArgumentOutOfRangeException(nameof(scalars), "At least one scaling value must be provided."); + Matrix r = CreateIdentity(scalars.Length + 1); + for (int i = 0; i < scalars.Length; i++) + r[i, i] = scalars[i]; + return r; } /// Performs an implicit conversion from [,] to . diff --git a/PInvoke/DXGI/DCommon.cs b/PInvoke/DXGI/DCommon.cs index 086b73b82..cd61bf9f5 100644 --- a/PInvoke/DXGI/DCommon.cs +++ b/PInvoke/DXGI/DCommon.cs @@ -3935,7 +3935,7 @@ HRESULT Open(D3D_INCLUDE_TYPE IncludeType, [MarshalAs(UnmanagedType.LPStr)] stri // struct { FLOAT m11; FLOAT m12; FLOAT m21; FLOAT m22; FLOAT dx; FLOAT dy; }; struct { FLOAT _11; FLOAT _12; FLOAT _21; FLOAT _22; // FLOAT _31; FLOAT _32; }; FLOAT m[3, 2]; }; } D2D_MATRIX_3X2_F; [PInvokeData("dcommon.h", MSDNShortId = "c8a54bad-4376-479b-8529-1e407623e473"), StructLayout(LayoutKind.Sequential)] - public struct D2D_MATRIX_3X2_F + public struct D2D_MATRIX_3X2_F : IEquatable { /// The value in the first row and first column of the matrix. public float _11; @@ -3996,6 +3996,30 @@ public struct D2D_MATRIX_3X2_F /// The determinant of this matrix. public float Determinant => _11 * _22 - _12 * _21; + /// Indicates whether this matrix is the identity matrix. + /// + /// Type: bool + /// true if the matrix is an identity matrix; otherwise, false. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1helper/nf-d2d1helper-matrix3x2f-isidentity + // bool IsIdentity(); + [PInvokeData("d2d1helper.h", MSDNShortId = "NF:d2d1helper.Matrix3x2F.IsIdentity")] + public bool IsIdentity => Equals(Identity()); + + /// Uses this matrix to transform the specified point and returns the result. + /// + /// Type: D2D1_POINT_2F + /// The point to transform. + /// + /// + /// Type: D2D1_POINT_2F + /// The transformed point. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1helper/nf-d2d1helper-matrix3x2f-transformpoint + // D2D1_POINT_2F TransformPoint( D2D1_POINT_2F point ); + [PInvokeData("d2d1helper.h", MSDNShortId = "NF:d2d1helper.Matrix3x2F.TransformPoint")] + public D2D_POINT_2F TransformPoint(in D2D_POINT_2F point) => new() { x = point.x * _11 + point.y * _21 + _31, y = point.x * _12 + point.y * _22 + _32 }; + /// Performs an implicit conversion from [,] to . /// The value. /// The result of the conversion. @@ -4016,6 +4040,24 @@ public struct D2D_MATRIX_3X2_F /// The result of the conversion. public static implicit operator Matrix(D2D_MATRIX_3X2_F value) => new(value.m); + /// Multiplies two matrices together to compute the product. + /// The first matrix. + /// The second matrix. + /// The product matrix. + public static DXGI_MATRIX_3X2_F operator *(DXGI_MATRIX_3X2_F left, DXGI_MATRIX_3X2_F right) => new() { m = new Matrix(left.m) * new Matrix(right.m) }; + + /// Implements the operator ==. + /// The left comparible. + /// The right comparible. + /// The result of the operator. + public static bool operator ==(DXGI_MATRIX_3X2_F left, DXGI_MATRIX_3X2_F right) => left.Equals(right); + + /// Implements the operator !=. + /// The left comparible. + /// The right comparible. + /// The result of the operator. + public static bool operator !=(DXGI_MATRIX_3X2_F left, DXGI_MATRIX_3X2_F right) => !(left == right); + /// Creates an identity matrix. /// An identity matrix. /// @@ -4047,7 +4089,16 @@ public struct D2D_MATRIX_3X2_F /// the upper-left corner of the square. /// /// - public static D2D_MATRIX_3X2_F Scale(float width, float height, float x, float y) => new() { _11 = width, _22 = height, _31 = x - width * x, _32 = y - height * y }; + public static D2D_MATRIX_3X2_F Scale(float width, float height, float x = 0f, float y = 0f) => new() { _11 = width, _22 = height, _31 = x - width * x, _32 = y - height * y }; + + /// + public override bool Equals(object? obj) => obj is DXGI_MATRIX_3X2_F f && Equals(f); + + /// + public bool Equals(DXGI_MATRIX_3X2_F other) => _11 == other._11 && _12 == other._12 && _21 == other._21 && _22 == other._22 && _31 == other._31 && _32 == other._32; + + /// + public override int GetHashCode() => m.GetHashCode(); } /// Describes a 4-by-3 floating point matrix. @@ -4145,7 +4196,7 @@ public struct D2D_MATRIX_4X3_F // https://learn.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_matrix_4x4_f // typedef struct D2D_MATRIX_4X4_F { union { struct { FLOAT _11; FLOAT _12; FLOAT _13; FLOAT _14; FLOAT _21; FLOAT _22; FLOAT _23; FLOAT _24; FLOAT _31; FLOAT _32; FLOAT _33; FLOAT _34; FLOAT _41; FLOAT _42; FLOAT _43; FLOAT _44; } DUMMYSTRUCTNAME; FLOAT m[4, 4]; } DUMMYUNIONNAME; } D2D_MATRIX_4X4_F; [PInvokeData("dcommon.h", MSDNShortId = "NS:dcommon.D2D_MATRIX_4X4_F"), StructLayout(LayoutKind.Sequential)] - public struct D2D_MATRIX_4X4_F + public struct D2D_MATRIX_4X4_F : IEquatable { /// public float _11; @@ -4195,6 +4246,26 @@ public struct D2D_MATRIX_4X4_F /// ; public float _44; + /// Calculates the determinant of the matrix. + /// + /// Type: FLOAT + /// The determinant. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-determinant + // FLOAT Determinant(); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.Determinant")] + public float Determinant => new Matrix(m).Determinant; + + /// Indicates whether this matrix is the identity matrix. + /// + /// Type: BOOL + /// Indicates whether this matrix is the identity matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-isidentity + // bool IsIdentity(); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.IsIdentity")] + public bool IsIdentity => new Matrix(m).IsIdentity; + /// public float[,] m { @@ -4222,6 +4293,33 @@ public struct D2D_MATRIX_4X4_F } } + /// + public override bool Equals(object? obj) => obj is D2D_MATRIX_4X4_F f && Equals(f); + + /// + public bool Equals(D2D_MATRIX_4X4_F other) => _11 == other._11 && _12 == other._12 && _13 == other._13 && _14 == other._14 && _21 == other._21 && _22 == other._22 && _23 == other._23 && _24 == other._24 && _31 == other._31 && _32 == other._32 && _33 == other._33 && _34 == other._34 && _41 == other._41 && _42 == other._42 && _43 == other._43 && _44 == other._44; + + /// + public override int GetHashCode() => ((float[,])this).GetHashCode(); + + /// Multiplies two matrices together to compute the product. + /// The first matrix. + /// The second matrix. + /// The product matrix. + public static D2D_MATRIX_4X4_F operator *(D2D_MATRIX_4X4_F left, D2D_MATRIX_4X4_F right) => new() { m = new Matrix(left.m) * new Matrix(right.m) }; + + /// Implements the operator ==. + /// The left comparible. + /// The right comparible. + /// The result of the operator. + public static bool operator ==(D2D_MATRIX_4X4_F left, D2D_MATRIX_4X4_F right) => left.Equals(right); + + /// Implements the operator !=. + /// The left comparible. + /// The right comparible. + /// The result of the operator. + public static bool operator !=(D2D_MATRIX_4X4_F left, D2D_MATRIX_4X4_F right) => !(left == right); + /// Performs an implicit conversion from [,] to . /// The value. /// The result of the conversion. @@ -4241,6 +4339,170 @@ public struct D2D_MATRIX_4X4_F /// The value. /// The result of the conversion. public static implicit operator Matrix(D2D_MATRIX_4X4_F value) => new(value.m); + + /// A perspective transformation given a depth value. + /// + /// Type: FLOAT + /// The depth for the perspective transform. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-perspectiveprojection + // Matrix4x4F PerspectiveProjection( FLOAT depth ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.PerspectiveProjection")] + public static D2D_MATRIX_4X4_F PerspectiveProjection(float depth) => new() { _11 = 1, _22 = 1, _33 = 1, _34 = depth > 0 ? -1 / depth : 0f, _44 = 1 }; + + /// Rotates the transform matrix around the X axis. + /// + /// Type: FLOAT + /// The amount of rotation. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-rotationx + // Matrix4x4F RotationX( FLOAT degreeX ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.RotationX")] + public static D2D_MATRIX_4X4_F RotationX(float degreeX) { var angle = degreeX * Math.PI / 180; return new() { _11 = 1, _22 = (float)Math.Cos(angle), _23 = (float)Math.Sin(angle), _32 = (float)-Math.Sin(angle), _33 = (float)Math.Cos(angle), _44 = 1 }; } + + /// Rotates the transform matrix around the Y axis. + /// + /// Type: FLOAT + /// The amount of rotation. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-rotationy + // Matrix4x4F RotationY( FLOAT degreeY ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.RotationY")] + public static D2D_MATRIX_4X4_F RotationY(float degreeY) { var angle = degreeY * Math.PI / 180; return new() { _11 = (float)Math.Cos(angle), _13 = (float)-Math.Sin(angle), _22 = 1, _31 = (float)Math.Sin(angle), _33 = (float)Math.Cos(angle), _44 = 1 }; } + + /// Rotates the transform matrix around the Z axis. + /// + /// Type: FLOAT + /// The amount of rotation. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-rotationz + // Matrix4x4F RotationZ( FLOAT degreeZ ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.RotationZ")] + public static D2D_MATRIX_4X4_F RotationZ(float degreeZ) { var angle = degreeZ * Math.PI / 180; return new() { _11 = (float)Math.Cos(angle), _12 = (float)Math.Sin(angle), _21 = (float)-Math.Sin(angle), _22 = (float)Math.Cos(angle), _33 = 1, _44 = 1 }; } + + /// Determines the 3-D Rotation matrix for an arbitrary axis. + /// + /// Type: FLOAT + /// The X point of the axis. + /// + /// + /// Type: FLOAT + /// The Y point of the axis. + /// + /// + /// Type: FLOAT + /// The Z point of the axis. + /// + /// + /// Type: FLOAT + /// The amount of rotation. + /// + /// + /// Type: Matrix4x4F + /// The result matrix + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-rotationarbitraryaxis + // Matrix4x4F RotationArbitraryAxis( FLOAT x, FLOAT y, FLOAT z, FLOAT degree ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.RotationArbitraryAxis")] + public static D2D_MATRIX_4X4_F RotationArbitraryAxis(float x, float y, float z, float degree) + { + var magnitude = (float)Math.Sqrt(x * x + y * y + z * z); + x /= magnitude; + y /= magnitude; + z /= magnitude; + + var angle = degree * Math.PI / 180; + var c = (float)Math.Cos(angle); + var s = (float)Math.Sin(angle); + var t = 1 - c; + return new() + { + _11 = 1 + t * (x * x - 1), + _12 = t * x * y + s * z, + _13 = t * x * z - s * y, + _21 = t * x * y - s * z, + _22 = 1 + t * (y * y - 1), + _23 = t * y * z + s * x, + _31 = t * x * z + s * y, + _32 = t * y * z - s * x, + _33 = 1 + t * (z * z - 1), + _44 = 1 + }; + } + + /// Scales the perspective plane of the matrix. + /// + /// Type: FLOAT + /// The scale in the X direction. + /// + /// + /// Type: FLOAT + /// The scale in the Y direction. + /// + /// + /// Type: FLOAT + /// The scale in the Z direction. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-scale + // Matrix4x4F Scale( FLOAT x, FLOAT y, FLOAT z ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.Scale")] + public static D2D_MATRIX_4X4_F Scale(float x, float y, float z) => new() { _11 = x, _22 = y, _33 = z, _44 = 1 }; + + /// Skews the matrix in the X direction. + /// + /// Type: FLOAT + /// The skew amount. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-skewx + // Matrix4x4F SkewX( FLOAT degreeX ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.SkewX")] + public static D2D_MATRIX_4X4_F SkewX(float degreeX) => new() { _11 = 1, _22 = 1, _23 = (float)Math.Tan(degreeX * Math.PI / 180), _33 = 1, _44 = 1 }; + + /// Skews the matrix in the Y direction. + /// + /// Type: FLOAT + /// The skew amount. + /// + /// + /// Type: Matrix4x4F + /// The result matrix. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-matrix4x4f-skewy + // Matrix4x4F SkewY( FLOAT degreeY ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.SkewY")] + public static D2D_MATRIX_4X4_F SkewY(float degreeY) => new() { _11 = 1, _12 = (float)Math.Tan(degreeY * Math.PI / 180), _22 = 1, _33 = 1, _44 = 1 }; + + /// Creates a translation matrix from the specified X, Y, and Z components. + /// The amount to translate on the X axis. + /// The amount to translate on the Y axis. + /// The amount to translate on the Z axis. + /// The translation matrix. + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.Matrix4x4F.Translation")] + public static D2D_MATRIX_4X4_F Translation(float x, float y, float z) => new() { _11 = 1, _22 = 1, _33 = 1, _41 = x, _42 = y, _43 = z, _44 = 1 }; } /// Describes a 5-by-4 floating point matrix. @@ -4368,7 +4630,7 @@ public struct D2D_MATRIX_5X4_F // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_point_2f typedef struct D2D_POINT_2F { FLOAT x; FLOAT // y; } D2D_POINT_2F; [PInvokeData("dcommon.h", MSDNShortId = "2ee55d63-594b-482d-9e31-2378369c6c30"), StructLayout(LayoutKind.Sequential)] - public struct D2D_POINT_2F(float x, float y) + public struct D2D_POINT_2F(float x = 0f, float y = 0f) : IEquatable { /// /// Type: FLOAT @@ -4382,6 +4644,33 @@ public struct D2D_POINT_2F(float x, float y) /// public float y = y; + /// + public override bool Equals(object? obj) => obj is D2D_POINT_2F f && Equals(f); + + /// + public bool Equals(D2D_POINT_2F other) => x == other.x && y == other.y; + + /// + public override int GetHashCode() => (x, y).GetHashCode(); + + /// Implements the operator *. + /// The left point. + /// The right matrix. + /// The result of the operator. + public static D2D_POINT_2F operator *(D2D_POINT_2F left, DXGI_MATRIX_3X2_F right) => right.TransformPoint(left); + + /// Implements the operator op_Equality. + /// The left. + /// The right. + /// The result of the operator. + public static bool operator ==(D2D_POINT_2F left, D2D_POINT_2F right) => left.Equals(right); + + /// Implements the operator op_Inequality. + /// The left. + /// The right. + /// The result of the operator. + public static bool operator !=(D2D_POINT_2F left, D2D_POINT_2F right) => !(left == right); + /// /// Performs an implicit conversion from to . /// @@ -4473,7 +4762,7 @@ public struct D2D_POINT_2U // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_rect_f typedef struct D2D_RECT_F { FLOAT left; FLOAT // top; FLOAT right; FLOAT bottom; } D2D_RECT_F; [PInvokeData("dcommon.h", MSDNShortId = "84bd7ab0-f273-46f8-b261-86cd1d7f3868"), StructLayout(LayoutKind.Sequential)] - public struct D2D_RECT_F(float left, float top, float right, float bottom) : IEquatable + public struct D2D_RECT_F(float left = 0f, float top = 0f, float right = 0f, float bottom = 0f) : IEquatable { /// The x-coordinate of the upper-left corner of the rectangle. public float left = left; @@ -4531,6 +4820,18 @@ public struct D2D_RECT_F(float left, float top, float right, float bottom) : IEq /// The r. /// The result of the conversion. public static implicit operator RectangleF(D2D_RECT_F r) => RectangleF.FromLTRB(r.left, r.top, r.right, r.bottom); + + /// + /// Creates a rectangle that has its upper-left corner set to (negative infinity, negative infinity) and its lower-right corner set + /// to (infinity, infinity). + /// + /// + /// A rectangle that has its upper-left corner set to (negative infinity, negative infinity) and its lower-right corner set to + /// (infinity, infinity). + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1helper/nf-d2d1helper-infiniterect D2D1_RECT_F InfiniteRect(); + [PInvokeData("d2d1helper.h", MSDNShortId = "NF:d2d1helper.InfiniteRect")] + public static D2D_RECT_F Infinite => new(-float.MaxValue, -float.MaxValue, float.MaxValue, float.MaxValue); } /// Represents a rectangle defined by the upper-left corner pair of coordinates (left,top) and the lower-right corner pair of coordinates (right, bottom). These coordinates are expressed as a 32-bit integer values. @@ -4538,7 +4839,7 @@ public struct D2D_RECT_F(float left, float top, float right, float bottom) : IEq // typedef struct D2D_RECT_U { UINT32 left; UINT32 top; UINT32 right; UINT32 bottom; } D2D_RECT_U; [PInvokeData("dcommon.h", MSDNShortId = "NS:dcommon.D2D_RECT_U")] [StructLayout(LayoutKind.Sequential)] - public struct D2D_RECT_U(uint left, uint top, uint right, uint bottom) : IEquatable + public struct D2D_RECT_U(uint left = 0, uint top = 0, uint right = 0, uint bottom = 0) : IEquatable { /// /// Type: FLOAT @@ -4671,7 +4972,7 @@ public class PD2D_RECT_F(float left, float top, float right, float bottom) // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_size_f typedef struct D2D_SIZE_F { FLOAT width; FLOAT // height; } D2D_SIZE_F; [PInvokeData("dcommon.h", MSDNShortId = "9d519bb9-3eb8-4d7e-ba00-b6cf5a428a04"), StructLayout(LayoutKind.Sequential)] - public struct D2D_SIZE_F(float width, float height) + public struct D2D_SIZE_F(float width = 0f, float height = 0f) : IEquatable { /// /// Type: FLOAT @@ -4685,6 +4986,27 @@ public struct D2D_SIZE_F(float width, float height) /// public float height = height; + /// + public override bool Equals(object? obj) => obj is D2D_SIZE_F f && Equals(f); + + /// + public bool Equals(D2D_SIZE_F other) => width == other.width && height == other.height; + + /// + public override int GetHashCode() => (width, height).GetHashCode(); + + /// Implements the operator op_Equality. + /// The left. + /// The right. + /// The result of the operator. + public static bool operator ==(D2D_SIZE_F left, D2D_SIZE_F right) => left.Equals(right); + + /// Implements the operator op_Inequality. + /// The left. + /// The right. + /// The result of the operator. + public static bool operator !=(D2D_SIZE_F left, D2D_SIZE_F right) => !(left == right); + /// Performs an implicit conversion from to . /// The sz. /// The result of the conversion. @@ -4700,7 +5022,7 @@ public struct D2D_SIZE_F(float width, float height) // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_size_u typedef struct D2D_SIZE_U { UINT32 width; UINT32 // height; } D2D_SIZE_U; [PInvokeData("dcommon.h", MSDNShortId = "d9ea9df5-7c5f-4afa-9859-14d77b017904"), StructLayout(LayoutKind.Sequential)] - public struct D2D_SIZE_U(uint width, uint height) + public struct D2D_SIZE_U(uint width = 0, uint height = 0) : IEquatable { /// /// Type: UINT32 @@ -4714,6 +5036,27 @@ public struct D2D_SIZE_U(uint width, uint height) /// public uint height = height; + /// + public override bool Equals(object? obj) => obj is D2D_SIZE_U u && Equals(u); + + /// + public bool Equals(D2D_SIZE_U other) => width == other.width && height == other.height; + + /// + public override int GetHashCode() => (width, height).GetHashCode(); + + /// Implements the operator op_Equality. + /// The left. + /// The right. + /// The result of the operator. + public static bool operator ==(D2D_SIZE_U left, D2D_SIZE_U right) => left.Equals(right); + + /// Implements the operator op_Inequality. + /// The left. + /// The right. + /// The result of the operator. + public static bool operator !=(D2D_SIZE_U left, D2D_SIZE_U right) => !(left == right); + /// Performs an explicit conversion from to . /// The sz. /// The result of the conversion. @@ -4724,7 +5067,7 @@ public struct D2D_SIZE_U(uint width, uint height) // https://learn.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_vector_2f // typedef struct D2D_VECTOR_2F { FLOAT x; FLOAT y; } D2D_VECTOR_2F; [PInvokeData("dcommon.h", MSDNShortId = "NS:dcommon.D2D_VECTOR_2F"), StructLayout(LayoutKind.Sequential)] - public struct D2D_VECTOR_2F(float x, float y) + public struct D2D_VECTOR_2F(float x = 0f, float y = 0f) { /// The x value of the vector. public float x = x; @@ -4747,7 +5090,7 @@ public struct D2D_VECTOR_2F(float x, float y) // https://learn.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_vector_3f // typedef struct D2D_VECTOR_3F { FLOAT x; FLOAT y; FLOAT z; } D2D_VECTOR_3F; [PInvokeData("dcommon.h", MSDNShortId = "NS:dcommon.D2D_VECTOR_3F"), StructLayout(LayoutKind.Sequential)] - public struct D2D_VECTOR_3F(float x, float y, float z) + public struct D2D_VECTOR_3F(float x = 0f, float y = 0f, float z = 0f) { /// The x value of the vector. public float x = x; @@ -4758,6 +5101,10 @@ public struct D2D_VECTOR_3F(float x, float y, float z) /// The z value of the vector. public float z = z; + /// Returns the length of a 3 dimensional vector. + /// The length. + public readonly float Length => (float)Math.Sqrt(x * x + y * y + z * z); + /// Performs an implicit conversion from [] to . /// The vector. /// The result of the conversion. @@ -4773,7 +5120,7 @@ public struct D2D_VECTOR_3F(float x, float y, float z) // https://learn.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d_vector_4f // typedef struct D2D_VECTOR_4F { FLOAT x; FLOAT y; FLOAT z; FLOAT w; } D2D_VECTOR_4F; [PInvokeData("dcommon.h", MSDNShortId = "NS:dcommon.D2D_VECTOR_4F"), StructLayout(LayoutKind.Sequential)] - public struct D2D_VECTOR_4F(float x, float y, float z, float w) + public struct D2D_VECTOR_4F(float x = 0f, float y = 0f, float z = 0f, float w = 0f) { /// The x value of the vector. public float x = x; @@ -4812,13 +5159,13 @@ public struct D2D_VECTOR_4F(float x, float y, float z, float w) // https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ns-dcommon-d2d1_pixel_format typedef struct D2D1_PIXEL_FORMAT { // DXGI_FORMAT format; D2D1_ALPHA_MODE alphaMode; } D2D1_PIXEL_FORMAT; [PInvokeData("dcommon.h", MSDNShortId = "e95afd9c-5793-4cb7-bcb8-aae4d28b6532"), StructLayout(LayoutKind.Sequential)] - public struct D2D1_PIXEL_FORMAT + public struct D2D1_PIXEL_FORMAT(DXGI_FORMAT format = DXGI_FORMAT.DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE alphaMode = D2D1_ALPHA_MODE.D2D1_ALPHA_MODE_UNKNOWN) { /// /// Type: DXGI_FORMAT /// A value that specifies the size and arrangement of channels in each pixel. /// - public DXGI_FORMAT format; + public DXGI_FORMAT format = format; /// /// Type: D2D1_ALPHA_MODE @@ -4827,7 +5174,7 @@ public struct D2D1_PIXEL_FORMAT /// and considered opaque, or whether it is unkown. /// /// - public D2D1_ALPHA_MODE alphaMode; + public D2D1_ALPHA_MODE alphaMode = alphaMode; } /// Defines a 3D box. diff --git a/PInvoke/DXGI/DXGI.cs b/PInvoke/DXGI/DXGI.cs index 22e9c9ed6..478c557bd 100644 --- a/PInvoke/DXGI/DXGI.cs +++ b/PInvoke/DXGI/DXGI.cs @@ -932,6 +932,13 @@ public struct D3DCOLORVALUE(float r, float g, float b, float a = 1.0f) : IEquata /// public float a = a; + /// Initializes a new instance of the struct. + /// The color. + /// The alpha value. + public D3DCOLORVALUE(System.Drawing.Color color, float a = 1.0f) : this(color.R / 255f, color.G / 255f, color.B / 255f, a) + { + } + /// public override bool Equals(object? obj) => obj is D3DCOLORVALUE dCOLORVALUE && Equals(dCOLORVALUE); @@ -976,12 +983,12 @@ public override int GetHashCode() /// The result of the conversion. public static explicit operator D3DCOLOR(D3DCOLORVALUE cv) => new((byte)(cv.r * 255), (byte)(cv.g * 255), (byte)(cv.b * 255), (byte)(cv.a * 255)); - /// Performs an explicit conversion from to []. + /// Performs an explicit conversion from to []. /// The color value. /// The result of the conversion. public static explicit operator float[](D3DCOLORVALUE cv) => [cv.r, cv.g, cv.b, cv.a]; - /// Performs an explicit conversion from [] to . + /// Performs an explicit conversion from [] to . /// The color value array. /// The result of the conversion. public static implicit operator D3DCOLORVALUE(float[] cv) => cv is not null && cv.Length == 4 ? new(cv[0], cv[1], cv[2], cv[3]) : throw new ArgumentException("An array of four values is required.", nameof(cv)); diff --git a/PInvoke/Direct2D/D2d1.Interfaces1.cs b/PInvoke/Direct2D/D2d1.Interfaces1.cs index 529b8b49e..9c08a13b4 100644 --- a/PInvoke/Direct2D/D2d1.Interfaces1.cs +++ b/PInvoke/Direct2D/D2d1.Interfaces1.cs @@ -116,7 +116,7 @@ public interface ID2D1Bitmap : ID2D1Image /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrombitmap HRESULT CopyFromBitmap( const // D2D1_POINT_2U *destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect ); - void CopyFromBitmap([In, Optional] IntPtr destPoint, [In] ID2D1Bitmap bitmap, [In, Optional] IntPtr srcRect); + void CopyFromBitmap([In, Optional] StructPointer destPoint, [In] ID2D1Bitmap bitmap, [In, Optional] StructPointer srcRect); /// Copies the specified region from the specified render target into the current bitmap. /// @@ -153,7 +153,7 @@ public interface ID2D1Bitmap : ID2D1Image /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfromrendertarget HRESULT // CopyFromRenderTarget( const D2D1_POINT_2U *destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect ); - void CopyFromRenderTarget([In, Optional] IntPtr destPoint, [In] ID2D1RenderTarget renderTarget, [In, Optional] IntPtr srcRect); + void CopyFromRenderTarget([In, Optional] StructPointer destPoint, [In] ID2D1RenderTarget renderTarget, [In, Optional] StructPointer srcRect); /// Copies the specified region from memory into the current bitmap. /// @@ -196,7 +196,7 @@ public interface ID2D1Bitmap : ID2D1Image /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrommemory HRESULT CopyFromMemory( const // D2D1_RECT_U *dstRect, const void *srcData, UINT32 pitch ); - void CopyFromMemory([In, Optional] IntPtr dstRect, [In] IntPtr srcData, uint pitch); + void CopyFromMemory([In, Optional] StructPointer dstRect, [In] IntPtr srcData, uint pitch); } /// Paints an area with a bitmap. @@ -545,7 +545,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, // ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -618,7 +618,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -649,7 +649,8 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, + [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -667,7 +668,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -693,7 +694,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -719,7 +720,8 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, + [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -744,7 +746,8 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, + [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -816,7 +819,8 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, + [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -833,7 +837,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -1174,7 +1178,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -1214,8 +1218,8 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -1708,7 +1712,7 @@ public interface ID2D1BitmapRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -2157,7 +2161,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, // ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -2230,7 +2234,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -2261,7 +2265,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -2279,7 +2283,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -2305,7 +2309,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -2331,7 +2335,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -2356,7 +2360,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -2428,7 +2432,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -2445,7 +2449,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -2786,7 +2790,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -2826,8 +2830,8 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -3320,7 +3324,7 @@ public interface ID2D1DCRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None diff --git a/PInvoke/Direct2D/D2d1.Interfaces2.cs b/PInvoke/Direct2D/D2d1.Interfaces2.cs index f199dc04f..614cf09fd 100644 --- a/PInvoke/Direct2D/D2d1.Interfaces2.cs +++ b/PInvoke/Direct2D/D2d1.Interfaces2.cs @@ -122,7 +122,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -157,7 +157,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -196,7 +196,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -227,7 +227,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -267,7 +267,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -300,7 +300,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -325,7 +325,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -355,7 +355,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -401,7 +401,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -427,7 +427,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -451,7 +451,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -493,7 +493,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -526,7 +526,7 @@ public interface ID2D1EllipseGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Gets the D2D1_ELLIPSE structure that describes this ellipse geometry. /// @@ -769,7 +769,7 @@ public interface ID2D1Factory // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// diff --git a/PInvoke/Direct2D/D2d1.Interfaces3.cs b/PInvoke/Direct2D/D2d1.Interfaces3.cs index 42fd4f3ac..d6d81cf61 100644 --- a/PInvoke/Direct2D/D2d1.Interfaces3.cs +++ b/PInvoke/Direct2D/D2d1.Interfaces3.cs @@ -53,7 +53,7 @@ public interface ID2D1Geometry : ID2D1Resource /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -88,7 +88,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -127,7 +127,7 @@ public interface ID2D1Geometry : ID2D1Resource // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -158,7 +158,7 @@ public interface ID2D1Geometry : ID2D1Resource // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -198,7 +198,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -231,7 +231,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -256,7 +256,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink? tessellationSink); + void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink? tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -286,7 +286,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -332,7 +332,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -358,7 +358,7 @@ public interface ID2D1Geometry : ID2D1Resource /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -382,7 +382,7 @@ public interface ID2D1Geometry : ID2D1Resource /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -424,7 +424,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -457,7 +457,7 @@ public interface ID2D1Geometry : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); } /// Represents a composite geometry, composed of other ID2D1Geometry objects. @@ -510,7 +510,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -545,7 +545,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -584,7 +584,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -615,7 +615,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -655,7 +655,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -688,7 +688,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -713,7 +713,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink? tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink? tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -743,7 +743,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -789,7 +789,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -815,7 +815,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -839,7 +839,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -881,7 +881,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -914,7 +914,7 @@ public interface ID2D1GeometryGroup : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink? geometrySink); /// Indicates how the intersecting areas of the geometries contained in this geometry group are combined. /// @@ -1367,7 +1367,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, // ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -1440,7 +1440,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -1471,7 +1471,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -1489,7 +1489,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -1515,7 +1515,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -1541,7 +1541,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection? gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection? gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -1566,7 +1566,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection? gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection? gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -1638,7 +1638,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -1655,7 +1655,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -1996,7 +1996,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -2036,8 +2036,8 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -2530,7 +2530,7 @@ public interface ID2D1HwndRenderTarget : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None diff --git a/PInvoke/Direct2D/D2d1.Interfaces4.cs b/PInvoke/Direct2D/D2d1.Interfaces4.cs index ce3f64a60..35a698630 100644 --- a/PInvoke/Direct2D/D2d1.Interfaces4.cs +++ b/PInvoke/Direct2D/D2d1.Interfaces4.cs @@ -92,7 +92,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -127,7 +127,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -166,7 +166,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -197,7 +197,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -237,7 +237,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -270,7 +270,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -295,7 +295,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -325,7 +325,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -371,7 +371,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -397,7 +397,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -421,7 +421,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -463,7 +463,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -496,7 +496,7 @@ public interface ID2D1PathGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Retrieves the geometry sink that is used to populate the path geometry with figures and segments. /// @@ -828,7 +828,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -863,7 +863,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -902,7 +902,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -933,7 +933,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -973,7 +973,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -1006,7 +1006,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -1031,7 +1031,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -1061,7 +1061,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -1107,7 +1107,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -1133,7 +1133,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -1157,7 +1157,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -1199,7 +1199,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -1232,7 +1232,7 @@ public interface ID2D1RectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Retrieves the rectangle that describes the rectangle geometry's dimensions. /// @@ -1330,7 +1330,7 @@ public interface ID2D1RenderTarget : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, // ID2D1Bitmap **bitmap ); - ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -1403,7 +1403,7 @@ public interface ID2D1RenderTarget : ID2D1Resource /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -1434,7 +1434,8 @@ public interface ID2D1RenderTarget : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, + [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -1452,7 +1453,7 @@ public interface ID2D1RenderTarget : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -1478,7 +1479,8 @@ public interface ID2D1RenderTarget : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, + D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -1504,7 +1506,8 @@ public interface ID2D1RenderTarget : ID2D1Resource // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, + [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -1529,7 +1532,8 @@ public interface ID2D1RenderTarget : ID2D1Resource // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, + [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -1601,7 +1605,8 @@ public interface ID2D1RenderTarget : ID2D1Resource // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, + [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -1618,7 +1623,7 @@ public interface ID2D1RenderTarget : ID2D1Resource /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - ID2D1Layer CreateLayer([In, Optional] IntPtr size); + ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -1959,7 +1964,8 @@ public interface ID2D1RenderTarget : ID2D1Resource // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, + [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -1999,8 +2005,9 @@ public interface ID2D1RenderTarget : ID2D1Resource // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, // D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + [In] PD2D_RECT_F? sourceRectangle = null); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -2493,7 +2500,7 @@ void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - void Clear([In, Optional] IntPtr clearColor); + void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -2754,7 +2761,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -2789,7 +2796,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -2828,7 +2835,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -2859,7 +2866,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -2899,7 +2906,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -2932,7 +2939,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -2957,7 +2964,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -2987,7 +2994,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -3033,7 +3040,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -3059,7 +3066,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -3083,7 +3090,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -3125,7 +3132,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -3158,7 +3165,7 @@ public interface ID2D1RoundedRectangleGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Retrieves a rounded rectangle that describes this rounded rectangle geometry. /// @@ -3319,4 +3326,65 @@ public interface ID2D1SimplifiedGeometrySink [PreserveSig] HRESULT Close(); } + + /// Creates an ID2D1Bitmap whose data is shared with another resource. + /// The interface ID of the object supplying the source data. + /// The render target that will create the bitmap. + /// + /// An ID2D1Bitmap, IDXGISurface, or an IWICBitmapLock that contains the data to share with the new ID2D1Bitmap. For more + /// information, see the Remarks section. + /// + /// + /// The pixel format and DPI of the bitmap to create . The DXGI_FORMAT portion of the pixel format must match the DXGI_FORMAT of data or + /// the method will fail, but the alpha modes don't have to match. To prevent a mismatch, you can pass NULL or the value obtained + /// from the D2D1::PixelFormat helper function. The DPI settings do not have to match those of data. If both dpiX and dpiY are 0.0f, the + /// DPI of the render target is used. + /// + /// When this method returns, contains the address of a pointer to the new bitmap. This parameter is passed uninitialized. + /// + /// + /// The CreateSharedBitmap method is useful for efficiently reusing bitmap data and can also be used to provide interoperability + /// with Direct3D. + /// + /// Sharing an ID2D1Bitmap + /// + /// By passing an ID2D1Bitmap created by a render target that is resource-compatible, you can share a bitmap with that render target; + /// both the original ID2D1Bitmap and the new ID2D1Bitmap created by this method will point to the same bitmap data. For + /// more information about when render target resources can be shared, see the Sharing Render Target Resources section of the Resources Overview. + /// + /// + /// You may also use this method to reinterpret the data of an existing bitmap and specify a new DPI or alpha mode. For example, in the + /// case of a bitmap atlas, an ID2D1Bitmap may contain multiple sub-images, each of which should be rendered with a different + /// D2D1_ALPHA_MODE ( D2D1_ALPHA_MODE_PREMULTIPLIED or D2D1_ALPHA_MODE_IGNORE). You could use the + /// CreateSharedBitmap method to reinterpret the bitmap using the desired alpha mode without having to load a separate copy of + /// the bitmap into memory. + /// + /// Sharing an IDXGISurface + /// + /// When using a DXGI surface render target (an ID2D1RenderTarget object created by the CreateDxgiSurfaceRenderTarget method), you can + /// pass an IDXGISurface surface to the CreateSharedBitmap method to share video memory with Direct3D and manipulate Direct3D + /// content as an ID2D1Bitmap. As described in the Resources Overview, the render target and the IDXGISurface must be using the same + /// Direct3D device. + /// + /// + /// Note also that the IDXGISurface must use one of the supported pixel formats and alpha modes described in Supported Pixel Formats and + /// Alpha Modes. + /// + /// For more information about interoperability with Direct3D, see the Direct2D and Direct3D Interoperability Overview. + /// Sharing an IWICBitmapLock + /// + /// An IWICBitmapLock stores the content of a WIC bitmap and shields it from simultaneous accesses. By passing an IWICBitmapLock + /// to the CreateSharedBitmap method, you can create an ID2D1Bitmap that points to the bitmap data already stored in the IWICBitmapLock. + /// + /// + /// To use an IWICBitmapLock with the CreateSharedBitmap method, the render target must use software rendering. To force a render + /// target to use software rendering, set to D2D1_RENDER_TARGET_TYPE_SOFTWARE the type field of the D2D1_RENDER_TARGET_PROPERTIES + /// structure that you use to create the render target. To check whether an existing render target uses software rendering, use the + /// IsSupported method. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT + // CreateSharedBitmap( REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); + public static ID2D1Bitmap CreateSharedBitmap(this ID2D1RenderTarget target, T data, [In, Optional] D2D1_BITMAP_PROPERTIES? bitmapProperties) where T : class => + target.CreateSharedBitmap(typeof(T).GUID, data, new(bitmapProperties, out _)); } \ No newline at end of file diff --git a/PInvoke/Direct2D/D2d1.Interfaces5.cs b/PInvoke/Direct2D/D2d1.Interfaces5.cs index 58bd4f832..8240734a7 100644 --- a/PInvoke/Direct2D/D2d1.Interfaces5.cs +++ b/PInvoke/Direct2D/D2d1.Interfaces5.cs @@ -335,7 +335,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -370,7 +370,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -409,7 +409,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -440,7 +440,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the @@ -480,7 +480,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the @@ -513,7 +513,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix @@ -538,7 +538,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -568,7 +568,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -614,7 +614,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -640,7 +640,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -664,7 +664,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -706,7 +706,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -739,7 +739,7 @@ public interface ID2D1TransformedGeometry : ID2D1Geometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Retrieves the source geometry of this transformed geometry object. /// diff --git a/PInvoke/Direct2D/D2d1.cs b/PInvoke/Direct2D/D2d1.cs index 6b89d6e1b..c9ee552e3 100644 --- a/PInvoke/Direct2D/D2d1.cs +++ b/PInvoke/Direct2D/D2d1.cs @@ -15,6 +15,12 @@ namespace Vanara.PInvoke; /// Items from the D2d1.dll public static partial class D2d1 { + /// + public const float D2D1_DEFAULT_FLATTENING_TOLERANCE = 0.25f; + + /// + public const ulong D2D1_INVALID_TAG = ulong.MaxValue; + /// Specifies how the edges of nontext primitives are rendered. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_antialias_mode typedef enum D2D1_ANTIALIAS_MODE { // D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1_ANTIALIAS_MODE_ALIASED, D2D1_ANTIALIAS_MODE_FORCE_DWORD } ; @@ -852,7 +858,7 @@ public enum D2D1_WINDOW_STATE : uint // factoryType, REFIID riid, const D2D1_FACTORY_OPTIONS *pFactoryOptions, void **ppIFactory ); [DllImport(Lib.D2d1, SetLastError = false, ExactSpelling = true)] [PInvokeData("d2d1.h", MSDNShortId = "8c0a685a-8f33-4072-a715-bb423cb44f03")] - public static extern HRESULT D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, in Guid riid, [In, Optional] IntPtr pFactoryOptions, [MarshalAs(UnmanagedType.Interface)] out object ppIFactory); + public static extern HRESULT D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, in Guid riid, [In, Optional] StructPointer pFactoryOptions, [MarshalAs(UnmanagedType.Interface)] out object ppIFactory); /// Creates a factory object that can be used to create Direct2D resources. /// The type of the factory interface to create. @@ -971,19 +977,19 @@ public static D2D1_GRADIENT_STOP[] GetGradientStops(this IDWritePaintReader rdr, // point; D2D1_SIZE_F size; FLOAT rotationAngle; D2D1_SWEEP_DIRECTION sweepDirection; D2D1_ARC_SIZE arcSize; } D2D1_ARC_SEGMENT; [PInvokeData("d2d1.h", MSDNShortId = "3f391265-20b4-4897-aa0b-d14b71cd5f0a")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_ARC_SEGMENT + public struct D2D1_ARC_SEGMENT(in DXGI.D2D_POINT_2F point, in DXGI.D2D_SIZE_F size, float rotationAngle, D2d1.D2D1_SWEEP_DIRECTION sweepDirection, D2d1.D2D1_ARC_SIZE arcSize) { /// /// Type: D2D1_POINT_2F /// The end point of the arc. /// - public D2D_POINT_2F point; + public D2D_POINT_2F point = point; /// /// Type: D2D1_SIZE_F /// The x-radius and y-radius of the arc. /// - public D2D_SIZE_F size; + public D2D_SIZE_F size = size; /// /// Type: FLOAT @@ -991,19 +997,19 @@ public struct D2D1_ARC_SEGMENT /// A value that specifies how many degrees in the clockwise direction the ellipse is rotated relative to the current coordinate system. /// /// - public float rotationAngle; + public float rotationAngle = rotationAngle; /// /// Type: D2D1_SWEEP_DIRECTION /// A value that specifies whether the arc sweep is clockwise or counterclockwise. /// - public D2D1_SWEEP_DIRECTION sweepDirection; + public D2D1_SWEEP_DIRECTION sweepDirection = sweepDirection; /// /// Type: D2D1_ARC_SIZE /// A value that specifies whether the given arc is larger than 180 degrees. /// - public D2D1_ARC_SIZE arcSize; + public D2D1_ARC_SIZE arcSize = arcSize; } /// Represents a cubic bezier segment drawn between two points. @@ -1027,25 +1033,25 @@ public struct D2D1_ARC_SEGMENT // D2D1_POINT_2F point1; D2D1_POINT_2F point2; D2D1_POINT_2F point3; } D2D1_BEZIER_SEGMENT; [PInvokeData("d2d1.h", MSDNShortId = "cf8df7d2-c4fe-4a46-a4b2-7e0eed67df2a")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_BEZIER_SEGMENT + public struct D2D1_BEZIER_SEGMENT(in DXGI.D2D_POINT_2F point1, in DXGI.D2D_POINT_2F point2, in DXGI.D2D_POINT_2F point3) { /// /// Type: D2D1_POINT_2F /// The first control point for the Bezier segment. /// - public D2D_POINT_2F point1; + public D2D_POINT_2F point1 = point1; /// /// Type: D2D1_POINT_2F /// The second control point for the Bezier segment. /// - public D2D_POINT_2F point2; + public D2D_POINT_2F point2 = point2; /// /// Type: D2D1_POINT_2F /// The end point for the Bezier segment. /// - public D2D_POINT_2F point3; + public D2D_POINT_2F point3 = point3; } /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush. @@ -1054,25 +1060,27 @@ public struct D2D1_BEZIER_SEGMENT // interpolationMode; } D2D1_BITMAP_BRUSH_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "e252d1b4-2f34-4479-94fc-636d4115b00c")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_BITMAP_BRUSH_PROPERTIES + public struct D2D1_BITMAP_BRUSH_PROPERTIES(D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, + D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE.D2D1_EXTEND_MODE_CLAMP, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR) { /// /// Type: D2D1_EXTEND_MODE /// A value that describes how the brush horizontally tiles those areas that extend past its bitmap. /// - public D2D1_EXTEND_MODE extendModeX; + public D2D1_EXTEND_MODE extendModeX = extendModeX; /// /// Type: D2D1_EXTEND_MODE /// A value that describes how the brush vertically tiles those areas that extend past its bitmap. /// - public D2D1_EXTEND_MODE extendModeY; + public D2D1_EXTEND_MODE extendModeY = extendModeY; /// /// Type: D2D1_BITMAP_INTERPOLATION_MODE /// A value that specifies how the bitmap is interpolated when it is scaled or rotated. /// - public D2D1_BITMAP_INTERPOLATION_MODE interpolationMode; + public D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = interpolationMode; } /// Describes the pixel format and dpi of a bitmap. @@ -1080,25 +1088,25 @@ public struct D2D1_BITMAP_BRUSH_PROPERTIES // D2D1_PIXEL_FORMAT pixelFormat; FLOAT dpiX; FLOAT dpiY; } D2D1_BITMAP_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "050246fd-f91a-4a2a-858a-5f0447e3ecbf")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_BITMAP_PROPERTIES + public struct D2D1_BITMAP_PROPERTIES(D2D1_PIXEL_FORMAT pixelFormat = default, float dpiX = 96f, float dpiY = 96f) { /// /// Type: D2D1_PIXEL_FORMAT /// The bitmap's pixel format and alpha mode. /// - public D2D1_PIXEL_FORMAT pixelFormat; + public D2D1_PIXEL_FORMAT pixelFormat = pixelFormat; /// /// Type: FLOAT /// The horizontal dpi of the bitmap. /// - public float dpiX; + public float dpiX = dpiX; /// /// Type: FLOAT /// The vertical dpi of the bitmap. /// - public float dpiY; + public float dpiY = dpiY; } /// Describes the opacity and transformation of a brush. @@ -1125,7 +1133,16 @@ public struct D2D1_BRUSH_PROPERTIES /// Type: D2D1_MATRIX_3X2_F /// The transformation that is applied to the brush. /// - public D2D_MATRIX_3X2_F transform; + public D2D1_MATRIX_3X2_F transform; + + /// Initializes a new instance of the struct. + /// The opacity. + /// The transform. + public D2D1_BRUSH_PROPERTIES(float opacity = 1.0f, D2D1_MATRIX_3X2_F? transform = null) + { + this.opacity = opacity; + this.transform = transform.GetValueOrDefault(D2D1_MATRIX_3X2_F.Identity()); + } } /// Describes the drawing state of a render target. @@ -1134,37 +1151,39 @@ public struct D2D1_BRUSH_PROPERTIES // tag2; D2D1_MATRIX_3X2_F transform; } D2D1_DRAWING_STATE_DESCRIPTION; [PInvokeData("d2d1.h", MSDNShortId = "ba4adc4b-4d86-40c4-8911-1c800d3c6f3e")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_DRAWING_STATE_DESCRIPTION + public struct D2D1_DRAWING_STATE_DESCRIPTION(D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE.D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, ulong tag1 = 0, ulong tag2 = 0, + in D2D_MATRIX_3X2_F? transform = null) { /// /// Type: D2D1_ANTIALIAS_MODE /// The antialiasing mode for subsequent nontext drawing operations. /// - public D2D1_ANTIALIAS_MODE antialiasMode; + public D2D1_ANTIALIAS_MODE antialiasMode = antialiasMode; /// /// Type: D2D1_TEXT_ANTIALIAS_MODE /// The antialiasing mode for subsequent text and glyph drawing operations. /// - public D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; + public D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = textAntialiasMode; /// /// Type: ulong /// A label for subsequent drawing operations. /// - public ulong tag1; + public ulong tag1 = tag1; /// /// Type: ulong /// A label for subsequent drawing operations. /// - public ulong tag2; + public ulong tag2 = tag2; /// /// Type: D2D1_MATRIX_3X2_F /// The transformation to apply to subsequent drawing operations. /// - public D2D_MATRIX_3X2_F transform; + public D2D_MATRIX_3X2_F transform = transform.GetValueOrDefault(D2D_MATRIX_3X2_F.Identity()); } /// Contains the center point, x-radius, and y-radius of an ellipse. @@ -1172,25 +1191,25 @@ public struct D2D1_DRAWING_STATE_DESCRIPTION // FLOAT radiusX; FLOAT radiusY; } D2D1_ELLIPSE; [PInvokeData("d2d1.h", MSDNShortId = "6fed6c49-ba83-4c2b-af8a-04156ee317f0")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_ELLIPSE + public struct D2D1_ELLIPSE(in DXGI.D2D_POINT_2F point, float radiusX, float radiusY) { /// /// Type: D2D1_POINT_2F /// The center point of the ellipse. /// - public D2D_POINT_2F point; + public D2D_POINT_2F point = point; /// /// Type: FLOAT /// The X-radius of the ellipse. /// - public float radiusX; + public float radiusX = radiusX; /// /// Type: FLOAT /// The Y-radius of the ellipse. /// - public float radiusY; + public float radiusY = radiusY; } /// Contains the debugging level of an ID2D1Factory object. @@ -1234,7 +1253,7 @@ public struct D2D1_FACTORY_OPTIONS // position; D2D1_COLOR_F color; } D2D1_GRADIENT_STOP; [PInvokeData("d2d1.h", MSDNShortId = "f6798542-382a-4074-bbe1-707bc00b3575")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_GRADIENT_STOP + public struct D2D1_GRADIENT_STOP(float position, in D3DCOLORVALUE color) { /// /// Type: FLOAT @@ -1243,13 +1262,13 @@ public struct D2D1_GRADIENT_STOP /// if the gradient stop is to be seen explicitly. /// /// - public float position; + public float position = position; /// /// Type: D2D1_COLOR_F /// The color of the gradient stop. /// - public D3DCOLORVALUE color; + public D3DCOLORVALUE color = color; } /// Contains the HWND, pixel size, and presentation options for an ID2D1HwndRenderTarget. @@ -1264,19 +1283,19 @@ public struct D2D1_GRADIENT_STOP // D2D1_HWND_RENDER_TARGET_PROPERTIES { HWND hwnd; D2D1_SIZE_U pixelSize; D2D1_PRESENT_OPTIONS presentOptions; } D2D1_HWND_RENDER_TARGET_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "4300843a-a24f-4f9e-a396-67172f083638")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_HWND_RENDER_TARGET_PROPERTIES + public struct D2D1_HWND_RENDER_TARGET_PROPERTIES(HWND hwnd, D2D_SIZE_U pixelSize = default, D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS.D2D1_PRESENT_OPTIONS_NONE) { /// /// Type: HWND /// The HWND to which the render target issues the output from its drawing commands. /// - public HWND hwnd; + public HWND hwnd = hwnd; /// /// Type: D2D1_SIZE_U /// The size of the render target, in pixels. /// - public D2D_SIZE_U pixelSize; + public D2D_SIZE_U pixelSize = pixelSize; /// /// Type: D2D1_PRESENT_OPTIONS @@ -1285,7 +1304,7 @@ public struct D2D1_HWND_RENDER_TARGET_PROPERTIES /// for the device to refresh before presenting. /// /// - public D2D1_PRESENT_OPTIONS presentOptions; + public D2D1_PRESENT_OPTIONS presentOptions = presentOptions; } /// Contains the content bounds, mask information, opacity settings, and other options for a layer resource. @@ -1294,37 +1313,38 @@ public struct D2D1_HWND_RENDER_TARGET_PROPERTIES // FLOAT opacity; ID2D1Brush *opacityBrush; D2D1_LAYER_OPTIONS layerOptions; } D2D1_LAYER_PARAMETERS; [PInvokeData("d2d1.h", MSDNShortId = "ce575df6-9464-4672-9a0e-ff7e016d9354")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_LAYER_PARAMETERS + public struct D2D1_LAYER_PARAMETERS(in D2D_RECT_F? contentBounds = null, ID2D1Geometry? geometricMask = null, D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + in D2D_MATRIX_3X2_F? maskTransform = null, float opacity = 1f, ID2D1Brush? opacityBrush = null, D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS.D2D1_LAYER_OPTIONS_NONE) { /// /// Type: D2D1_RECT_F /// The content bounds of the layer. Content outside these bounds is not guaranteed to render. /// - public D2D_RECT_F contentBounds; + public D2D_RECT_F contentBounds = contentBounds.GetValueOrDefault(D2D_RECT_F.Infinite); /// /// Type: ID2D1Geometry* /// The geometric mask specifies the area of the layer that is composited into the render target. /// - public IntPtr geometricMask; + public IUnknownPointer geometricMask = new(geometricMask); /// /// Type: D2D1_ANTIALIAS_MODE /// A value that specifies the antialiasing mode for the geometricMask. /// - public D2D1_ANTIALIAS_MODE maskAntialiasMode; + public D2D1_ANTIALIAS_MODE maskAntialiasMode = maskAntialiasMode; /// /// Type: D2D1_MATRIX_3X2_F /// A value that specifies the transform that is applied to the geometric mask when composing the layer. /// - public D2D_MATRIX_3X2_F maskTransform; + public D2D_MATRIX_3X2_F maskTransform = maskTransform.GetValueOrDefault(D2D_MATRIX_3X2_F.Identity()); /// /// Type: FLOAT /// An opacity value that is applied uniformly to all resources in the layer when compositing to the target. /// - public float opacity; + public float opacity = opacity; /// /// Type: ID2D1Brush* @@ -1333,13 +1353,13 @@ public struct D2D1_LAYER_PARAMETERS /// mapped brush pixel is multiplied against the corresponding layer pixel. /// /// - public IntPtr opacityBrush; + public IUnknownPointer opacityBrush = new(opacityBrush); /// /// Type: D2D1_LAYER_OPTIONS /// A value that specifies whether the layer intends to render text with ClearType antialiasing. /// - public D2D1_LAYER_OPTIONS layerOptions; + public D2D1_LAYER_OPTIONS layerOptions = layerOptions; } /// Contains the starting point and endpoint of the gradient axis for an ID2D1LinearGradientBrush. @@ -1362,19 +1382,19 @@ public struct D2D1_LAYER_PARAMETERS // D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES { D2D1_POINT_2F startPoint; D2D1_POINT_2F endPoint; } D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "753278f0-d8a1-4dc5-b976-a00f8aab357e")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES + public struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES(in DXGI.D2D_POINT_2F startPoint, in DXGI.D2D_POINT_2F endPoint) { /// /// Type: D2D1_POINT_2F /// In the brush's coordinate space, the starting point of the gradient axis. /// - public D2D_POINT_2F startPoint; + public D2D_POINT_2F startPoint = startPoint; /// /// Type: D2D1_POINT_2F /// In the brush's coordinate space, the endpoint of the gradient axis. /// - public D2D_POINT_2F endPoint; + public D2D_POINT_2F endPoint = endPoint; } /// Contains the control point and end point for a quadratic Bezier segment. @@ -1382,19 +1402,19 @@ public struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES // D2D1_QUADRATIC_BEZIER_SEGMENT { D2D1_POINT_2F point1; D2D1_POINT_2F point2; } D2D1_QUADRATIC_BEZIER_SEGMENT; [PInvokeData("d2d1.h", MSDNShortId = "5060cb17-b6f4-4796-b91d-602fd81591c2")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_QUADRATIC_BEZIER_SEGMENT + public struct D2D1_QUADRATIC_BEZIER_SEGMENT(in DXGI.D2D_POINT_2F point1, in DXGI.D2D_POINT_2F point2) { /// /// Type: D2D1_POINT_2F /// The control point of the quadratic Bezier segment. /// - public D2D_POINT_2F point1; + public D2D_POINT_2F point1 = point1; /// /// Type: D2D1_POINT_2F /// The end point of the quadratic Bezier segment. /// - public D2D_POINT_2F point2; + public D2D_POINT_2F point2 = point2; } /// Contains the gradient origin offset and the size and position of the gradient ellipse for an ID2D1RadialGradientBrush. @@ -1413,31 +1433,31 @@ public struct D2D1_QUADRATIC_BEZIER_SEGMENT // D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES { D2D1_POINT_2F center; D2D1_POINT_2F gradientOriginOffset; FLOAT radiusX; FLOAT radiusY; } D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "194f7624-ac3b-4054-8d6f-5b4c99ef6546")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES + public struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES(in DXGI.D2D_POINT_2F center, in DXGI.D2D_POINT_2F gradientOriginOffset, float radiusX, float radiusY) { /// /// Type: D2D1_POINT_2F /// In the brush's coordinate space, the center of the gradient ellipse. /// - public D2D_POINT_2F center; + public D2D_POINT_2F center = center; /// /// Type: D2D1_POINT_2F /// In the brush's coordinate space, the offset of the gradient origin relative to the gradient ellipse's center. /// - public D2D_POINT_2F gradientOriginOffset; + public D2D_POINT_2F gradientOriginOffset = gradientOriginOffset; /// /// Type: FLOAT /// In the brush's coordinate space, the x-radius of the gradient ellipse. /// - public float radiusX; + public float radiusX = radiusX; /// /// Type: FLOAT /// In the brush's coordinate space, the y-radius of the gradient ellipse. /// - public float radiusY; + public float radiusY = radiusY; } /// @@ -1479,7 +1499,9 @@ public struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES // D2D1_RENDER_TARGET_USAGE usage; D2D1_FEATURE_LEVEL minLevel; } D2D1_RENDER_TARGET_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "360900bd-1353-4a92-865c-ad34d5e98123")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_RENDER_TARGET_PROPERTIES + public struct D2D1_RENDER_TARGET_PROPERTIES(D2D1_RENDER_TARGET_TYPE type = D2D1_RENDER_TARGET_TYPE.D2D1_RENDER_TARGET_TYPE_DEFAULT, + D2D1_PIXEL_FORMAT pixelFormat = default, float dpiX = 0f, float dpiY = 0f, D2D1_RENDER_TARGET_USAGE usage = D2D1_RENDER_TARGET_USAGE.D2D1_RENDER_TARGET_USAGE_NONE, + D2D1_FEATURE_LEVEL minLevel = D2D1_FEATURE_LEVEL.D2D1_FEATURE_LEVEL_DEFAULT) { /// /// Type: D2D1_RENDER_TARGET_TYPE @@ -1489,7 +1511,7 @@ public struct D2D1_RENDER_TARGET_PROPERTIES /// otherwise, it uses software rendering. Note that WIC bitmap render targets do not support hardware rendering. /// /// - public D2D1_RENDER_TARGET_TYPE type; + public D2D1_RENDER_TARGET_TYPE type = type; /// /// Type: D2D1_PIXEL_FORMAT @@ -1499,7 +1521,7 @@ public struct D2D1_RENDER_TARGET_PROPERTIES /// modes supported by each render target, see Supported Pixel Formats and Alpha Modes. /// /// - public D2D1_PIXEL_FORMAT pixelFormat; + public D2D1_PIXEL_FORMAT pixelFormat = pixelFormat; /// /// Type: FLOAT @@ -1508,7 +1530,7 @@ public struct D2D1_RENDER_TARGET_PROPERTIES /// Remarks section. /// /// - public float dpiX; + public float dpiX = dpiX; /// /// Type: FLOAT @@ -1516,7 +1538,7 @@ public struct D2D1_RENDER_TARGET_PROPERTIES /// The vertical DPI of the render target. To use the default DPI, set dpiX and dpiY to 0. For more information, see the Remarks section. /// /// - public float dpiY; + public float dpiY = dpiY; /// /// Type: D2D1_RENDER_TARGET_USAGE @@ -1526,7 +1548,7 @@ public struct D2D1_RENDER_TARGET_PROPERTIES /// remoting if it is available. /// /// - public D2D1_RENDER_TARGET_USAGE usage; + public D2D1_RENDER_TARGET_USAGE usage = usage; /// /// Type: D2D1_FEATURE_LEVEL @@ -1538,7 +1560,7 @@ public struct D2D1_RENDER_TARGET_PROPERTIES /// the device is adequate. This field is used only when creating ID2D1HwndRenderTarget and ID2D1DCRenderTarget objects. /// /// - public D2D1_FEATURE_LEVEL minLevel; + public D2D1_FEATURE_LEVEL minLevel = minLevel; } /// Contains the dimensions and corner radii of a rounded rectangle. @@ -1560,25 +1582,25 @@ public struct D2D1_RENDER_TARGET_PROPERTIES // rect; FLOAT radiusX; FLOAT radiusY; } D2D1_ROUNDED_RECT; [PInvokeData("d2d1.h", MSDNShortId = "7069ca65-170e-42fc-8c1a-849a2f25c36f")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_ROUNDED_RECT + public struct D2D1_ROUNDED_RECT(in D2D_RECT_F rect, float radiusX, float radiusY) { /// /// Type: D2D1_RECT_F /// The coordinates of the rectangle. /// - public D2D_RECT_F rect; + public D2D_RECT_F rect = rect; /// /// Type: FLOAT /// The x-radius for the quarter ellipse that is drawn to replace every corner of the rectangle. /// - public float radiusX; + public float radiusX = radiusX; /// /// Type: FLOAT /// The y-radius for the quarter ellipse that is drawn to replace every corner of the rectangle. /// - public float radiusY; + public float radiusY = radiusY; } /// Describes the stroke that outlines a shape. @@ -1588,25 +1610,28 @@ public struct D2D1_ROUNDED_RECT // FLOAT miterLimit; D2D1_DASH_STYLE dashStyle; FLOAT dashOffset; } D2D1_STROKE_STYLE_PROPERTIES; [PInvokeData("d2d1.h", MSDNShortId = "67f3701f-febd-4afe-803e-c5d9dbcd1b21")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_STROKE_STYLE_PROPERTIES + public struct D2D1_STROKE_STYLE_PROPERTIES(D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, + D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, + D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN.D2D1_LINE_JOIN_MITER, float miterLimit = 10f, D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE.D2D1_DASH_STYLE_SOLID, + float dashOffset = 0f) { /// /// Type: D2D1_CAP_STYLE /// The cap applied to the start of all the open figures in a stroked geometry. /// - public D2D1_CAP_STYLE startCap; + public D2D1_CAP_STYLE startCap = startCap; /// /// Type: D2D1_CAP_STYLE /// The cap applied to the end of all the open figures in a stroked geometry. /// - public D2D1_CAP_STYLE endCap; + public D2D1_CAP_STYLE endCap = endCap; /// /// Type: D2D1_CAP_STYLE /// The shape at either end of each dash segment. /// - public D2D1_CAP_STYLE dashCap; + public D2D1_CAP_STYLE dashCap = dashCap; /// /// Type: D2D1_LINE_JOIN @@ -1615,7 +1640,7 @@ public struct D2D1_STROKE_STYLE_PROPERTIES /// segment should have a smooth join. /// /// - public D2D1_LINE_JOIN lineJoin; + public D2D1_LINE_JOIN lineJoin = lineJoin; /// /// Type: FLOAT @@ -1624,13 +1649,13 @@ public struct D2D1_STROKE_STYLE_PROPERTIES /// equal to 1.0f. /// /// - public float miterLimit; + public float miterLimit = miterLimit; /// /// Type: D2D1_DASH_STYLE /// A value that specifies whether the stroke has a dash pattern and, if so, the dash style. /// - public D2D1_DASH_STYLE dashStyle; + public D2D1_DASH_STYLE dashStyle = dashStyle; /// /// Type: FLOAT @@ -1640,7 +1665,7 @@ public struct D2D1_STROKE_STYLE_PROPERTIES /// stroke width, toward the end of the stroked geometry. /// /// - public float dashOffset; + public float dashOffset = dashOffset; } /// Contains the three vertices that describe a triangle. @@ -1683,7 +1708,7 @@ public struct DWRITE_GLYPH_RUN /// Type: IDWriteFontFace* /// The physical font face object to draw with. /// - public IntPtr fontFace; + public IUnknownPointer fontFace; /// /// Type: FLOAT @@ -1701,19 +1726,19 @@ public struct DWRITE_GLYPH_RUN /// Type: const UINT16* /// A pointer to an array of indices to render for the glyph run. /// - public IntPtr glyphIndices; + public ArrayPointer glyphIndices; /// /// Type: const FLOAT* /// A pointer to an array containing glyph advance widths for the glyph run. /// - public IntPtr glyphAdvances; + public ArrayPointer glyphAdvances; /// /// Type: const DWRITE_GLYPH_OFFSET* /// A pointer to an array containing glyph offsets for the glyph run. /// - public IntPtr glyphOffsets; + public ArrayPointer glyphOffsets; /// /// Type: BOOL diff --git a/PInvoke/Direct2D/D2d1EffectAuthor.cs b/PInvoke/Direct2D/D2d1EffectAuthor.cs index 5e3484aac..89dc41be2 100644 --- a/PInvoke/Direct2D/D2d1EffectAuthor.cs +++ b/PInvoke/Direct2D/D2d1EffectAuthor.cs @@ -1,4 +1,6 @@ -namespace Vanara.PInvoke; +using System; + +namespace Vanara.PInvoke; public static partial class D2d1 { diff --git a/PInvoke/Direct2D/D2d1_1.cs b/PInvoke/Direct2D/D2d1_1.cs index 74168704b..d61ad1922 100644 --- a/PInvoke/Direct2D/D2d1_1.cs +++ b/PInvoke/Direct2D/D2d1_1.cs @@ -511,61 +511,79 @@ public enum D2D1_PROPERTY_TYPE : uint D2D1_PROPERTY_TYPE_UNKNOWN, /// An arbitrary-length string. + [CorrespondingType(typeof(string))] D2D1_PROPERTY_TYPE_STRING, /// A 32-bit integer value constrained to be either 0 or 1. + [CorrespondingType(typeof(BOOL))] D2D1_PROPERTY_TYPE_BOOL, /// An unsigned 32-bit integer. + [CorrespondingType(typeof(uint))] D2D1_PROPERTY_TYPE_UINT32, /// A signed 32-bit integer. + [CorrespondingType(typeof(int))] D2D1_PROPERTY_TYPE_INT32, /// A 32-bit float. + [CorrespondingType(typeof(float))] D2D1_PROPERTY_TYPE_FLOAT, /// Two 32-bit float values. + [CorrespondingType(typeof(D2D_VECTOR_2F))] D2D1_PROPERTY_TYPE_VECTOR2, /// Three 32-bit float values. + [CorrespondingType(typeof(D2D_VECTOR_3F))] D2D1_PROPERTY_TYPE_VECTOR3, /// Four 32-bit float values. + [CorrespondingType(typeof(D2D_VECTOR_4F))] D2D1_PROPERTY_TYPE_VECTOR4, /// An arbitrary number of bytes. + [CorrespondingType(typeof(IntPtr))] D2D1_PROPERTY_TYPE_BLOB, /// A returned COM or nano-COM interface. + [CorrespondingType(typeof(IntPtr))] D2D1_PROPERTY_TYPE_IUNKNOWN, /// /// An enumeration. The value should be treated as a UINT32 with a defined array of fields to specify the bindings to human-readable strings. /// + [CorrespondingType(typeof(uint))] D2D1_PROPERTY_TYPE_ENUM, /// /// An enumeration. The value is the count of sub-properties in the array. The set of array elements will be contained in the sub-property. /// + [CorrespondingType(typeof(uint))] D2D1_PROPERTY_TYPE_ARRAY, /// A CLSID. + [CorrespondingType(typeof(Guid))] D2D1_PROPERTY_TYPE_CLSID, /// A 3x2 matrix of float values. + [CorrespondingType(typeof(D2D_MATRIX_3X2_F))] D2D1_PROPERTY_TYPE_MATRIX_3X2, /// A 4x2 matrix of float values. + [CorrespondingType(typeof(D2D_MATRIX_4X3_F))] D2D1_PROPERTY_TYPE_MATRIX_4X3, /// A 4x4 matrix of float values. + [CorrespondingType(typeof(D2D_MATRIX_4X4_F))] D2D1_PROPERTY_TYPE_MATRIX_4X4, /// A 5x4 matrix of float values. + [CorrespondingType(typeof(D2D_MATRIX_5X4_F))] D2D1_PROPERTY_TYPE_MATRIX_5X4, /// A nano-COM color context interface pointer. + [CorrespondingType(typeof(IntPtr))] D2D1_PROPERTY_TYPE_COLOR_CONTEXT, } @@ -827,7 +845,7 @@ public interface ID2D1Bitmap1 : ID2D1Bitmap /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrombitmap HRESULT CopyFromBitmap( const // D2D1_POINT_2U *destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect ); - new void CopyFromBitmap([In, Optional] IntPtr destPoint, [In] ID2D1Bitmap bitmap, [In, Optional] IntPtr srcRect); + new void CopyFromBitmap([In, Optional] StructPointer destPoint, [In] ID2D1Bitmap bitmap, [In, Optional] StructPointer srcRect); /// Copies the specified region from the specified render target into the current bitmap. /// @@ -864,7 +882,7 @@ public interface ID2D1Bitmap1 : ID2D1Bitmap /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfromrendertarget HRESULT CopyFromRenderTarget( // const D2D1_POINT_2U *destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect ); - new void CopyFromRenderTarget([In, Optional] IntPtr destPoint, [In] ID2D1RenderTarget renderTarget, [In, Optional] IntPtr srcRect); + new void CopyFromRenderTarget([In, Optional] StructPointer destPoint, [In] ID2D1RenderTarget renderTarget, [In, Optional] StructPointer srcRect); /// Copies the specified region from memory into the current bitmap. /// @@ -907,7 +925,7 @@ public interface ID2D1Bitmap1 : ID2D1Bitmap /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1bitmap-copyfrommemory HRESULT CopyFromMemory( const // D2D1_RECT_U *dstRect, const void *srcData, UINT32 pitch ); - new void CopyFromMemory([In, Optional] IntPtr dstRect, [In] IntPtr srcData, uint pitch); + new void CopyFromMemory([In, Optional] StructPointer dstRect, [In] IntPtr srcData, uint pitch); /// Gets the color context information associated with the bitmap. /// @@ -1670,7 +1688,7 @@ public interface ID2D1CommandSink // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F // *color ); [PreserveSig] - HRESULT Clear([In, Optional] IntPtr color); + HRESULT Clear([In, Optional] StructPointer color); /// Indicates the glyphs to be drawn. /// @@ -1706,7 +1724,7 @@ public interface ID2D1CommandSink // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws a line drawn between two points. /// @@ -1840,7 +1858,7 @@ public interface ID2D1CommandSink // *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F // *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Draws the provided image to the command sink. /// @@ -1879,7 +1897,7 @@ public interface ID2D1CommandSink // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, // D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + HRESULT DrawImage([In] ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -1899,7 +1917,7 @@ public interface ID2D1CommandSink // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); [PreserveSig] - HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Indicates a mesh to be filled by the command sink. /// @@ -1944,7 +1962,7 @@ public interface ID2D1CommandSink // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); [PreserveSig] - HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Indicates to the command sink a geometry to be filled. /// @@ -2237,7 +2255,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -2310,7 +2328,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -2341,7 +2359,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -2359,7 +2377,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -2385,7 +2403,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -2411,7 +2429,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -2436,7 +2454,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -2505,7 +2523,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -2522,7 +2540,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -2861,7 +2879,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -2901,8 +2919,8 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -3391,7 +3409,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -3632,7 +3650,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -3769,7 +3787,7 @@ public interface ID2D1DeviceContext : ID2D1RenderTarget // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -3934,7 +3952,7 @@ ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(Unmanag // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -3956,7 +3974,7 @@ ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(Unmanag // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -4356,7 +4374,7 @@ ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(Unmanag // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -4410,7 +4428,7 @@ ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(Unmanag // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -4425,7 +4443,7 @@ ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(Unmanag // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -4472,7 +4490,7 @@ ID2D1GradientStopCollection1 CreateGradientStopCollection([In, MarshalAs(Unmanag // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// @@ -5320,7 +5338,7 @@ public interface ID2D1Factory1 : ID2D1Factory // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -6273,7 +6291,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getbounds(constd2d1_matrix_3x2_f_d2d1_rect_f) // HRESULT GetBounds( const D2D1_MATRIX_3X2_F *worldTransform, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetBounds([In, Optional] IntPtr worldTransform); + new D2D_RECT_F GetBounds([In, Optional] PD2D_RECT_F? worldTransform); /// /// Gets the bounds of the geometry after it has been widened by the specified stroke width and style and transformed by the @@ -6306,7 +6324,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-getwidenedbounds%28float_id2d1strokestyle_constd2d1_matrix_3x2_f_float_d2d1_rect_f%29 // HRESULT GetWidenedBounds( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, D2D1_RECT_F *bounds ); - new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new D2D_RECT_F GetWidenedBounds(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Determines whether the geometry's stroke contains the specified point given the specified stroke thickness, style, and transform. @@ -6345,7 +6363,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // HRESULT StrokeContainsPoint( D2D1_POINT_2F point, FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F // *worldTransform, FLOAT flatteningTolerance, BOOL *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool StrokeContainsPoint(D2D_POINT_2F point, float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Indicates whether the area filled by the geometry would contain the specified point given the specified flattening tolerance. @@ -6376,7 +6394,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // HRESULT FillContainsPoint( D2D1_POINT_2F point, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, BOOL // *contains ); [return: MarshalAs(UnmanagedType.Bool)] - new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] IntPtr worldTransform, float flatteningTolerance); + new bool FillContainsPoint(D2D_POINT_2F point, [In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Describes the intersection between this geometry and the specified geometry. The comparison is performed by using the specified @@ -6416,7 +6434,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-comparewithgeometry%28id2d1geometry_constd2d1_matrix_3x2_f_float_d2d1_geometry_relation%29 // HRESULT CompareWithGeometry( ID2D1Geometry *inputGeometry, const D2D1_MATRIX_3X2_F *inputGeometryTransform, FLOAT // flatteningTolerance, D2D1_GEOMETRY_RELATION *relation ); - new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance); + new D2D1_GEOMETRY_RELATION CompareWithGeometry([In] ID2D1Geometry inputGeometry, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance); /// /// Creates a simplified version of the geometry that contains only lines and (optionally) cubic Bezier curves and writes the result @@ -6449,7 +6467,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-simplify%28d2d1_geometry_simplification_option_constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Simplify( D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, const D2D1_MATRIX_3X2_F *worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Creates a set of clockwise-wound triangles that cover the geometry after it has been transformed using the specified matrix and @@ -6474,7 +6492,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-tessellate%28constd2d1_matrix_3x2_f_float_id2d1tessellationsink%29 // HRESULT Tessellate( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1TessellationSink // *tessellationSink ); - new void Tessellate([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); + new void Tessellate([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1TessellationSink tessellationSink); /// Combines this geometry with the specified geometry and stores the result in an ID2D1SimplifiedGeometrySink. /// @@ -6504,7 +6522,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-combinewithgeometry(id2d1geometry_d2d1_combine_mode_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT CombineWithGeometry( ID2D1Geometry *inputGeometry, D2D1_COMBINE_MODE combineMode, const D2D1_MATRIX_3X2_F & // inputGeometryTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] IntPtr inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void CombineWithGeometry([In] ID2D1Geometry inputGeometry, D2D1_COMBINE_MODE combineMode, [In, Optional] StructPointer inputGeometryTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Computes the outline of the geometry and writes the result to an ID2D1SimplifiedGeometrySink. /// @@ -6550,7 +6568,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-outline%28constd2d1_matrix_3x2_f_float_id2d1simplifiedgeometrysink%29 // HRESULT Outline( const D2D1_MATRIX_3X2_F *worldTransform, FLOAT flatteningTolerance, ID2D1SimplifiedGeometrySink // *geometrySink ); - new void Outline([In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Outline([In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// /// Computes the area of the geometry after it has been transformed by the specified matrix and flattened using the specified tolerance. @@ -6576,7 +6594,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computearea(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeArea( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *area ); - new float ComputeArea([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeArea([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// Calculates the length of the geometry as though each segment were unrolled into a line. /// @@ -6600,7 +6618,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computelength(constd2d1_matrix_3x2_f__float_float) // HRESULT ComputeLength( const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, FLOAT *length ); - new float ComputeLength([In, Optional] IntPtr worldTransform, float flatteningTolerance); + new float ComputeLength([In, Optional] StructPointer worldTransform, float flatteningTolerance); /// /// Calculates the point and tangent vector at the specified distance along the geometry after it has been transformed by the @@ -6642,7 +6660,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-computepointatlength(float_constd2d1_matrix_3x2_f__float_d2d1_point_2f_d2d1_point_2f) // HRESULT ComputePointAtLength( FLOAT length, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT flatteningTolerance, // D2D1_POINT_2F *point, D2D1_POINT_2F *unitTangentVector ); - new void ComputePointAtLength(float length, [In, Optional] IntPtr worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); + new void ComputePointAtLength(float length, [In, Optional] StructPointer worldTransform, float flatteningTolerance, out D2D_POINT_2F point, out D2D_POINT_2F unitTangentVector); /// /// Widens the geometry by the specified stroke and writes the result to an ID2D1SimplifiedGeometrySink after it has been @@ -6675,7 +6693,7 @@ public interface ID2D1PathGeometry1 : ID2D1PathGeometry // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1geometry-widen(float_id2d1strokestyle_constd2d1_matrix_3x2_f__float_id2d1simplifiedgeometrysink) // HRESULT Widen( FLOAT strokeWidth, ID2D1StrokeStyle *strokeStyle, const D2D1_MATRIX_3X2_F & worldTransform, FLOAT // flatteningTolerance, ID2D1SimplifiedGeometrySink *geometrySink ); - new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] IntPtr worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); + new void Widen(float strokeWidth, [In, Optional] ID2D1StrokeStyle? strokeStyle, [In, Optional] StructPointer worldTransform, float flatteningTolerance, [In] ID2D1SimplifiedGeometrySink geometrySink); /// Retrieves the geometry sink that is used to populate the path geometry with figures and segments. /// @@ -7761,31 +7779,259 @@ public static D2D1_POINT_DESCRIPTION ComputePointAndSegmentAtLength(this ID2D1Pa [PInvokeData("d2d1_1.h", MSDNShortId = "0E305151-63EA-4865-B9C4-5F685D17FD5A")] public static extern float D2D1Vec3Length(float x, float y, float z); + /// Gets the property name that corresponds to the given index. + /// The instance. + /// The index of the property for which the name is being returned. + /// When this method returns, contains the name being retrieved. + /// This method returns an empty string if index is invalid. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getpropertyname(uint32_pwstr_uint32) HRESULT + // GetPropertyName( UINT32 index, PWSTR name, UINT32 nameCount ); + public static string GetPropertyName(this ID2D1Properties props, uint index) + { + var len = props.GetPropertyNameLength(index); + if (len == 0) + return string.Empty; + StringBuilder sb = new((int)len + 1); + props.GetPropertyName(index, sb, (uint)sb.Capacity); + return sb.ToString(); + } + + /// Gets the value of the specified property by index. + /// The type of the data to get. + /// The instance. + /// The index of the property from which the data is to be obtained. + /// TBD + /// When this method returns, contains a pointer to the data requested. + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvalue(uint32_d2d1_property_type_byte_uint32) + // HRESULT GetValue( UINT32 index, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize ); + public static T? GetValue(this ID2D1Properties props, uint index, D2D1_PROPERTY_TYPE type = D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_UNKNOWN) + { + using SafeCoTaskMemHandle mem = new(props.GetValueSize(index)); + if (mem.Size == 0) + return default; + props.GetValue(index, type, mem, (uint)mem.Size); + return mem.ToType(CharSet.Unicode); + } + + /// Gets the property value by name. + /// The type of the data to get. + /// The instance. + /// The property name to get. + /// TBD + /// When this method returns, contains the buffer with the data value. + /// + /// If name does not exist, no information is retrieved. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-getvaluebyname(pcwstr_d2d1_property_type_byte_uint32) + // HRESULT GetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, BYTE *data, UINT32 dataSize ); + public static T? GetValueByName(this ID2D1Properties props, string name, D2D1_PROPERTY_TYPE type = D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_UNKNOWN) => + GetValue(props, props.GetPropertyIndex(name), type); + + /// + /// Sets a bitmap as an effect input, while inserting a DPI compensation effect to preserve visual appearance as the device context's + /// DPI changes. + /// + /// + /// Type: ID2D1DeviceContext* + /// The device context that is the creator of the effect. + /// + /// + /// Type: ID2D1Effect* + /// The function sets the input of this effect. + /// + /// + /// Type: UINT32 + /// The index of the input to be set. + /// + /// + /// Type: ID2D1Bitmap* + /// The input bitmap. + /// + /// + /// Type: D2D1_INTERPOLATION_MODE + /// The interpolation mode for the DPI compensation effect. + /// + /// + /// Type: D2D1_BORDER_MODE + /// The border mode for the DPI compensation effect. + /// + /// + /// Type: HRESULT + /// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. + /// + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1helper/nf-d2d1_1helper-setdpicompensatedeffectinput HRESULT + // SetDpiCompensatedEffectInput( [in] ID2D1DeviceContext *deviceContext, [in] ID2D1Effect *effect, UINT32 inputIndex, [in, optional] + // ID2D1Bitmap *inputBitmap, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_BORDER_MODE borderMode ); + [PInvokeData("d2d1_1helper.h", MSDNShortId = "NF:d2d1_1helper.SetDpiCompensatedEffectInput")] + public static HRESULT SetDpiCompensatedEffectInput([In] ID2D1DeviceContext deviceContext, [In] ID2D1Effect effect, + uint inputIndex, [In, Optional] ID2D1Bitmap? inputBitmap, + D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE.D2D1_INTERPOLATION_MODE_LINEAR, + D2D1_BORDER_MODE borderMode = D2D1_BORDER_MODE.D2D1_BORDER_MODE_HARD) + { + if (inputBitmap is null) + { + effect.SetInput(inputIndex, default); + return HRESULT.S_OK; + } + + try + { + ID2D1Effect dpiCompensationEffect = deviceContext.CreateEffect(CLSID_D2D1DpiCompensation)!; + dpiCompensationEffect.SetInput(0, inputBitmap); + + D2D1_POINT_2F bitmapDpi = new(); + inputBitmap.GetDpi(out bitmapDpi.x, out bitmapDpi.y); + dpiCompensationEffect.SetValue(D2D1_DPICOMPENSATION_PROP.D2D1_DPICOMPENSATION_PROP_INPUT_DPI, bitmapDpi); + + dpiCompensationEffect.SetValue(D2D1_DPICOMPENSATION_PROP.D2D1_DPICOMPENSATION_PROP_INTERPOLATION_MODE, interpolationMode); + + dpiCompensationEffect.SetValue(D2D1_DPICOMPENSATION_PROP.D2D1_DPICOMPENSATION_PROP_BORDER_MODE, borderMode); + + effect.SetInputEffect(inputIndex, dpiCompensationEffect); + + Marshal.ReleaseComObject(dpiCompensationEffect); + + return HRESULT.S_OK; + } + catch (Exception ex) + { + return ex.HResult; + } + } + + /// + /// Sets the given input effect by index. + /// This method gets the output of the given effect and then passes the output image to the SetInput method. + /// + /// The instance. + /// The index of the input to set. + /// The input effect to set. + /// Whether to invalidate the graph at the location of the effect input + /// None + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1effect-setinputeffect void SetInputEffect( UINT32 index, + // [in, optional] ID2D1Effect *inputEffect, BOOL invalidate ); + [PInvokeData("d2d1_1.h", MSDNShortId = "NF:d2d1_1.ID2D1Effect.SetInputEffect")] + public static void SetInputEffect(this ID2D1Effect effect, uint index, ID2D1Effect? inputEffect = null, bool invalidate = true) + { + ID2D1Image? output = null; + inputEffect?.GetOutput(out output); + effect.SetInput(index, output, invalidate); + if (output is not null) + Marshal.ReleaseComObject(output); + } + + /// Sets the corresponding property by index. + /// The type of the data to set. + /// The index type. + /// The instance. + /// The index of the property to set. + /// TBD + /// The data to set. + /// + /// If the property does not exist, the request is ignored and D2DERR_INVALID_PROPERTY is returned. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32) + // HRESULT SetValue( UINT32 index, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + public static void SetValue(this ID2D1Properties props, TE index, D2D1_PROPERTY_TYPE type, in T data) where T : struct where TE : struct, IConvertible + { + using var mem = SafeCoTaskMemHandle.CreateFromStructure(data); + props.SetValue(index.ToUInt32(null), type, mem, (uint)mem.Size); + } + + /// Sets the corresponding property by index. + /// The type of the data to set. + /// The index type. + /// The instance. + /// The index of the property to set. + /// The data to set. + /// + /// If the property does not exist, the request is ignored and D2DERR_INVALID_PROPERTY is returned. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32) + // HRESULT SetValue( UINT32 index, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + public static void SetValue(this ID2D1Properties props, TE index, in T data) where T : struct where TE : struct, IConvertible => + SetValue(props, index, D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_UNKNOWN, data); + + /// Sets the corresponding property by index. + /// The instance. + /// The index of the property to set. + /// The data to set. + /// + /// If the property does not exist, the request is ignored and D2DERR_INVALID_PROPERTY is returned. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvalue(uint32_d2d1_property_type_constbyte_uint32) + // HRESULT SetValue( UINT32 index, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + public static void SetValue(this ID2D1Properties props, uint index, string data) + { + using SafeLPWSTR mem = new(data); + props.SetValue(index, D2D1_PROPERTY_TYPE.D2D1_PROPERTY_TYPE_STRING, mem, (uint)mem.Size); + } + + /// Sets the named property to the given value. + /// The type of the data to set. + /// The instance. + /// The name of the property to set. + /// TBD + /// The data to set. + /// + /// If the property does not exist, the request is ignored and the method returns D2DERR_INVALID_PROPERTY. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvaluebyname%28pcwstr_d2d1_property_type_constbyte_uint32%29 + // HRESULT SetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + public static void SetValueByName(this ID2D1Properties props, string name, D2D1_PROPERTY_TYPE type, in T data) where T : struct + { + using var mem = SafeCoTaskMemHandle.CreateFromStructure(data); + props.SetValueByName(name, type, mem, (uint)mem.Size); + } + + /// Sets the named property to the given value. + /// The instance. + /// The name of the property to set. + /// TBD + /// The data to set. + /// + /// If the property does not exist, the request is ignored and the method returns D2DERR_INVALID_PROPERTY. + /// Any error not in the standard set returned by a property implementation will be mapped into the standard error range. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1properties-setvaluebyname%28pcwstr_d2d1_property_type_constbyte_uint32%29 + // HRESULT SetValueByName( PCWSTR name, D2D1_PROPERTY_TYPE type, const BYTE *data, UINT32 dataSize ); + public static void SetValueByName(this ID2D1Properties props, string name, D2D1_PROPERTY_TYPE type, string data) + { + using SafeLPWSTR mem = new(data); + props.SetValueByName(name, type, mem, (uint)mem.Size); + } + /// Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush. // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_bitmap_brush_properties1 typedef struct // D2D1_BITMAP_BRUSH_PROPERTIES1 { D2D1_EXTEND_MODE extendModeX; D2D1_EXTEND_MODE extendModeY; D2D1_INTERPOLATION_MODE // interpolationMode; } D2D1_BITMAP_BRUSH_PROPERTIES1; [PInvokeData("d2d1_1.h", MSDNShortId = "NS:d2d1_1.D2D1_BITMAP_BRUSH_PROPERTIES1")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_BITMAP_BRUSH_PROPERTIES1 + public struct D2D1_BITMAP_BRUSH_PROPERTIES1(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) { /// /// Type: D2D1_EXTEND_MODE /// A value that describes how the brush horizontally tiles those areas that extend past its bitmap. /// - public D2D1_EXTEND_MODE extendModeX; + public D2D1_EXTEND_MODE extendModeX = extendModeX; /// /// Type: D2D1_EXTEND_MODE /// A value that describes how the brush vertically tiles those areas that extend past its bitmap. /// - public D2D1_EXTEND_MODE extendModeY; + public D2D1_EXTEND_MODE extendModeY = extendModeY; /// /// Type: D2D1_INTERPOLATION_MODE /// A value that specifies how the bitmap is interpolated when it is scaled or rotated. /// - public D2D1_INTERPOLATION_MODE interpolationMode; + public D2D1_INTERPOLATION_MODE interpolationMode = interpolationMode; } /// This structure allows a ID2D1Bitmap1 to be created with bitmap options and color context information available. @@ -7797,37 +8043,38 @@ public struct D2D1_BITMAP_BRUSH_PROPERTIES1 // D2D1_PIXEL_FORMAT pixelFormat; FLOAT dpiX; FLOAT dpiY; D2D1_BITMAP_OPTIONS bitmapOptions; ID2D1ColorContext *colorContext; } D2D1_BITMAP_PROPERTIES1; [PInvokeData("d2d1_1.h", MSDNShortId = "c9371ce3-f6fc-4fe6-ada6-0aa64a8f29a2")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_BITMAP_PROPERTIES1 + public struct D2D1_BITMAP_PROPERTIES1(D2D1_BITMAP_OPTIONS bitmapOptions = D2D1_BITMAP_OPTIONS.D2D1_BITMAP_OPTIONS_NONE, + in D2D1_PIXEL_FORMAT pixelFormat = default, float dpiX = 96f, float dpiY = 96f, ID2D1ColorContext? colorContext = null) { /// /// Type: D2D1_PIXEL_FORMAT /// The DXGI format and alpha mode to create the bitmap with. /// - public D2D1_PIXEL_FORMAT pixelFormat; + public D2D1_PIXEL_FORMAT pixelFormat = pixelFormat; /// /// Type: FLOAT /// The bitmap dpi in the x direction. /// - public float dpiX; + public float dpiX = dpiX; /// /// Type: FLOAT /// The bitmap dpi in the y direction. /// - public float dpiY; + public float dpiY = dpiY; /// /// Type: D2D1_BITMAP_OPTIONS /// The special creation options of the bitmap. /// - public D2D1_BITMAP_OPTIONS bitmapOptions; + public D2D1_BITMAP_OPTIONS bitmapOptions = bitmapOptions; /// /// Type: ID2D1ColorContext* /// The optionally specified color context information. /// - public IntPtr colorContext; + public IUnknownPointer colorContext = new(colorContext); } /// Specifies the options with which the Direct2D device, factory, and device context are created. @@ -7854,49 +8101,59 @@ public struct D2D1_CREATION_PROPERTIES // D2D1_TAG tag2; D2D1_MATRIX_3X2_F transform; D2D1_PRIMITIVE_BLEND primitiveBlend; D2D1_UNIT_MODE unitMode; } D2D1_DRAWING_STATE_DESCRIPTION1; [PInvokeData("d2d1_1.h", MSDNShortId = "NS:d2d1_1.D2D1_DRAWING_STATE_DESCRIPTION1")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_DRAWING_STATE_DESCRIPTION1 + public struct D2D1_DRAWING_STATE_DESCRIPTION1(D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE.D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, D2D1_TAG tag1 = 0, D2D1_TAG tag2 = 0, + in D2D_MATRIX_3X2_F? transform = null, D2D1_PRIMITIVE_BLEND primitiveBlend = D2D1_PRIMITIVE_BLEND.D2D1_PRIMITIVE_BLEND_SOURCE_OVER, + D2D1_UNIT_MODE unitMode = D2D1_UNIT_MODE.D2D1_UNIT_MODE_DIPS) { /// /// Type: D2D1_ANTIALIAS_MODE /// The antialiasing mode for subsequent nontext drawing operations. /// - public D2D1_ANTIALIAS_MODE antialiasMode; + public D2D1_ANTIALIAS_MODE antialiasMode = antialiasMode; /// /// Type: D2D1_TEXT_ANTIALIAS_MODE /// The antialiasing mode for subsequent text and glyph drawing operations. /// - public D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; + public D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = textAntialiasMode; /// /// Type: D2D1_TAG /// A label for subsequent drawing operations. /// - public D2D1_TAG tag1; + public D2D1_TAG tag1 = tag1; /// /// Type: D2D1_TAG /// A label for subsequent drawing operations. /// - public D2D1_TAG tag2; + public D2D1_TAG tag2 = tag2; /// /// Type: D2D1_MATRIX_3X2_F /// The transformation to apply to subsequent drawing operations. /// - public D2D_MATRIX_3X2_F transform; + public D2D_MATRIX_3X2_F transform = transform.GetValueOrDefault(D2D_MATRIX_3X2_F.Identity()); /// /// Type: D2D1_PRIMITIVE_BLEND /// The blend mode for the device context to apply to subsequent drawing operations. /// - public D2D1_PRIMITIVE_BLEND primitiveBlend; + public D2D1_PRIMITIVE_BLEND primitiveBlend = primitiveBlend; /// /// Type: D2D1_UNIT_MODE /// D2D1_UNIT_MODE /// - public D2D1_UNIT_MODE unitMode; + public D2D1_UNIT_MODE unitMode = unitMode; + + /// Initializes a new instance of the struct. + /// The D2D1_DRAWING_STATE_DESCRIPTION value. + /// The primitive blend. + /// The unit mode. + public D2D1_DRAWING_STATE_DESCRIPTION1(in 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) { } } /// Describes features of an effect. @@ -7928,31 +8185,32 @@ public struct D2D1_EFFECT_INPUT_DESCRIPTION // D2D1_INTERPOLATION_MODE interpolationMode; } D2D1_IMAGE_BRUSH_PROPERTIES; [PInvokeData("d2d1_1.h", MSDNShortId = "c7bcae4d-cdef-4bfc-aa5a-68b85497a7f6")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_IMAGE_BRUSH_PROPERTIES + public struct D2D1_IMAGE_BRUSH_PROPERTIES(in 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) { /// /// Type: D2D1_RECT_F /// The source rectangle in the image space from which the image will be tiled or interpolated. /// - public D2D_RECT_F sourceRectangle; + public D2D_RECT_F sourceRectangle = sourceRectangle; /// /// Type: D2D1_EXTEND_MODE /// The extend mode in the image x-axis. /// - public D2D1_EXTEND_MODE extendModeX; + public D2D1_EXTEND_MODE extendModeX = extendModeX; /// /// Type: D2D1_EXTEND_MODE /// The extend mode in the image y-axis. /// - public D2D1_EXTEND_MODE extendModeY; + public D2D1_EXTEND_MODE extendModeY = extendModeY; /// /// Type: D2D1_INTERPOLATION_MODE /// The interpolation mode to use when scaling the image brush. /// - public D2D1_INTERPOLATION_MODE interpolationMode; + public D2D1_INTERPOLATION_MODE interpolationMode = interpolationMode; } /// Contains the content bounds, mask information, opacity settings, and other options for a layer resource. @@ -7961,37 +8219,39 @@ public struct D2D1_IMAGE_BRUSH_PROPERTIES // FLOAT opacity; ID2D1Brush *opacityBrush; D2D1_LAYER_OPTIONS1 layerOptions; } D2D1_LAYER_PARAMETERS1; [PInvokeData("d2d1_1.h", MSDNShortId = "D7CC93F8-D871-4DFC-84A3-CA60EB52FF0A")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_LAYER_PARAMETERS1 + public struct D2D1_LAYER_PARAMETERS1(in D2D_RECT_F? contentBounds = null, ID2D1Geometry? geometricMask = null, + D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE.D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, in D2D_MATRIX_3X2_F? maskTransform = null, + float opacity = 1f, ID2D1Brush? opacityBrush = null, D2D1_LAYER_OPTIONS1 layerOptions = D2D1_LAYER_OPTIONS1.D2D1_LAYER_OPTIONS1_NONE) { /// /// Type: D2D1_RECT_F /// The content bounds of the layer. Content outside these bounds is not guaranteed to render. /// - public D2D_RECT_F contentBounds; + public D2D_RECT_F contentBounds = contentBounds.GetValueOrDefault(D2D_RECT_F.Infinite); /// /// Type: ID2D1Geometry* /// The geometric mask specifies the area of the layer that is composited into the render target. /// - public IntPtr geometricMask; + public IUnknownPointer geometricMask = new(geometricMask); /// /// Type: D2D1_ANTIALIAS_MODE /// A value that specifies the antialiasing mode for the geometricMask. /// - public D2D1_ANTIALIAS_MODE maskAntialiasMode; + public D2D1_ANTIALIAS_MODE maskAntialiasMode = maskAntialiasMode; /// /// Type: D2D1_MATRIX_3X2_F /// A value that specifies the transform that is applied to the geometric mask when composing the layer. /// - public D2D_MATRIX_3X2_F maskTransform; + public D2D_MATRIX_3X2_F maskTransform = maskTransform.GetValueOrDefault(D2D_MATRIX_3X2_F.Identity()); /// /// Type: FLOAT /// An opacity value that is applied uniformly to all resources in the layer when compositing to the target. /// - public float opacity; + public float opacity = opacity; /// /// Type: ID2D1Brush* @@ -8000,13 +8260,13 @@ public struct D2D1_LAYER_PARAMETERS1 /// brush pixel is multiplied against the corresponding layer pixel. /// /// - public IntPtr opacityBrush; + public IUnknownPointer opacityBrush = new(opacityBrush); /// /// Type: D2D1_LAYER_OPTIONS1 /// Additional options for the layer creation. /// - public D2D1_LAYER_OPTIONS1 layerOptions; + public D2D1_LAYER_OPTIONS1 layerOptions = layerOptions; } /// Describes mapped memory from the ID2D1Bitmap1::Map API. @@ -8050,29 +8310,31 @@ public struct D2D1_POINT_DESCRIPTION } /// The creation properties for a ID2D1PrintControl object. + /// Initializes a new instance of the struct. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/ns-d2d1_1-d2d1_print_control_properties typedef struct // D2D1_PRINT_CONTROL_PROPERTIES { D2D1_PRINT_FONT_SUBSET_MODE fontSubset; FLOAT rasterDPI; D2D1_COLOR_SPACE colorSpace; } D2D1_PRINT_CONTROL_PROPERTIES; [PInvokeData("d2d1_1.h", MSDNShortId = "5A4D4DDC-4161-44A2-9EB6-E4C14696B810")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_PRINT_CONTROL_PROPERTIES + public struct D2D1_PRINT_CONTROL_PROPERTIES(D2D1_PRINT_FONT_SUBSET_MODE fontSubset = D2D1_PRINT_FONT_SUBSET_MODE.D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT, + float rasterDPI = 150f, D2D1_COLOR_SPACE colorSpace = D2D1_COLOR_SPACE.D2D1_COLOR_SPACE_SRGB) { /// /// Type: D2D1_PRINT_FONT_SUBSET_MODE /// The mode to use for subsetting fonts for printing, defaults to D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT. /// - public D2D1_PRINT_FONT_SUBSET_MODE fontSubset; + public D2D1_PRINT_FONT_SUBSET_MODE fontSubset = fontSubset; /// /// Type: FLOAT /// DPI for rasterization of all unsupported Direct2D commands or options, defaults to 150.0. /// - public float rasterDPI; + public float rasterDPI = rasterDPI; /// /// Type: D2D1_COLOR_SPACE /// Color space for vector graphics, defaults to D2D1_COLOR_SPACE_SRGB. /// - public D2D1_COLOR_SPACE colorSpace; + public D2D1_COLOR_SPACE colorSpace = colorSpace; } /// Describes limitations to be applied to an imaging effect renderer. @@ -8158,54 +8420,59 @@ public struct D2D1_RESOURCE_USAGE // FLOAT miterLimit; D2D1_DASH_STYLE dashStyle; FLOAT dashOffset; D2D1_STROKE_TRANSFORM_TYPE transformType; } D2D1_STROKE_STYLE_PROPERTIES1; [PInvokeData("d2d1_1.h", MSDNShortId = "NS:d2d1_1.D2D1_STROKE_STYLE_PROPERTIES1")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_STROKE_STYLE_PROPERTIES1 + public struct D2D1_STROKE_STYLE_PROPERTIES1(D2d1.D2D1_CAP_STYLE startCap = D2d1.D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, + D2d1.D2D1_CAP_STYLE endCap = D2d1.D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, + D2d1.D2D1_CAP_STYLE dashCap = D2d1.D2D1_CAP_STYLE.D2D1_CAP_STYLE_FLAT, + D2d1.D2D1_LINE_JOIN lineJoin = D2d1.D2D1_LINE_JOIN.D2D1_LINE_JOIN_MITER, float miterLimit = 10f, + D2d1.D2D1_DASH_STYLE dashStyle = D2d1.D2D1_DASH_STYLE.D2D1_DASH_STYLE_SOLID, float dashOffset = 0f, + D2d1.D2D1_STROKE_TRANSFORM_TYPE transformType = D2d1.D2D1_STROKE_TRANSFORM_TYPE.D2D1_STROKE_TRANSFORM_TYPE_NORMAL) { /// /// Type: D2D1_CAP_STYLE /// The cap to use at the start of each open figure. /// - public D2D1_CAP_STYLE startCap; + public D2D1_CAP_STYLE startCap = startCap; /// /// Type: D2D1_CAP_STYLE /// The cap to use at the end of each open figure. /// - public D2D1_CAP_STYLE endCap; + public D2D1_CAP_STYLE endCap = endCap; /// /// Type: D2D1_CAP_STYLE /// The cap to use at the start and end of each dash. /// - public D2D1_CAP_STYLE dashCap; + public D2D1_CAP_STYLE dashCap = dashCap; /// /// Type: D2D1_LINE_JOIN /// The line join to use. /// - public D2D1_LINE_JOIN lineJoin; + public D2D1_LINE_JOIN lineJoin = lineJoin; /// /// Type: FLOAT /// The limit beyond which miters are either clamped or converted to bevels. /// - public float miterLimit; + public float miterLimit = miterLimit; /// /// Type: D2D1_DASH_STYLE /// The type of dash to use. /// - public D2D1_DASH_STYLE dashStyle; + public D2D1_DASH_STYLE dashStyle = dashStyle; /// /// Type: FLOAT /// The location of the first dash, relative to the start of the figure. /// - public float dashOffset; + public float dashOffset = dashOffset; /// /// Type: D2D1_STROKE_TRANSFORM_TYPE /// The rule that determines what render target properties affect the nib of the stroke. /// - public D2D1_STROKE_TRANSFORM_TYPE transformType; + public D2D1_STROKE_TRANSFORM_TYPE transformType = transformType; } } \ No newline at end of file diff --git a/PInvoke/Direct2D/D2d1_2.cs b/PInvoke/Direct2D/D2d1_2.cs index 52c0e4444..3b63e034a 100644 --- a/PInvoke/Direct2D/D2d1_2.cs +++ b/PInvoke/Direct2D/D2d1_2.cs @@ -1,4 +1,6 @@ -namespace Vanara.PInvoke; +using System.Drawing; + +namespace Vanara.PInvoke; public static partial class D2d1 { @@ -188,7 +190,7 @@ public interface ID2D1CommandSink1 : ID2D1CommandSink // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F // *color ); [PreserveSig] - new HRESULT Clear([In, Optional] IntPtr color); + new HRESULT Clear([In, Optional] StructPointer color); /// Indicates the glyphs to be drawn. /// @@ -224,7 +226,7 @@ public interface ID2D1CommandSink1 : ID2D1CommandSink // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws a line drawn between two points. /// @@ -358,7 +360,7 @@ public interface ID2D1CommandSink1 : ID2D1CommandSink // *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F // *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Draws the provided image to the command sink. /// @@ -397,7 +399,7 @@ public interface ID2D1CommandSink1 : ID2D1CommandSink // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, // D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -417,7 +419,7 @@ public interface ID2D1CommandSink1 : ID2D1CommandSink // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); [PreserveSig] - new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Indicates a mesh to be filled by the command sink. /// @@ -462,7 +464,7 @@ public interface ID2D1CommandSink1 : ID2D1CommandSink // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); [PreserveSig] - new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Indicates to the command sink a geometry to be filled. /// @@ -884,7 +886,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -957,7 +959,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -988,7 +990,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -1006,7 +1008,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -1032,7 +1034,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -1058,7 +1060,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -1083,7 +1085,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -1152,7 +1154,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -1169,7 +1171,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -1508,7 +1510,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -1548,8 +1550,8 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -2038,7 +2040,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -2279,7 +2281,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -2416,7 +2418,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -2581,7 +2583,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -2603,7 +2605,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -3003,7 +3005,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -3057,7 +3059,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -3072,7 +3074,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -3119,7 +3121,7 @@ public interface ID2D1DeviceContext1 : ID2D1DeviceContext // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// @@ -3559,7 +3561,7 @@ public interface ID2D1Factory2 : ID2D1Factory1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -4023,6 +4025,54 @@ public interface ID2D1GeometryRealization : ID2D1Resource new void GetFactory(out ID2D1Factory factory); } + /// Computes the appropriate flattening tolerance to pass to APIs that take a flattening tolerance (for instance, ID2D1DeviceContext1::CreateFilledGeometryRealization). + /// [in, ref] The matrix that will be applied subsequently to the geometry being flattened. + /// + /// Default: 96.0f + /// The horizontal DPI of the render target that the geometry will be rendered onto (a choice of 96 implies no DPI correction). + /// + /// + /// Default: 96.0f + /// The vertical DPI of the render target that the geometry will be rendered onto (a choice of 96 implies no DPI correction). + /// + /// + /// Default: 1.0f + /// + /// The maximum amount of additional scaling (on top of any scaling implied by the matrix or the DPI) that will be applied to the geometry. + /// + /// + /// The flattening tolerance. + /// + /// + /// Flattening tolerances affect how finely curved segments such as arcs and Beziers will be tessellated. When rendering a geometry + /// realization or the output of a geometry operation with the identity transform, the default flattening tolerance + /// (D2D1_DEFAULT_FLATTENING_TOLERANCE) is appropriate. Using the default tolerance with a large scale transform, however, can cause + /// visible faceting. To guard against this, callers should use ComputeFlatteningTolerance and pass in the expected transform + /// that the content will be rendered with and the DPI of the render target the content will be rendered onto. + /// + /// + /// Note   The DPI is used only to infer the corresponding scale transform. No attempt is made to validate dpi values (e.g. + /// ensure they are positive). + /// + /// + /// + /// In some scenarios content may be dynamically resized. In this case, the caller may wish to realize the geometry at a higher zoom + /// level than is currently required. This can be achieved by passing in a maxZoomFactor equal to or greater than the maximum scale the + /// geometry will be rendered at. Note that the maxZoomFactor is appended to any scale that may be present in the matrix parameter. + /// + /// + // https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/dn280327(v=vs.85) + // FLOAT ComputeFlatteningTolerance(_In_ const D2D1_MATRIX_3X2_F &matrix, FLOAT dpiX, FLOAT dpiY, FLOAT maxZoomFactor ); + [PInvokeData("D2d1_1.h")] + public static float ComputeFlatteningTolerance(in D2D1_MATRIX_3X2_F matrix, float dpiX = 96.0f, float dpiY = 96.0f, float maxZoomFactor = 1.0f) + { + D2D1_MATRIX_3X2_F dpiDependentTransform = D2D1_MATRIX_3X2_F.Scale(dpiX / 96.0f, dpiY / 96.0f); + + float absMaxZoomFactor = (maxZoomFactor > 0) ? maxZoomFactor : -maxZoomFactor; + + return D2D1_DEFAULT_FLATTENING_TOLERANCE / (absMaxZoomFactor * D2D1ComputeMaximumScaleFactor(dpiDependentTransform)); + } + /// Computes the maximum factor by which a given transform can stretch any vector. /// The input transform matrix. /// The scale factor. diff --git a/PInvoke/Direct2D/D2d1_3.Interfaces1.cs b/PInvoke/Direct2D/D2d1_3.Interfaces1.cs index a56ece626..dcfb8d981 100644 --- a/PInvoke/Direct2D/D2d1_3.Interfaces1.cs +++ b/PInvoke/Direct2D/D2d1_3.Interfaces1.cs @@ -265,7 +265,7 @@ public interface ID2D1CommandSink2 : ID2D1CommandSink1 // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F // *color ); [PreserveSig] - new HRESULT Clear([In, Optional] IntPtr color); + new HRESULT Clear([In, Optional] StructPointer color); /// Indicates the glyphs to be drawn. /// @@ -301,7 +301,7 @@ public interface ID2D1CommandSink2 : ID2D1CommandSink1 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws a line drawn between two points. /// @@ -435,7 +435,7 @@ public interface ID2D1CommandSink2 : ID2D1CommandSink1 // *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F // *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Draws the provided image to the command sink. /// @@ -474,7 +474,7 @@ public interface ID2D1CommandSink2 : ID2D1CommandSink1 // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, // D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -494,7 +494,7 @@ public interface ID2D1CommandSink2 : ID2D1CommandSink1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); [PreserveSig] - new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Indicates a mesh to be filled by the command sink. /// @@ -539,7 +539,7 @@ public interface ID2D1CommandSink2 : ID2D1CommandSink1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); [PreserveSig] - new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Indicates to the command sink a geometry to be filled. /// @@ -950,7 +950,7 @@ public interface ID2D1CommandSink3 : ID2D1CommandSink2 // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F // *color ); [PreserveSig] - new HRESULT Clear([In, Optional] IntPtr color); + new HRESULT Clear([In, Optional] StructPointer color); /// Indicates the glyphs to be drawn. /// @@ -986,7 +986,7 @@ public interface ID2D1CommandSink3 : ID2D1CommandSink2 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws a line drawn between two points. /// @@ -1120,7 +1120,7 @@ public interface ID2D1CommandSink3 : ID2D1CommandSink2 // *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F // *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Draws the provided image to the command sink. /// @@ -1159,7 +1159,7 @@ public interface ID2D1CommandSink3 : ID2D1CommandSink2 // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, // D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -1179,7 +1179,7 @@ public interface ID2D1CommandSink3 : ID2D1CommandSink2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); [PreserveSig] - new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Indicates a mesh to be filled by the command sink. /// @@ -1224,7 +1224,7 @@ public interface ID2D1CommandSink3 : ID2D1CommandSink2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); [PreserveSig] - new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Indicates to the command sink a geometry to be filled. /// @@ -1669,7 +1669,7 @@ public interface ID2D1CommandSink4 : ID2D1CommandSink3 // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F // *color ); [PreserveSig] - new HRESULT Clear([In, Optional] IntPtr color); + new HRESULT Clear([In, Optional] StructPointer color); /// Indicates the glyphs to be drawn. /// @@ -1705,7 +1705,7 @@ public interface ID2D1CommandSink4 : ID2D1CommandSink3 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws a line drawn between two points. /// @@ -1839,7 +1839,7 @@ public interface ID2D1CommandSink4 : ID2D1CommandSink3 // *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F // *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Draws the provided image to the command sink. /// @@ -1878,7 +1878,7 @@ public interface ID2D1CommandSink4 : ID2D1CommandSink3 // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, // D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -1898,7 +1898,7 @@ public interface ID2D1CommandSink4 : ID2D1CommandSink3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); [PreserveSig] - new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Indicates a mesh to be filled by the command sink. /// @@ -1943,7 +1943,7 @@ public interface ID2D1CommandSink4 : ID2D1CommandSink3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); [PreserveSig] - new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Indicates to the command sink a geometry to be filled. /// @@ -2401,7 +2401,7 @@ public interface ID2D1CommandSink5 : ID2D1CommandSink4 // https://docs.microsoft.com/ja-jp/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-clear HRESULT Clear( const D2D1_COLOR_F // *color ); [PreserveSig] - new HRESULT Clear([In, Optional] IntPtr color); + new HRESULT Clear([In, Optional] StructPointer color); /// Indicates the glyphs to be drawn. /// @@ -2437,7 +2437,7 @@ public interface ID2D1CommandSink5 : ID2D1CommandSink4 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new HRESULT DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, [In] ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws a line drawn between two points. /// @@ -2571,7 +2571,7 @@ public interface ID2D1CommandSink5 : ID2D1CommandSink4 // *bitmap, const D2D1_RECT_F *destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE interpolationMode, const D2D1_RECT_F // *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new HRESULT DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Draws the provided image to the command sink. /// @@ -2610,7 +2610,7 @@ public interface ID2D1CommandSink5 : ID2D1CommandSink4 // *image, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, // D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new HRESULT DrawImage([In] ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -2630,7 +2630,7 @@ public interface ID2D1CommandSink5 : ID2D1CommandSink4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-drawgdimetafile HRESULT DrawGdiMetafile( // ID2D1GdiMetafile *gdiMetafile, const D2D1_POINT_2F *targetOffset ); [PreserveSig] - new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new HRESULT DrawGdiMetafile([In] ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Indicates a mesh to be filled by the command sink. /// @@ -2675,7 +2675,7 @@ public interface ID2D1CommandSink5 : ID2D1CommandSink4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1commandsink-fillopacitymask HRESULT FillOpacityMask( // ID2D1Bitmap *opacityMask, ID2D1Brush *brush, const D2D1_RECT_F *destinationRectangle, const D2D1_RECT_F *sourceRectangle ); [PreserveSig] - new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new HRESULT FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Indicates to the command sink a geometry to be filled. /// @@ -4504,7 +4504,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -4577,7 +4577,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -4608,7 +4608,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -4626,7 +4626,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -4652,7 +4652,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -4678,7 +4678,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -4703,7 +4703,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -4772,7 +4772,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -4789,7 +4789,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -5128,7 +5128,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -5168,8 +5168,8 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -5658,7 +5658,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -5899,7 +5899,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -6036,7 +6036,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -6201,7 +6201,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -6223,7 +6223,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -6623,7 +6623,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -6677,7 +6677,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -6692,7 +6692,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -6739,7 +6739,7 @@ public interface ID2D1DeviceContext2 : ID2D1DeviceContext1 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// @@ -7364,7 +7364,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -7437,7 +7437,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -7468,7 +7468,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -7486,7 +7486,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -7512,7 +7512,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -7538,7 +7538,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -7563,7 +7563,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -7632,7 +7632,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -7649,7 +7649,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -7988,7 +7988,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -8028,8 +8028,8 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -8518,7 +8518,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -8759,7 +8759,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -8896,7 +8896,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -9061,7 +9061,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -9083,7 +9083,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -9483,7 +9483,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -9537,7 +9537,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -9552,7 +9552,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -9599,7 +9599,7 @@ public interface ID2D1DeviceContext3 : ID2D1DeviceContext2 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// diff --git a/PInvoke/Direct2D/D2d1_3.Interfaces2.cs b/PInvoke/Direct2D/D2d1_3.Interfaces2.cs index f1cc2fcf9..5a77e8db1 100644 --- a/PInvoke/Direct2D/D2d1_3.Interfaces2.cs +++ b/PInvoke/Direct2D/D2d1_3.Interfaces2.cs @@ -77,7 +77,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -150,7 +150,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -181,7 +181,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -199,7 +199,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -225,7 +225,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -251,7 +251,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -276,7 +276,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -345,7 +345,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -362,7 +362,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -701,7 +701,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -741,8 +741,8 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -1231,7 +1231,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -1472,7 +1472,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -1609,7 +1609,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -1774,7 +1774,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -1796,7 +1796,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -2196,7 +2196,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -2250,7 +2250,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -2265,7 +2265,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -2312,7 +2312,7 @@ public interface ID2D1DeviceContext4 : ID2D1DeviceContext3 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// @@ -3312,7 +3312,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -3385,7 +3385,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -3416,7 +3416,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -3434,7 +3434,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -3460,7 +3460,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -3486,7 +3486,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -3511,7 +3511,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -3580,7 +3580,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -3597,7 +3597,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -3936,7 +3936,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -3976,8 +3976,8 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -4466,7 +4466,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -4707,7 +4707,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -4844,7 +4844,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -5009,7 +5009,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -5031,7 +5031,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -5431,7 +5431,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -5485,7 +5485,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -5500,7 +5500,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -5547,7 +5547,7 @@ public interface ID2D1DeviceContext5 : ID2D1DeviceContext4 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// @@ -6605,7 +6605,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -6678,7 +6678,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -6709,7 +6709,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -6727,7 +6727,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -6753,7 +6753,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -6779,7 +6779,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -6804,7 +6804,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -6873,7 +6873,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -6890,7 +6890,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -7229,7 +7229,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -7269,8 +7269,8 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -7759,7 +7759,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -8000,7 +8000,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -8137,7 +8137,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -8302,7 +8302,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -8324,7 +8324,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -8724,7 +8724,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -8778,7 +8778,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -8793,7 +8793,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -8840,7 +8840,7 @@ public interface ID2D1DeviceContext6 : ID2D1DeviceContext5 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// diff --git a/PInvoke/Direct2D/D2d1_3.Interfaces3.cs b/PInvoke/Direct2D/D2d1_3.Interfaces3.cs index 1d4f70853..ef411d186 100644 --- a/PInvoke/Direct2D/D2d1_3.Interfaces3.cs +++ b/PInvoke/Direct2D/D2d1_3.Interfaces3.cs @@ -80,7 +80,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapfromwicbitmap(iwicbitmapsource_constd2d1_bitmap_properties_id2d1bitmap) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap // **bitmap ); - new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateBitmapFromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1Bitmap whose data is shared with another resource. /// @@ -153,7 +153,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsharedbitmap HRESULT CreateSharedBitmap( // REFIID riid, void *data, const D2D1_BITMAP_PROPERTIES *bitmapProperties, ID2D1Bitmap **bitmap ); - new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out] IntPtr data, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap CreateSharedBitmap(in Guid riid, [In, Out, MarshalAs(UnmanagedType.IUnknown, IidParameterIndex = 0)] object data, [In, Optional] StructPointer bitmapProperties); /// Creates an ID2D1BitmapBrush from the specified bitmap. /// @@ -184,7 +184,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createbitmapbrush(id2d1bitmap_constd2d1_bitmap_brush_properties_constd2d1_brush_properties_id2d1bitmapbrush) // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush **bitmapBrush ); - new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush CreateBitmapBrush([In, Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a new ID2D1SolidColorBrush that has the specified color and opacity. /// @@ -202,7 +202,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createsolidcolorbrush(constd2d1_color_f__constd2d1_brush_properties__id2d1solidcolorbrush) // HRESULT CreateSolidColorBrush( const D2D1_COLOR_F & color, const D2D1_BRUSH_PROPERTIES & brushProperties, // ID2D1SolidColorBrush **solidColorBrush ); - new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] IntPtr brushProperties); + new ID2D1SolidColorBrush CreateSolidColorBrush(in D3DCOLORVALUE color, [In, Optional] StructPointer brushProperties); /// Creates an ID2D1GradientStopCollection from the specified array of D2D1_GRADIENT_STOP structures. /// @@ -228,7 +228,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-creategradientstopcollection%28constd2d1_gradient_stop_uint32_d2d1_gamma_d2d1_extend_mode_id2d1gradientstopcollection%29 // HRESULT CreateGradientStopCollection( const D2D1_GRADIENT_STOP *gradientStops, UINT32 gradientStopsCount, D2D1_GAMMA // colorInterpolationGamma, D2D1_EXTEND_MODE extendMode, ID2D1GradientStopCollection **gradientStopCollection ); - new ID2D1GradientStopCollection CreateGradientStopCollection([In] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); + new ID2D1GradientStopCollection CreateGradientStopCollection([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] D2D1_GRADIENT_STOP[] gradientStops, uint gradientStopsCount, D2D1_GAMMA colorInterpolationGamma, D2D1_EXTEND_MODE extendMode); /// Creates an ID2D1LinearGradientBrush object for painting areas with a linear gradient. /// @@ -254,7 +254,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // HRESULT CreateLinearGradientBrush( const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1LinearGradientBrush // **linearGradientBrush ); - new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1LinearGradientBrush CreateLinearGradientBrush(in D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// Creates an ID2D1RadialGradientBrush object that can be used to paint areas with a radial gradient. /// @@ -279,7 +279,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // HRESULT CreateRadialGradientBrush( const D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1GradientStopCollection *gradientStopCollection, ID2D1RadialGradientBrush // **radialGradientBrush ); - new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] IntPtr brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); + new ID2D1RadialGradientBrush CreateRadialGradientBrush(in D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties, [In, Optional] StructPointer brushProperties, [In] ID2D1GradientStopCollection gradientStopCollection); /// /// Creates a bitmap render target for use during intermediate offscreen drawing that is compatible with the current render target. @@ -348,7 +348,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createcompatiblerendertarget(constd2d1_size_f_constd2d1_size_u_constd2d1_pixel_format_d2d1_compatible_render_target_options_id2d1bitmaprendertarget) // HRESULT CreateCompatibleRenderTarget( const D2D1_SIZE_F *desiredSize, const D2D1_SIZE_U *desiredPixelSize, const // D2D1_PIXEL_FORMAT *desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, ID2D1BitmapRenderTarget **bitmapRenderTarget ); - new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] IntPtr desiredSize, [In, Optional] IntPtr desiredPixelSize, [In, Optional] IntPtr desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); + new ID2D1BitmapRenderTarget CreateCompatibleRenderTarget([In, Optional] StructPointer desiredSize, [In, Optional] StructPointer desiredPixelSize, [In, Optional] StructPointer desiredFormat, [In, Optional] D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options); /// Creates a layer resource that can be used with this render target and its compatible render targets. /// @@ -365,7 +365,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 /// The layer automatically resizes itself, as needed. // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-createlayer(constd2d1_size_f_id2d1layer) // HRESULT CreateLayer( const D2D1_SIZE_F *size, ID2D1Layer **layer ); - new ID2D1Layer CreateLayer([In, Optional] IntPtr size); + new ID2D1Layer CreateLayer([In, Optional] StructPointer size); /// Create a mesh that uses triangles to describe a shape. /// @@ -704,7 +704,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // void FillOpacityMask( ID2D1Bitmap *opacityMask, ID2D1Brush *brush, D2D1_OPACITY_MASK_CONTENT content, const D2D1_RECT_F & // destinationRectangle, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] IntPtr destinationRectangle, [In, Optional] IntPtr sourceRectangle); + new void FillOpacityMask([In] ID2D1Bitmap opacityMask, [In] ID2D1Brush brush, D2D1_OPACITY_MASK_CONTENT content, [In, Optional] PD2D_RECT_F? destinationRectangle, [In, Optional] PD2D_RECT_F? sourceRectangle); /// Draws the specified bitmap after scaling it to the size of the specified rectangle. /// @@ -744,8 +744,8 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_BITMAP_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F & sourceRectangle ); [PreserveSig] - new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity = 1.0f, - D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] IntPtr sourceRectangle = default); + new void DrawBitmap([In] ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE.D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, [In] PD2D_RECT_F? sourceRectangle = default); /// Draws the specified text using the format information provided by an IDWriteTextFormat object. /// @@ -1234,7 +1234,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-clear(constd2d1_color_f_) void Clear( const // D2D1_COLOR_F & clearColor ); [PreserveSig] - new void Clear([In, Optional] IntPtr clearColor); + new void Clear([In, Optional] StructPointer clearColor); /// Initiates drawing on this render target. /// None @@ -1475,7 +1475,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 /// // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromwicbitmap(iwicbitmapsource_id2d1bitmap1) // HRESULT CreateBitmapFromWicBitmap( IWICBitmapSource *wicBitmapSource, ID2D1Bitmap1 **bitmap ); - new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmap1FromWicBitmap(IWICBitmapSource wicBitmapSource, [In, Optional] StructPointer bitmapProperties); /// Creates a color context. /// @@ -1612,7 +1612,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapfromdxgisurface(idxgisurface_constd2d1_bitmap_properties1__id2d1bitmap1) // HRESULT CreateBitmapFromDxgiSurface( IDXGISurface *surface, const D2D1_BITMAP_PROPERTIES1 & bitmapProperties, ID2D1Bitmap1 // **bitmap ); - new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] IntPtr bitmapProperties); + new ID2D1Bitmap1 CreateBitmapFromDxgiSurface(IDXGISurface surface, [In, Optional] StructPointer bitmapProperties); /// Creates an effect for the specified class ID. /// @@ -1777,7 +1777,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createimagebrush(id2d1image_constd2d1_image_brush_properties__constd2d1_brush_properties__id2d1imagebrush) // HRESULT CreateImageBrush( ID2D1Image *image, const D2D1_IMAGE_BRUSH_PROPERTIES & imageBrushProperties, const // D2D1_BRUSH_PROPERTIES & brushProperties, ID2D1ImageBrush **imageBrush ); - new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1ImageBrush CreateImageBrush([Optional] ID2D1Image? image, in D2D1_IMAGE_BRUSH_PROPERTIES imageBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a bitmap brush, the input image is a Direct2D bitmap object. /// @@ -1799,7 +1799,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-createbitmapbrush%28id2d1bitmap_constd2d1_bitmap_brush_properties1_constd2d1_brush_properties_id2d1bitmapbrush1%29 // HRESULT CreateBitmapBrush( ID2D1Bitmap *bitmap, const D2D1_BITMAP_BRUSH_PROPERTIES1 *bitmapBrushProperties, const // D2D1_BRUSH_PROPERTIES *brushProperties, ID2D1BitmapBrush1 **bitmapBrush ); - new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] IntPtr bitmapBrushProperties, [In, Optional] IntPtr brushProperties); + new ID2D1BitmapBrush1 CreateBitmapBrush1([Optional] ID2D1Bitmap? bitmap, [In, Optional] StructPointer bitmapBrushProperties, [In, Optional] StructPointer brushProperties); /// Creates a ID2D1CommandList object. /// @@ -2199,7 +2199,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // D2D1_POINT_2F baselineOrigin, const DWRITE_GLYPH_RUN *glyphRun, const DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription, // ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode ); [PreserveSig] - new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] IntPtr glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); + new void DrawGlyphRun(D2D_POINT_2F baselineOrigin, in DWRITE_GLYPH_RUN glyphRun, [In, Optional] StructPointer glyphRunDescription, ID2D1Brush foregroundBrush, DWRITE_MEASURING_MODE measuringMode); /// Draws an image to the device context. /// @@ -2253,7 +2253,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // void DrawImage( ID2D1Effect *effect, const D2D1_POINT_2F *targetOffset, const D2D1_RECT_F *imageRectangle, // D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode ); [PreserveSig] - new void DrawImage(ID2D1Image image, [In, Optional] IntPtr targetOffset, [In, Optional] IntPtr imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); + new void DrawImage(ID2D1Image image, [In, Optional] StructPointer targetOffset, [In, Optional] PD2D_RECT_F? imageRectangle, D2D1_INTERPOLATION_MODE interpolationMode, D2D1_COMPOSITE_MODE compositeMode); /// Draw a metafile to the device context. /// @@ -2268,7 +2268,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1_1/nf-d2d1_1-id2d1devicecontext-drawgdimetafile(id2d1gdimetafile_d2d1_point_2f) // void DrawGdiMetafile( ID2D1GdiMetafile *gdiMetafile, D2D1_POINT_2F targetOffset ); [PreserveSig] - new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] IntPtr targetOffset); + new void DrawGdiMetafile(ID2D1GdiMetafile gdiMetafile, [In, Optional] StructPointer targetOffset); /// Draws a bitmap to the render target. /// @@ -2315,7 +2315,7 @@ public interface ID2D1DeviceContext7 : ID2D1DeviceContext6 // void DrawBitmap( ID2D1Bitmap *bitmap, const D2D1_RECT_F & destinationRectangle, FLOAT opacity, D2D1_INTERPOLATION_MODE // interpolationMode, const D2D1_RECT_F *sourceRectangle, const D2D1_MATRIX_4X4_F *perspectiveTransform ); [PreserveSig] - new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] IntPtr destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] IntPtr sourceRectangle, [In, Optional] IntPtr perspectiveTransform); + new void DrawBitmap(ID2D1Bitmap bitmap, [In, Optional] PD2D_RECT_F? destinationRectangle, float opacity, D2D1_INTERPOLATION_MODE interpolationMode, [In, Optional] PD2D_RECT_F? sourceRectangle, [In, Optional] StructPointer perspectiveTransform); /// Push a layer onto the clip and layer stack of the device context. /// @@ -3622,7 +3622,7 @@ public interface ID2D1Factory3 : ID2D1Factory2 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -4260,7 +4260,7 @@ public interface ID2D1Factory4 : ID2D1Factory3 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -4911,7 +4911,7 @@ public interface ID2D1Factory5 : ID2D1Factory4 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -5579,7 +5579,7 @@ public interface ID2D1Factory6 : ID2D1Factory5 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -6267,7 +6267,7 @@ public interface ID2D1Factory7 : ID2D1Factory6 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -6975,7 +6975,7 @@ public interface ID2D1Factory8 : ID2D1Factory7 // https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1factory-createdrawingstateblock%28constd2d1_drawing_state_description_idwriterenderingparams_id2d1drawingstateblock%29 // HRESULT CreateDrawingStateBlock( const D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, IDWriteRenderingParams // *textRenderingParams, ID2D1DrawingStateBlock **drawingStateBlock ); - new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] IntPtr drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); + new ID2D1DrawingStateBlock CreateDrawingStateBlock([In, Optional] StructPointer drawingStateDescription, [In, Optional] IDWriteRenderingParams? textRenderingParams); /// Creates a render target that renders to a Microsoft Windows Imaging Component (WIC) bitmap. /// @@ -8544,7 +8544,7 @@ void SetStroke([In, Optional] ID2D1Brush? brush, float strokeWidth = 1f, // ID2D1Brush **brush, [out, optional] FLOAT *strokeWidth, [out, optional] FLOAT *dashes, UINT32 dashesCount, [out, optional] FLOAT // *dashOffset ); [PreserveSig] - void GetStroke([Out, Optional] IntPtr brush, [Out, Optional] StructPointer strokeWidth, + void GetStroke([Out, Optional] IUnknownPointer brush, [Out, Optional] StructPointer strokeWidth, [Out, Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] float[]? dashes, uint dashesCount, [Out, Optional] StructPointer dashOffset); } diff --git a/PInvoke/Direct2D/D2d1_3.cs b/PInvoke/Direct2D/D2d1_3.cs index 4c8d25b08..2258a5867 100644 --- a/PInvoke/Direct2D/D2d1_3.cs +++ b/PInvoke/Direct2D/D2d1_3.cs @@ -304,79 +304,211 @@ public enum D2D1_SPRITE_OPTIONS : uint // leftEdgeMode; D2D1_PATCH_EDGE_MODE bottomEdgeMode; D2D1_PATCH_EDGE_MODE rightEdgeMode; } D2D1_GRADIENT_MESH_PATCH; [PInvokeData("d2d1_3.h", MSDNShortId = "NS:d2d1_3.D2D1_GRADIENT_MESH_PATCH")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_GRADIENT_MESH_PATCH + public struct D2D1_GRADIENT_MESH_PATCH(D2D1_POINT_2F point00, D2D1_POINT_2F point01, D2D1_POINT_2F point02, D2D1_POINT_2F point03, D2D1_POINT_2F point10, + D2D1_POINT_2F point11, D2D1_POINT_2F point12, D2D1_POINT_2F point13, D2D1_POINT_2F point20, D2D1_POINT_2F point21, D2D1_POINT_2F point22, + D2D1_POINT_2F point23, D2D1_POINT_2F point30, D2D1_POINT_2F point31, D2D1_POINT_2F point32, D2D1_POINT_2F point33, D2D1_COLOR_F color00, + D2D1_COLOR_F color03, D2D1_COLOR_F color30, D2D1_COLOR_F color33, D2D1_PATCH_EDGE_MODE topEdgeMode, D2D1_PATCH_EDGE_MODE leftEdgeMode, + D2D1_PATCH_EDGE_MODE bottomEdgeMode, D2D1_PATCH_EDGE_MODE rightEdgeMode) { /// The coordinate-space location of the control point in column 0 and row 0 of the tensor grid. - public D2D1_POINT_2F point00; + public D2D1_POINT_2F point00 = point00; /// The coordinate-space location of the control point in column 0 and row 1 of the tensor grid. - public D2D1_POINT_2F point01; + public D2D1_POINT_2F point01 = point01; /// The coordinate-space location of the control point in column 0 and row 2 of the tensor grid. - public D2D1_POINT_2F point02; + public D2D1_POINT_2F point02 = point02; /// The coordinate-space location of the control point in column 0 and row 3 of the tensor grid. - public D2D1_POINT_2F point03; + public D2D1_POINT_2F point03 = point03; /// The coordinate-space location of the control point in column 1 and row 0 of the tensor grid. - public D2D1_POINT_2F point10; + public D2D1_POINT_2F point10 = point10; /// The coordinate-space location of the control point in column 1 and row 1 of the tensor grid. - public D2D1_POINT_2F point11; + public D2D1_POINT_2F point11 = point11; /// The coordinate-space location of the control point in column 1 and row 2 of the tensor grid. - public D2D1_POINT_2F point12; + public D2D1_POINT_2F point12 = point12; /// The coordinate-space location of the control point in column 1 and row 3 of the tensor grid. - public D2D1_POINT_2F point13; + public D2D1_POINT_2F point13 = point13; /// The coordinate-space location of the control point in column 2 and row 0 of the tensor grid. - public D2D1_POINT_2F point20; + public D2D1_POINT_2F point20 = point20; /// The coordinate-space location of the control point in column 2 and row 1 of the tensor grid. - public D2D1_POINT_2F point21; + public D2D1_POINT_2F point21 = point21; /// The coordinate-space location of the control point in column 2 and row 2 of the tensor grid. - public D2D1_POINT_2F point22; + public D2D1_POINT_2F point22 = point22; /// The coordinate-space location of the control point in column 2 and row 3 of the tensor grid. - public D2D1_POINT_2F point23; + public D2D1_POINT_2F point23 = point23; /// The coordinate-space location of the control point in column 3 and row 0 of the tensor grid. - public D2D1_POINT_2F point30; + public D2D1_POINT_2F point30 = point30; /// The coordinate-space location of the control point in column 3 and row 1 of the tensor grid. - public D2D1_POINT_2F point31; + public D2D1_POINT_2F point31 = point31; /// The coordinate-space location of the control point in column 3 and row 2 of the tensor grid. - public D2D1_POINT_2F point32; + public D2D1_POINT_2F point32 = point32; /// The coordinate-space location of the control point in column 3 and row 3 of the tensor grid. - public D2D1_POINT_2F point33; + public D2D1_POINT_2F point33 = point33; /// The color associated with the control point in column 0 and row 0 of the tensor grid. - public D2D1_COLOR_F color00; + public D2D1_COLOR_F color00 = color00; /// The color associated with the control point in column 0 and row 3 of the tensor grid. - public D2D1_COLOR_F color03; + public D2D1_COLOR_F color03 = color03; /// The color associated with the control point in column 3 and row 0 of the tensor grid. - public D2D1_COLOR_F color30; + public D2D1_COLOR_F color30 = color30; /// The color associated with the control point in column 3 and row 3 of the tensor grid. - public D2D1_COLOR_F color33; + public D2D1_COLOR_F color33 = color33; /// Specifies how to render the top edge of the mesh. - public D2D1_PATCH_EDGE_MODE topEdgeMode; + public D2D1_PATCH_EDGE_MODE topEdgeMode = topEdgeMode; /// Specifies how to render the left edge of the mesh. - public D2D1_PATCH_EDGE_MODE leftEdgeMode; + public D2D1_PATCH_EDGE_MODE leftEdgeMode = leftEdgeMode; /// Specifies how to render the bottom edge of the mesh. - public D2D1_PATCH_EDGE_MODE bottomEdgeMode; + public D2D1_PATCH_EDGE_MODE bottomEdgeMode = bottomEdgeMode; /// Specifies how to render the right edge of the mesh. - public D2D1_PATCH_EDGE_MODE rightEdgeMode; + public D2D1_PATCH_EDGE_MODE rightEdgeMode = rightEdgeMode; + + /// Creates a D2D1_GRADIENT_MESH_PATCH from a given Coons patch description. + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 0. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 1. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 2. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 3. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 4. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 5. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 6. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 7. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 8. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 9. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 10. + /// + /// + /// Type: D2D1_POINT_2F + /// The coordinate-space location of the control point at position 11. + /// + /// + /// Type: D2D1_COLOR_F + /// The color associated with the control point at position 0. + /// + /// + /// Type: D2D1_COLOR_F + /// The color associated with the control point at position 1. + /// + /// + /// Type: D2D1_COLOR_F + /// The color associated with the control point at position 2. + /// + /// + /// Type: D2D1_COLOR_F + /// The color associated with the control point at position 3. + /// + /// + /// Type: D2D1_PATCH_EDGE_MODE + /// Specifies how to render the top edge of the mesh. + /// + /// + /// Type: D2D1_PATCH_EDGE_MODE + /// Specifies how to render the left edge of the mesh. + /// + /// + /// Type: D2D1_PATCH_EDGE_MODE + /// Specifies how to render the bottom edge of the mesh. + /// + /// + /// Type: D2D1_PATCH_EDGE_MODE + /// Specifies how to render the right edge of the mesh. + /// + /// + /// Type: D2D1_GRADIENT_MESH_PATCH + /// Returns the created D2D1_GRADIENT_MESH_PATCH structure. + /// + /// The following image shows the numbering of control points in a Coons patch. + // https://learn.microsoft.com/en-us/windows/win32/api/d2d1_3helper/nf-d2d1_3helper-gradientmeshpatchfromcoonspatch + // D2D1_GRADIENT_MESH_PATCH GradientMeshPatchFromCoonsPatch( D2D1_POINT_2F point0, D2D1_POINT_2F point1, D2D1_POINT_2F point2, + // D2D1_POINT_2F point3, D2D1_POINT_2F point4, D2D1_POINT_2F point5, D2D1_POINT_2F point6, D2D1_POINT_2F point7, D2D1_POINT_2F + // point8, D2D1_POINT_2F point9, D2D1_POINT_2F point10, D2D1_POINT_2F point11, D2D1_COLOR_F color0, D2D1_COLOR_F color1, + // D2D1_COLOR_F color2, D2D1_COLOR_F color3, D2D1_PATCH_EDGE_MODE topEdgeMode, D2D1_PATCH_EDGE_MODE leftEdgeMode, + // D2D1_PATCH_EDGE_MODE bottomEdgeMode, D2D1_PATCH_EDGE_MODE rightEdgeMode ); + [PInvokeData("d2d1_3helper.h", MSDNShortId = "NF:d2d1_3helper.GradientMeshPatchFromCoonsPatch")] + public static D2D1_GRADIENT_MESH_PATCH FromCoonsPatch(D2D1_POINT_2F point0, D2D1_POINT_2F point1, D2D1_POINT_2F point2, D2D1_POINT_2F point3, D2D1_POINT_2F point4, + D2D1_POINT_2F point5, D2D1_POINT_2F point6, D2D1_POINT_2F point7, D2D1_POINT_2F point8, D2D1_POINT_2F point9, D2D1_POINT_2F point10, + D2D1_POINT_2F point11, D2D1_COLOR_F color0, D2D1_COLOR_F color1, D2D1_COLOR_F color2, D2D1_COLOR_F 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 = new() + { + point00 = point0, + point01 = point1, + point02 = point2, + point03 = point3, + point13 = point4, + point23 = point5, + point33 = point6, + point32 = point7, + point31 = point8, + point30 = point9, + point20 = point10, + point10 = point11, + color00 = color0, + color03 = color1, + color33 = color2, + color30 = color3, + topEdgeMode = topEdgeMode, + leftEdgeMode = leftEdgeMode, + bottomEdgeMode = bottomEdgeMode, + rightEdgeMode = rightEdgeMode, + }; + + D2D1GetGradientMeshInteriorPointsFromCoonsPatch(point0, point1, point2, point3, point4, point5, point6, point7, point8, point9, point10, point11, + out newPatch.point11, out newPatch.point12, out newPatch.point21, out newPatch.point22); + + return newPatch; + } } /// @@ -387,16 +519,16 @@ public struct D2D1_GRADIENT_MESH_PATCH // D2D1_INK_POINT point1; D2D1_INK_POINT point2; D2D1_INK_POINT point3; } D2D1_INK_BEZIER_SEGMENT; [PInvokeData("d2d1_3.h", MSDNShortId = "NS:d2d1_3.D2D1_INK_BEZIER_SEGMENT")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_INK_BEZIER_SEGMENT + public struct D2D1_INK_BEZIER_SEGMENT(in D2d1.D2D1_INK_POINT point1, in D2d1.D2D1_INK_POINT point2, in D2d1.D2D1_INK_POINT point3) { /// The first control point for the Bezier segment. - public D2D1_INK_POINT point1; + public D2D1_INK_POINT point1 = point1; /// The second control point for the Bezier segment. - public D2D1_INK_POINT point2; + public D2D1_INK_POINT point2 = point2; /// The end point for the Bezier segment. - public D2D1_INK_POINT point3; + public D2D1_INK_POINT point3 = point3; } /// Represents a point, radius pair that makes up part of a D2D1_INK_BEZIER_SEGMENT. @@ -404,16 +536,16 @@ public struct D2D1_INK_BEZIER_SEGMENT // FLOAT radius; } D2D1_INK_POINT; [PInvokeData("d2d1_3.h", MSDNShortId = "NS:d2d1_3.D2D1_INK_POINT")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_INK_POINT + public struct D2D1_INK_POINT(in D2D1_POINT_2F point, float radius) { /// The x-coordinate of the point. - public float x; + public float x = point.x; /// The y-coordinate of the point. - public float y; + public float y = point.y; /// The radius of this point. Corresponds to the width of the ink stroke at this point in the stroke. - public float radius; + public float radius = radius; } /// Defines the general pen tip shape and the transform used in an ID2D1InkStyle object. @@ -421,15 +553,15 @@ public struct D2D1_INK_POINT // D2D1_INK_STYLE_PROPERTIES { D2D1_INK_NIB_SHAPE nibShape; D2D1_MATRIX_3X2_F nibTransform; } D2D1_INK_STYLE_PROPERTIES; [PInvokeData("d2d1_3.h", MSDNShortId = "NS:d2d1_3.D2D1_INK_STYLE_PROPERTIES")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_INK_STYLE_PROPERTIES + public struct D2D1_INK_STYLE_PROPERTIES(D2d1.D2D1_INK_NIB_SHAPE nibShape, in D2D1_MATRIX_3X2_F nibTransform) { /// The pre-transform shape of the nib (pen tip) used to draw a given ink object. - public D2D1_INK_NIB_SHAPE nibShape; + public D2D1_INK_NIB_SHAPE nibShape = nibShape; /// /// The transform applied to the nib. Note that the translation components of the transform matrix are ignored for the purposes of rendering. /// - public D2D1_MATRIX_3X2_F nibTransform; + public D2D1_MATRIX_3X2_F nibTransform = nibTransform; } /// Simple description of a color space. @@ -438,22 +570,22 @@ public struct D2D1_INK_STYLE_PROPERTIES // whitePointXZ; D2D1_GAMMA1 gamma; } D2D1_SIMPLE_COLOR_PROFILE; [PInvokeData("d2d1_3.h", MSDNShortId = "NS:d2d1_3.D2D1_SIMPLE_COLOR_PROFILE")] [StructLayout(LayoutKind.Sequential)] - public struct D2D1_SIMPLE_COLOR_PROFILE + public struct D2D1_SIMPLE_COLOR_PROFILE(in D2D1_POINT_2F redPrimary, in D2D1_POINT_2F greenPrimary, in D2D1_POINT_2F bluePrimary, D2D1_GAMMA1 gamma, in D2D1_POINT_2F whitePointXZ) { /// The xy coordinates of the red primary in the CIExyY color space. - public D2D1_POINT_2F redPrimary; + public D2D1_POINT_2F redPrimary = redPrimary; /// The xy coordinates of the green primary in the CIExyY color space. - public D2D1_POINT_2F greenPrimary; + public D2D1_POINT_2F greenPrimary = greenPrimary; /// The xy coordinates of the blue primary in the CIExyY color space. - public D2D1_POINT_2F bluePrimary; + public D2D1_POINT_2F bluePrimary = bluePrimary; /// The XZ tristimulus values for the whitepoint in the CIEXYZ color space, normalized to luminance (Y) of 1. - public D2D1_POINT_2F whitePointXZ; + public D2D1_POINT_2F whitePointXZ = whitePointXZ; /// The gamma encoding to use for this color space. - public D2D1_GAMMA1 gamma; + public D2D1_GAMMA1 gamma = gamma; } /// Properties of a transformed image source. diff --git a/PInvoke/Direct2D/WindowsCodecs.Interfaces.cs b/PInvoke/Direct2D/WindowsCodecs.Interfaces.cs index 066ee30d4..f6318e08a 100644 --- a/PInvoke/Direct2D/WindowsCodecs.Interfaces.cs +++ b/PInvoke/Direct2D/WindowsCodecs.Interfaces.cs @@ -1378,7 +1378,7 @@ public interface IWICBitmapDecoderInfo : IWICBitmapCodecInfo /// /// /// Type: WICBitmapPattern* - /// Receives a list of WICBitmapPattern objects supported by the decoder. + /// Receives a list of objects supported by the decoder. /// /// /// Type: UINT* @@ -1399,7 +1399,7 @@ public interface IWICBitmapDecoderInfo : IWICBitmapCodecInfo /// // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicbitmapdecoderinfo-getpatterns HRESULT // GetPatterns( UINT cbSizePatterns, WICBitmapPattern *pPatterns, UINT *pcPatterns, UINT *pcbPatternsActual ); - void GetPatterns(uint cbSizePatterns, [In, Out] IntPtr pPatterns, [Out, Optional] out uint pcPatterns, [Out] out uint pcbPatternsActual); + void GetPatterns(uint cbSizePatterns, [In, Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] WICBitmapPattern[] pPatterns, [Out, Optional] out uint pcPatterns, [Out] out uint pcbPatternsActual); /// Retrieves a value that indicates whether the codec recognizes the pattern within a specified stream. /// @@ -4982,7 +4982,7 @@ public interface IWICDevelopRaw : IWICBitmapFrameDecode /// // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-settonecurve // HRESULT SetToneCurve( UINT cbToneCurveSize, const WICRawToneCurve *pToneCurve ); - void SetToneCurve(uint cbToneCurveSize, [In] IntPtr pToneCurve); + void SetToneCurve(uint cbToneCurveSize, [In] ManagedStructPointer pToneCurve); /// Gets the tone curve of the raw image. /// @@ -4999,7 +4999,7 @@ public interface IWICDevelopRaw : IWICBitmapFrameDecode /// // https://docs.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicdevelopraw-gettonecurve // HRESULT GetToneCurve( UINT cbToneCurveBufferSize, WICRawToneCurve *pToneCurve, UINT *pcbActualToneCurveBufferSize ); - void GetToneCurve(uint cbToneCurveBufferSize, [Out] IntPtr pToneCurve, out uint pcbActualToneCurveBufferSize); + void GetToneCurve(uint cbToneCurveBufferSize, [Out] ManagedStructPointer pToneCurve, out uint pcbActualToneCurveBufferSize); /// Sets the desired rotation angle. /// diff --git a/PInvoke/Direct2D/WindowsCodecs.Interfaces2.cs b/PInvoke/Direct2D/WindowsCodecs.Interfaces2.cs index ad3d3b014..341b4ce39 100644 --- a/PInvoke/Direct2D/WindowsCodecs.Interfaces2.cs +++ b/PInvoke/Direct2D/WindowsCodecs.Interfaces2.cs @@ -3259,7 +3259,7 @@ public interface IWICMetadataReaderInfo : IWICMetadataHandlerInfo /// // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatareaderinfo-getpatterns HRESULT // GetPatterns( REFGUID guidContainerFormat, UINT cbSize, WICMetadataPattern *pPattern, UINT *pcCount, UINT *pcbActual ); - void GetPatterns(in Guid guidContainerFormat, uint cbSize, [Out, Optional] IntPtr pPattern, out uint pcCount, out uint pcbActual); + void GetPatterns(in Guid guidContainerFormat, uint cbSize, [Out, Optional] ManagedStructPointer pPattern, out uint pcCount, out uint pcbActual); /// Determines if a stream contains a metadata item pattern. /// @@ -3700,7 +3700,7 @@ public interface IWICMetadataWriterInfo : IWICMetadataHandlerInfo /// // https://docs.microsoft.com/en-us/windows/win32/api/wincodecsdk/nf-wincodecsdk-iwicmetadatawriterinfo-getheader HRESULT // GetHeader( REFGUID guidContainerFormat, UINT cbSize, WICMetadataHeader *pHeader, UINT *pcbActual ); - void GetHeader(in Guid guidContainerFormat, uint cbSize, [Out] IntPtr pHeader, out uint pcbActual); + void GetHeader(in Guid guidContainerFormat, uint cbSize, [Out] ManagedStructPointer pHeader, out uint pcbActual); /// Creates an instance of an IWICMetadataWriter. /// diff --git a/PInvoke/Shared/FunctionHelper.cs b/PInvoke/Shared/FunctionHelper.cs index 93d86cb39..bb386080a 100644 --- a/PInvoke/Shared/FunctionHelper.cs +++ b/PInvoke/Shared/FunctionHelper.cs @@ -7,12 +7,20 @@ public static class FunctionHelper { private static readonly List buffErrs = new() { Win32Error.ERROR_MORE_DATA, Win32Error.ERROR_INSUFFICIENT_BUFFER, Win32Error.ERROR_BUFFER_OVERFLOW }; +#nullable disable /// Delegate for functions that use an IID to retrieve an object. /// The type of the error. /// The IID of the requested interface. /// The resulting interface. /// The error code for the function. - public delegate TErr IidFunc(in Guid riid, out object? ppv) where TErr : IErrorProvider; + public delegate TErr IidFunc(in Guid riid, out object ppv) where TErr : IErrorProvider; + + /// Delegate for functions that use an IID to retrieve an object. + /// The IID of the requested interface. + /// The resulting interface. + /// The error code for the function. + public delegate void IidFunc(in Guid riid, out object ppv); +#nullable restore /// Delegate to get the size of memory allocated to a pointer. /// The type of the size result. This is usually or . @@ -240,36 +248,31 @@ public static bool ChkGoodBuf(TSize sz, TRet err) where TSize : str return default; } +#nullable disable /// Helper function for functions that retrieve an object based on an IID. /// The type of the object to retrieve. /// The type of the error. /// The function. /// The returned object case to , or on failure. /// The error returned by . - public static TErr IidGetObj(IidFunc f, out T? ppv) where T : class where TErr : IErrorProvider + public static TErr IidGetObj(IidFunc f, out T ppv) where T : class where TErr : IErrorProvider { var hr = f(typeof(T).GUID, out var pv); - ppv = hr.Succeeded ? (T?)pv : default; + ppv = hr.Succeeded ? (T)pv : default; return hr; } - private static bool IsNotDef(TSize _sz, TRet _ret) where TSize : struct, IConvertible => !_sz.Equals(default(TSize)); - - /* - public delegate TRet P0QI(in Guid iid, out object ppv) where TRet : IErrorProvider, IConvertible; - public delegate TRet P1QI(TIn1 p1, in Guid iid, out object ppv) where TRet : IErrorProvider, IConvertible; - public delegate TRet P1IQI(in TIn1 p1, in Guid iid, out object ppv) where TIn1 : struct where TRet : IErrorProvider, IConvertible; - public delegate TRet P2QI(TIn1 p1, TIn2 p2, in Guid iid, out object ppv) where TRet : IErrorProvider, IConvertible; - - public static TIntf QueryInterface(P0QI f) => f0(typeof(TIntf).GUID, out object ppv).Succeeded ? (TIntf)ppv : throw new InvalidCastException(); - public static TIntf QueryInterface(P1QI f, TIn1 p1) => QueryInterface(f1, p1, hr => hr.Succeeded); - public static TIntf QueryInterface(P1IQI f, in TIn1 p1) where TIn1 : struct => QueryInterface(f1, in p1, hr => hr.Succeeded); - - private void Test() + /// Helper function for functions that retrieve an object based on an IID. + /// The type of the object to retrieve. + /// The function. + /// The returned object case to , or on failure. + /// The error returned by . + public static void IidGetObj(IidFunc f, out T ppv) where T : class { - static HRESULT GetObj(uint f, in Guid iid, out object ppv); - - X x = QueryInterface(GetObj, 3U); + f(typeof(T).GUID, out var pv); + ppv = (T)pv; } - */ +#nullable restore + + private static bool IsNotDef(TSize _sz, TRet _ret) where TSize : struct, IConvertible => !_sz.Equals(default(TSize)); } \ No newline at end of file diff --git a/PInvoke/Shared/WinDef/COLORREF.cs b/PInvoke/Shared/WinDef/COLORREF.cs index 49bf79eb5..40a335be8 100644 --- a/PInvoke/Shared/WinDef/COLORREF.cs +++ b/PInvoke/Shared/WinDef/COLORREF.cs @@ -68,7 +68,7 @@ public COLORREF(uint value) Value = value & 0x00FFFFFF; } - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// The color. public COLORREF(Color color) : this(color.R, color.G, color.B) { @@ -76,6 +76,15 @@ public COLORREF(Color color) : this(color.R, color.G, color.B) Value = CLR_NONE; } + /// Initializes a new instance of the struct. + /// The color. + /// The alpha value. + public COLORREF(Color color, byte alpha) : this(color.R, color.G, color.B, alpha) + { + if (color == Color.Transparent && alpha == 255) + Value = CLR_NONE; + } + /// A method to darken a color by a percentage of the difference between the color and Black. /// The percentage by which to darken the original color. ///