-
Re: Cannot get a CIFilter originated image to display in IB or simulator
FrankSchlegel Aug 20, 2019 11:51 AM (in response to skajam66)When you create a
UIImage
from aCIImage
(UIImage(ciImage: foi)
), the filter is not actually applied yet. Only when theUIImage
is used somewhere, the GPU would process your filter chain. And from my experience this is not very reliable in all scenarios.What you can do instead is to explicitly render the
CIImage
into aCGImage
and continue with that:let context = CIContext() // ideally you only create that once and re-use it if let outputCGImage = context.createCGImage(image: foi, from: foi.extent) { circleView.image = UIImage(cgImage: outputCGImage) } dash-apple-api://load?request_key=hsjer5Z_Yw&language=swiftdash-apple-api://load?request_key=hs4qSehPwa&language=swift
-
Re: Cannot get a CIFilter originated image to display in IB or simulator
skajam66 Aug 20, 2019 8:15 PM (in response to FrankSchlegel)Frank,
Thanks you for your response. I have resolved the issue following along with your advice thus:
if let f = constructFilter(radius: radius, brightness: sliderView.value.hsba.brightness), let foi = f.outputImage { #if TARGET_INTERFACE_BUILDER let context = CIContext() if let outputCGImage = context.createCGImage(foi, from: foi.extent) { circleView.image = UIImage(cgImage: outputCGImage) } #else circleView.image = UIImage(ciImage: foi) #endif }
I am curious as to the underlying issue here and how IB rendering differs from device rendering. Maybe it is GPU related?
If you have any insights on this I would appreciate heraing them.
Regards,
ac
-
Re: Cannot get a CIFilter originated image to display in IB or simulator
KMT Aug 20, 2019 8:22 PM (in response to skajam66)>how IB rendering differs from device rendering
Remember, the simulator is not an emulator, and runs a stack specifically for your mac and it's hardware. You're basically asking how rendering differs between those platforms...
Stick to device testing if actionable parity is important.
General info via Simulator Help / Differences between simulated and physical devices
-
-