gpt4 book ai didi

ios - SKSpriteNode 使用 PDF/SVG 矢量图像进行自动缩放

转载 作者:行者123 更新时间:2023-11-28 14:48:17 24 4
gpt4 key购买 nike

我正在尝试使用 PDF/SVG 图像作为 SKSpriteNode 的 SKTexture。我知道这可以通过勾选“Preserve Vector Data”,将 Scaled 设置为“Single Scale”并将 UIImageView 配置为

imageView.adjustsImageSizeForAccessibilityContentSizeCategory = true

在 SKTexture 中使用 UIImage 时可以这样做吗?这将阻止创建@2x 和@3x 图像。

谢谢

最佳答案

不能为 SKTexture 使用矢量图

SKTexture 没有矢量格式,它只是一个位图图像。

因此,当您将 PDF 矢量图像添加到您的 Assets 目录,然后从中创建一个 SKTexture 时,您会得到一个位图图像(如果您选择 Preserve Vector FormatSingle scale)

此过程的优点在于您无需创建 1x、2x 和 3x 大小的图像,因为 Xcode 会在构建时为您完成。但生成的纹理仍将采用位图格式。

关于ios - SKSpriteNode 使用 PDF/SVG 矢量图像进行自动缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50078362/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com