我得到的图像只有一个表示,那是一个NSCGImageSnapshotRep.
我试过[NSCGImageSnapshotRep bitmapData]但是,班级没有选择器bitmapData.
有人知道这堂课吗?我该bitmapData怎么办?
我从Webkit获得了这个NSImage [DOMElement renderedImage].
正确的用法是[NSBitmapImageRep representationUsingType:id properties:id],这种方法在这种情况下不起作用.
我也没多想compatibily,我会很高兴找到一个解决方案10.5+或10.6以上版本.
小智 13
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] ;
Run Code Online (Sandbox Code Playgroud)