1。
- (ボイド)displayLinkCallback:(CADisplayLink * )差出人{ CMTIME時間 = [snapshotOutput itemTimeForHostTime:CACurrentMediaTime()]。 もし([snapshotOutput hasNewPixelBufferForItemTime:時間]){ lastSnapshotPixelBuffer = [snapshotOutput copyPixelBufferForItemTime:時間itemTimeForDisplay:NULL]。 } } - (UIImage * )snapshotImage { 場合(lastSnapshotPixelBuffer){ CIImage * ciImage = [CIImage imageWithCVPixelBuffer:lastSnapshotPixelBuffer]。 CIContext *コンテキスト= [CIContext contextWithOptions:NULL]。 CGRect RECT = CGRectMake(0、 0 、 CVPixelBufferGetWidth(lastSnapshotPixelBuffer)、 CVPixelBufferGetHeight(lastSnapshotPixelBuffer))。 CGImageRef cgImage = [コンテキストcreateCGImage:ciImage fromRect:RECT]。 戻る[UIImage imageWithCGImage:cgImage]; } 戻りNULL。 }