我一整天都在寻找在动画中动态应用单个CIFilter的各种方法。
我希望应用一个强大的CIPixellation过滤器到一个图像,并逐渐动画到原始图像,而不使用类似阿尔法淡出,这将不会有期望的动画效果。
我看了布拉德的GPUImage,但是把MB的框架导入到一个非常简单的应用程序中,我有点害怕,尽管它看起来非常合适。
因此,剩下的唯一的事情是觉得有点烦躁和欺骗,所以我想问:下面的代码可能会让我的应用程序被拒绝吗?如果是的话,是基于甚麽理由?
干杯。
- (void)pixellateImage:(UIImage *)image fromValue:(int)from toValue:(int)to
{
dispatch_queue_t bgQueue = dispatch_queue_create("bgqueue", NULL);
for (int i = from; i >= to; i--) {
dispatch_async(bgQueue, ^{
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *ciImage = [[CIImage alloc] initWithImage:[UIImage imageNamed:@"c3po"]];
CIFilter *blur = [CIFilter filterWithName:@"CIPixellate"];
[blur setValue:ciImage forKey:kCIInputImageKey];
[blur setValue:[NSNumber numberWithInt:i] forKey:@"inputScale"];
CGImageRef imageRef = [context createCGImage:blur.outputImage fromRect:[blur.outputImage extent]];
UIImage *returnImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
dispatch_async(dispatch_get_main_queue(), ^{
self.imageView.image = returnImage;
});
});
}}
发布于 2014-06-24 16:11:06
只要您不使用私有API,黑客代码就不会被拒绝。
https://stackoverflow.com/questions/24391265
复制相似问题