Skip to content

Add Missing Extended Dynamic Range APIs to iOS #17340

@jfversluis

Description

@jfversluis

Issue moved from dotnet/maui#12852


From @Microno95 on Monday, January 23, 2023 1:07:32 PM

Description

In iOS 16, the extended dynamic range APIs were added for use with Metal. Specifically, the CAMetalLayer class now has the properties wantsExtendedDynamicRangeContent and edrMetadata exposed on iOS.

Adding these to the iOS SDK would enable developers to write applications that can take advantage of EDR on iOS platforms.

Public API Changes

namespace CoreAnimation
{
    [Register("CAMetalLayer", true)]
    [SupportedOSPlatform("ios8.0")]
    [SupportedOSPlatform("macos10.11")]
    [SupportedOSPlatform("maccatalyst13.0")]
    [SupportedOSPlatform("tvos8.0")]
    public class CAMetalLayer : CALayer
    {
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        [Export("init")]
        public CAMetalLayer();
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [DesignatedInitializer]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        [Export("initWithCoder:")]
        public CAMetalLayer(NSCoder coder);
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        protected CAMetalLayer(NSObjectFlag t);
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        protected internal CAMetalLayer(NativeHandle handle);

        public override NativeHandle ClassHandle { get; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos11.0")]
        [SupportedOSPlatform("macos10.13")]
        [SupportedOSPlatform("ios11.0")]
        [SupportedOSPlatform("maccatalyst11.0")]
        public virtual bool AllowsNextDrawableTimeout { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos13.0")]
        [SupportedOSPlatform("macos10.15")]
        [SupportedOSPlatform("ios13.0")]
        [SupportedOSPlatform("maccatalyst13.0")]
        public virtual CGColorSpace? ColorSpace { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual IMTLDevice? Device { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual CGSize DrawableSize { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual bool FramebufferOnly { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos11.2")]
        [SupportedOSPlatform("macos10.13.2")]
        [SupportedOSPlatform("ios11.2")]
        [SupportedOSPlatform("maccatalyst11.2")]
        public virtual nuint MaximumDrawableCount { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual MTLPixelFormat PixelFormat { get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("tvos13.0")]
        [SupportedOSPlatform("macos10.15")]
        [SupportedOSPlatform("ios13.0")]
        [SupportedOSPlatform("maccatalyst13.0")]
        public virtual IMTLDevice? PreferredDevice { get; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual bool PresentsWithTransaction { get; set; }
        // PROPOSED ADDITION //
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios16.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst16.0")]
        public virtual bool wantsExtendedDynamicRangeContent{ get; set; }
        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [SupportedOSPlatform("ios16.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst16.0")]
        public virtual CAEDRMetadata? edrMetadata { get; set; }
        // END OF ADDITION //

        [BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
        [Export("nextDrawable")]
        [SupportedOSPlatform("ios8.0")]
        [SupportedOSPlatform("macos10.11")]
        [SupportedOSPlatform("maccatalyst13.0")]
        [SupportedOSPlatform("tvos")]
        public virtual ICAMetalDrawable? NextDrawable();
    }
}

Intended Use-Case

I am working as part of software development team where we would like to display High Dynamic Range content on the latest iPad Pros which supports up to 1600 nits in EDR mode, but are unable to fully utilise the display as such.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions