Mr.*_*ian 5 objective-c uiimage ios gpuimage ios7
是否可以像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();
Run Code Online (Sandbox Code Playgroud)
以下是此代码对某些视觉辅助工具的屏幕截图.
这看起来像我需要的方式,但我不能动画底部图像下面的内容.我真的需要能够为UIImages和UIViews进行实时混合.
| 归档时间: |
|
| 查看次数: |
1234 次 |
| 最近记录: |