I'm looking at a way to catch the contents of a window like the camtvist 'Desktop +' feature. It can grab any window, even when its in the background.
Apple's OpenGLScreenCapture sample shows how to capture from hidden surfaces rather than from the main screen.
Any idea how CamTwist gets access to an NSWindow's pixel buffer?
After
AFAIK, official API can be found in CGWindow.h as part of core graphics: / P>
/ * Draw a composite image of the specified set of windows contained within a rectangular area. The set of windows is specified using the 'CGWandolist Open' option, with an optional additional window ID. The windows list options are: --- kCGWindowListOptionAll, kCGWindowListOptionOnScreenOnly: windows on the screen for all use in this user session to create the image used. The parameter `windowID 'should be a' kcg netwind 'id. --- kCGWindowListOptionOnScreenAboveWindow: Use windows on screen for everyone in this user session, ordered from front to back, specified by window `windowID ', to create image. To include the window specified by the 'WindowID', add the flag `kCGWindowListOptionIncludingWindow '--- the kCGWindowListOptionOnScreenBelowWindow: specified by the window` windowID', back to the ordered from the front, in this user session, all of the windows on the screen for the screen Use, to create an image. To include the window specified by 'WindowID', add the flag 'kCGWindowListOptionIncludingWindow' --- KCGWindowListOptionIncludingWindow: To create the image, use only the window specified by 'windowID'. The parameter specifies the rectangular in the 'screenbones' screen space (the upper y-value is rising below the top-left). Setting 'Screenbond' in 'CGFFIFINET' will include all windows on the entire desktop. Setting the `Screenbond 'to' CGRectNull 'will use the bounding box of the window specified in the form of a square rectangle. break
/ * parameter 'Image Option' allows you to specify whether window frames include decoration, such as shadow or similar effects Or if the window does not meet the criteria specified if `CGRectNull 'is specified for window boundary. If a window does not meet the specified criteria, or the windows can not be read, a transparent black image will be returned. Any screen window with the shared screen will not be included in the image 'KCG window shorington'. This function taps when this caller is not running within a quartz GUI session or window server. * / CG_EXTERN CGImageRef CGWindowListCreateImage (CGRect screenBounds, CGWindowListOption listOption, CGWindowID windowID, CGWindowImageOption imageOption) CG_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_NA); / * Create a picture of the overall set of windows set in a rectangular area, set of 'La' Cajivando Littercreat image 'window' windowArray ', is specified by an array of window IDs. * / CG_EXTERN CGImageRef CGWindowListCreateImageFromArray (CGRect Screen Bounce, CFArrayRef WindowAre, CGWindowImageOption imageOption) CG_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_NA); Sorry, the link to the documentation on the site of Apple could not be found. However, they appear in the sample code.
Comments
Post a Comment