以下是我试图应用以在图像上获取 CIFourfoldRotatedTile 过滤器的代码,但我在输出中得到一个 nil 图像。
CIContext *context = [CIContext contextWithOptions:nil]; // 1
CIImage *aimage = [CIImage imageWithCGImage:[UIImage imageNamed:@"Image1.png"].CGImage];
CIFilter *filter = [CIFilter filterWithName:@"CIFourfoldRotatedTile"]; // 3
[filter setValue:aimage forKey:kCIInputImageKey];
[filter setValue:[CIVector vectorWithCGPoint:CGPointMake(200, 200)] forKey:@"inputCenter"];
[filter setValue:[NSNumber numberWithFloat:2.0] forKey:@"inputAngle"];
[filter setValue:[NSNumber numberWithFloat:50] forKey:@"inputWidth"];
CIImage *result = [filter valueForKey:kCIOutputImageKey]; // 4
CGRect extent = [result extent];
CGImageRef cgImage = [context createCGImage:result fromRect:extent];
UIImage *finalImage = [UIImage imageWithCGImage:cgImage];
self.imgview.image = finalImage;
不知道我输入的参数是错误的。请指导我。谢谢。