[英]SKCropNode not rendering greyscale mask values in SpriteKit
我有一個SKCropNode,除了一件事外,它工作正常-蒙版圖像中所有非黑色或白色的灰度值都設置為純白色。
這意味着所有灰度Alpha值都不會透明顯示,而只是設置為完全不透明。
這是我的代碼:
let foregroundTexture = SKTexture(image: UIImage(contentsOfFile:NSBundle.mainBundle().resourcePath!.stringByAppendingPathComponent("P01_foreground.jpg"))!)
var foreground = SKSpriteNode(texture: foregroundTexture)
let maskTexture = SKTexture(image: UIImage(contentsOfFile:NSBundle.mainBundle().resourcePath!.stringByAppendingPathComponent("P01_mask.png"))!)
var mask = SKSpriteNode(texture: maskTexture)
var cropNode = SKCropNode()
cropNode.addChild(foreground)
cropNode.maskNode = mask
cropNode.position = CGPoint(x: device.x/2, y: device.y/2)
cropNode.zPosition = 2.0
self.addChild(cropNode)
有誰知道為什么將灰度區域設置為白色或如何獲得所需的結果? 提前致謝!
不幸的是,您似乎無法做到。 SKCropNode當前僅具有一個屬性,即maskNode本身。 沒有可用的其他設置來執行您想要的操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.