我想从转换后的 uiimageview
中绘制图像 - 引用左侧图像,
Dragview = UIImageView 可以使用一些控件旋转或缩放,我需要在相同位置绘制转换后的图像
我遇到转换问题(CGContextConcatCTM
),
它给出所需的输出如果
CGAffineTransform = CGAffineTransformIdentity
但我在具有相同变换的输出图像上得到了错误的原点
下面是我用来绘制与原始 ImageView 相同的图像的代码
UIGraphicsBeginImageContext(CGSizeMake(1024, 768));
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, dragView.originalTransform);
UIImage *curImage1 = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
最佳答案
试试这个:
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
关于iphone - 从变换后的 ImageView 绘制图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17065600/