현재 윈도우 화면을 타이틀 바, 그림자 포함해서 화면 캡쳐하는 방법. 


  TinyPigMacAppDelegate *delegate = (TinyPigMacAppDelegate *)[NSApplication sharedApplication].delegate;


  CGWindowID windowID = (CGWindowID)[[delegate window] windowNumber];

  CGWindowImageOption imageOptions = kCGWindowImageDefault;

  CGWindowListOption singleWindowListOptions = kCGWindowListOptionIncludingWindow;

  CGRect imageBounds = CGRectNull;

  CGImageRef windowImage = CGWindowListCreateImage(imageBounds, singleWindowListOptions, windowID, imageOptions);

  

  NSImage *img = [[NSImage alloc] initWithCGImage:windowImage size:imageBounds.size];


  if (windowImage) {

    CFRelease(windowImage);

  }


Posted by KraZYeom

댓글을 달아 주세요