diff --git a/Dev/Brightroom.xcodeproj/project.pbxproj b/Dev/Brightroom.xcodeproj/project.pbxproj index 3501269a..06ff5aaf 100644 --- a/Dev/Brightroom.xcodeproj/project.pbxproj +++ b/Dev/Brightroom.xcodeproj/project.pbxproj @@ -31,6 +31,15 @@ 4B36195126105E3900877B21 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4B600B29216B7C9E001E1456 /* Assets.xcassets */; }; 4B36195626107ADB00877B21 /* path-data in Resources */ = {isa = PBXBuildFile; fileRef = 4B36195526107ADB00877B21 /* path-data */; }; 4B3957C92C16D9ED000BD249 /* DemoFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3957C82C16D9ED000BD249 /* DemoFilterView.swift */; }; + 4B3957D12C16DAC3000BD249 /* sun-hdr-rec2020-avif.avif in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957CB2C16DABA000BD249 /* sun-hdr-rec2020-avif.avif */; }; + 4B3957D22C16DAC3000BD249 /* sun-hdr-p3-avif.avif in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957CA2C16DABA000BD249 /* sun-hdr-p3-avif.avif */; }; + 4B3957D32C16DAC3000BD249 /* sun-hdr-srgb-avif.avif in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957CC2C16DABA000BD249 /* sun-hdr-srgb-avif.avif */; }; + 4B3957D42C16DAC4000BD249 /* sun-hdr-rec2020-avif.avif in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957CB2C16DABA000BD249 /* sun-hdr-rec2020-avif.avif */; }; + 4B3957D52C16DAC4000BD249 /* sun-hdr-p3-avif.avif in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957CA2C16DABA000BD249 /* sun-hdr-p3-avif.avif */; }; + 4B3957D62C16DAC4000BD249 /* sun-hdr-srgb-avif.avif in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957CC2C16DABA000BD249 /* sun-hdr-srgb-avif.avif */; }; + 4B3957DA2C16DD42000BD249 /* sun-hdr-rec2020-heic.heic in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957D72C16DD42000BD249 /* sun-hdr-rec2020-heic.heic */; }; + 4B3957DB2C16DD42000BD249 /* sun-hdr-srgb-heic.heic in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957D82C16DD42000BD249 /* sun-hdr-srgb-heic.heic */; }; + 4B3957DC2C16DD42000BD249 /* sun-hdr-p3-heic.heic in Resources */ = {isa = PBXBuildFile; fileRef = 4B3957D92C16DD42000BD249 /* sun-hdr-p3-heic.heic */; }; 4B4103582611EAA80061A218 /* ImitationTinderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4103572611EAA80061A218 /* ImitationTinderViewController.swift */; }; 4B4103602611EAB20061A218 /* DemoImitationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B41035F2611EAB20061A218 /* DemoImitationsViewController.swift */; }; 4B46E71B2B762E20003179C2 /* MondrianLayout in Frameworks */ = {isa = PBXBuildFile; productRef = 4B46E71A2B762E20003179C2 /* MondrianLayout */; }; @@ -600,6 +609,12 @@ 4B36194B26105BEB00877B21 /* RendererTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RendererTests.swift; sourceTree = ""; }; 4B36195526107ADB00877B21 /* path-data */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = "path-data"; sourceTree = ""; }; 4B3957C82C16D9ED000BD249 /* DemoFilterView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoFilterView.swift; sourceTree = ""; }; + 4B3957CA2C16DABA000BD249 /* sun-hdr-p3-avif.avif */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sun-hdr-p3-avif.avif"; sourceTree = ""; }; + 4B3957CB2C16DABA000BD249 /* sun-hdr-rec2020-avif.avif */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sun-hdr-rec2020-avif.avif"; sourceTree = ""; }; + 4B3957CC2C16DABA000BD249 /* sun-hdr-srgb-avif.avif */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sun-hdr-srgb-avif.avif"; sourceTree = ""; }; + 4B3957D72C16DD42000BD249 /* sun-hdr-rec2020-heic.heic */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sun-hdr-rec2020-heic.heic"; sourceTree = ""; }; + 4B3957D82C16DD42000BD249 /* sun-hdr-srgb-heic.heic */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sun-hdr-srgb-heic.heic"; sourceTree = ""; }; + 4B3957D92C16DD42000BD249 /* sun-hdr-p3-heic.heic */ = {isa = PBXFileReference; lastKnownFileType = file; path = "sun-hdr-p3-heic.heic"; sourceTree = ""; }; 4B4103572611EAA80061A218 /* ImitationTinderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImitationTinderViewController.swift; sourceTree = ""; }; 4B41035F2611EAB20061A218 /* DemoImitationsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoImitationsViewController.swift; sourceTree = ""; }; 4B524FE229B8F6A600C1A416 /* Brightroom */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Brightroom; path = ..; sourceTree = ""; }; @@ -1143,6 +1158,19 @@ path = Library; sourceTree = ""; }; + 4B3957CD2C16DABA000BD249 /* hdr-images */ = { + isa = PBXGroup; + children = ( + 4B3957D92C16DD42000BD249 /* sun-hdr-p3-heic.heic */, + 4B3957D72C16DD42000BD249 /* sun-hdr-rec2020-heic.heic */, + 4B3957D82C16DD42000BD249 /* sun-hdr-srgb-heic.heic */, + 4B3957CA2C16DABA000BD249 /* sun-hdr-p3-avif.avif */, + 4B3957CB2C16DABA000BD249 /* sun-hdr-rec2020-avif.avif */, + 4B3957CC2C16DABA000BD249 /* sun-hdr-srgb-avif.avif */, + ); + path = "hdr-images"; + sourceTree = ""; + }; 4B4103562611EA8C0061A218 /* Imitations */ = { isa = PBXGroup; children = ( @@ -1332,6 +1360,7 @@ 4BE9B3D1260BA72D000A3D09 /* Bundle */ = { isa = PBXGroup; children = ( + 4B3957CD2C16DABA000BD249 /* hdr-images */, 4B2A10F9266B7AF800B0C885 /* image-test-suite */, 4BE9B3D0260BA720000A3D09 /* Images */, 4B1E95292176F52100E9DFB8 /* LUTs */, @@ -1923,6 +1952,9 @@ 4BA41C86260CE817005E6FA7 /* orientation_down.HEIC in Resources */, 4BA41C85260CE817005E6FA7 /* orientation_left.HEIC in Resources */, 4BA41C84260CE817005E6FA7 /* orientation_left_mirrored.HEIC in Resources */, + 4B3957D42C16DAC4000BD249 /* sun-hdr-rec2020-avif.avif in Resources */, + 4B3957D52C16DAC4000BD249 /* sun-hdr-p3-avif.avif in Resources */, + 4B3957D62C16DAC4000BD249 /* sun-hdr-srgb-avif.avif in Resources */, 4BA41C82260CE817005E6FA7 /* orientation_up_mirrored.HEIC in Resources */, 4BB7B9CC277A452A0014B62A /* LUT_64_Gloss.png in Resources */, 4B600B2A216B7C9E001E1456 /* Assets.xcassets in Resources */, @@ -1948,9 +1980,15 @@ 4BA41C90260CE817005E6FA7 /* orientation_left.HEIC in Resources */, 4BED4A0A261CA5B00011A98F /* LUT_64_1.jpg in Resources */, 4BA41C8E260CE817005E6FA7 /* orientation_right_mirrored.HEIC in Resources */, + 4B3957DC2C16DD42000BD249 /* sun-hdr-p3-heic.heic in Resources */, 4BA41C92260CE817005E6FA7 /* orientation_right.HEIC in Resources */, 4BA41C93260CE817005E6FA7 /* orientation_up.HEIC in Resources */, + 4B3957DB2C16DD42000BD249 /* sun-hdr-srgb-heic.heic in Resources */, + 4B3957DA2C16DD42000BD249 /* sun-hdr-rec2020-heic.heic in Resources */, 4BA41C94260CE817005E6FA7 /* orientation_down_mirrored.HEIC in Resources */, + 4B3957D12C16DAC3000BD249 /* sun-hdr-rec2020-avif.avif in Resources */, + 4B3957D22C16DAC3000BD249 /* sun-hdr-p3-avif.avif in Resources */, + 4B3957D32C16DAC3000BD249 /* sun-hdr-srgb-avif.avif in Resources */, 4BA41C8D260CE817005E6FA7 /* orientation_up_mirrored.HEIC in Resources */, 4BB7B9CD277A452A0014B62A /* LUT_64_Gloss.png in Resources */, 4BA41C8F260CE817005E6FA7 /* orientation_left_mirrored.HEIC in Resources */, diff --git a/Dev/Brightroom.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Dev/Brightroom.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b05bb2f6..595fe3b2 100644 --- a/Dev/Brightroom.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Dev/Brightroom.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -123,7 +123,7 @@ "location" : "https://github.com/FluidGroup/TextureSwiftSupport", "state" : { "branch" : "main", - "revision" : "5bae50cab3798dccb8b98c3ffbc70320ae66b45a" + "revision" : "3042c19dc5d67005222b7b422494805bcf2d7f18" } }, { diff --git a/Dev/Bundle/hdr-images/sun-hdr-p3.avif b/Dev/Bundle/hdr-images/sun-hdr-p3-avif.avif similarity index 100% rename from Dev/Bundle/hdr-images/sun-hdr-p3.avif rename to Dev/Bundle/hdr-images/sun-hdr-p3-avif.avif diff --git a/Dev/Bundle/hdr-images/sun-hdr-p3-heic.heic b/Dev/Bundle/hdr-images/sun-hdr-p3-heic.heic new file mode 100644 index 00000000..913c839a Binary files /dev/null and b/Dev/Bundle/hdr-images/sun-hdr-p3-heic.heic differ diff --git a/Dev/Bundle/hdr-images/sun-hdr-rec2020.avif b/Dev/Bundle/hdr-images/sun-hdr-rec2020-avif.avif similarity index 100% rename from Dev/Bundle/hdr-images/sun-hdr-rec2020.avif rename to Dev/Bundle/hdr-images/sun-hdr-rec2020-avif.avif diff --git a/Dev/Bundle/hdr-images/sun-hdr-rec2020-heic.heic b/Dev/Bundle/hdr-images/sun-hdr-rec2020-heic.heic new file mode 100644 index 00000000..530d4c80 Binary files /dev/null and b/Dev/Bundle/hdr-images/sun-hdr-rec2020-heic.heic differ diff --git a/Dev/Bundle/hdr-images/sun-hdr-srgb.avif b/Dev/Bundle/hdr-images/sun-hdr-srgb-avif.avif similarity index 100% rename from Dev/Bundle/hdr-images/sun-hdr-srgb.avif rename to Dev/Bundle/hdr-images/sun-hdr-srgb-avif.avif diff --git a/Dev/Bundle/hdr-images/sun-hdr-srgb-heic.heic b/Dev/Bundle/hdr-images/sun-hdr-srgb-heic.heic new file mode 100644 index 00000000..740b4f36 Binary files /dev/null and b/Dev/Bundle/hdr-images/sun-hdr-srgb-heic.heic differ diff --git a/Dev/Sources/SharedForDemo/Mocks.swift b/Dev/Sources/SharedForDemo/Mocks.swift index faf3f94f..4c39d8d7 100644 --- a/Dev/Sources/SharedForDemo/Mocks.swift +++ b/Dev/Sources/SharedForDemo/Mocks.swift @@ -32,6 +32,10 @@ enum Mocks { UIImage(named: "orientation_left.HEIC")! } + static func hdrImage() -> UIImage { + UIImage(named: "sun-hdr-p3-avif.avif")! + } + static func makeEditingStack(image: UIImage) -> EditingStack { .init( imageProvider: .init(image: image) diff --git a/Dev/Sources/SwiftUIDemo/ContentView.swift b/Dev/Sources/SwiftUIDemo/ContentView.swift index ed81d6c4..76974792 100644 --- a/Dev/Sources/SwiftUIDemo/ContentView.swift +++ b/Dev/Sources/SwiftUIDemo/ContentView.swift @@ -36,6 +36,23 @@ struct ContentView: View { }) } + Section("HDR") { + Button("AVIF") { + fullScreenView = .init { + DemoCropView( + editingStack: { Mocks.makeEditingStack(image: UIImage(named: "sun-hdr-p3-avif.avif")!) } + ) + } + } + Button("HEIC") { + fullScreenView = .init { + DemoCropView( + editingStack: { Mocks.makeEditingStack(image: UIImage(named: "sun-hdr-p3-heic.heic")!) } + ) + } + } + } + Section("Restoration Horizontal") { Button("Crop") { fullScreenView = .init { diff --git a/Sources/BrightroomEngine/DataSource/ImageSource.swift b/Sources/BrightroomEngine/DataSource/ImageSource.swift index 1bf77735..d8260d4d 100644 --- a/Sources/BrightroomEngine/DataSource/ImageSource.swift +++ b/Sources/BrightroomEngine/DataSource/ImageSource.swift @@ -64,7 +64,11 @@ public final class ImageSource: Equatable { )! }, makeCIImage: { - CIImage(image: image)! + if #available(iOS 17.0, *) { + CIImage(image: image, options: [.expandToHDR : true])! + } else { + CIImage(image: image, options: [:])! + } } ) } diff --git a/Sources/BrightroomUI/Shared/Components/ImageViews/MetalImageView.swift b/Sources/BrightroomUI/Shared/Components/ImageViews/MetalImageView.swift index 37ceda3a..32b7c241 100644 --- a/Sources/BrightroomUI/Shared/Components/ImageViews/MetalImageView.swift +++ b/Sources/BrightroomUI/Shared/Components/ImageViews/MetalImageView.swift @@ -73,6 +73,12 @@ open class MetalImageView: MTKView, CIImageDisplaying, MTKViewDelegate { clearColor = .init(red: 0, green: 0, blue: 0, alpha: 0) clearsContextBeforeDrawing = true + if #available(iOS 17.0, *) { + layer.wantsExtendedDynamicRangeContent = true + } else { + // Fallback on earlier versions + } + #if targetEnvironment(simulator) #else /// For supporting wide-color - extended sRGB diff --git a/Sources/BrightroomUI/Shared/Components/ImageViews/_ImageView.swift b/Sources/BrightroomUI/Shared/Components/ImageViews/_ImageView.swift index def49fd2..e8bbc8db 100644 --- a/Sources/BrightroomUI/Shared/Components/ImageViews/_ImageView.swift +++ b/Sources/BrightroomUI/Shared/Components/ImageViews/_ImageView.swift @@ -21,6 +21,7 @@ final class _ImageView: UIImageView, CIImageDisplaying { init() { super.init(frame: .zero) layer.drawsAsynchronously = true + preferredImageDynamicRange = .high } required init?(coder: NSCoder) {