Posts

Post not yet marked as solved
2 Replies
243 Views
I have provided a test UIKit app which displays three different images, side by side, each inside a separate MTKView. Each image is tagged with a different color profile: Display P3 uRGB Test RGB (from an image supplied in Apple's ImageApp sample). I set up default values for all color spaces and formats. I then check if the image is tagged and, if so, I override those values with state from the tagged color space. The variables I am setting: “workingColorSpace” in the Metal CIContext, default = sRGB “workingFormat” in the Metal CIContext, default = RGBAf “outputColorSpace” in the Metal CIContext, default = displayP3 “colorPixelFormat” in the MTKView, default = bgra8Unorm “colorSpace” in a CIRenderDestination that I use in the MTKView delegate draw method The “colorSpace” default value = CGColorSpaceCreateDeviceRGB() I also set “pixelFormat” in CIRenderDestination with the MTKView.colorPixelFormat. If the image is tagged, I override the following values with the tagged colorSpace: CIContext.workingColorSpace CIContext.outputColorSpace CIRenderDestination.colorSpace If the tagged colorSpace.isWideGamutRGB = true, then I set the CIRenderDestination.colorSpace to extendedSRGB, ignoring the color space in the tagged wide gamut color space, as well as set the colorPixelFormat = bgr10_xr Results: The above scenario will properly render the DisplayP3 image, and the uRGB image. The “Test RGB” image fails: If I do not override the CIRenderDestination.colorSpace with a value from the tagged image, then the “Test RGB” image succeeds, but the “uRGB” image fails to render properly: Question: Do I have everything hooked up correctly and, if so, why does one image fail, and the other succeed? Link to sample project: https://www.dropbox.com/scl/fi/57u2fcrgdvys7jtzykzxt/ColorSpaceTest.zip?rlkey=unjeeiu7mi0wx9wfpylt78nwd&dl=0
Posted Last updated
.
Post not yet marked as solved
0 Replies
556 Views
I am using Compositional Layout plus Diffable Data Source to display requested images in a single column inside a UICollectionView from the Photos Album using PhotoKit's Cached Image Manager. I would like the image cell to be the entire width of the collection view and the height of the cell to be scaled to the height of the image using Aspect Fit content mode. When I create the layout I use estimated height for both item and group layout objects. But the initial height of each cell stays at the estimated height. As soon as I start scrolling, some of the cells do actually resize the height correctly, but not always. Here is the sample code (replace the default ViewController.swift logic in a sample iOS project with the attached Sample Code): Sample Code
Posted Last updated
.
Post not yet marked as solved
2 Replies
1k Views
I am unable to initialize a CIRAWFilter object and access its instance variables using the new CIRAWFilter class API in iOS 15. If I compile and execute the following code, I get a run-time error stating, "-[CIRAWFilterImpl isGamutMappingEnabled]: unrecognized selector sent to instance 0x1065ec570'" It appears that a "CIRAWFilterImpl" object is getting created, not a "CIRAWFilter" object. I cannot cast to that type as it is unknown (most likely a private class). My code: if #available(iOS 15.0, *) { let rawFilter : CIRAWFilter = CIRAWFilter(imageURL: self.imageURL) let isGamutMappingEnabled = rawFilter.isGamutMappingEnabled print("isGamutMappingEnabled: (isGamutMappingEnabled)") }
Posted Last updated
.
Post not yet marked as solved
0 Replies
453 Views
If I create a CIRAWFilter object from a Raw image URL, the resulting object contains an NSDictionary titled, "_rawDictionary". One of the entries in this dictionary is called "sushiFactor". I see this entry for multiple Raw images from various camera manufacturers. Is this an industry-standard TIFF Tag in the Raw image community? What is the meaning of its value?
Posted Last updated
.
Post not yet marked as solved
1 Replies
689 Views
In iOS, I am creating a CIRAWFilter object by calling init() on the image file's URL and setting "CIRAWFilterOption.allowDraftMode : true" in the options dictionary passed in to the init call. If I set a scaleFactor = 0.5 and then call .outputImage() on the filter object, I get back a CIImage with an extent that is half the size of what I expect. If I set scaleFactor = 0.51 then I get back a CIImage with the expected extent. For example, starting with an original RAW image file of size 4,032 x 2,048: If I set the scaleFactor to 0.75 and call outputImage() on the CIRawFilter object, I get back a CIImage object with the extent 3,024 x 1,536 which has width and height at 75% of the original image's width and height. However, if I set the scaleFactor to 0.50 and call outputImage() on the CIRawFilter object, I get back an image with the extent 1,008 x 512, which is 25% of the size of the original RAW image and not 50%. If I set "allowDraftMode : false" then I always get back the correctly sized CIImage. Is this a bug or expected behavior?
Posted Last updated
.
Post not yet marked as solved
2 Replies
817 Views
I am unable to get a UIViewController to receive the UIPencilInteractionDelegate “pencilInteractionDidTap” method in response to double taps from an Apple Pencil. I am testing on iPad Pro 11 and 12.9 models, both running iOS 13.3.1I have implemented the following:extension UIViewController: UIPencilInteractionDelegate { public func pencilInteractionDidTap(_ interaction: UIPencilInteraction) { print("Handle pencil double-tap") }}In my UIViewController:override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let pencilInteraction = UIPencilInteraction() pencilInteraction.delegate = self view.addInteraction(pencilInteraction)}Note: If I create a new Single View iOS app and add this code, everything works as expected.However the above code does not work with the custom UIViewController in my app. My UIViewController’s view hosts a UIScrollView as well as overlaying Container Views and handles touch events in both the View Controller and ScrollView classes.I have also tried adding the UIPencilInteraction object to other UIViewControllers in my app and the “pencilInteractionDidTap” method is not called in any of them.Do I need to change something in the Responder chain to get the UIViewController to handle “pencilInteractionDidTap” method calls?
Posted Last updated
.