在iOS 7的通知中心中,箭头的实时混合是否可能实现?我想知道是否可以使UIImage与正下方的内容(UIView或CALayer)以柔和的光线进行混合,这样背景图像就可以移动,混合图像将保持在一个位置。
我希望能够使用UIImage,您可以设置blendMode属性为所需的混合模式,例如,imageView.blendMode = kCGBlendModeSoftLight;
我尝试使用GPUImage,但我无法弄清楚如何做到我需要的。任何帮助将不胜感激。
到目前为止,我用于设置UIImage混合模式的代码是这样的;但是,如果背景视图移动,则UIImage上的混合不会更新。
//blur the background
GPUImageGaussianBlurFilter *blurFilter = [[GPUImageGaussianBlurFilter alloc] init];
blurFilter.blurRadiusInPixels = 50.0f;
blurFilter.blurPasses = 4;
UIImage *blurredBackground = [blurFilter imageByFilteringImage:[UIImage imageNamed:@"Background.png"]];
//make the blended images
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 2.0f);
CGContextSetInterpolationQuality(UIGraphicsGetCurrentContext(), kCGInterpolationHigh);
[blurredBackground drawInRect:self.view.bounds blendMode:kCGBlendModeNormal alpha:1.0];
[[UIImage imageNamed:@"BarLineImage.png"] drawInRect:CGRectMake(0, self.view.bounds.size.height - 31, self.view.bounds.size.width, 1) blendMode:kCGBlendModeSoftLight alpha:1.0];
[[UIImage imageNamed:@"Equalizer-th.png"] drawInRect:CGRectMake(65, self.view.bounds.size.height - 30, 30, 30) blendMode:kCGBlendModeSoftLight alpha:1.0];
[[UIImage imageNamed:@"Player-th.png"] drawInRect:CGRectMake(145, self.view.bounds.size.height - 30, 30, 30) blendMode:kCGBlendModeSoftLight alpha:1.0];
[[UIImage imageNamed:@"Container-th.png"] drawInRect:CGRectMake(225, self.view.bounds.size.height - 30, 30, 30) blendMode:kCGBlendModeSoftLight alpha:1.0];
UIImage *blendedImages = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
这是代码的截图,以便更好地理解。 看起来我需要的样子,但我不能对底部图像下面的内容进行动画处理。我真的需要能够实时混合UIImages和UIViews。