将一个透明图像与正常图像组合

时间:2013-10-22 11:30:10

标签: image merge transparent uigraphicscontext

我想为图片添加透明叠加层 我正在使用它的代码:

 - (UIImage *) overlayImage
    {
        VampirizerAppDelegate* app = (VampirizerAppDelegate *)[UIApplication sharedApplication].delegate;

        UIImage* pSourceImage;

        pSourceImage = pTempResult;

        UIImage *topOverlayImg = [UIImage imageNamed:@"overlay-disco-lights-top.png"];

        // size is taken from the background image
        UIGraphicsBeginImageContext(pSourceImage.size);

        [pSourceImage drawAtPoint:CGPointZero];

        CGRect topImageRect = CGRectMake(0, 0, pSourceImage.size.width, pSourceImage.size.height);
        [pSourceImage drawInRect:topImageRect blendMode:kCGBlendModeOverlay alpha:0.99];

        NSLog(@"topImageRect : %@", NSStringFromCGRect(topImageRect));

        UIImage *combinedImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
return combinedImage;
        }

问题是我得到的最终图像不清晰且失真。

请帮忙

0 个答案:

没有答案