ios - 在 iOS Sprite 工具包中绘制平滑的圆圈

标签 ios drawing sprite-kit geometry antialiasing

我尝试在我的 iOS SpriteKit 项目中绘制一个圆,但圆的边缘不平滑。我想要一个漂亮的圆圈,因为我会用 Photoshop 绘制它(抗锯齿)。我发现了几个类似的问题,但我的问题仍然存在。

-(id)initWithSize:(CGSize)size
{
    if (self = [super initWithSize:size])
    {
        self.backgroundColor = [SKColor whiteColor];
        self.scaleMode = SKSceneScaleModeAspectFill;
        self.size = CGSizeMake(640, 1136);

        CGRect circle = CGRectMake(100.0, 100.0, 80.0, 80.0);
        SKShapeNode *shapeNode = [[SKShapeNode alloc] init];
        shapeNode.path = [UIBezierPath bezierPathWithOvalInRect:circle].CGPath;
        shapeNode.fillColor = [SKColor redColor];
        shapeNode.lineWidth = 0;
        [self addChild:shapeNode];
    }
    return self;
}

这里有什么技巧?

最佳答案

抗锯齿默认是激活的,但是它只作用于线条,不作用于填充。

将线宽设置为大于 0 的数字,然后重试。

关于ios - 在 iOS Sprite 工具包中绘制平滑的圆圈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24078687/

相关文章:

ios - 麦克风播放的音频断断续续,听起来像是空气吹入麦克风

oop - 有 OOP 的卡通指南吗?

flash - 如何以编程方式绘制可缩放、美观、弯曲的漫画书气球尾部?

swift - 使用 SpriteKit/Views 与 ViewController 显示关卡

ios - 碰撞类型源错误 - spritekit swift 游戏

ios - SpriteKit - SKSpriteNode 在 3.5 英寸和 4 英寸设备上的缩放方式不同

iphone - 全屏 youtube 视频、旋转和状态栏 (iOS)

iOS 自定义键盘 - 相机不工作

ios - 无法为 UITableView 创建框架

java - 在 paint 方法实现中减小了多边形的大小