1

rotate image merge but not working in this code i post my code please give me solution

- (void)mergeImage :(UIImage *)imageA withImage:(UIImage *)imageB ###
{
    UIImage *image0 = imageA;
    UIImage *image1=overlayimg.image;

    CGSize newImageSize = CGSizeMake(overlayimg.frame.size.width, overlayimg.frame.size.height);
    UIGraphicsBeginImageContext(newImageSize);

    [image0 drawInRect:CGRectMake(overlayimg.frame.origin.x,overlayimg.frame.origin.y,newImageSize.width,newImageSize.height)];

    NSLog(@"Last Rotation:%f",templastrotate);

    overlayimg.transform = CGAffineTransformMakeRotation(templastrotate);
    CGContextConcatCTM(UIGraphicsGetCurrentContext(), overlayimg.transform);

    [image1 drawInRect:CGRectMake(overlayView.frame.origin.x, overlayView.frame.origin.y,overlayView.frame.size.width,overlayView.frame.size.height)];

    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    imageView.contentMode = UIViewContentModeScaleAspectFill & UIViewContentModeScaleAspectFit;
    imageView.image=newImage; 
    UIGraphicsEndImageContext();
}
Akhilrajtr
  • 5,170
  • 3
  • 19
  • 30
Rohit suvagiya
  • 1,005
  • 2
  • 12
  • 40
  • Please state what doesn't work. Also what imageB is supposed to do? – cescofry Mar 24 '14 at 14:50
  • Maybe this answer will help you - http://stackoverflow.com/a/7020178/2225302 – Rost Apr 08 '14 at 18:44
  • What do you mean by merge? If you want to composite the images together there are CIFilters for this that provide numerous blending options: https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CISourceInCompositing – smyrgl May 07 '14 at 02:36
  • First of all, you're drawing at point `(overlayimg.frame.origin.x,overlayimg.frame.origin.y)` which is out of context's bounds. – arturdev Jul 02 '15 at 11:02

0 Answers0