microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.72k stars 307 forks source link

Use more meaningful overload names for WinRT APIs #4490

Open riverar opened 2 weeks ago

riverar commented 2 weeks ago

Upcoming Windows Vision, AI, etc. APIs are getting added to Windows App SDK/Runtime with sub-optimal method overload names. This makes use of these APIs outside of C# more difficult/annoying.

(We previously discussed this in this repository and generally agreed this was not ideal, but I'll have to dig it up.)

internal interface ITrimapImageSegmenter
{
        [Overload("RemoveBackgroundAsync")]
    IAsyncOperation<SoftwareBitmap> RemoveBackgroundAsync([In] SoftwareBitmap softwareBitmap, [In] SoftwareBitmap fgMask, [In] SoftwareBitmap bgMask);

        [Overload("RemoveBackground")]
    SoftwareBitmap RemoveBackground([In] SoftwareBitmap softwareBitmap, [In] SoftwareBitmap fgMask, [In] SoftwareBitmap bgMask);

-       [Overload("RemoveBackgroundAsync2")]
    IAsyncOperation<ImageBuffer> RemoveBackgroundAsync([In] ImageBuffer imageBuffer, [In] ImageBuffer fgMask, [In] ImageBuffer bgMask);

-       [Overload("RemoveBackground2")]
    ImageBuffer RemoveBackground([In] ImageBuffer imageBuffer, [In] ImageBuffer fgMask, [In] ImageBuffer bgMask);
}