Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding WIC (WindowsCodecs) support #1674

Merged
merged 7 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added build/cache/wic.json.gz
Binary file not shown.
Binary file modified build/cache/win32extras.json.gz
Binary file not shown.
7 changes: 7 additions & 0 deletions build/include/silk.net.windowscodecs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
typedef unsigned int UINT32;
typedef float FLOAT;

#include <Windows.h>
#include <dcommon.h>
#include <wincodec.h>
#include <wincodecsdk.h>
162 changes: 158 additions & 4 deletions generator.json
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@
"$windowsSdkDir/Include/$windowsSdkVersion/um/handleapi.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/fileapi.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/objidlbase.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/objidl.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/Documenttarget.h",
"$windowsSdkDir/Include/$windowsSdkVersion/shared/evntprov.h"
],
Expand All @@ -1028,7 +1029,11 @@
}
},
"exclude": [
"_SECURITY_ATTRIBUTES"
"_SECURITY_ATTRIBUTES",
"_STGMEDIUM_UNION",
"_GDI_OBJECT",
"__MIDL_IAdviseSink_0002",
"__MIDL_IAdviseSink_0003"
],
"rename": {
"ETW_COMPRESSION_RESUMPTION_MODE": "EtwCompressionResumptionMode",
Expand All @@ -1038,7 +1043,48 @@
"tagSOLE_AUTHENTICATION_LIST": "SoleAuthenticationList",
"tagSOLE_AUTHENTICATION_SERVICE": "SoleAuthenticationService",
"tagSOLE_AUTHENTICATION_INFO": "SoleAuthenticationInfo",
"tagSTATSTG": "STATSTG"
"tagSTATSTG": "STATSTG",
"tagACTIVATIONTYPE": "ActivationType",
"tagCLSCTX": "CLSCTX",
"tagDCOM_CALL_STATE": "DCOMCallState",
"tagEOLE_AUTHENTICATION_CAPABILITIES": "EoleAuthenticationCapabilities",
"tagEXTCONN": "EXTCONN",
"tagGLOBALOPT_EH_VALUES": "GlobalOptEHValues",
"tagGLOBALOPT_PROPERTIES": "GlobalOptProperties",
"tagGLOBALOPT_RO_FLAGS": "GlobalOptRoFlags",
"tagGLOBALOPT_RPCTP_VALUES": "GlobalOptRPCTPValues",
"tagGLOBALOPT_UNMARSHALING_POLICY_VALUES": "GlobalUnmarshalingPolicyValues",
"tagLOCKTYPE": "LockType",
"tagMEMCTX": "MEMCTX",
"tagMSHCTX": "MSHCTX",
"tagMSHLFLAGS": "MSHLFlags",
"tagRPCOPT_PROPERTIES": "RPCOptProperties",
"tagRPCOPT_SERVER_LOCALITY_VALUES": "RPCOptServerLocalityValues",
"tagSTGTY": "STGTY",
"tagSTREAM_SEEK": "StreamSeek",
"tagADVF": "ADVF",
"tagApplicationType": "ApplicationType",
"tagBIND_FLAGS": "BindFlags",
"tagCALLTYPE": "CallType",
"tagDATADIR": "DATADIR",
"tagMKREDUCE": "MKRREDUCE",
"tagMKSYS": "MKSYS",
"tagPENDINGMSG": "PendingMsg",
"tagPENDINGTYPE": "PendingType",
"tagSERVERCALL": "ServerCall",
"tagShutdownType": "ShutdownType",
"tagTYMED": "TYMED",
"tagBIND_OPTS": "BindOpts",
"tagBIND_OPTS2": "BindOpts2",
"tagBIND_OPTS3": "BindOpts3",
"tagDVTARGETDEVICE": "DVTargetDevice",
"tagFORMATETC": "FORMATETC",
"tagINTERFACEINFO": "InterfaceInfo",
"tagRemSNB": "RemSNB",
"tagRemSTGMEDIUM": "RemSTGMEDIUM",
"tagSTATDATA": "STATDATA",
"tagSTGMEDIUM": "STGMEDIUM",
"tagStorageLayout": "StorageLayout"
},
"bakery": {
"profileNames": [
Expand Down Expand Up @@ -1073,7 +1119,10 @@
"tagCY": "CY",
"tagDEC": "TagDecimal",
"tagSAFEARRAYBOUND": "SafeArrayBound",
"PfnTagEXCEPINFOvI": "PfnExceptionInfovI"
"PfnTagEXCEPINFOvI": "PfnExceptionInfovI",
"HICON__": "void",
"HBITMAP__": "void",
"HTASK__": "void"
},
{
"$include.dxTypemap": "build/dx_typemap.json",
Expand Down Expand Up @@ -1531,6 +1580,111 @@
}
]
},
{
"profileName": "WindowsCodecs",
"sources": [
"build/include/silk.net.windowscodecs.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/wincodec.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/wincodecsdk.h"
],
"mode": "Clang",
"cacheDir": "build/cache",
"cacheKey": "wic",
"controlDescriptors": [
"convert-windows-only",
"typemap-native",
"no-pre-2.18-obsolete-enums",
"no-csproj",
"no-extra-dir"
],
"converter": {},
"prefix": "WIC",
"clang": {
"args": [
"--language=c++",
"--std=c++17",
"-m32",
"-Wno-expansion-to-defined",
"-Wno-ignored-attributes",
"-Wno-ignored-pragma-intrinsic",
"-Wno-nonportable-include-path",
"-Wno-pragma-pack",
"-I$windowsSdkIncludes",
"-Ibuild/include"
],
"traverse": [
"$windowsSdkDir/Include/$windowsSdkVersion/um/wincodec.h",
"$windowsSdkDir/Include/$windowsSdkVersion/um/wincodecsdk.h"
],
"classes": {
"silk.net.windowscodecs.h": "[Core]WindowsCodecs",
"wincodec.h": "[Core]WindowsCodecs",
"wincodecsdk.h": "[Core]WindowsCodecs",
"wincodec_proxy.h": "[Core]WindowsCodecs"
}
},
"exclude": [
"ID2D1Device",
"ID2D1Image"
],
"rename": {
"WICProgressNotification": "ProgressNotificationEnum"
},
"bakery": {
"profileNames": [
"silk.net.windowscodecs",
"windowscodecs"
]
},
"output": {
"mode": "Default",
"path": "src/Microsoft/Silk.NET.Direct2D",
"innerPath": "WindowsCodecs",
"licenseFile": "build/LICENSE_HEADER.txt",
"props": "build/props/bindings.props"
},
"namespace": "Silk.NET.WindowsCodecs",
"extensionsNamespace": "Silk.NET.WindowsCodecs.Extensions",
"nameContainer": {
"linux-x64": "libwindowscodecs.so",
"win-x64": "windowscodecs.dll",
"win-x86": "windowscodecs.dll",
"osx-x64": "libwindowscodecs.dylib",
"android": "libwindowscodecs.so",
"iOS": "__Internal",
"className": "WICLibraryNameContainer"
},
"typeMaps": [
{
"ID2D1Device": "Silk.NET.Direct2D.ID2D1Device",
"ID2D1Image": "Silk.NET.Direct2D.ID2D1Image",
"D2D1_PIXEL_FORMAT": "Silk.NET.Direct2D.PixelFormat",
"DXGI_JPEG_QUANTIZATION_TABLE": "Silk.NET.DXGI.JpegQuantizationTable",
"DXGI_JPEG_AC_HUFFMAN_TABLE": "Silk.NET.DXGI.JpegACHuffmanTable",
"DXGI_JPEG_DC_HUFFMAN_TABLE": "Silk.NET.DXGI.JpegDCHuffmanTable",
"DXGI_FORMAT": "Silk.NET.DXGI.Format",
"_RPC_MESSAGE": "Silk.NET.Core.Win32Extras.RPCMessage",
"IRpcStubBuffer": "Silk.NET.Core.Win32Extras.IRpcStubBuffer",
"IRpcChannelBuffer": "Silk.NET.Core.Win32Extras.IRpcChannelBuffer",
"ISequentialStream": "Silk.NET.Core.Win32Extras.ISequentialStream",
"IPersist": "Silk.NET.Core.Win32Extras.IPersist",
"IPersistStream": "Silk.NET.Core.Win32Extras.IPersistStream",
"IPropertyBag2": "Silk.NET.Core.Native.IUnknown",
"IEnumUnknown": "Silk.NET.Core.Win32Extras.IEnumUnknown",
"IEnumString": "Silk.NET.Core.Win32Extras.IEnumString",
"tagSAFEARRAY": "Silk.NET.Core.Win32Extras.SafeArray",
"tagSTATSTG": "Silk.NET.Core.Win32Extras.STATSTG",
"tagPROPVARIANT": "void",
"tagPROPBAG2": "void",
"HPALETTE__": "void",
"HBITMAP__": "void",
"HICON__": "void"
},
{
"$include.commonTypeMap": "build/csharp_typemap.json"
}
]
},
{
"profileName": "D3D11",
"sources": [
Expand Down Expand Up @@ -2757,4 +2911,4 @@
]
}
]
}
}
54 changes: 54 additions & 0 deletions src/Core/Silk.NET.Core.Win32Extras/Enums/ADVF.gen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System;
using Silk.NET.Core.Attributes;

#pragma warning disable 1591

namespace Silk.NET.Core.Win32Extras
{
[Flags]
[NativeName("Name", "tagADVF")]
public enum ADVF : int
{
[NativeName("Name", "")]
None = 0,
[Obsolete("Deprecated in favour of \"Nodata\"")]
[NativeName("Name", "ADVF_NODATA")]
AdvfNodata = 0x1,
[Obsolete("Deprecated in favour of \"Primefirst\"")]
[NativeName("Name", "ADVF_PRIMEFIRST")]
AdvfPrimefirst = 0x2,
[Obsolete("Deprecated in favour of \"Onlyonce\"")]
[NativeName("Name", "ADVF_ONLYONCE")]
AdvfOnlyonce = 0x4,
[Obsolete("Deprecated in favour of \"Dataonstop\"")]
[NativeName("Name", "ADVF_DATAONSTOP")]
AdvfDataonstop = 0x40,
[Obsolete("Deprecated in favour of \"AcheNohandler\"")]
[NativeName("Name", "ADVFCACHE_NOHANDLER")]
AdvfcacheNohandler = 0x8,
[Obsolete("Deprecated in favour of \"AcheForcebuiltin\"")]
[NativeName("Name", "ADVFCACHE_FORCEBUILTIN")]
AdvfcacheForcebuiltin = 0x10,
[Obsolete("Deprecated in favour of \"AcheOnsave\"")]
[NativeName("Name", "ADVFCACHE_ONSAVE")]
AdvfcacheOnsave = 0x20,
[NativeName("Name", "ADVF_NODATA")]
Nodata = 0x1,
[NativeName("Name", "ADVF_PRIMEFIRST")]
Primefirst = 0x2,
[NativeName("Name", "ADVF_ONLYONCE")]
Onlyonce = 0x4,
[NativeName("Name", "ADVF_DATAONSTOP")]
Dataonstop = 0x40,
[NativeName("Name", "ADVFCACHE_NOHANDLER")]
AcheNohandler = 0x8,
[NativeName("Name", "ADVFCACHE_FORCEBUILTIN")]
AcheForcebuiltin = 0x10,
[NativeName("Name", "ADVFCACHE_ONSAVE")]
AcheOnsave = 0x20,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Silk.NET.Core.Win32Extras
{
[Flags]
[NativeName("Name", "tagACTIVATIONTYPE")]
public enum TagACTIVATIONTYPE : int
public enum ActivationType : int
{
[Obsolete("Deprecated in favour of \"Uncategorized\"")]
[NativeName("Name", "ACTIVATIONTYPE_UNCATEGORIZED")]
Expand Down
20 changes: 20 additions & 0 deletions src/Core/Silk.NET.Core.Win32Extras/Enums/ApplicationType.gen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System;
using Silk.NET.Core.Attributes;

#pragma warning disable 1591

namespace Silk.NET.Core.Win32Extras
{
[NativeName("Name", "tagApplicationType")]
public enum ApplicationType : int
{
[NativeName("Name", "ServerApplication")]
ServerApplication = 0x0,
[NativeName("Name", "LibraryApplication")]
LibraryApplication = 0x1,
}
}
26 changes: 26 additions & 0 deletions src/Core/Silk.NET.Core.Win32Extras/Enums/BindFlags.gen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System;
using Silk.NET.Core.Attributes;

#pragma warning disable 1591

namespace Silk.NET.Core.Win32Extras
{
[NativeName("Name", "tagBIND_FLAGS")]
public enum BindFlags : int
{
[Obsolete("Deprecated in favour of \"Maybotheruser\"")]
[NativeName("Name", "BIND_MAYBOTHERUSER")]
BindMaybotheruser = 0x1,
[Obsolete("Deprecated in favour of \"Justtestexistence\"")]
[NativeName("Name", "BIND_JUSTTESTEXISTENCE")]
BindJusttestexistence = 0x2,
[NativeName("Name", "BIND_MAYBOTHERUSER")]
Maybotheruser = 0x1,
[NativeName("Name", "BIND_JUSTTESTEXISTENCE")]
Justtestexistence = 0x2,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Silk.NET.Core.Win32Extras
{
[Flags]
[NativeName("Name", "tagCLSCTX")]
public enum TagCLSCTX : int
public enum CLSCTX : int
{
[NativeName("Name", "")]
None = 0,
Expand Down
41 changes: 41 additions & 0 deletions src/Core/Silk.NET.Core.Win32Extras/Enums/CallType.gen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System;
using Silk.NET.Core.Attributes;

#pragma warning disable 1591

namespace Silk.NET.Core.Win32Extras
{
[NativeName("Name", "tagCALLTYPE")]
public enum CallType : int
{
[Obsolete("Deprecated in favour of \"Toplevel\"")]
[NativeName("Name", "CALLTYPE_TOPLEVEL")]
CalltypeToplevel = 0x1,
[Obsolete("Deprecated in favour of \"Nested\"")]
[NativeName("Name", "CALLTYPE_NESTED")]
CalltypeNested = 0x2,
[Obsolete("Deprecated in favour of \"Async\"")]
[NativeName("Name", "CALLTYPE_ASYNC")]
CalltypeAsync = 0x3,
[Obsolete("Deprecated in favour of \"ToplevelCallpending\"")]
[NativeName("Name", "CALLTYPE_TOPLEVEL_CALLPENDING")]
CalltypeToplevelCallpending = 0x4,
[Obsolete("Deprecated in favour of \"AsyncCallpending\"")]
[NativeName("Name", "CALLTYPE_ASYNC_CALLPENDING")]
CalltypeAsyncCallpending = 0x5,
[NativeName("Name", "CALLTYPE_TOPLEVEL")]
Toplevel = 0x1,
[NativeName("Name", "CALLTYPE_NESTED")]
Nested = 0x2,
[NativeName("Name", "CALLTYPE_ASYNC")]
Async = 0x3,
[NativeName("Name", "CALLTYPE_TOPLEVEL_CALLPENDING")]
ToplevelCallpending = 0x4,
[NativeName("Name", "CALLTYPE_ASYNC_CALLPENDING")]
AsyncCallpending = 0x5,
}
}
26 changes: 26 additions & 0 deletions src/Core/Silk.NET.Core.Win32Extras/Enums/DATADIR.gen.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.


using System;
using Silk.NET.Core.Attributes;

#pragma warning disable 1591

namespace Silk.NET.Core.Win32Extras
{
[NativeName("Name", "tagDATADIR")]
public enum DATADIR : int
{
[Obsolete("Deprecated in favour of \"Get\"")]
[NativeName("Name", "DATADIR_GET")]
DatadirGet = 0x1,
[Obsolete("Deprecated in favour of \"Set\"")]
[NativeName("Name", "DATADIR_SET")]
DatadirSet = 0x2,
[NativeName("Name", "DATADIR_GET")]
Get = 0x1,
[NativeName("Name", "DATADIR_SET")]
Set = 0x2,
}
}
Loading