-
Notifications
You must be signed in to change notification settings - Fork 117
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
Gdiplus
missing some functions/enums GdipCreateSolidFill
, GdipCloneBrush
, GpStatus
#1287
Comments
Gdiplus
missing some functions/enums GdipCreateSolidFill
, GdipCloneBrush
Gdiplus
missing some functions/enums GdipCreateSolidFill
, GdipCloneBrush
, GpStatus
These functions are in the header gdiplusflat.h, which are purposefully omitted from the scraper since they're C++ classes. I think at this point, there's not much we can do since these APIs reference C++ types.
|
@sotteson1 is there any way around this for win32metadata? CC: @JeremyKuhne, we might have to add these manually to winforms in the shorter term if we can't get them included here. |
Note that GDI+ has a C++ wrapper library around a flat C API. The latter should be expressible by win32 metadata. The "C++ classes" are only use as opaque pointers and could be represented as |
@mikebattista any idea on this? Kennykerr's idea above sounds like a plan, but I am unsure how to go about it. |
First step would be to add the header to the right Partition and rebuild to see if the C APIs get picked up. |
@mikebattista I see you looked into adding the headers, how did you go? |
It became a non-trivial addition. Someone more familiar with that API would have a better time trying to add the APIs and resolve build errors. https://github.com/microsoft/win32metadata/compare/mikebattista/gdiplusflat is where I left off. |
Fwiw, TerraFX has this stuff wrapped and might give some guidance: https://github.com/terrafx/terrafx.interop.windows/tree/main/generation/Gdiplus I'm very interested in getting this in so we can flip System.Drawing over to CsWin32. |
@tannergooding is adding gdiplusflat.h here something you could help us with given you got this working in terrafx? I left off at 4b7ed82. |
I'd need to better understand what the errors being hit were. TerraFX is namely generated as a .NET Latest API surface (so doesn't support .NET Standard or .NET Framework) and is meant to be directly consumable from C#. Win32Metadata on the other hand is defining a .NET Standard compatible surface area for the most part and is meant to be consumed somewhat indirectly via generators for a particular language. In general TerraFX uses these central settings: https://github.com/terrafx/terrafx.interop.windows/blob/main/generation/settings.rsp A series of remaps: https://github.com/terrafx/terrafx.interop.windows/blob/main/generation/remap.rsp And then a series of "per-header" settings and "include headers" here: https://github.com/terrafx/terrafx.interop.windows/tree/main/generation/Gdiplus/um/gdiplusflat There isn't really anything special being done for The relevant C++ "opaque type" remappings are here: https://github.com/terrafx/terrafx.interop.windows/blob/main/generation/remap-types.rsp#L93-L148 It just does things like |
I'd guess the only difference in success vs failure here is a lack of remappings on the Win32Metadata side. Otherwise, the main difference is TerraFX uses |
If you have the time/motivation, the ask is to try to build https://github.com/microsoft/win32metadata/tree/mikebattista/gdiplusflat and work through the errors. Given potential settings and remaps needed and that you've worked through this already, you're probably most equipped to configure this. |
Not sure when I'm next going to have availability. Will let you know if I do. In general I expect it's just the missing remappings and they are likely something that Something like |
Why are there two separate similar projects? @tannergooding is there something blocking adoption of win32metadata directly? |
@riverar, Different use-cases and scenarios. Win32Metadata isn't meant for direct consumption, you have to use an additional tool on top such as CsWin32 CsWin32 is ok if you're depending on a couple of interop APIs, it adds measurable compilation overhead for more complex scenarios where you need many types or headers. CsWin32 also tries to make things "friendly" to use in terms of providing additional overloads, marshalling, etc. This can make it error prone in some cases, and add overhead that is not acceptable for some scenarios (like games/interop/etc). CsWin32 doesn't currently support trimming or AOT and several other "modern" scenarios. TerraFX on the other hand is a set of directly consumable 1-to-1 blittable bindings that are explicitly targeted towards and take advantage of modern .NET types and C# language features. It supports trimming, reflection free AOT, and more. It is specifically geared towards use in my own codebases and needs, which are high-perf 3D rendering, but has been adopted for use by several other prominent projects. I've been maintaining TerraFX, and the sources that dotnet/ClangSharp were built off of for a bit over 10 years now. It was only around 2019 that I started making them available on GitHub after I had gotten enough requests from other users that I make it available for broader use. |
@riverar did you end up getting anywhere? |
@elachlan Hey there, I have time to revisit this now, thanks for your patience! |
For the templates you were having issues with. Should we manually define them to avoid the issues in |
Oh those were unrelated to GDI. Was something that bubbled up while helping another Microsoft employee with another C++ project. |
https://learn.microsoft.com/en-au/windows/win32/api/gdiplustypes/ne-gdiplustypes-status
GdipCreateSolidFill
https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-solidbrush-flat
GdipCloneBrush
https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-brush-flat
I can't find the direct documentation on it.
Winforms tracking: dotnet/winforms#7468
The text was updated successfully, but these errors were encountered: