嵌入的圆形图像的半径为100像素. (圆圈是白色的,所以点击空白区域,你会得到图像.)使用SpriteKit按比例缩小会使边框变得非常模糊和像素化.如何在SpriteKit中放大/缩小并保留清晰的边框?目标是使用圆形基础图像并使用此基础图像创建不同大小的圆形图像.
// Create dot let dot = SKSpriteNode(imagenamed: "dot50") // position dot dot.position = scenePoint // Size dot let scale = radius / MasterDoTradius println("Dot size and scale: \(radius) and \(scale)") dot.setScale(scale) dot.texture!.filteringMode = .Nearest解决方法 看来你应该使用SKTextureFilteringlinear而不是SKTextureFilteringNearest:
SKTextureFilteringNearest:
Each pixel is drawn using the nearest point in the texture. This mode
is faster,but the results are often pixelated.SKTextureFilteringlinear:
Each pixel is drawn by using a linear filter of multiple texels in the
texture. This mode produces higher quality results but may be slower.
您可以使用SKShapeNode,它在缩放动画时效果更好,但最终结果(当点缩放到某个值时)将几乎像使用SKSpriteNode和图像一样像素化.
总结以上是内存溢出为你收集整理的ios – 使用SKSpriteNode进行缩放时的像素化圆圈全部内容,希望文章能够帮你解决ios – 使用SKSpriteNode进行缩放时的像素化圆圈所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)