NSView NSImage NSData转换
2018-02-08 10:25:30来源:http://www.ideawu.net/blog/archives/1016.html作者:idea's blog人点击
[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: