mirror of
https://github.com/amerkoleci/Vortice.Win32.git
synced 2026-01-14 08:06:02 +08:00
Bindings: Add DirectWrite and Direct2D1 support.
This commit is contained in:
@@ -57,46 +57,6 @@ public class ApiParameter
|
||||
public List<object> Attrs { get; set; } = new();
|
||||
}
|
||||
|
||||
public class ApiFunction
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool SetLastError { get; set; }
|
||||
public string DllImport { get; set; }
|
||||
public ApiDataType ReturnType { get; set; }
|
||||
public List<object> ReturnAttrs { get; set; }
|
||||
|
||||
public IList<ApiParameter> Params { get; set; } = new List<ApiParameter>();
|
||||
public List<object> Attrs { get; set; }
|
||||
|
||||
private string _toString = default;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_toString))
|
||||
{
|
||||
StringBuilder builder = new();
|
||||
builder.Append(ReturnType.Name).Append(' ');
|
||||
builder.Append(Name).Append('(');
|
||||
int parameterIndex = 0;
|
||||
foreach (var parameter in Params)
|
||||
{
|
||||
// TODO: Handle PointerTo, Array etc
|
||||
builder.Append(parameter.Type.Name).Append(' ').Append(parameter.Name);
|
||||
if (parameterIndex < Params.Count - 1)
|
||||
{
|
||||
builder.Append(", ");
|
||||
}
|
||||
parameterIndex++;
|
||||
}
|
||||
|
||||
builder.Append(')');
|
||||
_toString = builder.ToString();
|
||||
}
|
||||
|
||||
return _toString;
|
||||
}
|
||||
}
|
||||
|
||||
public class ApiType
|
||||
{
|
||||
public string Name { get; set; }
|
||||
@@ -118,18 +78,19 @@ public class ApiType
|
||||
// Com
|
||||
public string Guid { get; set; }
|
||||
public ApiDataType Interface { get; set; }
|
||||
public IList<ApiFunction> Methods { get; set; } = new List<ApiFunction>();
|
||||
public IList<ApiType> Methods { get; set; } = new List<ApiType>();
|
||||
|
||||
// Function
|
||||
public bool SetLastError { get; set; }
|
||||
public ApiDataType ReturnType { get; set; }
|
||||
public List<object> ReturnAttrs { get; set; }
|
||||
public IList<ApiParameter> Params { get; set; } = new List<ApiParameter>();
|
||||
public string DllImport { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ApiData
|
||||
{
|
||||
public ApiDataConstant[] Constants { get; set; }
|
||||
public ApiType[] Types { get; set; }
|
||||
public ApiFunction[] Functions { get; set; }
|
||||
public ApiType[] Functions { get; set; }
|
||||
}
|
||||
|
||||
@@ -62,10 +62,15 @@ public sealed class CodeWriter : IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
string content = _builder.ToString();
|
||||
File.WriteAllText(_fileName, content);
|
||||
if (string.IsNullOrEmpty(_fileName) == false)
|
||||
{
|
||||
string content = _builder.ToString();
|
||||
File.WriteAllText(_fileName, content);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => _builder.ToString();
|
||||
|
||||
public void Write(char chr)
|
||||
{
|
||||
WriteIndented(chr);
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// 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;
|
||||
@@ -25,9 +27,8 @@ public static class Program
|
||||
"Graphics.Direct2D.Common.json",
|
||||
"Graphics.Imaging.json",
|
||||
"Graphics.DirectWrite.json",
|
||||
//"Graphics.Direct2D.json",
|
||||
|
||||
//"Graphics.Imaging.D2D.json",
|
||||
"Graphics.Direct2D.json",
|
||||
"Graphics.Imaging.D2D.json",
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> s_csNameMappings = new()
|
||||
@@ -103,6 +104,10 @@ public static class Program
|
||||
|
||||
{ "Graphics.Imaging.WICRect", "System.Drawing.Rectangle" },
|
||||
|
||||
{ "Graphics.Direct2D.Matrix4x3F", "Win32.Graphics.Direct2D.Common.Matrix4x3" },
|
||||
{ "Graphics.Direct2D.Matrix4x4F", "Matrix4x4" },
|
||||
{ "Graphics.Direct2D.Matrix5x4F", "Win32.Graphics.Direct2D.Common.Matrix5x4" },
|
||||
|
||||
// TODO: Understand those ->
|
||||
{ "Foundation.RECT", "RawRect" },
|
||||
{ "Foundation.RECTL", "RawRect" },
|
||||
@@ -865,7 +870,7 @@ public static class Program
|
||||
|
||||
private static readonly HashSet<string> s_visitedEnums = new();
|
||||
private static readonly HashSet<string> s_visitedStructs = new();
|
||||
private static readonly Dictionary<string, List<KeyValuePair<ApiFunction, string>>> s_visitedComTypes = new();
|
||||
private static readonly Dictionary<string, List<KeyValuePair<ApiType, string>>> s_visitedComTypes = new();
|
||||
|
||||
private static bool s_generateUnmanagedDocs = true;
|
||||
|
||||
@@ -1113,7 +1118,7 @@ public static class Program
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
GenerateStruct(writer, structType);
|
||||
GenerateStruct(api, writer, structType);
|
||||
|
||||
s_visitedStructs.Add($"{writer.Api}.{structType.Name}");
|
||||
}
|
||||
@@ -1146,7 +1151,7 @@ public static class Program
|
||||
regionWritten = true;
|
||||
}
|
||||
|
||||
GenerateStruct(writer, structType);
|
||||
GenerateStruct(api, writer, structType);
|
||||
|
||||
s_visitedStructs.Add($"{writer.Api}.{structType.Name}");
|
||||
}
|
||||
@@ -1181,7 +1186,7 @@ public static class Program
|
||||
}
|
||||
|
||||
// Generate methods
|
||||
List<KeyValuePair<ApiFunction, string>> methodsToGenerate = new();
|
||||
List<KeyValuePair<ApiType, string>> methodsToGenerate = new();
|
||||
ApiType iterateType = comType;
|
||||
while (iterateType.Interface != null
|
||||
&& iterateType.Interface.Name != "IUnknown"
|
||||
@@ -1193,8 +1198,12 @@ public static class Program
|
||||
|
||||
if (iterateType != null)
|
||||
{
|
||||
foreach (ApiFunction method in iterateType.Methods)
|
||||
foreach (ApiType method in iterateType.Methods)
|
||||
{
|
||||
// Until we add Storage.Xps.Printing.IPrintDocumentPackageTarget
|
||||
if (method.Name == "CreatePrintControl")
|
||||
continue;
|
||||
|
||||
methodsToGenerate.Add(new(method, iterateType.Name));
|
||||
}
|
||||
}
|
||||
@@ -1211,8 +1220,12 @@ public static class Program
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ApiFunction method in comType.Methods)
|
||||
foreach (ApiType method in comType.Methods)
|
||||
{
|
||||
// Until we add Storage.Xps.Printing.IPrintDocumentPackageTarget
|
||||
if (method.Name == "CreatePrintControl")
|
||||
continue;
|
||||
|
||||
methodsToGenerate.Add(new(method, comType.Name));
|
||||
}
|
||||
|
||||
@@ -1234,7 +1247,7 @@ public static class Program
|
||||
writer.WriteLine($"#region Functions");
|
||||
using (writer.PushBlock($"public static unsafe partial class Apis"))
|
||||
{
|
||||
foreach (ApiFunction function in api.Functions)
|
||||
foreach (ApiType function in api.Functions)
|
||||
{
|
||||
if (function.Name.StartsWith("D3DX11") ||
|
||||
function.Name == "D3DDisassemble11Trace")
|
||||
@@ -1242,7 +1255,7 @@ public static class Program
|
||||
continue;
|
||||
}
|
||||
|
||||
WriteFunction(writer, api, function);
|
||||
WriteFunction(writer, api, function, string.Empty, false);
|
||||
writer.WriteLine();
|
||||
}
|
||||
}
|
||||
@@ -1250,7 +1263,12 @@ public static class Program
|
||||
writer.WriteLine($"#endregion Functions");
|
||||
}
|
||||
|
||||
private static void WriteFunction(CodeWriter writer, ApiData api, ApiFunction function)
|
||||
private static void WriteFunction(
|
||||
CodeWriter writer,
|
||||
ApiData api,
|
||||
ApiType function,
|
||||
string functionName,
|
||||
bool asCallback)
|
||||
{
|
||||
string returnType = GetTypeName(function.ReturnType);
|
||||
string functionSuffix = string.Empty;
|
||||
@@ -1303,7 +1321,13 @@ public static class Program
|
||||
}
|
||||
}
|
||||
|
||||
argumentBuilder.Append(parameterType).Append(' ').Append(parameterName);
|
||||
argumentBuilder.Append(parameterType);
|
||||
|
||||
if (asCallback == false)
|
||||
{
|
||||
argumentBuilder.Append(' ').Append(parameterName);
|
||||
}
|
||||
|
||||
if (isOptional == true)
|
||||
{
|
||||
//argumentBuilder.Append(" = default");
|
||||
@@ -1323,7 +1347,21 @@ public static class Program
|
||||
}
|
||||
|
||||
string argumentsString = argumentBuilder.ToString();
|
||||
writer.Write($"public {functionSuffix}{returnType} {function.Name}({argumentsString})");
|
||||
if (string.IsNullOrEmpty(functionName))
|
||||
{
|
||||
functionName = function.Name;
|
||||
}
|
||||
|
||||
writer.Write("public ");
|
||||
if (asCallback)
|
||||
{
|
||||
writer.Write($"unsafe delegate* unmanaged[Stdcall]<{argumentsString}, {returnType}> {functionName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write($"{functionSuffix}{returnType} {functionName}({argumentsString})");
|
||||
}
|
||||
|
||||
writer.WriteLine(";");
|
||||
}
|
||||
|
||||
@@ -1480,7 +1518,7 @@ public static class Program
|
||||
return enumValueName;
|
||||
}
|
||||
|
||||
private static void GenerateStruct(CodeWriter writer, ApiType structType, bool nestedType = false)
|
||||
private static void GenerateStruct(ApiData api, CodeWriter writer, ApiType structType, bool nestedType = false)
|
||||
{
|
||||
string csTypeName;
|
||||
string structPrefix = string.Empty;
|
||||
@@ -1516,11 +1554,6 @@ public static class Program
|
||||
writer.WriteLine("[StructLayout(LayoutKind.Explicit)]");
|
||||
}
|
||||
|
||||
if (structType.Name == "D2D_MATRIX_3X2_F")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
using (writer.PushBlock($"public partial struct {csTypeName}"))
|
||||
{
|
||||
int fieldIndex = 0;
|
||||
@@ -1542,7 +1575,24 @@ public static class Program
|
||||
fieldValueName = "Mask";
|
||||
}
|
||||
|
||||
string fieldTypeName = GetTypeName(field.Type);
|
||||
if (structType.Name == "D2D1_LAYER_PARAMETERS")
|
||||
{
|
||||
}
|
||||
|
||||
bool asPointer = false;
|
||||
if (field.Type.Kind == "ApiRef")
|
||||
{
|
||||
string apiName = GetApiName(field.Type);
|
||||
string fullTypeName = $"{apiName}.{field.Type.Name}";
|
||||
|
||||
if (s_visitedComTypes.ContainsKey(fullTypeName) ||
|
||||
api.Types.Any(item => item.Name == field.Type.Name && item.Kind.ToLowerInvariant() == "com"))
|
||||
{
|
||||
asPointer = true;
|
||||
}
|
||||
}
|
||||
|
||||
string fieldTypeName = GetTypeName(field.Type, asPointer);
|
||||
|
||||
writer.WriteLine($"/// <include file='../{writer.DocFileName}.xml' path='doc/member[@name=\"{structType.Name}::{field.Name}\"]/*' />");
|
||||
|
||||
@@ -1616,20 +1666,28 @@ public static class Program
|
||||
else
|
||||
{
|
||||
string unsafePrefix = string.Empty;
|
||||
fieldTypeName = NormalizeTypeName(writer.Api, fieldTypeName);
|
||||
if (fieldTypeName.EndsWith("*"))
|
||||
|
||||
if (field.Type.TargetKind == "FunctionPointer")
|
||||
{
|
||||
unsafePrefix += "unsafe ";
|
||||
ApiType functionType = api.Types.First(item => item.Name == field.Type.Name && item.Kind == "FunctionPointer");
|
||||
WriteFunction(writer, api, functionType, field.Name, true);
|
||||
}
|
||||
|
||||
if (isUnion)
|
||||
else
|
||||
{
|
||||
writer.WriteLine("[FieldOffset(0)]");
|
||||
fieldTypeName = NormalizeTypeName(writer.Api, fieldTypeName);
|
||||
if (fieldTypeName.EndsWith("*"))
|
||||
{
|
||||
unsafePrefix += "unsafe ";
|
||||
}
|
||||
|
||||
if (isUnion)
|
||||
{
|
||||
writer.WriteLine("[FieldOffset(0)]");
|
||||
}
|
||||
|
||||
fieldValueName = CleanupName(fieldValueName);
|
||||
writer.WriteLine($"public {unsafePrefix}{fieldTypeName} {fieldValueName};");
|
||||
}
|
||||
|
||||
fieldValueName = CleanupName(fieldValueName);
|
||||
|
||||
writer.WriteLine($"public {unsafePrefix}{fieldTypeName} {fieldValueName};");
|
||||
}
|
||||
|
||||
if (fieldIndex < structType.Fields.Length - 1)
|
||||
@@ -1713,7 +1771,7 @@ public static class Program
|
||||
|
||||
foreach (ApiType nestedTypeToGenerate in structType.NestedTypes)
|
||||
{
|
||||
GenerateStruct(writer, nestedTypeToGenerate, true);
|
||||
GenerateStruct(api, writer, nestedTypeToGenerate, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1725,7 +1783,7 @@ public static class Program
|
||||
ApiData api,
|
||||
CodeWriter writer,
|
||||
ApiType comType,
|
||||
List<KeyValuePair<ApiFunction, string>> methodsToGenerate)
|
||||
List<KeyValuePair<ApiType, string>> methodsToGenerate)
|
||||
{
|
||||
string csTypeName = comType.Name;
|
||||
|
||||
@@ -1812,14 +1870,14 @@ public static class Program
|
||||
}
|
||||
|
||||
bool needNewLine = false;
|
||||
foreach (KeyValuePair<ApiFunction, string> methodPair in methodsToGenerate)
|
||||
foreach (KeyValuePair<ApiType, string> methodPair in methodsToGenerate)
|
||||
{
|
||||
if (needNewLine)
|
||||
{
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
ApiFunction method = methodPair.Key;
|
||||
ApiType method = methodPair.Key;
|
||||
string docName = methodPair.Value;
|
||||
|
||||
// TODO: Handle inherit
|
||||
@@ -2308,6 +2366,10 @@ public static class Program
|
||||
{
|
||||
return "Rate" + prettyName;
|
||||
}
|
||||
else if (enumPrefix.Contains("_LEVEL"))
|
||||
{
|
||||
return "Level_" + prettyName;
|
||||
}
|
||||
|
||||
return "_" + prettyName;
|
||||
}
|
||||
@@ -2386,7 +2448,8 @@ public static class Program
|
||||
if (dataType.Kind == "ApiRef")
|
||||
{
|
||||
string apiName = GetApiName(dataType);
|
||||
string typeName = GetTypeName($"{apiName}.{dataType.Name}");
|
||||
string fullTypeName = $"{apiName}.{dataType.Name}";
|
||||
string typeName = GetTypeName(fullTypeName);
|
||||
return asPointer ? typeName + "*" : typeName;
|
||||
}
|
||||
else if (dataType.Kind == "Array")
|
||||
|
||||
28756
src/Vortice.Win32/Generated/Graphics/Direct2D.cs
Normal file
28756
src/Vortice.Win32/Generated/Graphics/Direct2D.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10864,7 +10864,7 @@ public partial struct VideoProcessorStream
|
||||
public unsafe ID3D11VideoProcessorInputView* ppPastSurfaces;
|
||||
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_VIDEO_PROCESSOR_STREAM::pInputSurface"]/*' />
|
||||
public ID3D11VideoProcessorInputView pInputSurface;
|
||||
public unsafe ID3D11VideoProcessorInputView* pInputSurface;
|
||||
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_VIDEO_PROCESSOR_STREAM::ppFutureSurfaces"]/*' />
|
||||
public unsafe ID3D11VideoProcessorInputView* ppFutureSurfaces;
|
||||
@@ -10873,7 +10873,7 @@ public partial struct VideoProcessorStream
|
||||
public unsafe ID3D11VideoProcessorInputView* ppPastSurfacesRight;
|
||||
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_VIDEO_PROCESSOR_STREAM::pInputSurfaceRight"]/*' />
|
||||
public ID3D11VideoProcessorInputView pInputSurfaceRight;
|
||||
public unsafe ID3D11VideoProcessorInputView* pInputSurfaceRight;
|
||||
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_VIDEO_PROCESSOR_STREAM::ppFutureSurfacesRight"]/*' />
|
||||
public unsafe ID3D11VideoProcessorInputView* ppFutureSurfacesRight;
|
||||
@@ -11650,7 +11650,7 @@ public partial struct VideoDecoderBufferDescription1
|
||||
public partial struct VideoDecoderBeginFrameCryptoSession
|
||||
{
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_VIDEO_DECODER_BEGIN_FRAME_CRYPTO_SESSION::pCryptoSession"]/*' />
|
||||
public ID3D11CryptoSession pCryptoSession;
|
||||
public unsafe ID3D11CryptoSession* pCryptoSession;
|
||||
|
||||
/// <include file='../Direct3D11.xml' path='doc/member[@name="D3D11_VIDEO_DECODER_BEGIN_FRAME_CRYPTO_SESSION::BlobSize"]/*' />
|
||||
public uint BlobSize;
|
||||
|
||||
@@ -7294,7 +7294,7 @@ public partial struct CachedPipelineState
|
||||
public partial struct GraphicsPipelineStateDescription
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_GRAPHICS_PIPELINE_STATE_DESC::pRootSignature"]/*' />
|
||||
public ID3D12RootSignature pRootSignature;
|
||||
public unsafe ID3D12RootSignature* pRootSignature;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_GRAPHICS_PIPELINE_STATE_DESC::VS"]/*' />
|
||||
public ShaderBytecode VS;
|
||||
@@ -7391,7 +7391,7 @@ public partial struct GraphicsPipelineStateDescription
|
||||
public partial struct ComputePipelineStateDescription
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_COMPUTE_PIPELINE_STATE_DESC::pRootSignature"]/*' />
|
||||
public ID3D12RootSignature pRootSignature;
|
||||
public unsafe ID3D12RootSignature* pRootSignature;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_COMPUTE_PIPELINE_STATE_DESC::CS"]/*' />
|
||||
public ShaderBytecode CS;
|
||||
@@ -8221,7 +8221,7 @@ public partial struct PackedMipInfo
|
||||
public partial struct ResourceTransitionBarrier
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_TRANSITION_BARRIER::pResource"]/*' />
|
||||
public ID3D12Resource pResource;
|
||||
public unsafe ID3D12Resource* pResource;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_TRANSITION_BARRIER::Subresource"]/*' />
|
||||
public uint Subresource;
|
||||
@@ -8238,10 +8238,10 @@ public partial struct ResourceTransitionBarrier
|
||||
public partial struct ResourceAliasingBarrier
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_ALIASING_BARRIER::pResourceBefore"]/*' />
|
||||
public ID3D12Resource pResourceBefore;
|
||||
public unsafe ID3D12Resource* pResourceBefore;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_ALIASING_BARRIER::pResourceAfter"]/*' />
|
||||
public ID3D12Resource pResourceAfter;
|
||||
public unsafe ID3D12Resource* pResourceAfter;
|
||||
}
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_UAV_BARRIER"]/*' />
|
||||
@@ -8249,7 +8249,7 @@ public partial struct ResourceAliasingBarrier
|
||||
public partial struct ResourceUavBarrier
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_UAV_BARRIER::pResource"]/*' />
|
||||
public ID3D12Resource pResource;
|
||||
public unsafe ID3D12Resource* pResource;
|
||||
}
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RESOURCE_BARRIER"]/*' />
|
||||
@@ -8361,7 +8361,7 @@ public partial struct PlacedSubresourceFootprint
|
||||
public partial struct TextureCopyLocation
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_TEXTURE_COPY_LOCATION::pResource"]/*' />
|
||||
public ID3D12Resource pResource;
|
||||
public unsafe ID3D12Resource* pResource;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_TEXTURE_COPY_LOCATION::Type"]/*' />
|
||||
public TextureCopyType Type;
|
||||
@@ -10433,7 +10433,7 @@ public partial struct StateObjectConfig
|
||||
public partial struct GlobalRootSignature
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_GLOBAL_ROOT_SIGNATURE::pGlobalRootSignature"]/*' />
|
||||
public ID3D12RootSignature pGlobalRootSignature;
|
||||
public unsafe ID3D12RootSignature* pGlobalRootSignature;
|
||||
}
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_LOCAL_ROOT_SIGNATURE"]/*' />
|
||||
@@ -10441,7 +10441,7 @@ public partial struct GlobalRootSignature
|
||||
public partial struct LocalRootSignature
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_LOCAL_ROOT_SIGNATURE::pLocalRootSignature"]/*' />
|
||||
public ID3D12RootSignature pLocalRootSignature;
|
||||
public unsafe ID3D12RootSignature* pLocalRootSignature;
|
||||
}
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_NODE_MASK"]/*' />
|
||||
@@ -10485,7 +10485,7 @@ public partial struct DxilLibraryDescription
|
||||
public partial struct ExistingCollectionDescription
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_EXISTING_COLLECTION_DESC::pExistingCollection"]/*' />
|
||||
public ID3D12StateObject pExistingCollection;
|
||||
public unsafe ID3D12StateObject* pExistingCollection;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_EXISTING_COLLECTION_DESC::NumExports"]/*' />
|
||||
public uint NumExports;
|
||||
@@ -10966,10 +10966,10 @@ public partial struct AutoBreadcrumbNode
|
||||
public unsafe ushort* pCommandQueueDebugNameW;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE::pCommandList"]/*' />
|
||||
public ID3D12GraphicsCommandList pCommandList;
|
||||
public unsafe ID3D12GraphicsCommandList* pCommandList;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE::pCommandQueue"]/*' />
|
||||
public ID3D12CommandQueue pCommandQueue;
|
||||
public unsafe ID3D12CommandQueue* pCommandQueue;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE::BreadcrumbCount"]/*' />
|
||||
public uint BreadcrumbCount;
|
||||
@@ -11012,10 +11012,10 @@ public partial struct AutoBreadcrumbNode1
|
||||
public unsafe ushort* pCommandQueueDebugNameW;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE1::pCommandList"]/*' />
|
||||
public ID3D12GraphicsCommandList pCommandList;
|
||||
public unsafe ID3D12GraphicsCommandList* pCommandList;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE1::pCommandQueue"]/*' />
|
||||
public ID3D12CommandQueue pCommandQueue;
|
||||
public unsafe ID3D12CommandQueue* pCommandQueue;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_AUTO_BREADCRUMB_NODE1::BreadcrumbCount"]/*' />
|
||||
public uint BreadcrumbCount;
|
||||
@@ -11384,10 +11384,10 @@ public partial struct RenderPassEndingAccessResolveSubresourceParameters
|
||||
public partial struct RenderPassEndingAccessResolveParameters
|
||||
{
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS::pSrcResource"]/*' />
|
||||
public ID3D12Resource pSrcResource;
|
||||
public unsafe ID3D12Resource* pSrcResource;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS::pDstResource"]/*' />
|
||||
public ID3D12Resource pDstResource;
|
||||
public unsafe ID3D12Resource* pDstResource;
|
||||
|
||||
/// <include file='../Direct3D12.xml' path='doc/member[@name="D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS::SubresourceCount"]/*' />
|
||||
public uint SubresourceCount;
|
||||
|
||||
@@ -2562,7 +2562,7 @@ public partial struct ShapingGlyphProperties
|
||||
public partial struct GlyphRun
|
||||
{
|
||||
/// <include file='../DirectWrite.xml' path='doc/member[@name="DWRITE_GLYPH_RUN::fontFace"]/*' />
|
||||
public IDWriteFontFace fontFace;
|
||||
public unsafe IDWriteFontFace* fontFace;
|
||||
|
||||
/// <include file='../DirectWrite.xml' path='doc/member[@name="DWRITE_GLYPH_RUN::fontEmSize"]/*' />
|
||||
public float fontEmSize;
|
||||
|
||||
358
src/Vortice.Win32/Generated/Graphics/Imaging.D2D.cs
Normal file
358
src/Vortice.Win32/Generated/Graphics/Imaging.D2D.cs
Normal file
@@ -0,0 +1,358 @@
|
||||
// ------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if !NET6_0_OR_GREATER
|
||||
using MemoryMarshal = Win32.MemoryMarshal;
|
||||
#endif
|
||||
|
||||
namespace Win32.Graphics.Imaging.D2D;
|
||||
|
||||
public static partial class Apis
|
||||
{
|
||||
}
|
||||
|
||||
#region COM Types
|
||||
/// <include file='../Imaging.xml' path='doc/member[@name="IWICImageEncoder"]/*' />
|
||||
/// <unmanaged>IWICImageEncoder</unmanaged>
|
||||
[Guid("04c75bf8-3ce1-473b-acc5-3cc4f5e94999")]
|
||||
[NativeTypeName("struct IWICImageEncoder : IUnknown")]
|
||||
[NativeInheritance("IUnknown")]
|
||||
public unsafe partial struct IWICImageEncoder
|
||||
{
|
||||
public static ref readonly Guid IID_IWICImageEncoder
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> data = new byte[] {
|
||||
0xF8, 0x5B, 0xC7, 0x04,
|
||||
0xE1, 0x3C,
|
||||
0x3B, 0x47,
|
||||
0xAC,
|
||||
0xC5,
|
||||
0x3C,
|
||||
0xC4,
|
||||
0xF5,
|
||||
0xE9,
|
||||
0x49,
|
||||
0x99
|
||||
};
|
||||
|
||||
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
|
||||
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
|
||||
}
|
||||
}
|
||||
|
||||
public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_IWICImageEncoder));
|
||||
|
||||
public void** lpVtbl;
|
||||
|
||||
/// <inheritdoc cref="IUnknown.QueryInterface" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(0)]
|
||||
public HResult QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IUnknown*, Guid*, void**, int>)(lpVtbl[0]))((IUnknown*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.AddRef" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(1)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IUnknown*, uint>)(lpVtbl[1]))((IUnknown*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IUnknown.Release" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(2)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IUnknown*, uint>)(lpVtbl[2]))((IUnknown*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <include file='../Imaging.xml' path='doc/member[@name="IWICImageEncoder::WriteFrame"]/*' />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(3)]
|
||||
public HResult WriteFrame(Graphics.Direct2D.ID2D1Image* pImage, Graphics.Imaging.IWICBitmapFrameEncode* pFrameEncode, Graphics.Imaging.WICImageParameters* pImageParameters)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImageEncoder*, Graphics.Direct2D.ID2D1Image*, Graphics.Imaging.IWICBitmapFrameEncode*, Graphics.Imaging.WICImageParameters*, int>)(lpVtbl[3]))((IWICImageEncoder*)Unsafe.AsPointer(ref this), pImage, pFrameEncode, pImageParameters);
|
||||
}
|
||||
|
||||
/// <include file='../Imaging.xml' path='doc/member[@name="IWICImageEncoder::WriteFrameThumbnail"]/*' />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(4)]
|
||||
public HResult WriteFrameThumbnail(Graphics.Direct2D.ID2D1Image* pImage, Graphics.Imaging.IWICBitmapFrameEncode* pFrameEncode, Graphics.Imaging.WICImageParameters* pImageParameters)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImageEncoder*, Graphics.Direct2D.ID2D1Image*, Graphics.Imaging.IWICBitmapFrameEncode*, Graphics.Imaging.WICImageParameters*, int>)(lpVtbl[4]))((IWICImageEncoder*)Unsafe.AsPointer(ref this), pImage, pFrameEncode, pImageParameters);
|
||||
}
|
||||
|
||||
/// <include file='../Imaging.xml' path='doc/member[@name="IWICImageEncoder::WriteThumbnail"]/*' />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(5)]
|
||||
public HResult WriteThumbnail(Graphics.Direct2D.ID2D1Image* pImage, Graphics.Imaging.IWICBitmapEncoder* pEncoder, Graphics.Imaging.WICImageParameters* pImageParameters)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImageEncoder*, Graphics.Direct2D.ID2D1Image*, Graphics.Imaging.IWICBitmapEncoder*, Graphics.Imaging.WICImageParameters*, int>)(lpVtbl[5]))((IWICImageEncoder*)Unsafe.AsPointer(ref this), pImage, pEncoder, pImageParameters);
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='../Imaging.xml' path='doc/member[@name="IWICImagingFactory2"]/*' />
|
||||
/// <unmanaged>IWICImagingFactory2</unmanaged>
|
||||
[Guid("7b816b45-1996-4476-b132-de9e247c8af0")]
|
||||
[NativeTypeName("struct IWICImagingFactory2 : IWICImagingFactory")]
|
||||
[NativeInheritance("IWICImagingFactory")]
|
||||
public unsafe partial struct IWICImagingFactory2
|
||||
{
|
||||
public static ref readonly Guid IID_IWICImagingFactory2
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
ReadOnlySpan<byte> data = new byte[] {
|
||||
0x45, 0x6B, 0x81, 0x7B,
|
||||
0x96, 0x19,
|
||||
0x76, 0x44,
|
||||
0xB1,
|
||||
0x32,
|
||||
0xDE,
|
||||
0x9E,
|
||||
0x24,
|
||||
0x7C,
|
||||
0x8A,
|
||||
0xF0
|
||||
};
|
||||
|
||||
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
|
||||
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
|
||||
}
|
||||
}
|
||||
|
||||
public static Guid* NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IID_IWICImagingFactory2));
|
||||
|
||||
public void** lpVtbl;
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateDecoderFromFilename" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(0)]
|
||||
public HResult CreateDecoderFromFilename(ushort* wzFilename, Guid* pguidVendor, uint dwDesiredAccess, Graphics.Imaging.WICDecodeOptions metadataOptions, Graphics.Imaging.IWICBitmapDecoder** ppIDecoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, ushort*, Guid*, uint, Graphics.Imaging.WICDecodeOptions, Graphics.Imaging.IWICBitmapDecoder**, int>)(lpVtbl[0]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), wzFilename, pguidVendor, dwDesiredAccess, metadataOptions, ppIDecoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateDecoderFromStream" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(1)]
|
||||
public HResult CreateDecoderFromStream(Com.IStream* pIStream, Guid* pguidVendor, Graphics.Imaging.WICDecodeOptions metadataOptions, Graphics.Imaging.IWICBitmapDecoder** ppIDecoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Com.IStream*, Guid*, Graphics.Imaging.WICDecodeOptions, Graphics.Imaging.IWICBitmapDecoder**, int>)(lpVtbl[1]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pIStream, pguidVendor, metadataOptions, ppIDecoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateDecoderFromFileHandle" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(2)]
|
||||
public HResult CreateDecoderFromFileHandle(nuint hFile, Guid* pguidVendor, Graphics.Imaging.WICDecodeOptions metadataOptions, Graphics.Imaging.IWICBitmapDecoder** ppIDecoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, nuint, Guid*, Graphics.Imaging.WICDecodeOptions, Graphics.Imaging.IWICBitmapDecoder**, int>)(lpVtbl[2]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), hFile, pguidVendor, metadataOptions, ppIDecoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateComponentInfo" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(3)]
|
||||
public HResult CreateComponentInfo(Guid* clsidComponent, Graphics.Imaging.IWICComponentInfo** ppIInfo)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Guid*, Graphics.Imaging.IWICComponentInfo**, int>)(lpVtbl[3]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), clsidComponent, ppIInfo);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateDecoder" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(4)]
|
||||
public HResult CreateDecoder(Guid* guidContainerFormat, Guid* pguidVendor, Graphics.Imaging.IWICBitmapDecoder** ppIDecoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Guid*, Guid*, Graphics.Imaging.IWICBitmapDecoder**, int>)(lpVtbl[4]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), guidContainerFormat, pguidVendor, ppIDecoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateEncoder" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(5)]
|
||||
public HResult CreateEncoder(Guid* guidContainerFormat, Guid* pguidVendor, Graphics.Imaging.IWICBitmapEncoder** ppIEncoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Guid*, Guid*, Graphics.Imaging.IWICBitmapEncoder**, int>)(lpVtbl[5]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), guidContainerFormat, pguidVendor, ppIEncoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreatePalette" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(6)]
|
||||
public HResult CreatePalette(Graphics.Imaging.IWICPalette** ppIPalette)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICPalette**, int>)(lpVtbl[6]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIPalette);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateFormatConverter" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(7)]
|
||||
public HResult CreateFormatConverter(Graphics.Imaging.IWICFormatConverter** ppIFormatConverter)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICFormatConverter**, int>)(lpVtbl[7]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIFormatConverter);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapScaler" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(8)]
|
||||
public HResult CreateBitmapScaler(Graphics.Imaging.IWICBitmapScaler** ppIBitmapScaler)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapScaler**, int>)(lpVtbl[8]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIBitmapScaler);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapClipper" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(9)]
|
||||
public HResult CreateBitmapClipper(Graphics.Imaging.IWICBitmapClipper** ppIBitmapClipper)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapClipper**, int>)(lpVtbl[9]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIBitmapClipper);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapFlipRotator" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(10)]
|
||||
public HResult CreateBitmapFlipRotator(Graphics.Imaging.IWICBitmapFlipRotator** ppIBitmapFlipRotator)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapFlipRotator**, int>)(lpVtbl[10]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIBitmapFlipRotator);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateStream" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(11)]
|
||||
public HResult CreateStream(Graphics.Imaging.IWICStream** ppIWICStream)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICStream**, int>)(lpVtbl[11]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIWICStream);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateColorContext" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(12)]
|
||||
public HResult CreateColorContext(Graphics.Imaging.IWICColorContext** ppIWICColorContext)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICColorContext**, int>)(lpVtbl[12]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIWICColorContext);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateColorTransformer" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(13)]
|
||||
public HResult CreateColorTransformer(Graphics.Imaging.IWICColorTransform** ppIWICColorTransform)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICColorTransform**, int>)(lpVtbl[13]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), ppIWICColorTransform);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmap" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(14)]
|
||||
public HResult CreateBitmap(uint uiWidth, uint uiHeight, Guid* pixelFormat, Graphics.Imaging.WICBitmapCreateCacheOption option, Graphics.Imaging.IWICBitmap** ppIBitmap)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, uint, uint, Guid*, Graphics.Imaging.WICBitmapCreateCacheOption, Graphics.Imaging.IWICBitmap**, int>)(lpVtbl[14]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), uiWidth, uiHeight, pixelFormat, option, ppIBitmap);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapFromSource" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(15)]
|
||||
public HResult CreateBitmapFromSource(Graphics.Imaging.IWICBitmapSource* pIBitmapSource, Graphics.Imaging.WICBitmapCreateCacheOption option, Graphics.Imaging.IWICBitmap** ppIBitmap)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapSource*, Graphics.Imaging.WICBitmapCreateCacheOption, Graphics.Imaging.IWICBitmap**, int>)(lpVtbl[15]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pIBitmapSource, option, ppIBitmap);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapFromSourceRect" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(16)]
|
||||
public HResult CreateBitmapFromSourceRect(Graphics.Imaging.IWICBitmapSource* pIBitmapSource, uint x, uint y, uint width, uint height, Graphics.Imaging.IWICBitmap** ppIBitmap)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapSource*, uint, uint, uint, uint, Graphics.Imaging.IWICBitmap**, int>)(lpVtbl[16]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pIBitmapSource, x, y, width, height, ppIBitmap);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapFromMemory" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(17)]
|
||||
public HResult CreateBitmapFromMemory(uint uiWidth, uint uiHeight, Guid* pixelFormat, uint cbStride, uint cbBufferSize, byte* pbBuffer, Graphics.Imaging.IWICBitmap** ppIBitmap)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, uint, uint, Guid*, uint, uint, byte*, Graphics.Imaging.IWICBitmap**, int>)(lpVtbl[17]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), uiWidth, uiHeight, pixelFormat, cbStride, cbBufferSize, pbBuffer, ppIBitmap);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapFromHBITMAP" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(18)]
|
||||
public HResult CreateBitmapFromHBITMAP(IntPtr hBitmap, IntPtr hPalette, Graphics.Imaging.WICBitmapAlphaChannelOption options, Graphics.Imaging.IWICBitmap** ppIBitmap)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, IntPtr, IntPtr, Graphics.Imaging.WICBitmapAlphaChannelOption, Graphics.Imaging.IWICBitmap**, int>)(lpVtbl[18]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), hBitmap, hPalette, options, ppIBitmap);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateBitmapFromHICON" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(19)]
|
||||
public HResult CreateBitmapFromHICON(IntPtr hIcon, Graphics.Imaging.IWICBitmap** ppIBitmap)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, IntPtr, Graphics.Imaging.IWICBitmap**, int>)(lpVtbl[19]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), hIcon, ppIBitmap);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateComponentEnumerator" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(20)]
|
||||
public HResult CreateComponentEnumerator(uint componentTypes, uint options, Com.IEnumUnknown** ppIEnumUnknown)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, uint, uint, Com.IEnumUnknown**, int>)(lpVtbl[20]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), componentTypes, options, ppIEnumUnknown);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateFastMetadataEncoderFromDecoder" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(21)]
|
||||
public HResult CreateFastMetadataEncoderFromDecoder(Graphics.Imaging.IWICBitmapDecoder* pIDecoder, Graphics.Imaging.IWICFastMetadataEncoder** ppIFastEncoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapDecoder*, Graphics.Imaging.IWICFastMetadataEncoder**, int>)(lpVtbl[21]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pIDecoder, ppIFastEncoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateFastMetadataEncoderFromFrameDecode" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(22)]
|
||||
public HResult CreateFastMetadataEncoderFromFrameDecode(Graphics.Imaging.IWICBitmapFrameDecode* pIFrameDecoder, Graphics.Imaging.IWICFastMetadataEncoder** ppIFastEncoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICBitmapFrameDecode*, Graphics.Imaging.IWICFastMetadataEncoder**, int>)(lpVtbl[22]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pIFrameDecoder, ppIFastEncoder);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateQueryWriter" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(23)]
|
||||
public HResult CreateQueryWriter(Guid* guidMetadataFormat, Guid* pguidVendor, Graphics.Imaging.IWICMetadataQueryWriter** ppIQueryWriter)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Guid*, Guid*, Graphics.Imaging.IWICMetadataQueryWriter**, int>)(lpVtbl[23]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), guidMetadataFormat, pguidVendor, ppIQueryWriter);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWICImagingFactory.CreateQueryWriterFromReader" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(24)]
|
||||
public HResult CreateQueryWriterFromReader(Graphics.Imaging.IWICMetadataQueryReader* pIQueryReader, Guid* pguidVendor, Graphics.Imaging.IWICMetadataQueryWriter** ppIQueryWriter)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Imaging.IWICMetadataQueryReader*, Guid*, Graphics.Imaging.IWICMetadataQueryWriter**, int>)(lpVtbl[24]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pIQueryReader, pguidVendor, ppIQueryWriter);
|
||||
}
|
||||
|
||||
/// <include file='../Imaging.xml' path='doc/member[@name="IWICImagingFactory2::CreateImageEncoder"]/*' />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(25)]
|
||||
public HResult CreateImageEncoder(Graphics.Direct2D.ID2D1Device* pD2DDevice, IWICImageEncoder** ppWICImageEncoder)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<IWICImagingFactory2*, Graphics.Direct2D.ID2D1Device*, IWICImageEncoder**, int>)(lpVtbl[25]))((IWICImagingFactory2*)Unsafe.AsPointer(ref this), pD2DDevice, ppWICImageEncoder);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Com Types
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using Win32.Graphics.Imaging.D2D;
|
||||
using static Win32.Apis;
|
||||
|
||||
namespace Win32.Graphics.Imaging;
|
||||
@@ -17,4 +18,14 @@ public static unsafe partial class Apis
|
||||
__uuidof<IWICImagingFactory>(),
|
||||
(void**)factory);
|
||||
}
|
||||
|
||||
public static HResult CreateWICImagingFactory(IWICImagingFactory2** factory)
|
||||
{
|
||||
return CoCreateInstance(
|
||||
(Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID_WICImagingFactory2)),
|
||||
null,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
__uuidof<IWICImagingFactory2>(),
|
||||
(void**)factory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0;</TargetFrameworks>
|
||||
<Description>Windows API low level bindings.</Description>
|
||||
<VersionPrefix>1.4.1</VersionPrefix>
|
||||
<VersionPrefix>1.5.0</VersionPrefix>
|
||||
<VersionSuffix Condition="'$(VersionSuffix)' == ''"></VersionSuffix>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -15,9 +15,15 @@ using static Win32.Graphics.Direct3D11.Apis;
|
||||
using static Win32.Graphics.Dxgi.Apis;
|
||||
using static Win32.Graphics.Imaging.Apis;
|
||||
using static Win32.Graphics.DirectWrite.Apis;
|
||||
using static Win32.Graphics.Direct2D.Apis;
|
||||
using InfoQueueFilter = Win32.Graphics.Direct3D11.InfoQueueFilter;
|
||||
using MessageId = Win32.Graphics.Direct3D11.MessageId;
|
||||
using Win32.Graphics.Direct2D;
|
||||
using Win32.Graphics.DirectWrite;
|
||||
using FactoryType = Win32.Graphics.Direct2D.FactoryType;
|
||||
using DWriteFactoryType = Win32.Graphics.DirectWrite.FactoryType;
|
||||
using FeatureLevel = Win32.Graphics.Direct3D.FeatureLevel;
|
||||
using Win32.Graphics.Imaging.D2D;
|
||||
|
||||
namespace ClearScreen;
|
||||
|
||||
@@ -54,11 +60,11 @@ public static unsafe class Program
|
||||
string assetsPath = Path.Combine(AppContext.BaseDirectory, "Assets", "Textures");
|
||||
string textureFile = Path.Combine(assetsPath, "10points.png");
|
||||
|
||||
using ComPtr<IWICImagingFactory> wicImagingFactory = default;
|
||||
|
||||
using ComPtr<IWICImagingFactory2> wicImagingFactory = default;
|
||||
CreateWICImagingFactory(wicImagingFactory.GetAddressOf()).ThrowIfFailed();
|
||||
|
||||
using ComPtr<IWICBitmapDecoder> decoder = wicImagingFactory.Get()->CreateDecoderFromFilename(textureFile);
|
||||
using ComPtr<IWICBitmapDecoder> decoder =
|
||||
((IWICImagingFactory*)wicImagingFactory.Get())->CreateDecoderFromFilename(textureFile);
|
||||
|
||||
using ComPtr<IWICBitmapFrameDecode> wicBitmapFrameDecode = default;
|
||||
|
||||
@@ -76,8 +82,15 @@ public static unsafe class Program
|
||||
|
||||
private static void TestD2D1AndDWrite()
|
||||
{
|
||||
using ComPtr<ID2D1Factory2> d2d1Factory2 = default;
|
||||
|
||||
D2D1CreateFactory(FactoryType.MultiThreaded,
|
||||
__uuidof<ID2D1Factory2>(),
|
||||
default,
|
||||
d2d1Factory2.GetVoidAddressOf()).ThrowIfFailed();
|
||||
|
||||
using ComPtr<IDWriteFactory> dwriteFactory = default;
|
||||
DWriteCreateFactory(FactoryType.Shared, __uuidof<IDWriteFactory>(), dwriteFactory.GetIUnknownAddressOf()).ThrowIfFailed();
|
||||
DWriteCreateFactory(DWriteFactoryType.Shared, __uuidof<IDWriteFactory>(), dwriteFactory.GetIUnknownAddressOf()).ThrowIfFailed();
|
||||
|
||||
using ComPtr<IDWriteTextFormat> textFormat =
|
||||
dwriteFactory.Get()->CreateTextFormat(
|
||||
|
||||
Reference in New Issue
Block a user