我正在尝试渲染一个位图以保存到用户的相册,该相册的分辨率必须高于320x480的iPhone屏幕(但仍在iOS内存限制范围内) . 但是,使用此代码创建上下文:
UIGraphicsBeginImageContext(CGSizeMake(finalImgWidth, finalImgHeight));
CGContextRef ctx = UIGraphicsGetCurrentContext();
或CG模拟:
CGContextRef ctx = CGBitmapContextCreate(rawData, finalImgWidth, finalImgHeight, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast);
如果宽度或高度大于320x480,则返回nil上下文 .
有没有其他方法来创建高分辨率图像?
注意:我已经知道如何正常绘制上下文并截取屏幕截图 . 我需要一个可以扩展到典型照片分辨率的解决方案
2 回答
你试过
[UIImage initWithCGImage:scale:orientation:]
吗?首先,使用图像初始化
UIImage
对象,以获取图像的几何图形 . 然后计算比例因子 .好吧,我认为它会对你有所帮助 . 在以下Apple示例代码中,它们显示如何在屏幕中显示大图像 .
Scrolling Apple Sample Code