diff --git a/src/Generator/Program.cs b/src/Generator/Program.cs index ed56a25..a69bff1 100644 --- a/src/Generator/Program.cs +++ b/src/Generator/Program.cs @@ -1,11 +1,7 @@ // Copyright © Amer Koleci and Contributors. // Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. -using System.ComponentModel.DataAnnotations; -using System.Data.Common; using System.Globalization; -using System.Reflection; -using System.Reflection.Metadata; using System.Text; using Newtonsoft.Json; @@ -15,8 +11,6 @@ public static class Program { private static readonly string[] jsons = new[] { - //"System.Com.json", - "Graphics.json", "Graphics.Dxgi.Common.json", "Graphics.Dxgi.json", @@ -101,9 +95,12 @@ public static class Program { "Graphics.Direct2D.Common.D2D_VECTOR_3F", "Vector3" }, { "Graphics.Direct2D.Common.D2D_VECTOR_4F", "Vector4" }, { "Graphics.Direct2D.Common.D2D_SIZE_F", "System.Drawing.SizeF" }, + { "Graphics.Direct2D.Common.D2D_POINT_2U", "System.Drawing.Point" }, + { "Graphics.Direct2D.Common.D2D_SIZE_U", "System.Drawing.Size" }, { "Graphics.Imaging.WICRect", "System.Drawing.Rectangle" }, + { "Graphics.DirectWrite.DWRITE_COLOR_F", "Win32.Graphics.Direct2D.Common.ColorF" }, { "Graphics.Direct2D.Matrix4x3F", "Win32.Graphics.Direct2D.Common.Matrix4x3" }, { "Graphics.Direct2D.Matrix4x4F", "Matrix4x4" }, { "Graphics.Direct2D.Matrix5x4F", "Win32.Graphics.Direct2D.Common.Matrix5x4" }, @@ -1888,13 +1885,20 @@ public static class Program StringBuilder argumentsNameBuilder = new(); int parameterIndex = 0; + bool allOptional = false; + + if (method.Name == "EndDraw") + { + allOptional = + method.Params.All(item => item.Attrs.Any(attr => attr is string str && str == "Optional")); + } + foreach (ApiParameter parameter in method.Params) { bool asPointer = false; string parameterType = string.Empty; - - if (method.Name == "CreateSurface" && parameter.Name == "ppSurface") + if (method.Name == "CreateBitmap" && comType.Name == "ID2D1RenderTarget") { } @@ -1975,10 +1979,10 @@ public static class Program parameterName = CleanupName(parameterName); argumentBuilder.Append(parameterType).Append(' ').Append(parameterName); - //if (isOptional == true) - //{ - //argumentBuilder.Append(" = default"); - //} + if (allOptional == true && isOptional == true) + { + argumentBuilder.Append(" = null"); + } argumentsTypesBuilder.Append(parameterType); argumentsNameBuilder.Append(parameterName); @@ -2370,6 +2374,10 @@ public static class Program { return "Level_" + prettyName; } + else if (enumPrefix.Contains("_GAMMA")) + { + return "Gamma_" + prettyName[0] + "_" + prettyName[1]; + } return "_" + prettyName; } @@ -2514,6 +2522,10 @@ public static class Program case "Luid": case "HResult": return true; + + case "System.Drawing.Size": + case "System.Drawing.SizeF": + return true; } return false; diff --git a/src/Vortice.Win32/Bool32.cs b/src/Vortice.Win32/Bool32.cs index a960f3c..e393112 100644 --- a/src/Vortice.Win32/Bool32.cs +++ b/src/Vortice.Win32/Bool32.cs @@ -43,7 +43,7 @@ public readonly partial struct Bool32 : IComparable, IComparable, IEquat public static explicit operator short(Bool32 value) => (short)(value.Value); - public static implicit operator Bool32(int value) => new Bool32(value); + public static implicit operator Bool32(int value) => new(value); public static implicit operator int(Bool32 value) => value.Value; diff --git a/src/Vortice.Win32/Generated/Graphics/Direct2D.Common.cs b/src/Vortice.Win32/Generated/Graphics/Direct2D.Common.cs index d07ea83..da48f12 100644 --- a/src/Vortice.Win32/Generated/Graphics/Direct2D.Common.cs +++ b/src/Vortice.Win32/Generated/Graphics/Direct2D.Common.cs @@ -290,17 +290,6 @@ public partial struct PixelFormat public AlphaMode alphaMode; } -/// -/// D2D_POINT_2U -public partial struct Point2u -{ - /// - public uint x; - - /// - public uint y; -} - /// /// D2D_RECT_F public partial struct RectF @@ -335,17 +324,6 @@ public partial struct RectU public uint bottom; } -/// -/// D2D_SIZE_U -public partial struct SizeU -{ - /// - public uint width; - - /// - public uint height; -} - /// /// D2D1_BEZIER_SEGMENT public partial struct BezierSegment diff --git a/src/Vortice.Win32/Generated/Graphics/Direct2D.cs b/src/Vortice.Win32/Generated/Graphics/Direct2D.cs index 1d7d4bd..9e21de3 100644 --- a/src/Vortice.Win32/Generated/Graphics/Direct2D.cs +++ b/src/Vortice.Win32/Generated/Graphics/Direct2D.cs @@ -1624,10 +1624,10 @@ public enum Gamma : uint { /// /// D2D1_GAMMA_2_2 - _22 = 0, + Gamma_2_2 = 0, /// /// D2D1_GAMMA_1_0 - _10 = 1, + Gamma_1_0 = 1, } /// @@ -4875,7 +4875,7 @@ public partial struct HwndRenderTargetProperties public IntPtr hwnd; /// - public Common.SizeU pixelSize; + public System.Drawing.Size pixelSize; /// public PresentOptions presentOptions; @@ -4948,7 +4948,7 @@ public partial struct RenderingControls public BufferPrecision bufferPrecision; /// - public Common.SizeU tileSize; + public System.Drawing.Size tileSize; } /// @@ -5704,9 +5704,9 @@ public unsafe partial struct ID2D1Bitmap /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(5)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((ID2D1Bitmap*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((ID2D1Bitmap*)Unsafe.AsPointer(ref this)); } /// @@ -5728,17 +5728,17 @@ public unsafe partial struct ID2D1Bitmap /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(8)] - public HResult CopyFromBitmap(Common.Point2u* destPoint, ID2D1Bitmap* bitmap, Common.RectU* srcRect) + public HResult CopyFromBitmap(System.Drawing.Point* destPoint, ID2D1Bitmap* bitmap, Common.RectU* srcRect) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID2D1Bitmap*)Unsafe.AsPointer(ref this), destPoint, bitmap, srcRect); + return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID2D1Bitmap*)Unsafe.AsPointer(ref this), destPoint, bitmap, srcRect); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(9)] - public HResult CopyFromRenderTarget(Common.Point2u* destPoint, ID2D1RenderTarget* renderTarget, Common.RectU* srcRect) + public HResult CopyFromRenderTarget(System.Drawing.Point* destPoint, ID2D1RenderTarget* renderTarget, Common.RectU* srcRect) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((ID2D1Bitmap*)Unsafe.AsPointer(ref this), destPoint, renderTarget, srcRect); + return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((ID2D1Bitmap*)Unsafe.AsPointer(ref this), destPoint, renderTarget, srcRect); } /// @@ -8550,9 +8550,9 @@ public unsafe partial struct ID2D1RenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(4)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -8614,9 +8614,9 @@ public unsafe partial struct ID2D1RenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(12)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -8910,7 +8910,7 @@ public unsafe partial struct ID2D1RenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(49)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[49]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -8950,9 +8950,9 @@ public unsafe partial struct ID2D1RenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(54)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[54]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[54]))((ID2D1RenderTarget*)Unsafe.AsPointer(ref this)); } /// @@ -9036,9 +9036,9 @@ public unsafe partial struct ID2D1BitmapRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -9100,9 +9100,9 @@ public unsafe partial struct ID2D1BitmapRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(11)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -9396,7 +9396,7 @@ public unsafe partial struct ID2D1BitmapRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(48)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[48]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -9436,9 +9436,9 @@ public unsafe partial struct ID2D1BitmapRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(53)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1BitmapRenderTarget*)Unsafe.AsPointer(ref this)); } /// @@ -9538,9 +9538,9 @@ public unsafe partial struct ID2D1HwndRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -9602,9 +9602,9 @@ public unsafe partial struct ID2D1HwndRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(11)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -9898,7 +9898,7 @@ public unsafe partial struct ID2D1HwndRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(48)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[48]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -9938,9 +9938,9 @@ public unsafe partial struct ID2D1HwndRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(53)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this)); } /// @@ -9978,9 +9978,9 @@ public unsafe partial struct ID2D1HwndRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(58)] - public HResult Resize(Common.SizeU* pixelSize) + public HResult Resize(System.Drawing.Size* pixelSize) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[58]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), pixelSize); + return ((delegate* unmanaged[Stdcall])(lpVtbl[58]))((ID2D1HwndRenderTarget*)Unsafe.AsPointer(ref this), pixelSize); } /// @@ -10134,9 +10134,9 @@ public unsafe partial struct ID2D1DCRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -10198,9 +10198,9 @@ public unsafe partial struct ID2D1DCRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(11)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -10494,7 +10494,7 @@ public unsafe partial struct ID2D1DCRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(48)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[48]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -10534,9 +10534,9 @@ public unsafe partial struct ID2D1DCRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(53)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1DCRenderTarget*)Unsafe.AsPointer(ref this)); } /// @@ -11314,9 +11314,9 @@ public unsafe partial struct ID2D1PrintControl /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult AddPage(ID2D1CommandList* commandList, System.Drawing.SizeF* pageSize, Com.IStream* pagePrintTicketStream, ulong* tag1, ulong* tag2) + public HResult AddPage(ID2D1CommandList* commandList, System.Drawing.SizeF pageSize, Com.IStream* pagePrintTicketStream, ulong* tag1, ulong* tag2) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1PrintControl*)Unsafe.AsPointer(ref this), commandList, pageSize, pagePrintTicketStream, tag1, tag2); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1PrintControl*)Unsafe.AsPointer(ref this), commandList, pageSize, pagePrintTicketStream, tag1, tag2); } /// @@ -12468,9 +12468,9 @@ public unsafe partial struct ID2D1Bitmap1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(4)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1Bitmap1*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1Bitmap1*)Unsafe.AsPointer(ref this)); } /// @@ -12492,17 +12492,17 @@ public unsafe partial struct ID2D1Bitmap1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(7)] - public HResult CopyFromBitmap(Common.Point2u* destPoint, ID2D1Bitmap* bitmap, Common.RectU* srcRect) + public HResult CopyFromBitmap(System.Drawing.Point* destPoint, ID2D1Bitmap* bitmap, Common.RectU* srcRect) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((ID2D1Bitmap1*)Unsafe.AsPointer(ref this), destPoint, bitmap, srcRect); + return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((ID2D1Bitmap1*)Unsafe.AsPointer(ref this), destPoint, bitmap, srcRect); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(8)] - public HResult CopyFromRenderTarget(Common.Point2u* destPoint, ID2D1RenderTarget* renderTarget, Common.RectU* srcRect) + public HResult CopyFromRenderTarget(System.Drawing.Point* destPoint, ID2D1RenderTarget* renderTarget, Common.RectU* srcRect) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID2D1Bitmap1*)Unsafe.AsPointer(ref this), destPoint, renderTarget, srcRect); + return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID2D1Bitmap1*)Unsafe.AsPointer(ref this), destPoint, renderTarget, srcRect); } /// @@ -12980,9 +12980,9 @@ public unsafe partial struct ID2D1DeviceContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -13044,9 +13044,9 @@ public unsafe partial struct ID2D1DeviceContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(11)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -13340,7 +13340,7 @@ public unsafe partial struct ID2D1DeviceContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(48)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[48]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -13380,9 +13380,9 @@ public unsafe partial struct ID2D1DeviceContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(53)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[53]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this)); } /// @@ -13412,9 +13412,9 @@ public unsafe partial struct ID2D1DeviceContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(57)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[57]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[57]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -15310,9 +15310,9 @@ public unsafe partial struct ID2D1SourceTransform /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(8)] - public HResult Draw(ID2D1Bitmap1* target, RawRect* drawRect, Common.Point2u* targetOrigin) + public HResult Draw(ID2D1Bitmap1* target, RawRect* drawRect, System.Drawing.Point* targetOrigin) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID2D1SourceTransform*)Unsafe.AsPointer(ref this), target, drawRect, targetOrigin); + return ((delegate* unmanaged[Stdcall])(lpVtbl[8]))((ID2D1SourceTransform*)Unsafe.AsPointer(ref this), target, drawRect, targetOrigin); } } @@ -16244,9 +16244,9 @@ public unsafe partial struct ID2D1DeviceContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -16524,9 +16524,9 @@ public unsafe partial struct ID2D1DeviceContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(38)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[38]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[38]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -16588,9 +16588,9 @@ public unsafe partial struct ID2D1DeviceContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(46)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[46]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[46]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -16884,7 +16884,7 @@ public unsafe partial struct ID2D1DeviceContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(83)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[83]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -16924,9 +16924,9 @@ public unsafe partial struct ID2D1DeviceContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(88)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[88]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[88]))((ID2D1DeviceContext1*)Unsafe.AsPointer(ref this)); } /// @@ -18656,9 +18656,9 @@ public unsafe partial struct ID2D1SvgDocument /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(4)] - public HResult SetViewportSize(System.Drawing.SizeF* viewportSize) + public HResult SetViewportSize(System.Drawing.SizeF viewportSize) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1SvgDocument*)Unsafe.AsPointer(ref this), viewportSize); + return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1SvgDocument*)Unsafe.AsPointer(ref this), viewportSize); } /// @@ -19520,9 +19520,9 @@ public unsafe partial struct ID2D1DeviceContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(6)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[6]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[6]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -19800,9 +19800,9 @@ public unsafe partial struct ID2D1DeviceContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(41)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[41]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[41]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -19864,9 +19864,9 @@ public unsafe partial struct ID2D1DeviceContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(49)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[49]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[49]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -20160,7 +20160,7 @@ public unsafe partial struct ID2D1DeviceContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(86)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[86]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -20200,9 +20200,9 @@ public unsafe partial struct ID2D1DeviceContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(91)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[91]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[91]))((ID2D1DeviceContext2*)Unsafe.AsPointer(ref this)); } /// @@ -21498,9 +21498,9 @@ public unsafe partial struct ID2D1DeviceContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(17)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[17]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[17]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -21778,9 +21778,9 @@ public unsafe partial struct ID2D1DeviceContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(52)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[52]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[52]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -21842,9 +21842,9 @@ public unsafe partial struct ID2D1DeviceContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(60)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[60]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[60]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -22138,7 +22138,7 @@ public unsafe partial struct ID2D1DeviceContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(97)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[97]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -22178,9 +22178,9 @@ public unsafe partial struct ID2D1DeviceContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(102)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[102]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[102]))((ID2D1DeviceContext3*)Unsafe.AsPointer(ref this)); } /// @@ -23264,9 +23264,9 @@ public unsafe partial struct ID2D1DeviceContext4 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(19)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[19]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[19]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -23544,9 +23544,9 @@ public unsafe partial struct ID2D1DeviceContext4 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(54)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[54]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[54]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -23608,9 +23608,9 @@ public unsafe partial struct ID2D1DeviceContext4 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(62)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[62]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[62]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -23904,7 +23904,7 @@ public unsafe partial struct ID2D1DeviceContext4 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(99)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[99]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -23944,9 +23944,9 @@ public unsafe partial struct ID2D1DeviceContext4 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(104)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[104]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[104]))((ID2D1DeviceContext4*)Unsafe.AsPointer(ref this)); } /// @@ -25174,9 +25174,9 @@ public unsafe partial struct ID2D1DeviceContext5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(26)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[26]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[26]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -25454,9 +25454,9 @@ public unsafe partial struct ID2D1DeviceContext5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(61)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[61]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[61]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -25518,9 +25518,9 @@ public unsafe partial struct ID2D1DeviceContext5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(69)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[69]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[69]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -25814,7 +25814,7 @@ public unsafe partial struct ID2D1DeviceContext5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(106)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[106]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -25854,9 +25854,9 @@ public unsafe partial struct ID2D1DeviceContext5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(111)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[111]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[111]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this)); } /// @@ -25886,9 +25886,9 @@ public unsafe partial struct ID2D1DeviceContext5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(115)] - public HResult CreateSvgDocument(Com.IStream* inputXmlStream, System.Drawing.SizeF* viewportSize, ID2D1SvgDocument** svgDocument) + public HResult CreateSvgDocument(Com.IStream* inputXmlStream, System.Drawing.SizeF viewportSize, ID2D1SvgDocument** svgDocument) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[115]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), inputXmlStream, viewportSize, svgDocument); + return ((delegate* unmanaged[Stdcall])(lpVtbl[115]))((ID2D1DeviceContext5*)Unsafe.AsPointer(ref this), inputXmlStream, viewportSize, svgDocument); } /// @@ -26782,9 +26782,9 @@ public unsafe partial struct ID2D1DeviceContext6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(3)] - public HResult CreateSvgDocument(Com.IStream* inputXmlStream, System.Drawing.SizeF* viewportSize, ID2D1SvgDocument** svgDocument) + public HResult CreateSvgDocument(Com.IStream* inputXmlStream, System.Drawing.SizeF viewportSize, ID2D1SvgDocument** svgDocument) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), inputXmlStream, viewportSize, svgDocument); + return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), inputXmlStream, viewportSize, svgDocument); } /// @@ -26998,9 +26998,9 @@ public unsafe partial struct ID2D1DeviceContext6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(30)] - public HResult CreateBitmap(Common.SizeU* size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* sourceData, uint pitch, BitmapProperties1* bitmapProperties, ID2D1Bitmap1** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[30]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[30]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), size, sourceData, pitch, bitmapProperties, bitmap); } /// @@ -27278,9 +27278,9 @@ public unsafe partial struct ID2D1DeviceContext6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(65)] - public HResult CreateBitmap(Common.SizeU* size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + public HResult CreateBitmap(System.Drawing.Size size, void* srcData, uint pitch, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[65]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); + return ((delegate* unmanaged[Stdcall])(lpVtbl[65]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), size, srcData, pitch, bitmapProperties, bitmap); } /// @@ -27342,9 +27342,9 @@ public unsafe partial struct ID2D1DeviceContext6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(73)] - public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, Common.SizeU* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + public HResult CreateCompatibleRenderTarget(System.Drawing.SizeF* desiredSize, System.Drawing.Size* desiredPixelSize, Common.PixelFormat* desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[73]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); + return ((delegate* unmanaged[Stdcall])(lpVtbl[73]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget); } /// @@ -27638,7 +27638,7 @@ public unsafe partial struct ID2D1DeviceContext6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(110)] - public HResult EndDraw(ulong* tag1, ulong* tag2) + public HResult EndDraw(ulong* tag1 = null, ulong* tag2 = null) { return ((delegate* unmanaged[Stdcall])(lpVtbl[110]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this), tag1, tag2); } @@ -27678,9 +27678,9 @@ public unsafe partial struct ID2D1DeviceContext6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(115)] - public Graphics.Direct2D.Common.SizeU GetPixelSize() + public System.Drawing.Size GetPixelSize() { - return ((delegate* unmanaged[Stdcall])(lpVtbl[115]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this)); + return ((delegate* unmanaged[Stdcall])(lpVtbl[115]))((ID2D1DeviceContext6*)Unsafe.AsPointer(ref this)); } /// diff --git a/src/Vortice.Win32/Generated/Graphics/Direct3D11.cs b/src/Vortice.Win32/Generated/Graphics/Direct3D11.cs index 0f815d6..f22e0f7 100644 --- a/src/Vortice.Win32/Generated/Graphics/Direct3D11.cs +++ b/src/Vortice.Win32/Generated/Graphics/Direct3D11.cs @@ -18573,9 +18573,9 @@ public unsafe partial struct ID3D11VideoContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(17)] - public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size* Size) + public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size Size) { - ((delegate* unmanaged[Stdcall])(lpVtbl[17]))((ID3D11VideoContext*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); + ((delegate* unmanaged[Stdcall])(lpVtbl[17]))((ID3D11VideoContext*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); } /// @@ -18629,9 +18629,9 @@ public unsafe partial struct ID3D11VideoContext /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(24)] - public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size** pSize) + public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size* pSize) { - ((delegate* unmanaged[Stdcall])(lpVtbl[24]))((ID3D11VideoContext*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); + ((delegate* unmanaged[Stdcall])(lpVtbl[24]))((ID3D11VideoContext*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); } /// @@ -21875,9 +21875,9 @@ public unsafe partial struct ID3D11VideoContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(13)] - public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size* Size) + public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size Size) { - ((delegate* unmanaged[Stdcall])(lpVtbl[13]))((ID3D11VideoContext1*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); + ((delegate* unmanaged[Stdcall])(lpVtbl[13]))((ID3D11VideoContext1*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); } /// @@ -21931,9 +21931,9 @@ public unsafe partial struct ID3D11VideoContext1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(20)] - public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size** pSize) + public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size* pSize) { - ((delegate* unmanaged[Stdcall])(lpVtbl[20]))((ID3D11VideoContext1*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); + ((delegate* unmanaged[Stdcall])(lpVtbl[20]))((ID3D11VideoContext1*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); } /// @@ -30465,9 +30465,9 @@ public unsafe partial struct ID3D11VideoContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(27)] - public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size* Size) + public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size Size) { - ((delegate* unmanaged[Stdcall])(lpVtbl[27]))((ID3D11VideoContext2*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); + ((delegate* unmanaged[Stdcall])(lpVtbl[27]))((ID3D11VideoContext2*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); } /// @@ -30521,9 +30521,9 @@ public unsafe partial struct ID3D11VideoContext2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(34)] - public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size** pSize) + public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size* pSize) { - ((delegate* unmanaged[Stdcall])(lpVtbl[34]))((ID3D11VideoContext2*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); + ((delegate* unmanaged[Stdcall])(lpVtbl[34]))((ID3D11VideoContext2*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); } /// @@ -31445,9 +31445,9 @@ public unsafe partial struct ID3D11VideoContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(31)] - public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size* Size) + public void VideoProcessorSetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32 Enable, System.Drawing.Size Size) { - ((delegate* unmanaged[Stdcall])(lpVtbl[31]))((ID3D11VideoContext3*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); + ((delegate* unmanaged[Stdcall])(lpVtbl[31]))((ID3D11VideoContext3*)Unsafe.AsPointer(ref this), pVideoProcessor, Enable, Size); } /// @@ -31501,9 +31501,9 @@ public unsafe partial struct ID3D11VideoContext3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(38)] - public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size** pSize) + public void VideoProcessorGetOutputConstriction(ID3D11VideoProcessor* pVideoProcessor, Bool32* pEnabled, System.Drawing.Size* pSize) { - ((delegate* unmanaged[Stdcall])(lpVtbl[38]))((ID3D11VideoContext3*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); + ((delegate* unmanaged[Stdcall])(lpVtbl[38]))((ID3D11VideoContext3*)Unsafe.AsPointer(ref this), pVideoProcessor, pEnabled, pSize); } /// diff --git a/src/Vortice.Win32/Generated/Graphics/DirectWrite.cs b/src/Vortice.Win32/Generated/Graphics/DirectWrite.cs index d378c46..5a27326 100644 --- a/src/Vortice.Win32/Generated/Graphics/DirectWrite.cs +++ b/src/Vortice.Win32/Generated/Graphics/DirectWrite.cs @@ -2363,23 +2363,6 @@ public partial struct Panose #endregion Unions #region Structs -/// -/// DWRITE_COLOR_F -public partial struct ColorF -{ - /// - public float r; - - /// - public float g; - - /// - public float b; - - /// - public float a; -} - /// /// DWRITE_FONT_METRICS public partial struct FontMetrics @@ -2933,7 +2916,7 @@ public partial struct ColorGlyphRun public float baselineOriginY; /// - public ColorF runColor; + public Win32.Graphics.Direct2D.Common.ColorF runColor; /// public ushort paletteIndex; @@ -3018,7 +3001,7 @@ public partial struct GlyphImageData public uint pixelsPerEm; /// - public Graphics.Direct2D.Common.SizeU pixelSize; + public System.Drawing.Size pixelSize; /// public System.Drawing.Point horizontalLeftOrigin; @@ -6107,9 +6090,9 @@ public unsafe partial struct IDWriteBitmapRenderTarget /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(9)] - public HResult GetSize(System.Drawing.Size** size) + public HResult GetSize(System.Drawing.Size* size) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((IDWriteBitmapRenderTarget*)Unsafe.AsPointer(ref this), size); + return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((IDWriteBitmapRenderTarget*)Unsafe.AsPointer(ref this), size); } /// @@ -8475,9 +8458,9 @@ public unsafe partial struct IDWriteBitmapRenderTarget1 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(9)] - public HResult GetSize(System.Drawing.Size** size) + public HResult GetSize(System.Drawing.Size* size) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((IDWriteBitmapRenderTarget1*)Unsafe.AsPointer(ref this), size); + return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((IDWriteBitmapRenderTarget1*)Unsafe.AsPointer(ref this), size); } /// @@ -10523,9 +10506,9 @@ public unsafe partial struct IDWriteFontFace2 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(33)] - public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, ColorF* paletteEntries) + public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, Win32.Graphics.Direct2D.Common.ColorF** paletteEntries) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[33]))((IDWriteFontFace2*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); + return ((delegate* unmanaged[Stdcall])(lpVtbl[33]))((IDWriteFontFace2*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); } /// @@ -12585,9 +12568,9 @@ public unsafe partial struct IDWriteFontFace3 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(6)] - public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, ColorF* paletteEntries) + public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, Win32.Graphics.Direct2D.Common.ColorF** paletteEntries) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[6]))((IDWriteFontFace3*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); + return ((delegate* unmanaged[Stdcall])(lpVtbl[6]))((IDWriteFontFace3*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); } /// @@ -14681,9 +14664,9 @@ public unsafe partial struct IDWriteFontFace4 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(20)] - public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, ColorF* paletteEntries) + public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, Win32.Graphics.Direct2D.Common.ColorF** paletteEntries) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[20]))((IDWriteFontFace4*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); + return ((delegate* unmanaged[Stdcall])(lpVtbl[20]))((IDWriteFontFace4*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); } /// @@ -16943,9 +16926,9 @@ public unsafe partial struct IDWriteFontFace5 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(24)] - public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, ColorF* paletteEntries) + public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, Win32.Graphics.Direct2D.Common.ColorF** paletteEntries) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[24]))((IDWriteFontFace5*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); + return ((delegate* unmanaged[Stdcall])(lpVtbl[24]))((IDWriteFontFace5*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); } /// @@ -21001,9 +20984,9 @@ public unsafe partial struct IDWriteFontFace6 /// [MethodImpl(MethodImplOptions.AggressiveInlining)] [VtblIndex(29)] - public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, ColorF* paletteEntries) + public HResult GetPaletteEntries(uint colorPaletteIndex, uint firstEntryIndex, uint entryCount, Win32.Graphics.Direct2D.Common.ColorF** paletteEntries) { - return ((delegate* unmanaged[Stdcall])(lpVtbl[29]))((IDWriteFontFace6*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); + return ((delegate* unmanaged[Stdcall])(lpVtbl[29]))((IDWriteFontFace6*)Unsafe.AsPointer(ref this), colorPaletteIndex, firstEntryIndex, entryCount, paletteEntries); } /// diff --git a/src/Vortice.Win32/Graphics/Direct2D/ID2D1Effect.cs b/src/Vortice.Win32/Graphics/Direct2D/ID2D1Effect.cs new file mode 100644 index 0000000..7d007d3 --- /dev/null +++ b/src/Vortice.Win32/Graphics/Direct2D/ID2D1Effect.cs @@ -0,0 +1,76 @@ +// Copyright © Amer Koleci and Contributors. +// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. + +namespace Win32.Graphics.Direct2D; + +public unsafe partial struct ID2D1Effect +{ + public HResult SetValueByName(ReadOnlySpan name, ReadOnlySpan data) + where T : unmanaged + { + fixed (char* namePtr = name) + { + fixed (T* dataPtr = data) + { + return SetValueByName((ushort*)namePtr, PropertyType.Unknown, (byte*)dataPtr, (uint)(data.Length * sizeof(T))); + } + } + } + + public HResult SetValueByName(ReadOnlySpan name, byte* data, uint dataSize) + { + fixed (char* namePtr = name) + { + return SetValueByName((ushort*)namePtr, PropertyType.Unknown, data, dataSize); + } + } + + public HResult SetValueByName(ushort* name, byte* data, uint dataSize) + { + return SetValueByName(name, PropertyType.Unknown, data, dataSize); + } + + public HResult SetValue(uint index, byte* data, uint dataSize) + { + return SetValue(index, PropertyType.Unknown, data, dataSize); + } + + public HResult GetValueByName(ushort* name, byte* data, uint dataSize) + { + return GetValueByName(name, PropertyType.Unknown, data, dataSize); + } + + public HResult GetValueByName(ReadOnlySpan name, byte* data, uint dataSize) + { + fixed (char* namePtr = name) + { + return GetValueByName((ushort*)namePtr, PropertyType.Unknown, data, dataSize); + } + } + + public HResult GetValue(uint index, byte* data, uint dataSize) + { + return GetValue(index, PropertyType.Unknown, data, dataSize); + } + + public void SetInput(uint index, ID2D1Image* input) + { + SetInput(index, input, 1); + } + + public void SetInputEffect(uint index, ID2D1Effect* inputEffect, bool invalidate = true) + { + ID2D1Image* output = null; + + if (inputEffect != null) + { + inputEffect->GetOutput(&output); + } + + SetInput(index, output, invalidate); + if (output != null) + { + _ = output->Release(); + } + } +} diff --git a/src/Vortice.Win32/Graphics/Direct2D/ID2D1RenderTarget.cs b/src/Vortice.Win32/Graphics/Direct2D/ID2D1RenderTarget.cs new file mode 100644 index 0000000..fcfa370 --- /dev/null +++ b/src/Vortice.Win32/Graphics/Direct2D/ID2D1RenderTarget.cs @@ -0,0 +1,86 @@ +// Copyright © Amer Koleci and Contributors. +// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. + +using System.Drawing; +using Win32.Graphics.Direct2D.Common; +using Win32.Graphics.Imaging; + +namespace Win32.Graphics.Direct2D; + +public unsafe partial struct ID2D1RenderTarget +{ + public HResult CreateBitmap(Size size, BitmapProperties* bitmapProperties, ID2D1Bitmap** bitmap) + { + return CreateBitmap(size, null, 0, bitmapProperties, bitmap); + } + + public HResult CreateBitmapFromWicBitmap(IWICBitmapSource* wicBitmapSource, ID2D1Bitmap** bitmap) + { + return CreateBitmapFromWicBitmap(wicBitmapSource, null, bitmap); + } + + public HResult CreateBitmapBrush(ID2D1Bitmap* bitmap, ID2D1BitmapBrush** bitmapBrush) + { + return CreateBitmapBrush(bitmap, null, null, bitmapBrush); + } + + public HResult CreateBitmapBrush(ID2D1Bitmap* bitmap, BitmapBrushProperties* bitmapBrushProperties, ID2D1BitmapBrush** bitmapBrush) + { + return CreateBitmapBrush(bitmap, bitmapBrushProperties, null, bitmapBrush); + } + + public HResult CreateSolidColorBrush(ColorF* color, ID2D1SolidColorBrush** solidColorBrush) + { + return CreateSolidColorBrush(color, null, solidColorBrush); + } + + public HResult CreateGradientStopCollection(GradientStop* gradientStops, uint gradientStopsCount, ID2D1GradientStopCollection** gradientStopCollection) + { + return CreateGradientStopCollection(gradientStops, gradientStopsCount, Gamma.Gamma_2_2, ExtendMode.Clamp, gradientStopCollection); + } + + public HResult CreateLinearGradientBrush(LinearGradientBrushProperties* linearGradientBrushProperties, ID2D1GradientStopCollection* gradientStopCollection, ID2D1LinearGradientBrush** linearGradientBrush) + { + return CreateLinearGradientBrush(linearGradientBrushProperties, null, gradientStopCollection, linearGradientBrush); + } + + public HResult CreateRadialGradientBrush(RadialGradientBrushProperties* radialGradientBrushProperties, ID2D1GradientStopCollection* gradientStopCollection, ID2D1RadialGradientBrush** radialGradientBrush) + { + return CreateRadialGradientBrush(radialGradientBrushProperties, null, gradientStopCollection, radialGradientBrush); + } + + public HResult CreateCompatibleRenderTarget(ID2D1BitmapRenderTarget** bitmapRenderTarget) + { + return CreateCompatibleRenderTarget(null, null, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget); + } + + public HResult CreateCompatibleRenderTarget(SizeF desiredSize, ID2D1BitmapRenderTarget** bitmapRenderTarget) + { + return CreateCompatibleRenderTarget(&desiredSize, null, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget); + } + + public HResult CreateCompatibleRenderTarget(SizeF desiredSize, Size desiredPixelSize, ID2D1BitmapRenderTarget** bitmapRenderTarget) + { + return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, null, CompatibleRenderTargetOptions.None, bitmapRenderTarget); + } + + public HResult CreateCompatibleRenderTarget(SizeF desiredSize, Size desiredPixelSize, PixelFormat desiredFormat, ID2D1BitmapRenderTarget** bitmapRenderTarget) + { + return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, CompatibleRenderTargetOptions.None, bitmapRenderTarget); + } + + public HResult CreateCompatibleRenderTarget(SizeF desiredSize, Size desiredPixelSize, PixelFormat desiredFormat, CompatibleRenderTargetOptions options, ID2D1BitmapRenderTarget** bitmapRenderTarget) + { + return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget); + } + + public HResult CreateLayer(SizeF size, ID2D1Layer** layer) + { + return CreateLayer(&size, layer); + } + + public HResult CreateLayer(ID2D1Layer** layer) + { + return CreateLayer(null, layer); + } +} diff --git a/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceExtensions.cs b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs similarity index 78% rename from src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceExtensions.cs rename to src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs index 777a5e3..ff839f2 100644 --- a/src/Vortice.Win32/Graphics/Direct3D11/ID3D11DeviceExtensions.cs +++ b/src/Vortice.Win32/Graphics/Direct3D11/ID3D11Device.cs @@ -3,13 +3,9 @@ namespace Win32.Graphics.Direct3D11; -/// -/// A with extensions for the type. -/// -public static unsafe class ID3D11DeviceExtensions +public unsafe partial struct ID3D11Device { - public static ComPtr CreateBuffer( - this ref ID3D11Device device, + public ComPtr CreateBuffer( in T data, BufferDescription description) where T : unmanaged { @@ -24,12 +20,12 @@ public static unsafe class ID3D11DeviceExtensions }; using ComPtr buffer = default; - device.CreateBuffer(&description, &subresourceData, buffer.GetAddressOf()).ThrowIfFailed(); + CreateBuffer(&description, &subresourceData, buffer.GetAddressOf()).ThrowIfFailed(); return buffer.Move(); } } - public static ComPtr CreateBuffer(this ref ID3D11Device device, ReadOnlySpan data, BufferDescription description) where T : unmanaged + public ComPtr CreateBuffer(ReadOnlySpan data, BufferDescription description) where T : unmanaged { if (description.ByteWidth == 0) description.ByteWidth = (uint)(sizeof(T) * data.Length); @@ -42,7 +38,7 @@ public static unsafe class ID3D11DeviceExtensions }; using ComPtr buffer = default; - device.CreateBuffer(&description, &subresourceData, buffer.GetAddressOf()).ThrowIfFailed(); + CreateBuffer(&description, &subresourceData, buffer.GetAddressOf()).ThrowIfFailed(); return buffer.Move(); } } @@ -60,8 +56,7 @@ public static unsafe class ID3D11DeviceExtensions /// Miscellaneous resource options. /// The size (in bytes) of the structure element for structured buffers. /// An initialized buffer - public static ComPtr CreateBuffer( - this ref ID3D11Device device, + public ComPtr CreateBuffer( ReadOnlySpan data, BindFlags bindFlags, Usage usage = Usage.Default, @@ -88,7 +83,7 @@ public static unsafe class ID3D11DeviceExtensions }; using ComPtr buffer = default; - device.CreateBuffer(&description, &subresourceData, buffer.GetAddressOf()).ThrowIfFailed(); + CreateBuffer(&description, &subresourceData, buffer.GetAddressOf()).ThrowIfFailed(); return buffer.Move(); } } diff --git a/src/Vortice.Win32/Graphics/Direct3D12/ID3D12Device.cs b/src/Vortice.Win32/Graphics/Direct3D12/ID3D12Device.cs new file mode 100644 index 0000000..817c7d5 --- /dev/null +++ b/src/Vortice.Win32/Graphics/Direct3D12/ID3D12Device.cs @@ -0,0 +1,17 @@ +// Copyright © Amer Koleci and Contributors. +// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. + +using Win32.Graphics.Dxgi; + +namespace Win32.Graphics.Direct3D12; + +public unsafe partial struct ID3D12Device +{ + public TFeature CheckFeatureSupport(Feature feature) + where TFeature : unmanaged + { + TFeature featureData = default; + CheckFeatureSupport(feature, &featureData, (uint)sizeof(TFeature)).ThrowIfFailed(); + return featureData; + } +} diff --git a/src/Vortice.Win32/Graphics/Direct3D12/ID3D12DeviceExtensions.cs b/src/Vortice.Win32/Graphics/Direct3D12/ID3D12DeviceExtensions.cs deleted file mode 100644 index 1ae04ef..0000000 --- a/src/Vortice.Win32/Graphics/Direct3D12/ID3D12DeviceExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright © Amer Koleci and Contributors. -// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. - -using Win32.Graphics.Dxgi; - -namespace Win32.Graphics.Direct3D12; - -/// -/// A with extensions for the type. -/// -public static unsafe class ID3D12DeviceExtensions -{ - public static TFeature CheckFeatureSupport(this ref ID3D12Device device, Feature feature) - where TFeature : unmanaged - { - TFeature featureData = default; - device.CheckFeatureSupport(feature, &featureData, (uint)sizeof(TFeature)).ThrowIfFailed(); - return featureData; - } -} diff --git a/src/Vortice.Win32/Graphics/DirectWrite/IDWriteFactoryExtensions.cs b/src/Vortice.Win32/Graphics/DirectWrite/IDWriteFactory.cs similarity index 81% rename from src/Vortice.Win32/Graphics/DirectWrite/IDWriteFactoryExtensions.cs rename to src/Vortice.Win32/Graphics/DirectWrite/IDWriteFactory.cs index 579a03c..d19f0b5 100644 --- a/src/Vortice.Win32/Graphics/DirectWrite/IDWriteFactoryExtensions.cs +++ b/src/Vortice.Win32/Graphics/DirectWrite/IDWriteFactory.cs @@ -6,13 +6,9 @@ using Win32.Graphics.Imaging; namespace Win32.Graphics.DirectWrite; -/// -/// A with extensions for the type. -/// -public static unsafe class IDWriteFactoryExtensions +public unsafe partial struct IDWriteFactory { - public static ComPtr CreateTextFormat( - this ref IDWriteFactory factory, + public ComPtr CreateTextFormat( ReadOnlySpan fontFamilyName, float fontSize, FontWeight fontWeight = FontWeight.Normal, @@ -23,7 +19,7 @@ public static unsafe class IDWriteFactoryExtensions fixed (char* fontFamilyNamePtr = fontFamilyName) { - factory.CreateTextFormat( + CreateTextFormat( (ushort*)fontFamilyNamePtr, null, fontWeight, @@ -37,8 +33,7 @@ public static unsafe class IDWriteFactoryExtensions } } - public static ComPtr CreateTextFormat( - this ref IDWriteFactory factory, + public ComPtr CreateTextFormat( ReadOnlySpan fontFamilyName, float fontSize, ReadOnlySpan localeName, @@ -52,7 +47,7 @@ public static unsafe class IDWriteFactoryExtensions { fixed (char* localeNamePtr = localeName) { - factory.CreateTextFormat( + CreateTextFormat( (ushort*)fontFamilyNamePtr, null, fontWeight, @@ -67,8 +62,7 @@ public static unsafe class IDWriteFactoryExtensions } } - public static ComPtr CreateTextFormat( - this ref IDWriteFactory factory, + public ComPtr CreateTextFormat( ReadOnlySpan fontFamilyName, IDWriteFontCollection* fontCollection, float fontSize, @@ -83,7 +77,7 @@ public static unsafe class IDWriteFactoryExtensions { fixed (char* localeNamePtr = localeName) { - factory.CreateTextFormat( + CreateTextFormat( (ushort*)fontFamilyNamePtr, fontCollection, fontWeight, diff --git a/src/Vortice.Win32/Graphics/Imaging/IWICBitmapSource.cs b/src/Vortice.Win32/Graphics/Imaging/IWICBitmapSource.cs new file mode 100644 index 0000000..256b86e --- /dev/null +++ b/src/Vortice.Win32/Graphics/Imaging/IWICBitmapSource.cs @@ -0,0 +1,27 @@ +// Copyright © Amer Koleci and Contributors. +// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. + +using System.Drawing; + +namespace Win32.Graphics.Imaging; + +public unsafe partial struct IWICBitmapSource +{ + public HResult CopyPixels(int stride, ReadOnlySpan data) + where T : unmanaged + { + fixed (T* dataPtr = data) + { + return CopyPixels(null, (uint)stride, (uint)(data.Length * sizeof(T)), (byte*)dataPtr); + } + } + + public HResult CopyPixels(Rectangle rect, int stride, ReadOnlySpan data) + where T : unmanaged + { + fixed (T* dataPtr = data) + { + return CopyPixels(&rect, (uint)stride, (uint)(data.Length * sizeof(T)), (byte*)dataPtr); + } + } +} diff --git a/src/Vortice.Win32/Graphics/Imaging/IWICBitmapSourceExtensions.cs b/src/Vortice.Win32/Graphics/Imaging/IWICBitmapSourceExtensions.cs deleted file mode 100644 index e3e9df7..0000000 --- a/src/Vortice.Win32/Graphics/Imaging/IWICBitmapSourceExtensions.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright © Amer Koleci and Contributors. -// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information. - -using System.Drawing; - -namespace Win32.Graphics.Imaging; - -/// -/// A with extensions for the type. -/// -public static unsafe class IWICBitmapSourceExtensions -{ - public static HResult CopyPixels(this ref IWICBitmapSource source, int stride, ReadOnlySpan data) - where T : unmanaged - { - fixed (T* dataPtr = data) - { - return source.CopyPixels(null, (uint)stride, (uint)(data.Length * sizeof(T)), (byte*)dataPtr); - } - } - - public static HResult CopyPixels(this ref IWICBitmapSource source, Rectangle rect, int stride, ReadOnlySpan data) - where T : unmanaged - { - fixed (T* dataPtr = data) - { - return source.CopyPixels(&rect, (uint)stride, (uint)(data.Length * sizeof(T)), (byte*)dataPtr); - } - } -} diff --git a/src/Vortice.Win32/Graphics/Imaging/IWICImagingFactoryExtensions.cs b/src/Vortice.Win32/Graphics/Imaging/IWICImagingFactory.cs similarity index 62% rename from src/Vortice.Win32/Graphics/Imaging/IWICImagingFactoryExtensions.cs rename to src/Vortice.Win32/Graphics/Imaging/IWICImagingFactory.cs index 787d893..443d736 100644 --- a/src/Vortice.Win32/Graphics/Imaging/IWICImagingFactoryExtensions.cs +++ b/src/Vortice.Win32/Graphics/Imaging/IWICImagingFactory.cs @@ -3,22 +3,17 @@ namespace Win32.Graphics.Imaging; -/// -/// A with extensions for the type. -/// -public static unsafe class IWICImagingFactoryExtensions +public unsafe partial struct IWICImagingFactory { - public static ComPtr CreateDecoderFromFilename( - this ref IWICImagingFactory factory, + public ComPtr CreateDecoderFromFilename( string filename, FileAccess desiredAccess = FileAccess.Read, WICDecodeOptions metadataOptions = WICDecodeOptions.CacheOnDemand) { - return CreateDecoderFromFilename(ref factory, filename.AsSpan(), desiredAccess, metadataOptions); + return CreateDecoderFromFilename(filename.AsSpan(), desiredAccess, metadataOptions); } - public static ComPtr CreateDecoderFromFilename( - this ref IWICImagingFactory factory, + public ComPtr CreateDecoderFromFilename( ReadOnlySpan filename, FileAccess desiredAccess = FileAccess.Read, WICDecodeOptions metadataOptions = WICDecodeOptions.CacheOnDemand) @@ -29,7 +24,7 @@ public static unsafe class IWICImagingFactoryExtensions fixed (char* filenamePtr = filename) { - factory.CreateDecoderFromFilename( + CreateDecoderFromFilename( (ushort*)filenamePtr, null, nativeAccess, diff --git a/src/samples/01-ClearScreen/Program.cs b/src/samples/01-ClearScreen/Program.cs index a329f82..4395d96 100644 --- a/src/samples/01-ClearScreen/Program.cs +++ b/src/samples/01-ClearScreen/Program.cs @@ -82,6 +82,9 @@ public static unsafe class Program private static void TestD2D1AndDWrite() { + using ComPtr effect = default; + //effect.Get()->SetInput(); + using ComPtr d2d1Factory2 = default; D2D1CreateFactory(FactoryType.MultiThreaded,