【发布时间】:2013-03-12 19:46:02
【问题描述】:
UIImage *sticky = [UIImage imageNamed:@"Radio.png"];
[_imgViewSticky setImage:sticky];
CIImage *outputImage = [self.originalImage CIImage];
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef cgImg = [context createCGImage:outputImage fromRect:[outputImage extent]];
float widthRatio = [outputImage extent].size.width / 320;
float heighRatio = [outputImage extent].size.height / 480;
CGPoint cgStickyPoint = CGPointMake(_imgViewSticky.frame.origin.x * widthRatio, _imgViewSticky.frame.origin.y * heighRatio);
cgImg = [self setStickyForCGImage:cgImg withPosition:cgStickyPoint];
最后一行返回一个 CGImageRef 对象。
我将值分配给最终图像,如下所示:
UIImage *finalImage = [UIImage ImageWithCGImageRef:cgImg];
但我没有得到图像。任何想法为什么?任何帮助深表感谢。
【问题讨论】:
-
您能描述一下您想要实现的目标吗?我认为应该有更简单的方法来做到这一点。
-
我正在尝试将贴纸添加到图像中。非常像 Aviary,只有我的应该使用 2 个手指手势
标签: ios uiimage core-image ciimage