4
보기의 비트 맵을 캡처해야하는 매우 간단한 코드 비트가 있습니다. 이것은 Leopard에서 작동하는 데 사용되었지만 Snow Leopard에서는 끔찍하게 망가졌습니다. 여기 왜 bitmapImageRepForCachingDisplayInRect : 빈 이미지를 만드나요?
창에 버튼을 눌러 응답 코드입니다 :- (IBAction)snapshot:(id)sender
{
NSView* view = [[sender window] contentView];
NSBitmapImageRep* bitmap
= [view bitmapImageRepForCachingDisplayInRect:[view bounds]];
NSData *tiff = [bitmap TIFFRepresentation];
[tiff writeToFile:[@"~/Desktop/snapshot.tiff" stringByExpandingTildeInPath]
atomically:YES];
}
단지는 완전히 투명한 이미지 결과 스냅 샷 버튼을 클릭.
여기 내가 완전히 단서가 없습니까, 아니면이 비트 맵 캐싱 방법이 잘못 되었습니까?
기본적으로이 코드를 호출하는 버튼이있는 초보 NSDocument 프로젝트는 here입니다.