
Untitled
By: a guest on
Aug 6th, 2012 | syntax:
None | size: 1.20 KB | hits: 27 | expires: Never
IOS UIImage Image upside down
CGAffineTransform myTr = CGAffineTransformMake(1, 0, 0, -1, 0, backImage.size.height);
CGContextConcatCTM(context, myTr);
[backImage drawInRect:CGRectMake(cbx, -cby, backImage.size.width, backImage.size.height)];
myTr = CGAffineTransformMake(1, 0, 0, -1, 0, backImage.size.height);
CGContextConcatCTM(context, myTr);
NSData *imageData = UIImageJPEGRepresentation(backImage, 0);
UIGraphicsBeginImageContextWithOptions(size, isOpaque, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawImage(context, (CGRect){ {0,0}, origSize }, [origImage CGImage]);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
NSData *imageData = UIImageJPEGRepresentation(backImage, 0);
1, 0, 0
0, 1, 0
0, 0, 1
CGAffineTransform matrix = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
matrix = CGAffineTransformTranslate(matrix, x, y);
matrix = CGAffineTransformScale(matrix, -1, 1);
matrix = CGAffineTransformScale(matrix, 1, -1);
matrix = CGAffineTransformRotate(matrix, angle);
matrix = CGAffineTransformScale(matrix, imageWidth/viewWidth, imageheight/viewHeight);
CGContextConcatCTM(context, matrix);