标签:htm size and cgpoint get width div turn graph
原文:http://www.cnblogs.com/shisishao/p/6000999.html
#pragma mark 获取裁剪区域 - (CGRect)getImageRect:(UIImage *)tempImage { CGRect rect; if (tempImage.size.width > tempImage.size.height) { rect = CGRectMake((tempImage.size.width-tempImage.size.height)/2, 0, tempImage.size.height, tempImage.size.height); } else if (tempImage.size.width < tempImage.size.height) { rect = CGRectMake(0, (tempImage.size.height-tempImage.size.width)/2, tempImage.size.width, tempImage.size.width); } else { rect = CGRectMake(0, 0, tempImage.size.width, tempImage.size.width); } return rect; } #pragma mark 裁剪图片 - (UIImage *)getCropImage:(UIImage *)image andRect:(CGRect)rect { rect = CGRectMake(ceilf(rect.origin.x), ceilf(rect.origin.y), ceilf(rect.size.width), ceilf(rect.size.height)); UIGraphicsBeginImageContext(rect.size); [image drawAtPoint:CGPointMake(-rect.origin.x, -rect.origin.y)]; UIImage *cropImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return cropImage; }
标签:htm size and cgpoint get width div turn graph
原文地址:http://www.cnblogs.com/siasyl/p/7600851.html