gpt4 book ai didi

macos - Mavericks下的CALayer添加CIFilter?

转载 作者:行者123 更新时间:2023-12-03 16:01:37 32 4
gpt4 key购买 nike

这是向图层添加过滤器的标准方法:

NSView *view = self.window.contentView;
view.wantsLayer = YES;
CATextLayer *textLayer = [CATextLayer layer];
textLayer.frame = CGRectMake(10.0, 10.0, 200.0, 100.0);
textLayer.string = @"foo";
textLayer.foregroundColor = [[NSColor redColor] CGColor];

// Add filter
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur" keysAndValues:@"inputRadius", @5.0, nil];
textLayer.filters = @[filter];

// Attach layer
[view.layer addSublayer:textLayer];

但是,它使我在 OS X Mavericks 上的应用程序崩溃。曾经在 10.8 上工作。

2013-10-23 13:09:20.767 Serus[3608:303] *** Terminating app due to uncaught exception 'CAInvalidCIFilter', reason: 'CI filters are not supported by this layer tree: {CIGaussianBlur {
inputImage = "<null>";
inputRadius = 10;
}}.'

此图层树不支持 CI 过滤器

有人见过这个吗?我可能做错了什么?

最佳答案

想通了,苹果决定改变这一点,并且无缘无故地需要一个新标志

progressIndicator.layerUsesCoreImageFilters = YES;

关于macos - Mavericks下的CALayer添加CIFilter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19540070/

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