我得到了一个只有一个表示的图像,那就是一个NSCGImageSnapshotRep。
我尝试了[NSCGImageSnapshotRep bitmapData],但是这个类没有bitmapData的选择器。
有人知道这门课吗?我怎样才能得到bitmapData
我要从Webkit [DOMElement renderedImage]那里得到这个[DOMElement renderedImage]。
Create bitmap of a DOMElement Objective C
正确的用法是[NSBitmapImageRep representationUsingType:id properties:id],这意味着在这种情况下不起作用。
我没有考虑兼容性,我会很高兴找到一个解决方案10.5+或10.6+。
发布于 2011-06-09 07:25:45
NSImage *img = [DOMElement renderedImage] ;
[img lockFocus] ;
NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0.0, 0.0, [img size].width, [img size].height)] ;
[img unlockFocus] ;
...
// don't forget when you are done with the rep:
[bitmapRep release] ;https://stackoverflow.com/questions/4438802
复制相似问题