NSView NSImage NSData转换

2018-02-08 10:25:30来源:http://www.ideawu.net/blog/archives/1016.html作者:idea's blog人点击

分享
NSBitmapImageRep *bitmap =[view bitmapImageRepForCachingDisplayInRect:[view visibleRect]];
[view cacheDisplayInRect:[view visibleRect] toBitmapImageRep:bitmap];
NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
[image addRepresentation:bitmap];
NSBitmapImageRep *bitmap = [NSBitmapImageRep imageRepWithData:data];
NSBitmapImageRep *bitmap = [[[NSBitmapImageRep alloc] initWithCGImage:CGImage];
Related posts:

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台