我正在开发相机应用程序,我在其中放置了一个叠加图像,因为我捕获了图像。我正在使用以下代码进行合并图像的处理,但徽标的位置不正确。
- (UIImage*)addOverlayToBaseImage:(UIImage*)baseImage {
UIImage *newImage = [self CombineImage:baseImage];
return newImage;
}
-(UIImage *)CombineImage :(UIImage*)myCapturedImage{
CGSize finalSize = [myCapturedImage size];
CGSize overlaySize = [overlayGraphic size];
UIGraphicsBeginImageContext(finalSize);
[myCapturedImage drawInRect:CGRectMake(0,0,finalSize.width,finalSize.height)];
CGFloat xScaleFactor = finalSize.width / 320;
CGFloat yScaleFactor = finalSize.height / 480;
[overlayGraphic drawInRect:CGRectMake(30 * xScaleFactor, 100 * yScaleFactor, overlaySize.width * xScaleFactor, overlaySize.height * yScaleFactor)];
UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return combinedImage;
}
我从这个 url [ http://www.musicalgeometry.com/?p=1681]中获取参考,并在图像中使用该 onr Capture camera view 和 onverlay
如果我的代码有任何错误,请指导我。
谢谢。