我正在学习使用 CoreAnimation。我试图在我的 NSView 中添加一些 CIFilter,但是遇到了问题。
当我将过滤器添加到我的视图(视图将 NSButton 作为子视图)时,它只会清除其所有内容,但它不应该!
你能帮我吗,我做错了什么?
subView.wantsLayer = YES;
CIVector *center = [CIVector vectorWithX:NSMidX([subView bounds])
Y:NSMidY([subView bounds])];
CIFilter *pointalize = [CIFilter filterWithName: @"CIPointillize"];
[pointalize setDefaults];
[pointalize setValue: @(1.0) forKey: kCIInputRadiusKey];
[pointalize setValue: center forKey: kCIInputCenterKey];
pointalize.name = @"pointalize";
[subView setContentFilters: @[pointalize]];