Class: MotionScreenshot::Screenshot

Inherits:
Object
  • Object
show all
Defined in:
lib/motion_screenshot/screenshot.rb

Class Method Summary collapse

Class Method Details

.get(window_id = KCGNullWindowID, rect = CGRectNull) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/motion_screenshot/screenshot.rb', line 3

def self.get window_id=KCGNullWindowID, rect=CGRectNull
  cgImage = CGWindowListCreateImage(rect, KCGWindowListOptionOnScreenOnly, window_id, KCGWindowImageBoundsIgnoreFraming)
  bitmapRep = NSBitmapImageRep.alloc.initWithCGImage(cgImage)
  image = NSImage.alloc.init()
  image.addRepresentation(bitmapRep)
  return image;
end