2012年6月30日 星期六

ScreenShot to Image

首先要#import "QuartzCore/CALayer.h"跟QuartzCore.framework

.m檔程式碼如下
UIGraphicsBeginImageContext(CGRectMake(mainImageStartX, mainImageStartY, Main_Pic_Width, Main_Pic_Height).size);

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, CGAffineTransformMakeTranslation(-mainImageStartX, -mainImageStartY));

[self.view.layer renderInContext:context];

g_StartImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

沒有留言:

張貼留言