绘制左右翻转的图片

来源:互联网 发布:flotherm软件 编辑:程序博客网 时间:2024/05/16 11:29


- (UIImage *)overturnImage:(UIImage *)image {

   CGSize size = image.size;

    UIGraphicsBeginImageContext(size);

    CGContextRef context =UIGraphicsGetCurrentContext();

    

   CGContextTranslateCTM(context, size.width, size.height);

   CGContextScaleCTM(context, -1.0, -1.0);

   CGContextDrawImage(context, CGRectMake(0, 0, size.width, size.height), image.CGImage);

    

    UIImage *turnImage =UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

   return turnImage;

}