Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding CIFilter to CALayer under Mavericks?

Tags:

so this is the standard way of adding filter to a layer:

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]; 

However, it crashes my application on OS X Mavericks. Used to work on 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 filters are not supported by this layer tree

Anybody ever seen this? What may I be doing wrong?

like image 720
Vojto Avatar asked Oct 23 '13 11:10

Vojto


1 Answers

Figured it out, Apple decided to change this and require a new flag for no reason

progressIndicator.layerUsesCoreImageFilters = YES; 
like image 191
user2912108 Avatar answered Nov 03 '22 17:11

user2912108