View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Videos

Abrir menú Cerrar menú
  • Colecciones
  • Todos los videos
  • Información

Más videos

  • Información
  • Código
  • Explore EDR on iOS

    EDR is Apple's High Dynamic Range representation and rendering pipeline. Explore how you can render HDR content using EDR in your app and unleash the dynamic range capabilities of HDR displays on iPhone and iPad. We'll show how you can take advantage of the native EDR APIs on iOS, provide best practices to help you decide when HDR is appropriate, and share tips for tone-mapping and HDR content rendering. We'll also introduce you to Reference Mode and highlight how it provides a reference response to enable color-critical workflows such as color grading, editing, and content review.

    Recursos

    • CAEDRMetadata

    Videos relacionados

    WWDC23

    • Bring your game to Mac, Part 1: Make a game plan
    • Support HDR images in your app

    Tech Talks

    • Discover Reference Mode

    WWDC22

    • Display EDR content with Core Image, Metal, and SwiftUI
    • Display HDR video in EDR with AVFoundation and Metal
  • Buscar este video…
    • 9:23 - Create CGImage and Draw

      // Create CGImage from HDR Image
      let isr = CGImageSourceCreateWithURL(HDRImageURL, nil)
      let img = CGImageSourceCreateImageAtIndex(isr, 0, nil)
      
      // Draw into floating point bitmap context
      let width  = img.width
      let height = img.height
      
      let info = CGBitmapInfo(rawValue: kCGBitmapByteOrder16Host |CGImageAlphaInfo.premultipliedLast.rawValue | CGBitmapInfo.floatComponents.rawValue)
      
      let ctx = CGContext(data: nil, width: width, height: height, bitsPerComponent: 16,
          bytesPerRow: 0, space: layer.colorspace, bitmapInfo: info.rawValue)
      
      ctx?.draw(in: img,
                image: CGRect(x: 0, y: 0, width: CGFloat(width), height: CGFloat(height)))
    • 10:30 - Create floating point texture and Load EDR bitmap

      // Create floating point texture
      let desc = MTLTextureDescriptor()
      
      desc.pixelFormat = .rgba16Float
      desc.textureType = .type2D
      
      let texture = layer.device.makeTexture(descriptor: desc)
      
      // Load EDR bitmap into texture
      let data = ctx.data
      
      texture.replace(region: MTLRegionMake2D(0, 0, width, height),
                      mipmapLevel: 0,
                      withBytes: &data,
                      bytesPerRow: ctx.bytesPerRow)
    • 11:55 - CAMetalLayer properties

      // Opt into using EDR
      var layer = CAMetalLayer()
      layer?.wantsExtendedDynamicRangeContent = true
      
      // Use supported pixel format and color spaces
      layer.pixelFormat = MTLPixelFormatRGBA16Float
      layer.colorspace  = CGColorSpace(name: kCGColorSpaceExtendedLinearDisplayP3)
    • 14:42 - UIScreen headroom

      // Query potential headroom
      let screen = windowScene.screen
      let maxPotentialEDR = screen.potentialEDRHeadroom
      if (maxPotentialEDR < 1.5) {
          // SDR path
      }
      
      // Query current headroom
      func draw(_ rect: CGRect) {
          let maxEDR = screen.currentEDRHeadroom
          // Tone-map to maxEDR
      }
      
      // Register for Reference Mode notifications
      let notification = NotificationCenter.default
      notification.addObserver(self,
                               selector: #selector(screenChangedEvent(_:)),
                               name: UIScreen.referenceDisplayModeStatusDidChangeNotification,
                               object: nil)
      
      // Query for latest status and headroom
      func screenChangedEvent(_ notification: Notification?) {
          let status          = screen.referenceDisplayModeStatus
          let maxPotentialEDR = screen.potentialEDRHeadroom
      }
    • 16:54 - CAEDRMetadata and CAMetalLayer

      // Check if EDR metadata is available
      let isAvailable = CAEDRMetadata.isAvailable
      
      // Instantiate EDR metadata
      // ...
      
      // Apply EDR metadata to layer
      let layer: CAMetalLayer? = nil
      layer?.edrMetadata = metadata
    • 17:22 - Instantiating CAEDRMetadata

      // HLG
      let edrMetadata = CAEDRMetadata.hlg
      
      // HDR10 (Mastering Display luminance)
      let edrMetaData = CAEDRMetadata.hdr10(minLuminance: minLuminance,
                                            maxLuminance: maxContentMasteringDisplayBrightness,
                                            opticalOutputScale: outputScale)
      
      // HDR10 (Supplemental Enhancement Information)
      let edrMetaData = CAEDRMetadata.hdr10(displayInfo: displayData,
                                            contentInfo: contentInfo,
                                            opticalOutputScale: outputScale)

Developer Footer

  • Videos
  • WWDC22
  • Explore EDR on iOS
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines