如何应用iOS 7的CICrystallize过滤器?

时间:2014-02-25 11:16:52

标签: ios core-image

我正在使用Xcode 5和iOS7使用Photo app。问题是,当我应用CICrystallize过滤器并运行项目时,模拟器的屏幕变为空白。谁能帮助我? 该方法的实施是:

- (IBAction)cristalizar:(id)sender {
    CIImage *imagen = [[CIImage alloc]initWithCGImage:self.imagenView.image.CGImage];

    CIFilter *cristalizar = [CIFilter filterWithName:@"CICrystallize"];
    [cristalizar setDefaults];
    CIVector *vector = [CIVector vectorWithX:150 Y:150];
    [cristalizar setValue:imagen forKey:kCIInputImageKey];
    [cristalizar setValue:@20.00f forKey:kCIInputRadiusKey];
    [cristalizar setValue:vector forKey:kCIInputCenterKey];

    CIImage *resultado = [cristalizar valueForKey:kCIOutputImageKey];

    CIContext *contexto = [CIContext contextWithOptions:nil];
    CGImageRef cgImagen = [contexto createCGImage:resultado fromRect:[resultado extent]];
    self.imagenView.image = [UIImage imageWithCGImage:cgImagen];
}

1 个答案:

答案 0 :(得分:1)

iOS上无法使用CICrystallize

  

<强>状况

     

在OS X v10.4及更高版本中可用。