UNPKG

nativescript-cscreenshot

Version:
13 lines 720 B
import { Common } from './cscreenshot.common'; import { ImageSource } from '@nativescript/core'; export class Cscreenshot extends Common { take(view, callback) { let iosView = view.ios.view ? view.ios.view : view.ios; UIGraphicsBeginImageContextWithOptions(iosView.frame.size, false, 0); iosView.drawViewHierarchyInRectAfterScreenUpdates(CGRectMake(0, 0, iosView.frame.size.width, iosView.frame.size.height), true); var imageFromCurrentImageContext = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); callback(ImageSource.fromDataSync(UIImagePNGRepresentation(imageFromCurrentImageContext))); } } //# sourceMappingURL=cscreenshot.ios.js.map