[objective-c]UIImageを2枚重ねた状態をUIImageにする

UIImageを2枚重ねた状態をUIImageにする

-(UIImage*)getWImage:(UIImage*)bottomImage frontImage:(UIImage*)frontImage{
    int width = bottomImage.size.width;
    int height = bottomImage.size.height;
    
    CGSize newSize = CGSizeMake(width, height);
    UIGraphicsBeginImageContextWithOptions(newSize, NO, 1.0);
    [bottomImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
    [frontImage drawInRect:CGRectMake(0,0,newSize.width,newSize.height) blendMode:kCGBlendModeNormal alpha:1.0];
    
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return newImage;
}