diff --git a/src/screencapturekit.cs b/src/screencapturekit.cs index b9f178957e4e..f80f8430be46 100644 --- a/src/screencapturekit.cs +++ b/src/screencapturekit.cs @@ -16,9 +16,82 @@ using Foundation; using CoreFoundation; using CoreMedia; +using UniformTypeIdentifiers; namespace ScreenCaptureKit { + [Mac (26, 0), MacCatalyst (26, 0)] + [Native] + public enum SCScreenshotDisplayIntent : long { + Canonical, + Local, + } + + [Mac (26, 0), MacCatalyst (26, 0)] + [Native] + public enum SCScreenshotDynamicRange : long { + Sdr, + Hdr, + SdrAndHdr, + } + + [Mac (26, 0), MacCatalyst (26, 0)] + [BaseType (typeof (NSObject))] + interface SCScreenshotConfiguration { + [Export ("width")] + nint Width { get; set; } + + [Export ("height")] + nint Height { get; set; } + + [Export ("showsCursor")] + bool ShowsCursor { get; set; } + + [Export ("sourceRect", ArgumentSemantic.Assign)] + CGRect SourceRect { get; set; } + + [Export ("destinationRect", ArgumentSemantic.Assign)] + CGRect DestinationRect { get; set; } + + [Export ("ignoreShadows")] + bool IgnoreShadows { get; set; } + + [Export ("ignoreClipping")] + bool IgnoreClipping { get; set; } + + [Export ("includeChildWindows")] + bool IncludeChildWindows { get; set; } + + [Export ("displayIntent", ArgumentSemantic.Assign)] + SCScreenshotDisplayIntent DisplayIntent { get; set; } + + [Export ("dynamicRange", ArgumentSemantic.Assign)] + SCScreenshotDynamicRange DynamicRange { get; set; } + + [Export ("contentType", ArgumentSemantic.Assign)] + UTType ContentType { get; set; } + + [NullAllowed, Export ("fileURL", ArgumentSemantic.Strong)] + NSUrl FileUrl { get; set; } + + [Static] + [Export ("supportedContentTypes")] + UTType [] SupportedContentTypes { get; } + } + + [Mac (26, 0), MacCatalyst (26, 0)] + [BaseType (typeof (NSObject))] + interface SCScreenshotOutput { + [NullAllowed, Export ("sdrImage", ArgumentSemantic.Strong)] + CGImage SdrImage { get; set; } + + [NullAllowed, Export ("hdrImage", ArgumentSemantic.Strong)] + CGImage HdrImage { get; set; } + + [NullAllowed, Export ("fileURL", ArgumentSemantic.Assign)] + NSUrl FileUrl { get; set; } + } + [NoiOS, NoTV, Mac (12, 3), MacCatalyst (18, 2)] [ErrorDomain ("SCStreamErrorDomain")] [Native] @@ -125,6 +198,8 @@ public enum SCStreamConfigurationPreset : long { CaptureHdrStreamCanonicalDisplay, CaptureHdrScreenshotLocalDisplay, CaptureHdrScreenshotCanonicalDisplay, + [MacCatalyst (26, 0), Mac (26, 0)] + CaptureHdrRecordingPreservedSdrHdr10, } [NoiOS, NoTV, Mac (12, 3), MacCatalyst (18, 2)] @@ -643,6 +718,7 @@ interface SCShareableContentInfo { } delegate void SCScreenshotManagerCaptureImageCallback ([NullAllowed] CGImage image, [NullAllowed] NSError error); + delegate void SCScreenshotManagerCaptureScreenshotCallback ([NullAllowed] SCScreenshotOutput output, [NullAllowed] NSError error); [NoiOS, NoTV, Mac (14, 0), MacCatalyst (18, 2)] [BaseType (typeof (NSObject))] @@ -663,6 +739,18 @@ interface SCScreenshotManager { [Export ("captureImageInRect:completionHandler:")] [Async] void CaptureImage (CGRect rect, [NullAllowed] SCScreenshotManagerCaptureImageCallback completionHandler); + + [Async] + [MacCatalyst (26, 0), Mac (26, 0)] + [Static] + [Export ("captureScreenshotWithFilter:configuration:completionHandler:")] + void CaptureScreenshot (SCContentFilter contentFilter, SCScreenshotConfiguration config, [NullAllowed] SCScreenshotManagerCaptureScreenshotCallback completionHandler); + + [Async] + [MacCatalyst (26, 0), Mac (26, 0)] + [Static] + [Export ("captureScreenshotWithRect:configuration:completionHandler:")] + void CaptureScreenshot (CGRect rect, SCScreenshotConfiguration config, [NullAllowed] SCScreenshotManagerCaptureScreenshotCallback completionHandler); } [Mac (15, 0), NoiOS, NoTV, MacCatalyst (18, 2)] diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-ScreenCaptureKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-ScreenCaptureKit.todo deleted file mode 100644 index d06a50947b51..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-ScreenCaptureKit.todo +++ /dev/null @@ -1,38 +0,0 @@ -!missing-enum! SCScreenshotDisplayIntent not bound -!missing-enum! SCScreenshotDynamicRange not bound -!missing-enum-value! SCStreamConfigurationPreset native value SCStreamConfigurationPresetCaptureHDRRecordingPreservedSDRHDR10 = 4 not bound -!missing-selector! +SCScreenshotConfiguration::supportedContentTypes not bound -!missing-selector! +SCScreenshotManager::captureScreenshotWithFilter:configuration:completionHandler: not bound -!missing-selector! +SCScreenshotManager::captureScreenshotWithRect:configuration:completionHandler: not bound -!missing-selector! SCScreenshotConfiguration::contentType not bound -!missing-selector! SCScreenshotConfiguration::destinationRect not bound -!missing-selector! SCScreenshotConfiguration::displayIntent not bound -!missing-selector! SCScreenshotConfiguration::dynamicRange not bound -!missing-selector! SCScreenshotConfiguration::fileURL not bound -!missing-selector! SCScreenshotConfiguration::height not bound -!missing-selector! SCScreenshotConfiguration::ignoreClipping not bound -!missing-selector! SCScreenshotConfiguration::ignoreShadows not bound -!missing-selector! SCScreenshotConfiguration::includeChildWindows not bound -!missing-selector! SCScreenshotConfiguration::setContentType: not bound -!missing-selector! SCScreenshotConfiguration::setDestinationRect: not bound -!missing-selector! SCScreenshotConfiguration::setDisplayIntent: not bound -!missing-selector! SCScreenshotConfiguration::setDynamicRange: not bound -!missing-selector! SCScreenshotConfiguration::setFileURL: not bound -!missing-selector! SCScreenshotConfiguration::setHeight: not bound -!missing-selector! SCScreenshotConfiguration::setIgnoreClipping: not bound -!missing-selector! SCScreenshotConfiguration::setIgnoreShadows: not bound -!missing-selector! SCScreenshotConfiguration::setIncludeChildWindows: not bound -!missing-selector! SCScreenshotConfiguration::setShowsCursor: not bound -!missing-selector! SCScreenshotConfiguration::setSourceRect: not bound -!missing-selector! SCScreenshotConfiguration::setWidth: not bound -!missing-selector! SCScreenshotConfiguration::showsCursor not bound -!missing-selector! SCScreenshotConfiguration::sourceRect not bound -!missing-selector! SCScreenshotConfiguration::width not bound -!missing-selector! SCScreenshotOutput::fileURL not bound -!missing-selector! SCScreenshotOutput::hdrImage not bound -!missing-selector! SCScreenshotOutput::sdrImage not bound -!missing-selector! SCScreenshotOutput::setFileURL: not bound -!missing-selector! SCScreenshotOutput::setHdrImage: not bound -!missing-selector! SCScreenshotOutput::setSdrImage: not bound -!missing-type! SCScreenshotConfiguration not bound -!missing-type! SCScreenshotOutput not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-ScreenCaptureKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-ScreenCaptureKit.todo deleted file mode 100644 index d06a50947b51..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-ScreenCaptureKit.todo +++ /dev/null @@ -1,38 +0,0 @@ -!missing-enum! SCScreenshotDisplayIntent not bound -!missing-enum! SCScreenshotDynamicRange not bound -!missing-enum-value! SCStreamConfigurationPreset native value SCStreamConfigurationPresetCaptureHDRRecordingPreservedSDRHDR10 = 4 not bound -!missing-selector! +SCScreenshotConfiguration::supportedContentTypes not bound -!missing-selector! +SCScreenshotManager::captureScreenshotWithFilter:configuration:completionHandler: not bound -!missing-selector! +SCScreenshotManager::captureScreenshotWithRect:configuration:completionHandler: not bound -!missing-selector! SCScreenshotConfiguration::contentType not bound -!missing-selector! SCScreenshotConfiguration::destinationRect not bound -!missing-selector! SCScreenshotConfiguration::displayIntent not bound -!missing-selector! SCScreenshotConfiguration::dynamicRange not bound -!missing-selector! SCScreenshotConfiguration::fileURL not bound -!missing-selector! SCScreenshotConfiguration::height not bound -!missing-selector! SCScreenshotConfiguration::ignoreClipping not bound -!missing-selector! SCScreenshotConfiguration::ignoreShadows not bound -!missing-selector! SCScreenshotConfiguration::includeChildWindows not bound -!missing-selector! SCScreenshotConfiguration::setContentType: not bound -!missing-selector! SCScreenshotConfiguration::setDestinationRect: not bound -!missing-selector! SCScreenshotConfiguration::setDisplayIntent: not bound -!missing-selector! SCScreenshotConfiguration::setDynamicRange: not bound -!missing-selector! SCScreenshotConfiguration::setFileURL: not bound -!missing-selector! SCScreenshotConfiguration::setHeight: not bound -!missing-selector! SCScreenshotConfiguration::setIgnoreClipping: not bound -!missing-selector! SCScreenshotConfiguration::setIgnoreShadows: not bound -!missing-selector! SCScreenshotConfiguration::setIncludeChildWindows: not bound -!missing-selector! SCScreenshotConfiguration::setShowsCursor: not bound -!missing-selector! SCScreenshotConfiguration::setSourceRect: not bound -!missing-selector! SCScreenshotConfiguration::setWidth: not bound -!missing-selector! SCScreenshotConfiguration::showsCursor not bound -!missing-selector! SCScreenshotConfiguration::sourceRect not bound -!missing-selector! SCScreenshotConfiguration::width not bound -!missing-selector! SCScreenshotOutput::fileURL not bound -!missing-selector! SCScreenshotOutput::hdrImage not bound -!missing-selector! SCScreenshotOutput::sdrImage not bound -!missing-selector! SCScreenshotOutput::setFileURL: not bound -!missing-selector! SCScreenshotOutput::setHdrImage: not bound -!missing-selector! SCScreenshotOutput::setSdrImage: not bound -!missing-type! SCScreenshotConfiguration not bound -!missing-type! SCScreenshotOutput not bound