Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

ios5 - Taking Screenshots in the background (iOS) - Improving Performance

This question is an extension to: Taking Screenshots from iOS app - emulating Display recorder (query on the internals)
There are 2 ways I came across to take screenshots from the background -
1. Creating an image out of the ios surface and saving it - it captures at a very fast rate (approximately 0.2-0.3 sec/ 12-15 screenshots), however there are some problems that are encountered, discussed here: Releasing an IOSurface
2. The following code does the same job using the createScreenIOSurface API:

IOSurfaceRef surface = [UIWindow createScreenIOSurface];
UIImage *surfaceImage = [[UIImage alloc] _initWithIOSurface:surface orientation:UIImageOrientationUp];
CFRelease(surface);
UIImageSaveToPhotosAlbum(surfaceImage, self, nil, nil);

However, the capture rate is very bad, approximately 0.5-0.7 sec/screenshot.

So, is there a solution to the problem faced in approach 1 ?
Is there a way to improve performance for approach 2 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...