iOS Development

ios – CIGaussianFilter just isn’t centering impact

On iOS, I wish to apply a CIGaussianFilter on an SKSpriteNode which is a full display screen picture, nonetheless the blurred picture does not stay centered.

let blur = CIFilter(title:"CIGaussianBlur",parameters: ["inputRadius": 20.0])
effectsNode = SKEffectNode()
effectsNode.filter = blur
effectsNode.blendMode = .alpha
effectsNode.shouldCenterFilter = true
effectsNode.shouldEnableEffects = true
effectsNode.shouldRasterize = false

UIGraphicsBeginImageContextWithOptions(self.view!.bounds.dimension, true, 0)
view!.drawHierarchy(in: self.view!.bounds, afterScreenUpdates: true)
let picture = UIGraphicsGetImageFromCurrentImageContext()
let nodeToBlur = SKSpriteNode(texture:SKTexture(picture: picture!))

However the extra the picture is blurred, the extra it would get to the upper-left a part of the display screen. How can I keep away from this and preserve the picture centered ?
enter image description here

What's your reaction?

Leave A Reply

Your email address will not be published.