I'm trying to use the screenshot approach to add a blurred image of my background to the scene -- as outlined briefly here and elsewhere.
However, on my retina screen, the image that is overlaid is 1024 x 768 and not 2048 x 1536. This makes it appear incredibly small on the screen. How do I overlay the right sized image by adjusting this code?
func blurWithCompletion() {
if let effectNode = scene?.childNode(withName: "effectsNode") as? SKEffectNode {
let blur = CIFilter(name: "CIGaussianBlur", withInputParameters: ["inputRadius": 10.0]);
effectNode.filter = blur;
effectNode.shouldRasterize = true;
effectNode.shouldEnableEffects = true;
UIGraphicsBeginImageContextWithOptions((view?.frame.size)!, true, 2.0)
view?.drawHierarchy(in: (view?.frame)!, afterScreenUpdates: true)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let node = SKSpriteNode(texture: SKTexture(image: image!));
effectNode.addChild(node);
}
}
EDIT: view?.frame.size is 1024 x 768; the image size is the same.